[pacman-dev] [PATCHv3 1/3] makepkg: Add a --noarchive option to inhibit archive creation
Allan McRae
allan at archlinux.org
Sat Mar 8 05:19:10 EST 2014
On 04/03/14 05:29, 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.
>
> Since this option aborts the process prematurely, it behaves like the
> -o,--nobuild option, i.e. any other option acting on later stages in the process
> will be automatically discarded. For --noarchive, it means that in
>
> $ makepkg --noarchive --install
>
> the '--install' option does not do anything.
>
> Signed-off-by: Pierre Neidhardt <ambrevar at gmail.com>
> ---
Pulled to my branch with minor changes below.
> doc/makepkg.8.txt | 5 +++++
> scripts/makepkg.sh.in | 22 +++++++++++++++++-----
> 2 files changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt
> index 77a7a83..4b3cbbd 100644
> --- a/doc/makepkg.8.txt
> +++ b/doc/makepkg.8.txt
> @@ -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.
> +
> *\--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 e230c15..9d2b43f 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
> @@ -1868,6 +1869,8 @@ write_pkginfo() {
> }
>
> create_package() {
> + (( NOARCHIVE )) && return
> +
> if [[ ! -d $pkgdir ]]; then
> error "$(gettext "Missing %s directory.")" "\$pkgdir/"
> plain "$(gettext "Aborting...")"
> @@ -2403,7 +2406,7 @@ check_build_status() {
> fullver=$(get_full_version)
> pkgarch=$(get_pkg_arch)
> if [[ -f $PKGDEST/${pkgname}-${fullver}-${pkgarch}${PKGEXT} ]] \
> - && ! (( FORCE || SOURCEONLY || NOBUILD )); then
> + && ! (( FORCE || SOURCEONLY || NOBUILD || NOARCHIVE)); then
> if (( INSTALL )); then
> warning "$(gettext "A package has already been built, installing existing package...")"
> install_package
> @@ -2425,7 +2428,7 @@ check_build_status() {
> allpkgbuilt=0
> fi
> done
> - if ! (( FORCE || SOURCEONLY || NOBUILD )); then
> + if ! (( FORCE || SOURCEONLY || NOBUILD || NOARCHIVE)); then
> if (( allpkgbuilt )); then
> if (( INSTALL )); then
> warning "$(gettext "The package group has already been built, installing existing packages...")"
> @@ -2537,6 +2540,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 Do not create archive")\n"
Changed this to "Do not create the package archive"
> 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"
> @@ -2582,10 +2586,11 @@ ARGLIST=("$@")
>
> # Parse Command Line Options.
> OPT_SHORT="AcCdefFghiLmop:rRsSV"
> +
Removed this whitespace addition.
> 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
> @@ -2623,6 +2628,7 @@ while true; do
> --key) shift; GPGKEY=$1 ;;
> -L|--log) LOGGING=1 ;;
> -m|--nocolor) USE_COLOR='n' ;;
> + --noarchive) NOARCHIVE=1 ;;
> --nocheck) RUN_CHECK='n' ;;
> --noprepare) RUN_PREPARE='n' ;;
> --nosign) SIGNPKG='n' ;;
> @@ -3080,6 +3086,12 @@ else
> fi
> fi
>
> +# if inhibiting archive creation, go no further
> +if (( NOARCHIVE )); then
> + msg "$(gettext "Package folder is ready.")"
> + exit 0
> +fi
> +
> fullver=$(get_full_version)
> msg "$(gettext "Finished making: %s")" "$pkgbase $fullver ($(date))"
>
>
More information about the pacman-dev
mailing list