summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2024-04-05 15:54:56 -0400
committerbill-auger <mr.j.spam.me@gmail.com>2024-04-05 17:04:24 -0400
commit48ae8e8a68d4d982679b312754c14754e4045b40 (patch)
tree3ea2d407db7774465b0167c7f41e483e7c5bb32b
parente913deb77780e4b07f9bb015a2d22a72b1cd6e12 (diff)
scratch-pkg: isolate mksource vs technical patching concerns
-rw-r--r--pcr-testing/scratch-pkg/PKGBUILD71
-rw-r--r--pcr-testing/scratch-pkg/a.patch5
-rw-r--r--pcr-testing/scratch-pkg/upstream.patch5
3 files changed, 51 insertions, 30 deletions
diff --git a/pcr-testing/scratch-pkg/PKGBUILD b/pcr-testing/scratch-pkg/PKGBUILD
index 06b93deab..9b450fe9f 100644
--- a/pcr-testing/scratch-pkg/PKGBUILD
+++ b/pcr-testing/scratch-pkg/PKGBUILD
@@ -3,8 +3,16 @@
# NOTE: This PKGBUILD is for experiments and for testing libretools.
# Packages built with this PKGBUILD are not intended for distribution.
-# Only the -nonfree source-ball is published, containing a single file:
-# $pkgname-$pkgver/dummy
+# Only the -nonfree source-ball is published, containing two files:
+# $pkgname-$pkgver/non-free $pkgname-$pkgver/buggy
+
+
+# configuration
+_MKSOURCE=true # excersize the mksource mechanism
+_N_MKSOURCES=2 # number of upstream sources to be isolated for mksource
+_SIGN=false # require signature (yours) for libre source-ball
+_WANTS_INTERNET=false # build fails if this expectation is not met
+_REPO_URL=https://repo.parabola.nu/other
pkgbase=scratch-pkg
@@ -20,46 +28,55 @@ license=(GPL)
depends=()
makedepends=()
-_REPO_URL=https://repo.parabola.nu/other
-source=(${_REPO_URL}/${pkgname}-libre/${pkgname}-${pkgver}-nonfree.tar.gz{,.sig}
- a.patch)
+source=(${_REPO_URL}/${pkgname}/${pkgname}-${pkgver}-nonfree.tar.gz{,.sig}
+ upstream.patch)
-sha256sums=(a1ccabdfb9e43e4ddd00e5a4f801ed1c7ba89a4d0cb3a3f1dbf2d1895f585476
+sha256sums=(c4a3d2c7dfece8ff1e5f982f7d79d74960271476f6401c7ae5e8adac58bad957
SKIP
- 787331f939f817e3b9cc7e0ee97cb8833de619863c4057b0bbd58d54d882569a)
+ 82126a2be0589ab9b313186d954d5d90183f7b083d986b16d5d7c3587826c7c1)
validpgpkeys=()
# parabola mksource over-rides
-_N_MKSOURCES=2
-mksource=( ${source[*]:0:${_N_MKSOURCES}} )
-mksha256sums=( ${sha256sums[*]:0:${_N_MKSOURCES}} )
-mkvalidpgpkeys=( ${validpgpkeys[*]} )
-source=(${_REPO_URL}/${pkgname}-libre/${pkgname}-${pkgver}-parabola.tar.gz{,.sig}
- ${source[*]:${_N_MKSOURCES}})
-sha256sums=(SKIP # the libre source-ball does not exist, intentionally
- SKIP
- ${sha256sums[*]:${_N_MKSOURCES}})
-validpgpkeys=( 'YOUR GPG KEY' )
+if $_MKSOURCE
+then mksource=( ${source[*]:0:${_N_MKSOURCES}} )
+ mksha256sums=( ${sha256sums[*]:0:${_N_MKSOURCES}} )
+ mkvalidpgpkeys=( ${validpgpkeys[*]} )
+ source=(${_REPO_URL}/${pkgname}/${pkgname}-${pkgver}-parabola.tar.gz
+ ${source[*]:${_N_MKSOURCES}})
+ sha256sums=(SKIP # the libre source-ball does not exist, intentionally
+ ${sha256sums[*]:${_N_MKSOURCES}})
+ if $_SIGN
+ then source+=(${_REPO_URL}/${pkgname}-libre/${pkgname}-${pkgver}-parabola.tar.gz.sig)
+ sha256sums+=(SKIP) # the libre source-ball signature (yours)
+ validpgpkeys=( 'YOUR GPG KEY' )
+ fi
+fi
mksource()
{
cd $pkgname-$pkgver
- rm dummy ; echo dummy-libre > dummy-libre ;
+ rm non-free
}
prepare()
{
cd $pkgname-$pkgver
+ # technical patching
+ patch < "$srcdir"/upstream.patch
+
# network check
local net_check_url=https://repo.parabola.nu/check_network_status.txt
- local online_msg="this PKGBUILD has internet access in the build chroot"
- local offline_msg="this PKGBUILD does not have internet access in the build chroot"
- curl ${net_check_url} &> /dev/null && echo "${online_msg}" || echo "${offline_msg}"
-
- patch < "$srcdir"/a.patch ; grep -q '^dummy-libre patched$' dummy-libre ;
+ local online_msg="ERROR: the build chroot has internet access"
+ local offline_msg="ERROR: the build chroot does not have internet access"
+ local wants_internet=$($_WANTS_INTERNET ; echo $(( ! $? )) ;)
+ local has_internet=$(curl ${net_check_url} &> /dev/null ; echo $(( ! $? )) ;)
+ if (( wants_internet != has_internet ))
+ then $_WANTS_INTERNET && echo "${offline_msg}" || echo "${online_msg}"
+ return 1
+ fi
}
build()
@@ -71,7 +88,11 @@ check()
{
cd $pkgname-$pkgver
- [[ ! -e dummy ]] && grep -q '^dummy-libre patched$' dummy-libre
+ local wants_clean=$($_MKSOURCE ; echo $(( ! $? )) ;)
+ local is_clean=$([[ ! -e non-free ]] ; echo $(( ! $? )) ;)
+ (( wants_clean == is_clean ))
+
+ grep -q '^buggy - patched$' buggy
}
package_scratch-pkg()
@@ -80,7 +101,7 @@ package_scratch-pkg()
install=${pkgname}.install
- cp dummy-libre "$pkgdir"/
+ cp buggy "$pkgdir"/
}
package_scratch-pkg-split1() { echo "package_scratch-pkg-split1()" ; }
package_scratch-pkg-split2() { echo "package_scratch-pkg-split2()" ; }
diff --git a/pcr-testing/scratch-pkg/a.patch b/pcr-testing/scratch-pkg/a.patch
deleted file mode 100644
index 101c4cb65..000000000
--- a/pcr-testing/scratch-pkg/a.patch
+++ /dev/null
@@ -1,5 +0,0 @@
---- dummy-libre 2024-04-03 00:51:42.856666645 -0400
-+++ dummy-libre 2024-04-03 00:53:08.229999979 -0400
-@@ -0,1 +1 @@
--dummy-libre
-+dummy-libre patched
diff --git a/pcr-testing/scratch-pkg/upstream.patch b/pcr-testing/scratch-pkg/upstream.patch
new file mode 100644
index 000000000..6cd188ed7
--- /dev/null
+++ b/pcr-testing/scratch-pkg/upstream.patch
@@ -0,0 +1,5 @@
+--- buggy 2024-04-03 00:51:42.856666645 -0400
++++ buggy 2024-04-03 00:53:08.229999979 -0400
+@@ -0,1 +1 @@
+-buggy
++buggy - patched