Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts/repo-add.sh.in
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2015-03-15 16:40:11 +1000
committerAllan McRae <allan@archlinux.org>2015-03-26 14:43:37 +1000
commit6aef45ee1aaf27dba21265fbdd65139061a91123 (patch)
treeaf5ead80685a86fce0c45a4743b3e0bacfbd5147 /scripts/repo-add.sh.in
parent81d233b79345d05d5bf17a4b2844085e14f9ee36 (diff)
repo-add: check early for xdelta if it is needed
The check for xdelta3 was done as needed (and not in all cases). Do this check early so that repo-add does not abort part way through. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/repo-add.sh.in')
-rw-r--r--scripts/repo-add.sh.in28
1 files changed, 24 insertions, 4 deletions
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index d4963543..c16295be 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -212,6 +212,28 @@ check_gpg() {
fi
}
+check_xdelta() {
+ local need_xdelta=0
+
+ if (( DELTA )); then
+ need_xdelta=1
+ else
+ if [[ $cmd == "repo-add" ]];
+ for f in ${args[@]:1}; do
+ case $f in
+ *.delta) need_xdelta=1 ;;
+ *) ;;
+ done
+ fi
+
+ if (( need_xdelta )); then
+ if ! type xdelta3 &>/dev/null; then
+ error "$(gettext "Cannot find the xdelta3 binary! Is xdelta3 installed?")"
+ exit 1
+ fi
+ fi
+}
+
# sign the package database once repackaged
create_signature() {
(( ! SIGN )) && return
@@ -525,10 +547,6 @@ add() {
if [[ ${1##*.} == "delta" ]]; then
deltafile=$1
msg "$(gettext "Adding delta '%s'")" "$deltafile"
- if ! type xdelta3 &>/dev/null; then
- error "$(gettext "Cannot find the xdelta3 binary! Is xdelta3 installed?")"
- exit 1
- fi
if db_write_delta "$deltafile"; then
return 0
else
@@ -736,6 +754,8 @@ if (( SIGN || KEY || VERIFY )); then
check_gpg
fi
+check_xdelta
+
fail=0
for arg in "${args[@]:1}"; do
case $cmd in