Commit 6c52b391 authored by Natanael Copa's avatar Natanael Copa
Browse files

abuild: improve sanitycheck

- check that md5sums correspond to source
- warn if maintainer is missing
parent 0e9c2e70
- Better saintycheck:
* check that number of md5sums is correct
* verify that there is a Maintainer
- Automatically add $install to $source - Automatically add $install to $source
- Fetch sources from a specified mirror - Fetch sources from a specified mirror
......
...@@ -71,6 +71,7 @@ die() { ...@@ -71,6 +71,7 @@ die() {
# check if apkbuild is basicly sane # check if apkbuild is basicly sane
sanitycheck() { sanitycheck() {
local i
msg "Checking sanity of $APKBUILD..." msg "Checking sanity of $APKBUILD..."
[ -z "$pkgname" ] && die "Missing pkgname in APKBUILD" [ -z "$pkgname" ] && die "Missing pkgname in APKBUILD"
[ -z "${pkgname##* *}" ] && die "pkgname contains spaces" [ -z "${pkgname##* *}" ] && die "pkgname contains spaces"
...@@ -82,24 +83,30 @@ sanitycheck() { ...@@ -82,24 +83,30 @@ sanitycheck() {
[ -z "$url" ] && die "Missing url in APKBUILD" [ -z "$url" ] && die "Missing url in APKBUILD"
[ -z "$license" ] && die "Missing license in APKBULID" [ -z "$license" ] && die "Missing license in APKBULID"
if [ "$(echo $source | wc -l)" -ne "$(echo $md5sums | wc -l)" ]; then for i in $source; do
die "Number of md5sums does not correspond to number of sources" md5sums_has ${i##*/} || die "${i##*/} is missing in md5sums"
fi done
for i in $(echo "$md5sums" | awk '{ print $2 }'); do
source_has $i || die "$i is missing in source"
done
# common spelling errors # common spelling errors
[ -n "$depend" ] && die "APKBUILD contains 'depend'. It should be depends" [ -n "$depend" ] && die "APKBUILD contains 'depend'. It should be depends"
[ -n "$makedepend" ] && die "APKBUILD contains 'makedepend'. It should be makedepends" [ -n "$makedepend" ] && die "APKBUILD contains 'makedepend'. It should be makedepends"
grep '^# Maintainer:' $APKBUILD >/dev/null || warning "No maintainer"
return 0 return 0
} }
md5check() { md5check() {
local dummy f
if [ -z "$source" ]; then if [ -z "$source" ]; then
return 0 return 0
fi fi
if [ -z "$md5sums" ]; then if [ -z "$md5sums" ]; then
die "Use 'abuild checksum' to generate/update the checksum(s)" die "Use 'abuild checksum' to generate/update the checksum(s)"
fi fi
if [ "$(echo $source | wc -l)" -ne "$(echo $md5sums | wc -l)" ]; then if [ "$(echo $source | wc -l)" -ne "$(echo $md5sums | wc -l)" ]; then
die "Number of md5sums does not correspond to number of sources" die "Number of md5sums does not correspond to number of sources"
fi fi
...@@ -550,6 +557,14 @@ listpkg() { ...@@ -550,6 +557,14 @@ listpkg() {
done done
} }
source_has() {
local i
for i in $source; do
[ "$1" = "${i##*/}" ] && return 0
done
return 1
}
subpackages_has() { subpackages_has() {
local i local i
for i in $subpackages; do for i in $subpackages; do
...@@ -573,6 +588,10 @@ options_has() { ...@@ -573,6 +588,10 @@ options_has() {
list_has "$1" $options list_has "$1" $options
} }
md5sums_has() {
list_has "$1" $md5sums
}
# install package after build # install package after build
post_add() { post_add() {
local pkgf="$PKGDEST/$1-$pkgver-r$pkgrel.apk" local pkgf="$PKGDEST/$1-$pkgver-r$pkgrel.apk"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment