PKGBUILD 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. # Maintainer: Your Name <your-email@example.net>
  2. # NOTE: This PKGBUILD is for experiments and for testing libretools.
  3. # Packages built with this PKGBUILD are not intended for distribution.
  4. # Only the -nonfree source-ball is published, containing two files:
  5. # $pkgname-$pkgver/non-free $pkgname-$pkgver/buggy
  6. # configuration
  7. _MKSOURCE=true # excersize the mksource mechanism
  8. _N_MKSOURCES=2 # number of upstream sources to be isolated for mksource
  9. _SIGN=false # require signature (yours) for libre source-ball
  10. _WANTS_INTERNET=false # build fails if this expectation is not met
  11. _YOUR_GPG_KEY='YOUR GPG KEY' # for second pass, if _MKSOURCE=true and _SIGN=true
  12. _REPO_URL=https://repo.parabola.nu/other
  13. pkgbase=scratch-pkg
  14. pkgname=(scratch-pkg{,-split1,-split2})
  15. epoch=1
  16. pkgver=42
  17. pkgrel=420.3
  18. pkgdesc="PKGBUILD for testing libretools"
  19. arch=(any)
  20. url=
  21. license=(GPL)
  22. depends=()
  23. makedepends=()
  24. source=(${_REPO_URL}/${pkgname}/${pkgname}-${pkgver}-nonfree.tar.gz{,.sig}
  25. upstream.patch)
  26. sha256sums=(c4a3d2c7dfece8ff1e5f982f7d79d74960271476f6401c7ae5e8adac58bad957
  27. SKIP
  28. 82126a2be0589ab9b313186d954d5d90183f7b083d986b16d5d7c3587826c7c1)
  29. validpgpkeys=( 3954A7AB837D0EA9CFA9798925DB7D9B5A8D4B40 )
  30. # parabola mksource over-rides
  31. if $_MKSOURCE
  32. then mksource=( ${source[*]:0:${_N_MKSOURCES}} )
  33. mksha256sums=( ${sha256sums[*]:0:${_N_MKSOURCES}} )
  34. mkvalidpgpkeys=( ${validpgpkeys[*]} )
  35. source=( ${_REPO_URL}/${pkgname}/${pkgname}-${pkgver}-parabola.tar.gz
  36. ${source[*]:${_N_MKSOURCES}} )
  37. sha256sums=( SKIP # the libre source-ball does not exist, intentionally
  38. ${sha256sums[*]:${_N_MKSOURCES}} )
  39. if $_SIGN
  40. then source+=( ${_REPO_URL}/${pkgname}-libre/${pkgname}-${pkgver}-parabola.tar.gz.sig )
  41. sha256sums+=( SKIP ) # the libre source-ball signature (yours)
  42. validpgpkeys=( ${_YOUR_GPG_KEY} )
  43. fi
  44. fi
  45. mksource()
  46. {
  47. cd $pkgname-$pkgver
  48. # libre patching
  49. rm non-free
  50. echo "mksource() out"
  51. }
  52. prepare()
  53. {
  54. cd $pkgname-$pkgver
  55. # technical patching
  56. patch < "$srcdir"/upstream.patch
  57. # network check
  58. local net_check_url=https://repo.parabola.nu/check_network_status.txt
  59. local online_msg="ERROR: the build chroot has internet access"
  60. local offline_msg="ERROR: the build chroot does not have internet access"
  61. local wants_internet=$($_WANTS_INTERNET ; echo $(( ! $? )) ;)
  62. local has_internet=$(curl ${net_check_url} &> /dev/null ; echo $(( ! $? )) ;)
  63. if (( wants_internet != has_internet ))
  64. then $_WANTS_INTERNET && echo "${offline_msg}" || echo "${online_msg}"
  65. return 1
  66. fi
  67. echo "prepare() out"
  68. }
  69. build()
  70. {
  71. cd $pkgname-$pkgver
  72. echo "build() out"
  73. }
  74. check()
  75. {
  76. cd $pkgname-$pkgver
  77. local wants_clean=$($_MKSOURCE ; echo $(( ! $? )) ;)
  78. local is_clean=$([[ ! -e non-free ]] ; echo $(( ! $? )) ;)
  79. (( wants_clean == is_clean ))
  80. grep -q '^buggy - patched$' buggy
  81. echo "check() out"
  82. }
  83. package_scratch-pkg()
  84. {
  85. cd $pkgname-$pkgver
  86. install=${pkgname}.install
  87. cp buggy "$pkgdir"/
  88. echo "package_scratch-pkg-split1() out"
  89. }
  90. package_scratch-pkg-split1() { echo "package_scratch-pkg-split1() out" ; }
  91. package_scratch-pkg-split2() { echo "package_scratch-pkg-split2() out" ; }