diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-02-08 21:02:22 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-02-08 21:02:22 +0000 |
commit | 6c52b391125c8ace2e65eb5242e58c483897a0aa (patch) | |
tree | 2da3c912e67479e79d61cbb4757eeef27dc00104 /abuild | |
parent | 0e9c2e708c8ee9017653c52cfc03b8ff40868c2f (diff) | |
download | abuild-6c52b391125c8ace2e65eb5242e58c483897a0aa.tar.gz abuild-6c52b391125c8ace2e65eb5242e58c483897a0aa.tar.bz2 abuild-6c52b391125c8ace2e65eb5242e58c483897a0aa.tar.xz abuild-6c52b391125c8ace2e65eb5242e58c483897a0aa.zip |
abuild: improve sanitycheck
- check that md5sums correspond to source
- warn if maintainer is missing
Diffstat (limited to 'abuild')
-rwxr-xr-x | abuild | 27 |
1 files changed, 23 insertions, 4 deletions
@@ -71,6 +71,7 @@ die() { # check if apkbuild is basicly sane sanitycheck() { + local i msg "Checking sanity of $APKBUILD..." [ -z "$pkgname" ] && die "Missing pkgname in APKBUILD" [ -z "${pkgname##* *}" ] && die "pkgname contains spaces" @@ -82,24 +83,30 @@ sanitycheck() { [ -z "$url" ] && die "Missing url in APKBUILD" [ -z "$license" ] && die "Missing license in APKBULID" - if [ "$(echo $source | wc -l)" -ne "$(echo $md5sums | wc -l)" ]; then - die "Number of md5sums does not correspond to number of sources" - fi + for i in $source; do + md5sums_has ${i##*/} || die "${i##*/} is missing in md5sums" + done + + for i in $(echo "$md5sums" | awk '{ print $2 }'); do + source_has $i || die "$i is missing in source" + done # common spelling errors [ -n "$depend" ] && die "APKBUILD contains 'depend'. It should be depends" [ -n "$makedepend" ] && die "APKBUILD contains 'makedepend'. It should be makedepends" + + grep '^# Maintainer:' $APKBUILD >/dev/null || warning "No maintainer" return 0 } md5check() { + local dummy f if [ -z "$source" ]; then return 0 fi if [ -z "$md5sums" ]; then die "Use 'abuild checksum' to generate/update the checksum(s)" fi - if [ "$(echo $source | wc -l)" -ne "$(echo $md5sums | wc -l)" ]; then die "Number of md5sums does not correspond to number of sources" fi @@ -550,6 +557,14 @@ listpkg() { done } +source_has() { + local i + for i in $source; do + [ "$1" = "${i##*/}" ] && return 0 + done + return 1 +} + subpackages_has() { local i for i in $subpackages; do @@ -573,6 +588,10 @@ options_has() { list_has "$1" $options } +md5sums_has() { + list_has "$1" $md5sums +} + # install package after build post_add() { local pkgf="$PKGDEST/$1-$pkgver-r$pkgrel.apk" |