summaryrefslogtreecommitdiffstats
path: root/db-functions
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2016-02-08 14:26:23 +0100
committerPierre Schmitz <pierre@archlinux.de>2016-02-16 19:31:01 +0100
commit282bf65c81e278b9237b4c202d325642bc0aa1a3 (patch)
tree98900724229a5f2ed8d8b3ed0b9bd7a62ad0372f /db-functions
parent7f1c367f8d8504126caf3daa07a15d259fd072fa (diff)
downloaddbscripts-282bf65c81e278b9237b4c202d325642bc0aa1a3.tar.gz
dbscripts-282bf65c81e278b9237b4c202d325642bc0aa1a3.tar.xz
disallow packages not built in a chrootHEADmaster
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@archlinux.org> Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
Diffstat (limited to 'db-functions')
-rw-r--r--db-functions18
1 files changed, 18 insertions, 0 deletions
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!'