diff options
-rw-r--r-- | db-functions | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/db-functions b/db-functions index bd87064..cf1b8eb 100644 --- a/db-functions +++ b/db-functions @@ -163,6 +163,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() { @@ -225,6 +232,24 @@ getpkgarch() { echo "$_ver" } +check_packager() { + local _packager + + _packager=$(_grep_pkginfo "$1" "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!' |