[pacman-dev] [PATCH] makepkg: Add --noextractonly (-E) to also download/verify source files

Olivier Brunel i.am.jack.mail at gmail.com
Fri Feb 22 09:03:58 EST 2013


Because --noextract also implies to not download/verify source files, it wasn't
possible to simply do just that, without either extracting and/or building. This
option allows just that (and is therefore mostly useful with --nobuild).

Signed-off-by: Olivier Brunel <i.am.jack.mail at gmail.com>
---
 doc/makepkg.8.txt     |   5 ++
 scripts/makepkg.sh.in | 175 ++++++++++++++++++++++++++------------------------
 2 files changed, 96 insertions(+), 84 deletions(-)

diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt
index 498c79b..7404865 100644
--- a/doc/makepkg.8.txt
+++ b/doc/makepkg.8.txt
@@ -65,6 +65,11 @@ Options
 	then make a package out of the result. Keep in mind that creating a
 	patch may be a better solution to allow others to use your PKGBUILD.
 
+*-E, \--noextractonly*::
+	Same as '\--noextract' option, but still downloads and verify checksums of
+	source files. This is mostly useful with the '\--nobuild' option, to only
+	download and verify source files, without doing anything else.
+
 *-f, \--force*::
 	makepkg will not build a package if a built package already exists in
 	the `PKGDEST` (set in linkman:makepkg.conf[5]) directory, which may
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index bd29d73..e46221a 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -68,6 +68,7 @@ INSTALL=0
 NOBUILD=0
 NODEPS=0
 NOEXTRACT=0
+NOEXTRACTONLY=0
 RMDEPS=0
 REPKG=0
 LOGGING=0
@@ -2392,42 +2393,43 @@ usage() {
 	printf -- "$(gettext "Usage: %s [options]")\n" "$0"
 	echo
 	printf -- "$(gettext "Options:")\n"
-	printf -- "$(gettext "  -A, --ignorearch Ignore incomplete %s field in %s")\n" "arch" "$BUILDSCRIPT"
-	printf -- "$(gettext "  -c, --clean      Clean up work files after build")\n"
-	printf -- "$(gettext "  -d, --nodeps     Skip all dependency checks")\n"
-	printf -- "$(gettext "  -e, --noextract  Do not extract source files (use existing %s dir)")\n" "src/"
-	printf -- "$(gettext "  -f, --force      Overwrite existing package")\n"
-	printf -- "$(gettext "  -g, --geninteg   Generate integrity checks for source files")\n"
-	printf -- "$(gettext "  -h, --help       Show this help message and exit")\n"
-	printf -- "$(gettext "  -i, --install    Install package after successful build")\n"
-	printf -- "$(gettext "  -L, --log        Log package build process")\n"
-	printf -- "$(gettext "  -m, --nocolor    Disable colorized output messages")\n"
-	printf -- "$(gettext "  -o, --nobuild    Download and extract files only")\n"
-	printf -- "$(gettext "  -p <file>        Use an alternate build script (instead of '%s')")\n" "$BUILDSCRIPT"
-	printf -- "$(gettext "  -r, --rmdeps     Remove installed dependencies after a successful build")\n"
-	printf -- "$(gettext "  -R, --repackage  Repackage contents of the package without rebuilding")\n"
-	printf -- "$(gettext "  -s, --syncdeps   Install missing dependencies with %s")\n" "pacman"
-	printf -- "$(gettext "  -S, --source     Generate a source-only tarball without downloaded sources")\n"
-	printf -- "$(gettext "  --allsource      Generate a source-only tarball including downloaded sources")\n"
-	printf -- "$(gettext "  --asroot         Allow %s to run as root user")\n" "makepkg"
-	printf -- "$(gettext "  --check          Run the %s function in the %s")\n" "check()" "$BUILDSCRIPT"
-	printf -- "$(gettext "  --config <file>  Use an alternate config file (instead of '%s')")\n" "$confdir/makepkg.conf"
-	printf -- "$(gettext "  --holdver        Do not update VCS sources")\n"
-	printf -- "$(gettext "  --key <key>      Specify a key to use for %s signing instead of the default")\n" "gpg"
-	printf -- "$(gettext "  --nocheck        Do not run the %s function in the %s")\n" "check()" "$BUILDSCRIPT"
-	printf -- "$(gettext "  --nosign         Do not create a signature for the package")\n"
-	printf -- "$(gettext "  --pkg <list>     Only build listed packages from a split package")\n"
-	printf -- "$(gettext "  --sign           Sign the resulting package with %s")\n" "gpg"
-	printf -- "$(gettext "  --skipchecksums  Do not verify checksums of the source files")\n"
-	printf -- "$(gettext "  --skipinteg      Do not perform any verification checks on source files")\n"
-	printf -- "$(gettext "  --skippgpcheck   Do not verify source files with PGP signatures")\n"
+	printf -- "$(gettext "  -A, --ignorearch    Ignore incomplete %s field in %s")\n" "arch" "$BUILDSCRIPT"
+	printf -- "$(gettext "  -c, --clean         Clean up work files after build")\n"
+	printf -- "$(gettext "  -d, --nodeps        Skip all dependency checks")\n"
+	printf -- "$(gettext "  -e, --noextract     Do not extract source files (use existing %s dir)")\n" "src/"
+	printf -- "$(gettext "  -E, --noextractonly Same as --noextract but still download & verify checksums")\n"
+	printf -- "$(gettext "  -f, --force         Overwrite existing package")\n"
+	printf -- "$(gettext "  -g, --geninteg      Generate integrity checks for source files")\n"
+	printf -- "$(gettext "  -h, --help          Show this help message and exit")\n"
+	printf -- "$(gettext "  -i, --install       Install package after successful build")\n"
+	printf -- "$(gettext "  -L, --log           Log package build process")\n"
+	printf -- "$(gettext "  -m, --nocolor       Disable colorized output messages")\n"
+	printf -- "$(gettext "  -o, --nobuild       Download and extract files only")\n"
+	printf -- "$(gettext "  -p <file>           Use an alternate build script (instead of '%s')")\n" "$BUILDSCRIPT"
+	printf -- "$(gettext "  -r, --rmdeps        Remove installed dependencies after a successful build")\n"
+	printf -- "$(gettext "  -R, --repackage     Repackage contents of the package without rebuilding")\n"
+	printf -- "$(gettext "  -s, --syncdeps      Install missing dependencies with %s")\n" "pacman"
+	printf -- "$(gettext "  -S, --source        Generate a source-only tarball without downloaded sources")\n"
+	printf -- "$(gettext "  --allsource         Generate a source-only tarball including downloaded sources")\n"
+	printf -- "$(gettext "  --asroot            Allow %s to run as root user")\n" "makepkg"
+	printf -- "$(gettext "  --check             Run the %s function in the %s")\n" "check()" "$BUILDSCRIPT"
+	printf -- "$(gettext "  --config <file>     Use an alternate config file (instead of '%s')")\n" "$confdir/makepkg.conf"
+	printf -- "$(gettext "  --holdver           Do not update VCS sources")\n"
+	printf -- "$(gettext "  --key <key>         Specify a key to use for %s signing instead of the default")\n" "gpg"
+	printf -- "$(gettext "  --nocheck           Do not run the %s function in the %s")\n" "check()" "$BUILDSCRIPT"
+	printf -- "$(gettext "  --nosign            Do not create a signature for the package")\n"
+	printf -- "$(gettext "  --pkg <list>        Only build listed packages from a split package")\n"
+	printf -- "$(gettext "  --sign              Sign the resulting package with %s")\n" "gpg"
+	printf -- "$(gettext "  --skipchecksums     Do not verify checksums of the source files")\n"
+	printf -- "$(gettext "  --skipinteg         Do not perform any verification checks on source files")\n"
+	printf -- "$(gettext "  --skippgpcheck      Do not verify source files with PGP signatures")\n"
 	echo
 	printf -- "$(gettext "These options can be passed to %s:")\n" "pacman"
 	echo
-	printf -- "$(gettext "  --asdeps         Install packages as non-explicitly installed")\n"
-	printf -- "$(gettext "  --noconfirm      Do not ask for confirmation when resolving dependencies")\n"
-	printf -- "$(gettext "  --needed         Do not reinstall the targets that are already up to date")\n"
-	printf -- "$(gettext "  --noprogressbar  Do not show a progress bar when downloading files")\n"
+	printf -- "$(gettext "  --asdeps            Install packages as non-explicitly installed")\n"
+	printf -- "$(gettext "  --noconfirm         Do not ask for confirmation when resolving dependencies")\n"
+	printf -- "$(gettext "  --needed            Do not reinstall the targets that are already up to date")\n"
+	printf -- "$(gettext "  --noprogressbar     Do not show a progress bar when downloading files")\n"
 	echo
 	printf -- "$(gettext "If %s is not specified, %s will look for '%s'")\n" "-p" "makepkg" "$BUILDSCRIPT"
 	echo
@@ -2454,12 +2456,12 @@ fi
 ARGLIST=("$@")
 
 # Parse Command Line Options.
-OPT_SHORT="AcdefFghiLmop:rRsSV"
+OPT_SHORT="AcdeEfFghiLmop:rRsSV"
 OPT_LONG=('allsource' 'asroot' 'check' 'clean' 'config:' 'force' 'geninteg'
-          'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'nobuild' 'nocolor'
-          'nocheck' 'nodeps' 'noextract' 'nosign' 'pkg:' 'repackage' 'rmdeps'
-          'skipchecksums' 'skipinteg' 'skippgpcheck' 'skippgpcheck' 'sign'
-          'source' 'syncdeps' 'version')
+          'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'nobuild'
+          'nocolor' 'nocheck' 'nodeps' 'noextract' 'noextractonly' 'nosign'
+          'pkg:' 'repackage' 'rmdeps' 'skipchecksums' 'skipinteg' 'skippgpcheck'
+          'skippgpcheck' 'sign' 'source' 'syncdeps' 'version')
 
 # Pacman Options
 OPT_LONG+=('asdeps' 'noconfirm' 'needed' 'noprogressbar')
@@ -2473,46 +2475,47 @@ unset OPT_SHORT OPT_LONG OPTRET
 while true; do
 	case "$1" in
 		# Pacman Options
-		--asdeps)         ASDEPS=1;;
-		--noconfirm)      PACMAN_OPTS+=" --noconfirm" ;;
-		--needed)         NEEDED=1;;
-		--noprogressbar)  PACMAN_OPTS+=" --noprogressbar" ;;
+		--asdeps)           ASDEPS=1;;
+		--noconfirm)        PACMAN_OPTS+=" --noconfirm" ;;
+		--needed)           NEEDED=1;;
+		--noprogressbar)    PACMAN_OPTS+=" --noprogressbar" ;;
 
 		# Makepkg Options
-		--allsource)      SOURCEONLY=2 ;;
-		--asroot)         ASROOT=1 ;;
-		-A|--ignorearch)  IGNOREARCH=1 ;;
-		-c|--clean)       CLEANUP=1 ;;
-		--check)          RUN_CHECK='y' ;;
-		--config)         shift; MAKEPKG_CONF=$1 ;;
-		-d|--nodeps)      NODEPS=1 ;;
-		-e|--noextract)   NOEXTRACT=1 ;;
-		-f|--force)       FORCE=1 ;;
-		-F)               INFAKEROOT=1 ;;
-		-g|--geninteg)    GENINTEG=1 ;;
-		--holdver)        HOLDVER=1 ;;
-		-i|--install)     INSTALL=1 ;;
-		--key)            shift; GPGKEY=$1 ;;
-		-L|--log)         LOGGING=1 ;;
-		-m|--nocolor)     USE_COLOR='n' ;;
-		--nocheck)        RUN_CHECK='n' ;;
-		--nosign)         SIGNPKG='n' ;;
-		-o|--nobuild)     NOBUILD=1 ;;
-		-p)               shift; BUILDFILE=$1 ;;
-		--pkg)            shift; IFS=, read -ra p <<<"$1"; PKGLIST+=("${p[@]}"); unset p ;;
-		-r|--rmdeps)      RMDEPS=1 ;;
-		-R|--repackage)   REPKG=1 ;;
-		--skipchecksums)  SKIPCHECKSUMS=1 ;;
-		--skipinteg)      SKIPCHECKSUMS=1; SKIPPGPCHECK=1 ;;
-		--skippgpcheck)   SKIPPGPCHECK=1;;
-		--sign)           SIGNPKG='y' ;;
-		-s|--syncdeps)    DEP_BIN=1 ;;
-		-S|--source)      SOURCEONLY=1 ;;
-
-		-h|--help)        usage; exit 0 ;; # E_OK
-		-V|--version)     version; exit 0 ;; # E_OK
-
-		--)               OPT_IND=0; shift; break 2;;
+		--allsource)        SOURCEONLY=2 ;;
+		--asroot)           ASROOT=1 ;;
+		-A|--ignorearch)    IGNOREARCH=1 ;;
+		-c|--clean)         CLEANUP=1 ;;
+		--check)            RUN_CHECK='y' ;;
+		--config)           shift; MAKEPKG_CONF=$1 ;;
+		-d|--nodeps)        NODEPS=1 ;;
+		-e|--noextract)     NOEXTRACT=1 ;;
+		-E|--noextractonly) NOEXTRACTONLY=1 ;;
+		-f|--force)         FORCE=1 ;;
+		-F)                 INFAKEROOT=1 ;;
+		-g|--geninteg)      GENINTEG=1 ;;
+		--holdver)          HOLDVER=1 ;;
+		-i|--install)       INSTALL=1 ;;
+		--key)              shift; GPGKEY=$1 ;;
+		-L|--log)           LOGGING=1 ;;
+		-m|--nocolor)       USE_COLOR='n' ;;
+		--nocheck)          RUN_CHECK='n' ;;
+		--nosign)           SIGNPKG='n' ;;
+		-o|--nobuild)       NOBUILD=1 ;;
+		-p)                 shift; BUILDFILE=$1 ;;
+		--pkg)              shift; IFS=, read -ra p <<<"$1"; PKGLIST+=("${p[@]}"); unset p ;;
+		-r|--rmdeps)        RMDEPS=1 ;;
+		-R|--repackage)     REPKG=1 ;;
+		--skipchecksums)    SKIPCHECKSUMS=1 ;;
+		--skipinteg)        SKIPCHECKSUMS=1; SKIPPGPCHECK=1 ;;
+		--skippgpcheck)     SKIPPGPCHECK=1;;
+		--sign)             SIGNPKG='y' ;;
+		-s|--syncdeps)      DEP_BIN=1 ;;
+		-S|--source)        SOURCEONLY=1 ;;
+
+		-h|--help)          usage; exit 0 ;; # E_OK
+		-V|--version)       version; exit 0 ;; # E_OK
+
+		--)                 OPT_IND=0; shift; break 2;;
 	esac
 	shift
 done
@@ -2885,9 +2888,7 @@ mkdir -p "$srcdir"
 chmod a-s "$srcdir"
 cd_safe "$srcdir"
 
-if (( NOEXTRACT )); then
-	warning "$(gettext "Using existing %s tree")" "src/"
-elif (( REPKG )); then
+if (( REPKG )); then
 	if (( ! PKGFUNC && ! SPLITPKG )) \
 	     && { [[ ! -d $pkgdirbase ]] || dir_is_empty "$pkgdirbase"; }; then
 		error "$(gettext "The package directory is empty, there is nothing to repackage!")"
@@ -2895,11 +2896,17 @@ elif (( REPKG )); then
 		exit 1
 	fi
 else
-	download_sources
-	check_source_integrity
-	extract_sources
-	if (( PREPAREFUNC )); then
-		run_prepare
+	if (( ! NOEXTRACT )); then
+		download_sources
+		check_source_integrity
+	fi
+	if (( NOEXTRACT || NOEXTRACTONLY )); then
+		warning "$(gettext "Using existing %s tree")" "src/"
+	else
+		extract_sources
+		if (( PREPAREFUNC )); then
+			run_prepare
+		fi
 	fi
 fi
 
-- 
1.8.1.4



More information about the pacman-dev mailing list