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

Allan McRae allan at archlinux.org
Sun Mar 2 03:20:34 EST 2014


On 02/03/14 05:46, 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>
> ---
>  doc/makepkg.8.txt     |  7 ++++++-
>  scripts/makepkg.sh.in | 14 ++++++++++----
>  2 files changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt
> index 29f4a03..7b29023 100644
> --- a/doc/makepkg.8.txt
> +++ b/doc/makepkg.8.txt
> @@ -102,7 +102,7 @@ Options
>  
>  *-i, \--install*::
>  	Install or upgrade the package after a successful build using
> -	linkman:pacman[8].
> +	linkman:pacman[8]. This option and '\--noarchive' are mutually exclusive.
>  
>  *-L, \--log*::
>  	Enable makepkg build logging. This will use the *tee* program to send
> @@ -165,6 +165,11 @@ Options
>  	Run the check() function in the PKGBUILD, overriding the setting in
>  	linkman:makepkg.conf[5].
>  
> +*\--noarchive*::
> +	Do not create the archive at the end of the build process. This can be
> +	useful to test the package() function or if your target distribution does
> +	not use pacman. This option and '\--install' are mutually exclusive.
> +
>  *\--nocheck*::
>  	Do not run the check() function in the PKGBUILD or handle the checkdepends.
>  
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index b69c071..0689807 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,8 @@ write_pkginfo() {
>  }
>  
>  create_package() {
> +	(( NOARCHIVE )) && return
> +
>  	if [[ ! -d $pkgdir ]]; then
>  		error "$(gettext "Missing %s directory.")" "\$pkgdir/"
>  		plain "$(gettext "Aborting...")"
> @@ -2513,6 +2516,7 @@ usage() {
>  	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 "  --noarchive      Skip package archive creation and installation")\n"

Just "Do not create package archive" - do not mention installation.

>  	printf -- "$(gettext "  --nocheck        Do not run the %s function in the %s")\n" "check()" "$BUILDSCRIPT"
>  	printf -- "$(gettext "  --noprepare      Do not run the %s function in the %s")\n" "prepare()" "$BUILDSCRIPT"
>  	printf -- "$(gettext "  --nosign         Do not create a signature for the package")\n"
> @@ -2558,10 +2562,11 @@ ARGLIST=("$@")
>  
>  # Parse Command Line Options.
>  OPT_SHORT="AcCdefFghiLmop: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')
>  
>  # Pacman Options
> @@ -2584,6 +2589,7 @@ while true; do
>  		# Makepkg Options
>  		--allsource)      SOURCEONLY=2 ;;
>  		--asroot)         ASROOT=1 ;;
> +		--noarchive)      NOARCHIVE=1; INSTALL=0 ;;

Needs moved down - alphabetical.   Also, do only NOARCHIVE=1 here.  See
below.

>  		-A|--ignorearch)  IGNOREARCH=1 ;;
>  		-c|--clean)       CLEANUP=1 ;;
>  		-C|--cleanbuild)  CLEANBUILD=1 ;;
> @@ -2595,7 +2601,7 @@ while true; do
>  		-F)               INFAKEROOT=1 ;;
>  		-g|--geninteg)    GENINTEG=1 ;;
>  		--holdver)        HOLDVER=1 ;;
> -		-i|--install)     INSTALL=1 ;;
> +		-i|--install)     INSTALL=1; NOARCHIVE=0 ;;

I do not like this.  It means that if I specify both --install and
--noarchive it does something, but that something depends on what order
I specify them in.   Just do INSTALL=1;   That the end of this case
statement, do a check if (( INSTALL && NOARCHIVE )) and do an error.

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



More information about the pacman-dev mailing list