summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Chantry <shiningxc@gmail.com>2009-10-14 20:07:28 +0200
committerDan McGee <dan@archlinux.org>2010-05-06 02:28:49 +0200
commit79987c92cb07c67914adf1febcc5ebdecf2a09b7 (patch)
treece483b706eac7f894482acbbd218cde6e2c4912e
parent64c3255b0e03190a35a1cef4bbc8b75b6be72684 (diff)
downloadpacman-79987c92cb07c67914adf1febcc5ebdecf2a09b7.tar.gz
pacman-79987c92cb07c67914adf1febcc5ebdecf2a09b7.tar.xz
makepkg -g: use checksums defined in the pkgbuild
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> [Allan: amend documentation] Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--doc/makepkg.8.txt9
-rw-r--r--scripts/makepkg.sh.in27
2 files changed, 31 insertions, 5 deletions
diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt
index 3fbd4062..1c70a35d 100644
--- a/doc/makepkg.8.txt
+++ b/doc/makepkg.8.txt
@@ -81,10 +81,11 @@ Options
*-g, \--geninteg*::
For each source file in the source array of PKGBUILD, download the file
- if required and generate integrity checks. The integrity checks
- generated are determined by the value of the INTEGRITY_CHECK array in
- linkman:makepkg.conf[5]. This output can be redirected into your
- PKGBUILD for source validation using "`makepkg -g >> PKGBUILD`".
+ if required and generate integrity checks. The integrity checks generated
+ are determined by the checks present in the PKGBUILD, falling back to the
+ value of the INTEGRITY_CHECK array in makepkg.conf(5) if these are absent
+ This output can be redirected into your PKGBUILD for source validation
+ using "`makepkg -g >> PKGBUILD`".
*--skipinteg*::
Do not fail when the PKGBUILD does not contain any integrity checks, just
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 7e99062b..dbb1a1e7 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -497,6 +497,24 @@ download_sources() {
popd &>/dev/null
}
+get_integlist() {
+ local integ
+ local integlist=()
+
+ for integ in md5 sha1 sha256 sha384 sha512; do
+ local integrity_sums=($(eval echo "\${${integ}sums[@]}"))
+ if [[ -n "$integrity_sums" ]]; then
+ integlist=(${integlist[@]} $integ)
+ fi
+ done
+
+ if (( ${#integlist[@]} > 0 )); then
+ echo ${integlist[@]}
+ else
+ echo ${INTEGRITY_CHECK[@]}
+ fi
+}
+
generate_checksums() {
msg "$(gettext "Generating checksums for source files...")"
plain ""
@@ -506,8 +524,15 @@ generate_checksums() {
exit 1 # $E_MISSING_PROGRAM
fi
+ local integlist
+ if (( $# == 0 )); then
+ integlist=$(get_integlist)
+ else
+ integlist=$@
+ fi
+
local integ
- for integ in ${INTEGRITY_CHECK[@]}; do
+ for integ in ${integlist[@]}; do
integ="${integ,,}"
case "$integ" in
md5|sha1|sha256|sha384|sha512) : ;;