[pacman-dev] [PATCHv3 1/3] makepkg: Add a --noarchive option to inhibit archive creation
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@gmail.com> --- 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" 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" + 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))" -- 1.9.0
Before usage() and 'getopts' lines where not sorted consistently. Now the same sorting is used: the output of 'sort' using en_US.utf8 locale. (Case and punctuation characters are ignored.) Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> --- scripts/makepkg.sh.in | 59 +++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 9d2b43f..aa02fa6 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -2516,45 +2516,45 @@ usage() { 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 " --allsource Generate a source-only tarball including downloaded sources")\n" + printf -- "$(gettext " --asroot Allow %s to run as root user")\n" "makepkg" printf -- "$(gettext " -C, --cleanbuild Remove %s dir before building the package")\n" "\$srcdir/" + printf -- "$(gettext " -c, --clean Clean up work files after build")\n" + 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 " -d, --nodeps Skip all dependency checks")\n" printf -- "$(gettext " -e, --noextract Do not extract source files (use existing %s dir)")\n" "\$srcdir/" 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 " --holdver Do not update VCS sources")\n" printf -- "$(gettext " -i, --install Install package after successful build")\n" + printf -- "$(gettext " --key <key> Specify a key to use for %s signing instead of the default")\n" "gpg" 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 " -V, --version Show version information and exit")\n" - printf -- "$(gettext " --allsource Generate a source-only tarball including downloaded sources")\n" - printf -- "$(gettext " --verifysource Download source files (if needed) and perform integrity checks")\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 " --noarchive Do not create archive")\n" 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" + 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 " --pkg <list> Only build listed packages from a split package")\n" + printf -- "$(gettext " -R, --repackage Repackage contents of the package without rebuilding")\n" + printf -- "$(gettext " -r, --rmdeps Remove installed dependencies after a successful build")\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 " -S, --source Generate a source-only tarball without downloaded sources")\n" + printf -- "$(gettext " -s, --syncdeps Install missing dependencies with %s")\n" "pacman" + printf -- "$(gettext " --verifysource Download source files (if needed) and perform integrity checks")\n" + printf -- "$(gettext " -V, --version Show version information and exit")\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 " --noconfirm Do not ask for confirmation when resolving dependencies")\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" @@ -2604,18 +2604,12 @@ 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" ;; - # Makepkg Options + -A|--ignorearch) IGNOREARCH=1 ;; --allsource) SOURCEONLY=2 ;; --asroot) ASROOT=1 ;; - -A|--ignorearch) IGNOREARCH=1 ;; - -c|--clean) CLEANUP=1 ;; -C|--cleanbuild) CLEANBUILD=1 ;; + -c|--clean) CLEANUP=1 ;; --check) RUN_CHECK='y' ;; --config) shift; MAKEPKG_CONF=$1 ;; -d|--nodeps) NODEPS=1 ;; @@ -2623,6 +2617,7 @@ while true; do -f|--force) FORCE=1 ;; -F) INFAKEROOT=1 ;; -g|--geninteg) GENINTEG=1 ;; + -h|--help) usage; exit 0 ;; # E_OK --holdver) HOLDVER=1 ;; -i|--install) INSTALL=1 ;; --key) shift; GPGKEY=$1 ;; @@ -2633,21 +2628,25 @@ while true; do --noprepare) RUN_PREPARE='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 ;; + -p) shift; BUILDFILE=$1 ;; -R|--repackage) REPKG=1 ;; + -r|--rmdeps) RMDEPS=1 ;; + --sign) SIGNPKG='y' ;; --skipchecksums) SKIPCHECKSUMS=1 ;; --skipinteg) SKIPCHECKSUMS=1; SKIPPGPCHECK=1 ;; --skippgpcheck) SKIPPGPCHECK=1;; - --sign) SIGNPKG='y' ;; - -s|--syncdeps) DEP_BIN=1 ;; -S|--source) SOURCEONLY=1 ;; + -s|--syncdeps) DEP_BIN=1 ;; --verifysource) VERIFYSOURCE=1 ;; - - -h|--help) usage; exit 0 ;; # E_OK -V|--version) version; exit 0 ;; # E_OK + # Pacman Options + --asdeps) ASDEPS=1;; + --needed) NEEDED=1;; + --noconfirm) PACMAN_OPTS+=" --noconfirm" ;; + --noprogressbar) PACMAN_OPTS+=" --noprogressbar" ;; + --) OPT_IND=0; shift; break 2;; esac shift -- 1.9.0
On 04/03/14 05:29, Pierre Neidhardt wrote:
Before usage() and 'getopts' lines where not sorted consistently. Now the same sorting is used: the output of 'sort' using en_US.utf8 locale. (Case and punctuation characters are ignored.)
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> --- scripts/makepkg.sh.in | 59 +++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 30 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 9d2b43f..aa02fa6 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -2516,45 +2516,45 @@ usage() { 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 " --allsource Generate a source-only tarball including downloaded sources")\n" + printf -- "$(gettext " --asroot Allow %s to run as root user")\n" "makepkg" printf -- "$(gettext " -C, --cleanbuild Remove %s dir before building the package")\n" "\$srcdir/" + printf -- "$(gettext " -c, --clean Clean up work files after build")\n" + 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 " -d, --nodeps Skip all dependency checks")\n" printf -- "$(gettext " -e, --noextract Do not extract source files (use existing %s dir)")\n" "\$srcdir/" 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 " --holdver Do not update VCS sources")\n" printf -- "$(gettext " -i, --install Install package after successful build")\n" + printf -- "$(gettext " --key <key> Specify a key to use for %s signing instead of the default")\n" "gpg" 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 " -V, --version Show version information and exit")\n" - printf -- "$(gettext " --allsource Generate a source-only tarball including downloaded sources")\n" - printf -- "$(gettext " --verifysource Download source files (if needed) and perform integrity checks")\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 " --noarchive Do not create archive")\n" 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" + 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 " --pkg <list> Only build listed packages from a split package")\n" + printf -- "$(gettext " -R, --repackage Repackage contents of the package without rebuilding")\n" + printf -- "$(gettext " -r, --rmdeps Remove installed dependencies after a successful build")\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 " -S, --source Generate a source-only tarball without downloaded sources")\n" + printf -- "$(gettext " -s, --syncdeps Install missing dependencies with %s")\n" "pacman" + printf -- "$(gettext " --verifysource Download source files (if needed) and perform integrity checks")\n" + printf -- "$(gettext " -V, --version Show version information and exit")\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 " --noconfirm Do not ask for confirmation when resolving dependencies")\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"
This was set to show all sort options first (because they are most frequently used), follow by the long options without a short equivalent. I see there were some places where keeping that order still needs adjustment (--noconfirm stands out, and I could accept the upper versus lower case letter adjustment), but I do not like the global change.
@@ -2604,18 +2604,12 @@ 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" ;; -
Seems pointless just moving a block.
# Makepkg Options + -A|--ignorearch) IGNOREARCH=1 ;; --allsource) SOURCEONLY=2 ;; --asroot) ASROOT=1 ;; - -A|--ignorearch) IGNOREARCH=1 ;; - -c|--clean) CLEANUP=1 ;; -C|--cleanbuild) CLEANBUILD=1 ;; + -c|--clean) CLEANUP=1 ;; --check) RUN_CHECK='y' ;; --config) shift; MAKEPKG_CONF=$1 ;; -d|--nodeps) NODEPS=1 ;; @@ -2623,6 +2617,7 @@ while true; do -f|--force) FORCE=1 ;; -F) INFAKEROOT=1 ;; -g|--geninteg) GENINTEG=1 ;; + -h|--help) usage; exit 0 ;; # E_OK --holdver) HOLDVER=1 ;; -i|--install) INSTALL=1 ;; --key) shift; GPGKEY=$1 ;; @@ -2633,21 +2628,25 @@ while true; do --noprepare) RUN_PREPARE='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 ;; + -p) shift; BUILDFILE=$1 ;; -R|--repackage) REPKG=1 ;; + -r|--rmdeps) RMDEPS=1 ;; + --sign) SIGNPKG='y' ;; --skipchecksums) SKIPCHECKSUMS=1 ;; --skipinteg) SKIPCHECKSUMS=1; SKIPPGPCHECK=1 ;; --skippgpcheck) SKIPPGPCHECK=1;; - --sign) SIGNPKG='y' ;; - -s|--syncdeps) DEP_BIN=1 ;; -S|--source) SOURCEONLY=1 ;; + -s|--syncdeps) DEP_BIN=1 ;; --verifysource) VERIFYSOURCE=1 ;; -
Moving --sign into order is fine. I think the upper vs lower case and single vs double hyphen ordering here is really unnecessary churn.
- -h|--help) usage; exit 0 ;; # E_OK -V|--version) version; exit 0 ;; # E_OK
These looked kept separate for a reason...
+ # Pacman Options + --asdeps) ASDEPS=1;; + --needed) NEEDED=1;; + --noconfirm) PACMAN_OPTS+=" --noconfirm" ;; + --noprogressbar) PACMAN_OPTS+=" --noprogressbar" ;; + --) OPT_IND=0; shift; break 2;; esac shift
On 14-03-04 13:52:29, Allan McRae wrote:
On 04/03/14 05:29, Pierre Neidhardt wrote:
Before usage() and 'getopts' lines where not sorted consistently. Now the same sorting is used: the output of 'sort' using en_US.utf8 locale. (Case and punctuation characters are ignored.)
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> --- scripts/makepkg.sh.in | 59 +++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 30 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 9d2b43f..aa02fa6 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -2516,45 +2516,45 @@ usage() { 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 " --allsource Generate a source-only tarball including downloaded sources")\n" + printf -- "$(gettext " --asroot Allow %s to run as root user")\n" "makepkg" printf -- "$(gettext " -C, --cleanbuild Remove %s dir before building the package")\n" "\$srcdir/" + printf -- "$(gettext " -c, --clean Clean up work files after build")\n" + 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 " -d, --nodeps Skip all dependency checks")\n" printf -- "$(gettext " -e, --noextract Do not extract source files (use existing %s dir)")\n" "\$srcdir/" 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 " --holdver Do not update VCS sources")\n" printf -- "$(gettext " -i, --install Install package after successful build")\n" + printf -- "$(gettext " --key <key> Specify a key to use for %s signing instead of the default")\n" "gpg" 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 " -V, --version Show version information and exit")\n" - printf -- "$(gettext " --allsource Generate a source-only tarball including downloaded sources")\n" - printf -- "$(gettext " --verifysource Download source files (if needed) and perform integrity checks")\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 " --noarchive Do not create archive")\n" 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" + 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 " --pkg <list> Only build listed packages from a split package")\n" + printf -- "$(gettext " -R, --repackage Repackage contents of the package without rebuilding")\n" + printf -- "$(gettext " -r, --rmdeps Remove installed dependencies after a successful build")\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 " -S, --source Generate a source-only tarball without downloaded sources")\n" + printf -- "$(gettext " -s, --syncdeps Install missing dependencies with %s")\n" "pacman" + printf -- "$(gettext " --verifysource Download source files (if needed) and perform integrity checks")\n" + printf -- "$(gettext " -V, --version Show version information and exit")\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 " --noconfirm Do not ask for confirmation when resolving dependencies")\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"
This was set to show all sort options first (because they are most frequently used), follow by the long options without a short equivalent. I see there were some places where keeping that order still needs adjustment (--noconfirm stands out, and I could accept the upper versus lower case letter adjustment), but I do not like the global change.
Actually the original sorting order here was rather fine to me. But not the one in usage(). I changed it here to keep them in sync. See below for another suggestion. "--verifysource" was put completely randomly in the list, I suppose.
@@ -2604,18 +2604,12 @@ 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" ;; -
Seems pointless just moving a block.
But it does keep in sync with the usage() part.
# Makepkg Options + -A|--ignorearch) IGNOREARCH=1 ;; --allsource) SOURCEONLY=2 ;; --asroot) ASROOT=1 ;; - -A|--ignorearch) IGNOREARCH=1 ;; - -c|--clean) CLEANUP=1 ;; -C|--cleanbuild) CLEANBUILD=1 ;; + -c|--clean) CLEANUP=1 ;; --check) RUN_CHECK='y' ;; --config) shift; MAKEPKG_CONF=$1 ;; -d|--nodeps) NODEPS=1 ;; @@ -2623,6 +2617,7 @@ while true; do -f|--force) FORCE=1 ;; -F) INFAKEROOT=1 ;; -g|--geninteg) GENINTEG=1 ;; + -h|--help) usage; exit 0 ;; # E_OK --holdver) HOLDVER=1 ;; -i|--install) INSTALL=1 ;; --key) shift; GPGKEY=$1 ;; @@ -2633,21 +2628,25 @@ while true; do --noprepare) RUN_PREPARE='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 ;; + -p) shift; BUILDFILE=$1 ;; -R|--repackage) REPKG=1 ;; + -r|--rmdeps) RMDEPS=1 ;; + --sign) SIGNPKG='y' ;; --skipchecksums) SKIPCHECKSUMS=1 ;; --skipinteg) SKIPCHECKSUMS=1; SKIPPGPCHECK=1 ;; --skippgpcheck) SKIPPGPCHECK=1;; - --sign) SIGNPKG='y' ;; - -s|--syncdeps) DEP_BIN=1 ;; -S|--source) SOURCEONLY=1 ;; + -s|--syncdeps) DEP_BIN=1 ;; --verifysource) VERIFYSOURCE=1 ;; -
Moving --sign into order is fine. I think the upper vs lower case and single vs double hyphen ordering here is really unnecessary churn.
Again, the point is to write them the same way as in usage(). -- Pierre Neidhardt Having no talent is no longer enough. -- Gore Vidal
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> --- scripts/makepkg.sh.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index aa02fa6..be1da7d 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -2100,7 +2100,7 @@ install_package() { if ! run_pacman -U "${pkglist[@]}"; then warning "$(gettext "Failed to install built package(s).")" - return 0 + return 1 fi } @@ -3095,7 +3095,6 @@ fullver=$(get_full_version) msg "$(gettext "Finished making: %s")" "$pkgbase $fullver ($(date))" install_package - -exit 0 #E_OK +exit $? # vim: set noet: -- 1.9.0
On 04/03/14 05:29, Pierre Neidhardt wrote:
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> --- scripts/makepkg.sh.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index aa02fa6..be1da7d 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -2100,7 +2100,7 @@ install_package() {
if ! run_pacman -U "${pkglist[@]}"; then warning "$(gettext "Failed to install built package(s).")" - return 0 + return 1 fi }
See commit deff57ce which references FS#13417 for history about this. A
On 14-03-04 13:40:54, Allan McRae wrote:
On 04/03/14 05:29, Pierre Neidhardt wrote:
Signed-off-by: Pierre Neidhardt <ambrevar@gmail.com> --- scripts/makepkg.sh.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index aa02fa6..be1da7d 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -2100,7 +2100,7 @@ install_package() {
if ! run_pacman -U "${pkglist[@]}"; then warning "$(gettext "Failed to install built package(s).")" - return 0 + return 1 fi }
See commit deff57ce which references FS#13417 for history about this.
OK. I did this because on two occasions, makepkg returns "exit $?" after install_package() has been called. Which is rather pointless then (and confusing). I will add a comment to install_package() and change the "exit $?" to "exit 0". -- Pierre Neidhardt No man is an island if he's on at least one mailing list.
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@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))"
participants (2)
-
Allan McRae
-
Pierre Neidhardt