From 2222e9f8dfe6e149262f629571b3432718351d3f Mon Sep 17 00:00:00 2001 From: Andres P Date: Tue, 22 Jun 2010 22:12:51 -0430 Subject: rankmirrors: fix bogus variable assignment $replacedurl was being built from an expansion of itself. But at the time it happened, it was empty. Fixes FS#19911 Signed-off-by: Andres P Signed-off-by: Allan McRae --- scripts/rankmirrors.sh.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/rankmirrors.sh.in b/scripts/rankmirrors.sh.in index 9b4e973a..201cc4be 100644 --- a/scripts/rankmirrors.sh.in +++ b/scripts/rankmirrors.sh.in @@ -70,15 +70,15 @@ ARCH="$(uname -m)" getfetchurl() { local strippedurl="${1%/}" - local replacedurl="${replacedurl//'$arch'/$ARCH}" + local replacedurl="${strippedurl//'$arch'/$ARCH}" if [[ ! $TARGETREPO ]]; then - replacedurl="${strippedurl//'$repo'/core}" + replacedurl="${replacedurl//'$repo'/core}" local tmp="${replacedurl%/*}" tmp="${tmp%/*}" local reponame="${tmp##*/}" else - replacedurl="${strippedurl//'$repo'/$TARGETREPO}" + replacedurl="${replacedurl//'$repo'/$TARGETREPO}" local reponame="$TARGETREPO" fi -- cgit v1.2.3-24-g4f1b From 226c137245192444085d03a7f841b35afe99791c Mon Sep 17 00:00:00 2001 From: Andres P Date: Tue, 22 Jun 2010 22:12:50 -0430 Subject: rankmirrors: fix bogus pacman configuration parsing Valid pacman configuration files do not have to start with a hash for that line to be a comment, neither do directives need to be in column 0. Signed-off-by: Andres P Signed-off-by: Allan McRae --- scripts/rankmirrors.sh.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/rankmirrors.sh.in b/scripts/rankmirrors.sh.in index 201cc4be..fcb42fa4 100644 --- a/scripts/rankmirrors.sh.in +++ b/scripts/rankmirrors.sh.in @@ -184,9 +184,9 @@ fi timesarray=() for line in "${linearray[@]}"; do - if [[ $line =~ ^# ]]; then + if [[ $line =~ ^[[:space:]]*# ]]; then [[ $TIMESONLY ]] || echo $line - elif [[ $line =~ ^Server ]]; then + elif [[ $line =~ ^[[:space:]]*Server ]]; then # Getting values and times and such server="${line#*= }" -- cgit v1.2.3-24-g4f1b From 708f186f98a0c2094225aa94ac8a139ac3a9163e Mon Sep 17 00:00:00 2001 From: Andres P Date: Tue, 22 Jun 2010 22:12:49 -0430 Subject: rankmirrors: pipe errors to stderr If this is to be scripted with AIF or another tool, it needs to respect stderr. Signed-off-by: Andres P Signed-off-by: Allan McRae --- scripts/rankmirrors.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/rankmirrors.sh.in b/scripts/rankmirrors.sh.in index fcb42fa4..b0dc1ab7 100644 --- a/scripts/rankmirrors.sh.in +++ b/scripts/rankmirrors.sh.in @@ -49,7 +49,7 @@ version() { } err() { - echo "$1" + echo "$1" >&2 exit 1 } -- cgit v1.2.3-24-g4f1b From 07a9effdd06345d09f09cdc92e23c937d8fa94b5 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Wed, 23 Jun 2010 13:16:36 +1000 Subject: makepkg: prevent error trap activation in bash-3.2 Running "pacman -T foo" is expected to return a non-zero value when "foo" is not installed. This sets of the error trap in bash-3.2 but not bash 4.x. Work around this by disabling the error trap around this pacman call as we are manually checking the return value anyway. Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 4f9f89b1..2699f637 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -382,11 +382,15 @@ run_pacman() { } check_deps() { - (( $# > 0 )) || return + (( $# > 0 )) || return 0 + # Disable error trap in pacman subshell call as this breaks bash-3.2 compatibility + # Also, a non-zero return value is not unexpected and we are manually dealing them + set +E local ret=0 - pmout=$(run_pacman -T "$@") - ret=$? + pmout=$(run_pacman -T "$@") || ret=$? + set -E + if (( ret == 127 )); then #unresolved deps echo "$pmout" elif (( ret )); then -- cgit v1.2.3-24-g4f1b