[arch-projects] [dbscripts] [PATCH] disallow packages not built in a chroot
Levente Polyak
anthraxx at archlinux.org
Mon Feb 8 13:26:23 UTC 2016
double shame!
This will detect both, packages with missing .BUILDINFO (built in
non updated environments) and packages that are not built in a
chroot at all (indicated by non default builddir).
Signed-off-by: Levente Polyak <anthraxx at archlinux.org>
---
db-functions | 18 ++++++++++++++++++
db-update | 6 ++++++
2 files changed, 24 insertions(+)
diff --git a/db-functions b/db-functions
index 667ac8d..3101c0c 100644
--- a/db-functions
+++ b/db-functions
@@ -230,6 +230,13 @@ _grep_pkginfo() {
echo "${_ret#${2} = }"
}
+# usage: _grep_buildinfo pkgfile pattern
+_grep_buildinfo() {
+ local _ret
+
+ _ret="$(/usr/bin/bsdtar -xOqf "$1" .BUILDINFO | grep -m 1 "^${2} = ")"
+ echo "${_ret#${2} = }"
+}
# Get the package base or name as fallback
getpkgbase() {
@@ -299,6 +306,17 @@ check_packager() {
[[ $_packager && $_packager != 'Unknown Packager' ]]
}
+check_buildinfo() {
+ /usr/bin/bsdtar -tf "$1" .BUILDINFO >/dev/null 2>&1
+}
+
+check_builddir() {
+ local _builddir
+
+ _builddir=$(_grep_buildinfo "$1" "builddir")
+ [[ $_builddir && $_builddir = '/build' ]]
+}
+
getpkgfile() {
if [[ ${#} -ne 1 ]]; then
error 'No canonical package found!'
diff --git a/db-update b/db-update
index cdc35a5..db8cb91 100755
--- a/db-update
+++ b/db-update
@@ -54,6 +54,12 @@ for repo in ${repos[@]}; do
if ! check_packager "${pkg}"; then
die "Package ${repo}/${pkg##*/} does not have a valid packager"
fi
+ if ! check_buildinfo "${pkg}"; then
+ die "Package ${repo}/${pkg##*/} does not have a .BUILDINFO file"
+ fi
+ if ! check_builddir "${pkg}"; then
+ die "Package ${repo}/${pkg##*/} was not built in a chroot"
+ fi
done
if ! check_splitpkgs ${repo} ${pkgs[@]}; then
die "Missing split packages for ${repo}"
--
2.7.0
More information about the arch-projects
mailing list