summaryrefslogtreecommitdiffstats
path: root/cron-jobs
diff options
context:
space:
mode:
Diffstat (limited to 'cron-jobs')
-rwxr-xr-xcron-jobs/check_archlinux/check_packages.py5
-rwxr-xr-xcron-jobs/check_archlinux/parse_pkgbuilds.sh82
2 files changed, 73 insertions, 14 deletions
diff --git a/cron-jobs/check_archlinux/check_packages.py b/cron-jobs/check_archlinux/check_packages.py
index 9bdd9c1..d42feab 100755
--- a/cron-jobs/check_archlinux/check_packages.py
+++ b/cron-jobs/check_archlinux/check_packages.py
@@ -38,6 +38,7 @@ checked_deps = []
class PacmanPackage:
def __init__(self):
self.name,self.version = "",""
+ self.base = ""
self.path,self.repo = "",""
self.deps,self.makedeps = [],[]
self.provides,self.conflicts = [],[]
@@ -77,6 +78,8 @@ def parse_data(repo,data):
if packages.has_key(pkg.name):
dup = packages[pkg.name]
packages[pkg.name] = pkg
+ elif attrname == "base":
+ pkg.base = line
elif attrname == "version":
pkg.version = line
elif attrname == "path":
@@ -356,7 +359,7 @@ for name,pkg in packages.iteritems():
print "==> checking mismatches"
for name,pkg in repopkgs.iteritems():
pkgdirname = pkg.path.split("/")[-1]
- if name != pkgdirname:
+ if name != pkgdirname and pkg.base != pkgdirname:
mismatches.append(name + " vs. " + pkg.path)
print "==> checking archs"
diff --git a/cron-jobs/check_archlinux/parse_pkgbuilds.sh b/cron-jobs/check_archlinux/parse_pkgbuilds.sh
index 7dcfbbb..0faa29f 100755
--- a/cron-jobs/check_archlinux/parse_pkgbuilds.sh
+++ b/cron-jobs/check_archlinux/parse_pkgbuilds.sh
@@ -5,24 +5,36 @@
exit() { return; }
-parse() {
- unset pkgname pkgver pkgrel
- unset depends makedepends conflicts provides
- ret=0
- dir=$1
- pkgbuild=$dir/PKGBUILD
- source $pkgbuild &>/dev/null || ret=$?
+variables=('pkgname' 'pkgver' 'pkgrel' 'depends' 'makedepends' 'provides' 'conflicts' )
+readonly -a variables
- # ensure $pkgname and $pkgver variables were found
- if [ $ret -ne 0 -o -z "$pkgname" -o -z "$pkgver" ]; then
- echo -e "%INVALID%\n$pkgbuild\n"
- return 1
- fi
+backup_package_variables() {
+ for var in ${variables[@]}; do
+ indirect="${var}_backup"
+ eval "${indirect}=(\${$var[@]})"
+ done
+}
+
+restore_package_variables() {
+ for var in ${variables[@]}; do
+ indirect="${var}_backup"
+ if [ -n "${!indirect}" ]; then
+ eval "${var}=(\${$indirect[@]})"
+ else
+ unset ${var}
+ fi
+ done
+}
+print_info() {
echo -e "%NAME%\n$pkgname\n"
echo -e "%VERSION%\n$pkgver-$pkgrel\n"
echo -e "%PATH%\n$dir\n"
+ if [ -n "$pkgbase" ]; then
+ echo -e "%BASE%\n$pkgbase\n"
+ fi
+
if [ -n "$arch" ]; then
echo "%ARCH%"
for i in ${arch[@]}; do echo $i; done
@@ -52,6 +64,50 @@ parse() {
for i in ${provides[@]}; do echo $i; done
echo ""
fi
+}
+
+source_pkgbuild() {
+ ret=0
+ dir=$1
+ pkgbuild=$dir/PKGBUILD
+ for var in ${variables[@]}; do
+ unset ${var}
+ done
+ source $pkgbuild &>/dev/null || ret=$?
+
+ # ensure $pkgname and $pkgver variables were found
+ if [ $ret -ne 0 -o -z "$pkgname" -o -z "$pkgver" ]; then
+ echo -e "%INVALID%\n$pkgbuild\n"
+ return 1
+ fi
+
+ if [ "${#pkgname[@]}" -gt "1" ]; then
+ for pkg in ${pkgname[@]}; do
+ if [ "$(type -t package_${pkg})" != "function" ]; then
+ echo -e "%INVALID%\n$pkgbuild\n"
+ return 1
+ else
+ backup_package_variables
+ pkgname=$pkg
+ while IFS= read -r line; do
+ var=${line%%=*}
+ var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
+ for realvar in ${variables[@]}; do
+ if [ "$var" == "$realvar" ]; then
+ eval $line
+ break
+ fi
+ done
+ done < <(type package_${pkg})
+ print_info
+ restore_package_variables
+ fi
+ done
+ else
+ echo
+ print_info
+ fi
+
return 0
}
@@ -63,7 +119,7 @@ find_pkgbuilds() {
fi
if [ -f $1/PKGBUILD ]; then
- parse $1
+ source_pkgbuild $1
return
fi
empty=1