diff -Naur pacman-3.3.2.orig/scripts/makepkg.sh.in pacman-3.3.2/scripts/makepkg.sh.in --- pacman-3.3.2.orig/scripts/makepkg.sh.in 2009-10-12 12:40:40.001333202 +0800 +++ pacman-3.3.2/scripts/makepkg.sh.in 2009-10-12 12:41:26.188828599 +0800 @@ -58,6 +58,7 @@ FORCE=0 INFAKEROOT=0 GENINTEG=0 +GETINTEG=0 SKIPINTEG=0 INSTALL=0 NOBUILD=0 @@ -556,6 +557,47 @@ done } +update_checksums() { + local file="$startdir/$BUILDSCRIPT" + local integ + + # necessary override for --geninteg + unset INTEGRITY_CHECK + + for integ in md5 sha1 sha256 sha384 sha512; do + grep "${integ}sums=(" $file &> /dev/null && \ + INTEGRITY_CHECK=(${INTEGRITY_CHECK[@]} $integ) + done + + [ ${#INTEGRITY_CHECK[@]} -eq 0 ] && source "$MAKEPKG_CONF" + + integ=${INTEGRITY_CHECK[0]} + if grep "&& ${integ}sums=(" "$file" | grep '$CARCH' &> /dev/null; then + error "$(gettext "Multi-arch checksum update not supported. Exiting...")" + exit 1 + else + for integ in ${INTEGRITY_CHECK[@]}; do + sed -i "/${integ}sums=(/,/)$/d" "$file" + done + + if grep "# vim: set" "$file" &> /dev/null; then + sed -i '/# vim: set/d' "$file" + sed -i -e :a -e '/^\n*$/{$d;N;ba' -e '}' "$file" + local vimset=1 + fi + + generate_checksums >> "$file" + + if [ -n "$vimset" ]; then + echo >> "$file" + echo "# vim: set ts=2 sw=2 et:" >> "$file" + fi + fi + + msg "$(gettext "Updated checksums in %s")" "$BUILDSCRIPT" + return 0 +} + check_checksums() { [ ${#source[@]} -eq 0 ] && return 0 @@ -1420,6 +1462,7 @@ echo "$(gettext " -f, --force Overwrite existing package")" echo "$(gettext " -g, --geninteg Generate integrity checks for source files")" echo "$(gettext " --skipinteg Do not fail when integrity checks are missing")" + printf "$(gettext " -G, --getinteg Update integrity checks in %s")\n" "$BUILDSCRIPT" echo "$(gettext " -h, --help This help")" echo "$(gettext " -i, --install Install package after successful build")" echo "$(gettext " -L, --log Log package build process")" @@ -1465,9 +1508,9 @@ ARGLIST=$@ # Parse Command Line Options. -OPT_SHORT="AcCdefFghiLmop:rRsV" +OPT_SHORT="AcCdefFgGhiLmop:rRsV" OPT_LONG="allsource,asroot,ignorearch,clean,cleancache,nodeps" -OPT_LONG="$OPT_LONG,noextract,force,forcever:,geninteg,help,holdver" +OPT_LONG="$OPT_LONG,noextract,force,forcever:,geninteg,getinteg,help,holdver" OPT_LONG="$OPT_LONG,install,log,nocolor,nobuild,rmdeps,repackage,skipinteg" OPT_LONG="$OPT_LONG,source,syncdeps,version,config:" # Pacman Options @@ -1500,6 +1543,7 @@ --forcever) shift; FORCE_VER=$1;; -F) INFAKEROOT=1 ;; -g|--geninteg) GENINTEG=1 ;; + -G| --getinteg) GETINTEG=1 ;; --holdver) HOLDVER=1 ;; -i|--install) INSTALL=1 ;; -L|--log) LOGGING=1 ;; @@ -1668,6 +1712,15 @@ exit 0 # $E_OK fi +if [ "$GETINTEG" -eq 1 ]; then + mkdir -p "$srcdir" + cd "$srcdir" + download_sources + update_checksums + cd "$startdir" + exit 0 +fi + if [ "$(type -t package)" = "function" ]; then PKGFUNC=1 fi