makepkg: refactor checking source integrity

Move the source integrity checking into its own function as the code
was duplicated and is now more complicated with the separation of the
two checks types.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Allan McRae 2011-07-18 19:58:54 +10:00 committed by Dan McGee
parent 2b3405e01b
commit 49d9426b6a

View file

@ -764,6 +764,21 @@ check_pgpsigs() {
fi fi
} }
check_source_integrity() {
if (( SKIPCHECKSUMS && SKIPPGPCHECK )); then
warning "$(gettext "Skipping all source file integrity checks.")"
elif (( SKIPCHECKSUMS )); then
warning "$(gettext "Skipping verification of source file checksums.")"
check_pgpsigs
elif (( SKIPPGPCHECK )); then
warning "$(gettext "Skipping verification of source file PGP signatures.")"
check_checksums
else
check_checksums
check_pgpsigs
fi
}
extract_sources() { extract_sources() {
msg "$(gettext "Extracting Sources...")" msg "$(gettext "Extracting Sources...")"
local netfile local netfile
@ -2249,18 +2264,7 @@ if (( SOURCEONLY )); then
(( SOURCEONLY == 2 )); then (( SOURCEONLY == 2 )); then
download_sources download_sources
fi fi
if (( SKIPCHECKSUMS && SKIPPGPCHECK )); then check_source_integrity
warning "$(gettext "Skipping all source file integrity checks.")"
elif (( SKIPCHECKSUMS )); then
warning "$(gettext "Skipping verification of source file checksums.")"
check_pgpsigs
elif (( SKIPPGPCHECK )); then
warning "$(gettext "Skipping verification of source file PGP signatures.")"
check_checksums
else
check_checksums
check_pgpsigs
fi
cd "$startdir" cd "$startdir"
# if we are root or if fakeroot is not enabled, then we don't use it # if we are root or if fakeroot is not enabled, then we don't use it
@ -2334,18 +2338,7 @@ elif (( REPKG )); then
fi fi
else else
download_sources download_sources
if (( SKIPCHECKSUMS && SKIPPGPCHECK )); then check_source_integrity
warning "$(gettext "Skipping all source file integrity checks.")"
elif (( SKIPCHECKSUMS )); then
warning "$(gettext "Skipping verification of source file checksums.")"
check_pgpsigs
elif (( SKIPPGPCHECK )); then
warning "$(gettext "Skipping verification of source file PGP signatures.")"
check_checksums
else
check_checksums
check_pgpsigs
fi
extract_sources extract_sources
fi fi