[pacman-dev] [PATCH] makepkg: added a -a, --noarchive option to inhibit archive creation

Florian Pritz bluewind at xinu.at
Fri Feb 28 15:35:02 EST 2014


The patch subject could be a little better. Try to always use the
present tense (Add instead of added) and capitalize the first word to
stay in line with tools like git merge and revert. Also present tense is
shorter in most cases.

Also use an instead of a before vowel sounds.

Not too big of a deal, but I stopped a second there while reading it so
figured I might tell you as well.

On 28.02.2014 16:04, Pierre Neidhardt wrote:
> 1. Packagers who want to test the package() function, i.e. to check the content
> of the pkg/ folder.
> 
> 2. Developers who want to check how the packaged version of a program looks, in
> other words how the pkg/ folder looks.
> 
> 3. For users of systems with no port tree, makepkg can ease package creation.
> However the resulting archive of the whole makepkg process is often useless.
> 
> For all situations, makepkg will usually be called several times. But no archive
> (the final package) is needed in any cases. The archive creation ends up being a
> waste of time and resource, especially for big applications and slow machines.
> 
> Signed-off-by: Pierre Neidhardt <ambrevar at gmail.com>
> ---
>  scripts/makepkg.sh.in | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index b69c071..d84b635 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -74,6 +74,7 @@ INFAKEROOT=0
>  INSTALL=0
>  LOGGING=0
>  NEEDED=0
> +NOARCHIVE=0
>  NOBUILD=0
>  NODEPS=0
>  NOEXTRACT=0
> @@ -1844,6 +1845,10 @@ write_pkginfo() {
>  }
>  
>  create_package() {
> +	if (( NOARCHIVE )); then
> +		return 1
> +	fi

Why return 1? install_package doesn't do that and if the option is set
it's not really an error.

Use the same short code that install_package uses for consistency.

(( NOARCHIVE )) && return

> +
>  	if [[ ! -d $pkgdir ]]; then
>  		error "$(gettext "Missing %s directory.")" "\$pkgdir/"
>  		plain "$(gettext "Aborting...")"
> @@ -2488,6 +2493,7 @@ usage() {
>  	printf -- "$(gettext "Usage: %s [options]")\n" "$0"
>  	echo
>  	printf -- "$(gettext "Options:")\n"
> +	printf -- "$(gettext "  -a, --noarchive  Do not create archive from %s and do not install")\n" "\$pkgdir"

Shorter: "Skip package archive creation and installation". If you want
to keep yours: s/create archive/create an archive/.

>  	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 "  -C, --cleanbuild Remove %s dir before building the package")\n" "\$srcdir/"
> @@ -2557,11 +2563,12 @@ fi
>  ARGLIST=("$@")
>  
>  # Parse Command Line Options.
> -OPT_SHORT="AcCdefFghiLmop:rRsSV"
> +OPT_SHORT="aAcCdefFghiLmop:rRsSV"
> +
>  OPT_LONG=('allsource' 'asroot' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg'
> -          'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'nobuild' 'nocolor'
> -          'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'pkg:' 'repackage' 'rmdeps'
> -          'sign' 'skipchecksums' 'skipinteg' 'skippgpcheck' 'source' 'syncdeps'
> +          'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'noarchive' 'nobuild'
> +          'nocolor' 'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'pkg:' 'repackage'
> +          'rmdeps' 'sign' 'skipchecksums' 'skipinteg' 'skippgpcheck' 'source' 'syncdeps'
>            'verifysource' 'version')

I haven't checked this hunk.

>  
>  # Pacman Options
> @@ -2584,6 +2591,7 @@ while true; do
>  		# Makepkg Options
>  		--allsource)      SOURCEONLY=2 ;;
>  		--asroot)         ASROOT=1 ;;
> +		-a|--noarchive)   NOARCHIVE=1; INSTALL=0 ;;
>  		-A|--ignorearch)  IGNOREARCH=1 ;;
>  		-c|--clean)       CLEANUP=1 ;;
>  		-C|--cleanbuild)  CLEANBUILD=1 ;;
> @@ -2595,7 +2603,7 @@ while true; do
>  		-F)               INFAKEROOT=1 ;;
>  		-g|--geninteg)    GENINTEG=1 ;;
>  		--holdver)        HOLDVER=1 ;;
> -		-i|--install)     INSTALL=1 ;;
> +		-i|--install)     INSTALL=1; NOARCHIVE=0 ;;

Document that in the manpage (also document the --noarchive flag).

>  		--key)            shift; GPGKEY=$1 ;;
>  		-L|--log)         LOGGING=1 ;;
>  		-m|--nocolor)     USE_COLOR='n' ;;
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.archlinux.org/pipermail/pacman-dev/attachments/20140228/97935bb8/attachment.asc>


More information about the pacman-dev mailing list