summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/makepkg.sh.in182
1 files changed, 147 insertions, 35 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 0402475a..af906608 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -767,16 +767,59 @@ extract_svn() {
popd &>/dev/null
}
+get_all_sources() {
+ local aggregate l a
+
+ if array_build l 'source'; then
+ aggregate+=("${l[@]}")
+ fi
+
+ for a in "${arch[@]}"; do
+ if array_build l "source_$a"; then
+ aggregate+=("${l[@]}")
+ fi
+ done
+
+ array_build "$1" "aggregate"
+}
+
+get_all_sources_for_arch() {
+ local aggregate l
+
+ if array_build l 'source'; then
+ aggregate+=("${l[@]}")
+ fi
+
+ if array_build l "source_$CARCH"; then
+ aggregate+=("${l[@]}")
+ fi
+
+ array_build "$1" "aggregate"
+}
+
download_sources() {
+ local netfile all_sources
+ local get_source_fn=get_all_sources_for_arch get_vcs=1
+
msg "$(gettext "Retrieving sources...")"
- local GET_VCS=1
- if [[ $1 == "fast" ]]; then
- GET_VCS=0
- fi
+ while true; do
+ case $1 in
+ allarch)
+ get_source_fn=get_all_sources
+ ;;
+ novcs)
+ get_vcs=0
+ ;;
+ *)
+ break 2
+ ;;
+ esac
+ shift
+ done
- local netfile
- for netfile in "${source[@]}"; do
+ "$get_source_fn" 'all_sources'
+ for netfile in "${all_sources[@]}"; do
pushd "$SRCDEST" &>/dev/null
local proto=$(get_protocol "$netfile")
@@ -785,16 +828,16 @@ download_sources() {
download_local "$netfile"
;;
bzr*)
- (( GET_VCS )) && download_bzr "$netfile"
+ (( get_vcs )) && download_bzr "$netfile"
;;
git*)
- (( GET_VCS )) && download_git "$netfile"
+ (( get_vcs )) && download_git "$netfile"
;;
hg*)
- (( GET_VCS )) && download_hg "$netfile"
+ (( get_vcs )) && download_hg "$netfile"
;;
svn*)
- (( GET_VCS )) && download_svn "$netfile"
+ (( get_vcs )) && download_svn "$netfile"
;;
*)
download_file "$netfile"
@@ -976,8 +1019,10 @@ in_array() {
}
source_has_signatures() {
- local file
- for file in "${source[@]}"; do
+ local file all_sources
+
+ get_all_sources_for_arch 'all_sources'
+ for file in "${all_sources[@]}"; do
if [[ ${file%%::*} = *.@(sig?(n)|asc) ]]; then
return 0
fi
@@ -1120,16 +1165,27 @@ get_integlist() {
}
generate_one_checksum() {
- local integ=$1 numsrc=${#source[*]} indentsz idx
+ local integ=$1 arch=$2 sources numsrc indentsz idx
+
+ if [[ $arch ]]; then
+ array_build sources "source_$arch"
+ else
+ array_build sources 'source'
+ fi
+ numsrc=${#sources[*]}
if (( numsrc == 0 )); then
return
fi
- printf "%ssums=(%n" "$integ" indentsz
+ if [[ $arch ]]; then
+ printf "%ssums_%s=(%n" "$integ" "$arch" indentsz
+ else
+ printf "%ssums=(%n" "$integ" indentsz
+ fi
for (( idx = 0; idx < numsrc; ++idx )); do
- local netfile=${source[idx]}
+ local netfile=${sources[idx]}
local proto sum
proto="$(get_protocol "$netfile")"
@@ -1182,6 +1238,9 @@ generate_checksums() {
fi
generate_one_checksum "$integ"
+ for a in "${arch[@]}"; do
+ generate_one_checksum "$integ" "$a"
+ done
done
}
@@ -1214,15 +1273,25 @@ verify_integrity_one() {
}
verify_integrity_sums() {
- local integ=$1 integrity_sums
+ local integ=$1 arch=$2 integrity_sums=() sources=()
- array_build integrity_sums "${integ}sums"
+ if [[ $arch ]]; then
+ array_build integrity_sums "${integ}sums_$arch"
+ array_build sources "source_$arch"
+ else
+ array_build integrity_sums "${integ}sums"
+ array_build sources source
+ fi
+
+ if (( ${#integrity_sums[@]} == 0 && ${#sources[@]} == 0 )); then
+ return 1
+ fi
- if (( ${#integrity_sums[@]} == ${#source[@]} )); then
+ if (( ${#integrity_sums[@]} == ${#sources[@]} )); then
msg "$(gettext "Validating source files with %s...")" "${integ}sums"
local idx errors=0
- for (( idx = 0; idx < ${#source[*]}; idx++ )); do
- verify_integrity_one "${source[idx]}" "$integ" "${integrity_sums[idx]}" || errors=1
+ for (( idx = 0; idx < ${#sources[*]}; idx++ )); do
+ verify_integrity_one "${sources[idx]}" "$integ" "${integrity_sums[idx]}" || errors=1
done
if (( errors )); then
@@ -1237,14 +1306,44 @@ verify_integrity_sums() {
fi
}
+have_sources() {
+ local a
+
+ case $1 in
+ all)
+ for a in "${arch[@]}"; do
+ array_build _ source_"$a" && return 0
+ done
+ ;;
+ *)
+ if (( ${#source[*]} )) || array_build _ source_"$CARCH"; then
+ return 0
+ fi
+ ;;
+ esac
+
+ return 1
+}
+
check_checksums() {
(( SKIPCHECKSUMS )) && return 0
- (( ! ${#source[@]} )) && return 0
+ have_sources "$1" || return 0
local correlation=0
- local integ
+ local integ a
for integ in "${known_hash_algos[@]}"; do
verify_integrity_sums "$integ" && correlation=1
+
+ case $1 in
+ all)
+ for a in "${arch[@]}"; do
+ verify_integrity_sums "$integ" "$a" && correlation=1
+ done
+ ;;
+ *)
+ verify_integrity_sums "$integ" "$CARCH" && correlation=1
+ ;;
+ esac
done
if (( ! correlation )); then
@@ -1321,8 +1420,17 @@ check_pgpsigs() {
local warning=0
local errors=0
local statusfile=$(mktemp)
+ local all_sources
- for file in "${source[@]}"; do
+ case $1 in
+ all)
+ get_all_sources 'all_sources'
+ ;;
+ *)
+ get_all_sources_for_arch 'all_sources'
+ ;;
+ esac
+ for file in "${all_sources[@]}"; do
file="$(get_filename "$file")"
if [[ ! $file = *.@(sig?(n)|asc) ]]; then
continue
@@ -1426,20 +1534,22 @@ check_source_integrity() {
warning "$(gettext "Skipping all source file integrity checks.")"
elif (( SKIPCHECKSUMS )); then
warning "$(gettext "Skipping verification of source file checksums.")"
- check_pgpsigs
+ check_pgpsigs "$@"
elif (( SKIPPGPCHECK )); then
warning "$(gettext "Skipping verification of source file PGP signatures.")"
- check_checksums
+ check_checksums "$@"
else
- check_checksums
- check_pgpsigs
+ check_checksums "$@"
+ check_pgpsigs "$@"
fi
}
extract_sources() {
msg "$(gettext "Extracting sources...")"
- local netfile
- for netfile in "${source[@]}"; do
+ local netfile all_sources
+
+ get_all_sources_for_arch 'all_sources'
+ for netfile in "${all_sources[@]}"; do
local file=$(get_filename "$netfile")
if in_array "$file" "${noextract[@]}"; then
# skip source files in the noextract=() array
@@ -2130,8 +2240,10 @@ create_srcpackage() {
msg2 "$(gettext "Adding %s...")" "$BUILDSCRIPT"
ln -s "${BUILDFILE}" "${srclinks}/${pkgbase}/${BUILDSCRIPT}"
- local file
- for file in "${source[@]}"; do
+ local file all_sources
+
+ get_all_sources 'all_sources'
+ for file in "${all_sources[@]}"; do
if [[ "$file" = "$(get_filename "$file")" ]] || (( SOURCEONLY == 2 )); then
local absfile
absfile=$(get_filepath "$file") || missing_source_file "$file"
@@ -3268,7 +3380,7 @@ if (( GENINTEG )); then
mkdir -p "$srcdir"
chmod a-s "$srcdir"
cd_safe "$srcdir"
- download_sources fast
+ download_sources novcs allarch
generate_checksums
exit 0 # $E_OK
fi
@@ -3372,12 +3484,12 @@ if (( SOURCEONLY )); then
chmod a-s "$srcdir"
cd_safe "$srcdir"
if (( SOURCEONLY == 2 )); then
- download_sources
+ download_sources allarch
elif ( (( ! SKIPCHECKSUMS )) || \
( (( ! SKIPPGPCHECK )) && source_has_signatures ) ); then
- download_sources fast
+ download_sources novcs
fi
- check_source_integrity
+ check_source_integrity all
cd_safe "$startdir"
enter_fakeroot