Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts/makepkg.sh.in
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2012-07-16 21:56:32 +1000
committerAllan McRae <allan@archlinux.org>2012-08-04 00:16:39 +1000
commit4b129d484394ce6090a9ed21782fe1df2227ad18 (patch)
treef13329786770cbd3f9bad36aa0f60419d75019fe /scripts/makepkg.sh.in
parentb1e75d7dd663a72d90195e4907ee8fa145461fc2 (diff)
makepkg: check pkgver validity after updating
If a PKGBUILD has a pkgver() function, skip checking the pkgver validity until it has been updated. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/makepkg.sh.in')
-rw-r--r--scripts/makepkg.sh.in34
1 files changed, 25 insertions, 9 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 0d23f749..3157a9ce 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -548,6 +548,7 @@ download_sources() {
if declare -f pkgver >/dev/null && (( GET_VCS )); then
update_pkgver
+ check_pkgver || exit 1
fi
popd &>/dev/null
@@ -1787,7 +1788,7 @@ check_sanity() {
# check for no-no's in the build script
local i
local ret=0
- for i in 'pkgname' 'pkgrel' 'pkgver'; do
+ for i in 'pkgname' 'pkgrel'; do
if [[ -z ${!i} ]]; then
error "$(gettext "%s is not allowed to be empty.")" "$i"
ret=1
@@ -1811,14 +1812,9 @@ check_sanity() {
ret=1
fi
- awk -F'=' '$1 ~ /^[[:space:]]*pkgver$/' "$BUILDFILE" | sed "s/[[:space:]]*#.*//" |
- while IFS='=' read -r _ i; do
- eval i=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "${i%%+([[:space:]])}")\"
- if [[ $i = *[[:space:]:-]* ]]; then
- error "$(gettext "%s is not allowed to contain colons, hyphens or whitespace.")" "pkgver"
- return 1
- fi
- done || ret=1
+ if ! declare -f pkgver >/dev/null; then
+ check_pkgver || ret=1
+ fi
awk -F'=' '$1 ~ /^[[:space:]]*pkgrel$/' "$BUILDFILE" | sed "s/[[:space:]]*#.*//" |
while IFS='=' read -r _ i; do
@@ -1948,6 +1944,26 @@ check_sanity() {
return $ret
}
+check_pkgver() {
+ local ret=0
+
+ if [[ -z ${pkgver} ]]; then
+ error "$(gettext "%s is not allowed to be empty.")" "pkgver"
+ ret=1
+ fi
+
+ awk -F'=' '$1 ~ /^[[:space:]]*pkgver$/' "$BUILDFILE" | sed "s/[[:space:]]*#.*//" |
+ while IFS='=' read -r _ i; do
+ eval i=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "${i%%+([[:space:]])}")\"
+ if [[ $i = *[[:space:]:-]* ]]; then
+ error "$(gettext "%s is not allowed to contain colons, hyphens or whitespace.")" "pkgver"
+ return 1
+ fi
+ done || ret=1
+
+ return $ret
+}
+
check_software() {
# check for needed software
local ret=0