summaryrefslogtreecommitdiffstats
path: root/scripts/makepkg.sh.in
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2014-12-23 16:57:29 +0100
committerAllan McRae <allan@archlinux.org>2014-12-24 02:15:38 +0100
commitd2d00e454353d5a420ce3406e9cd011e299d091d (patch)
tree3f0c66d68a6c06693291fd10ea6af0281603d673 /scripts/makepkg.sh.in
parentc07593c64ce616c768061348865ead2a13248b0f (diff)
downloadpacman-d2d00e454353d5a420ce3406e9cd011e299d091d.tar.gz
pacman-d2d00e454353d5a420ce3406e9cd011e299d091d.tar.xz
makepkg: properly correlate checksums for multiple sources
Previously, we used a single boolean value to determine correlation of sources to checksums. Since the introduction of arch-specific sources, this is no longer sufficient, as we must ensure that we have checksums for (potentially) multiple source arrays. This change inlines the logic of have_sources to build an associative array of source array names, unsetting them as we discover their checksums. The error condition then becomes a non-empty correlation array. Fixes: https://bugs.archlinux.org/task/43192 Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/makepkg.sh.in')
-rw-r--r--scripts/makepkg.sh.in32
1 files changed, 13 insertions, 19 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index ae8cf57b..d53c39f2 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1317,47 +1317,41 @@ verify_integrity_sums() {
fi
}
-have_sources() {
- local a
-
- (( ${#source[*]} )) && return 0
+check_checksums() {
+ local integ a
+ declare -A correlation
+ (( SKIPCHECKSUMS )) && return 0
+ # Initialize a map which we'll use to verify that every source array has at
+ # least some kind of checksum array associated with it.
+ (( ${#source[*]} )) && correlation['source']=1
case $1 in
all)
for a in "${arch[@]}"; do
- array_build _ source_"$a" && return 0
+ array_build _ source_"$a" && correlation["source_$a"]=1
done
;;
*)
- array_build _ source_"$CARCH" && return 0
+ array_build _ source_"$CARCH" && correlation["source_$CARCH"]=1
;;
esac
- return 1
-}
-
-check_checksums() {
- (( SKIPCHECKSUMS )) && return 0
- have_sources "$1" || return 0
-
- local correlation=0
- local integ a
for integ in "${known_hash_algos[@]}"; do
- verify_integrity_sums "$integ" && correlation=1
+ verify_integrity_sums "$integ" && unset "correlation[source]"
case $1 in
all)
for a in "${arch[@]}"; do
- verify_integrity_sums "$integ" "$a" && correlation=1
+ verify_integrity_sums "$integ" "$a" && unset "correlation[source_$a]"
done
;;
*)
- verify_integrity_sums "$integ" "$CARCH" && correlation=1
+ verify_integrity_sums "$integ" "$CARCH" && unset "correlation[source_$CARCH]"
;;
esac
done
- if (( ! correlation )); then
+ if (( ${#correlation[*]} )); then
error "$(gettext "Integrity checks are missing.")"
exit 1 # TODO: error code
fi