[pacman-dev] [PATCH] add the ability to only build on new pkgver or pkgrel
If I haven't bumped the pkgrel, or there have been no new commits, I don't want to rebuild the package. Similar to the --needed flag, but pertains to building instead of installing. --- contrib/bash_completion.in | 4 ++-- contrib/zsh_completion.in | 1 + doc/makepkg.8.txt | 4 ++++ scripts/makepkg.sh.in | 10 +++++++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/contrib/bash_completion.in b/contrib/bash_completion.in index b0901af..af382e8 100644 --- a/contrib/bash_completion.in +++ b/contrib/bash_completion.in @@ -74,8 +74,8 @@ _makepkg() { COMPREPLY=() _get_comp_words_by_ref cur prev if [[ $cur = -* && ! $prev =~ ^-(-(config|help)$|\w*[Chp]) ]]; then - opts=('allsource asdeps asroot check clean config force geninteg help holdver ignorearch - install log nobuild nocheck nocolor noconfirm nodeps noextract + opts=('allsource asdeps asroot buildneeded check clean config force geninteg help holdver + ignorearch install log nobuild nocheck nocolor noconfirm nodeps noextract noprogressbar nosign pkg repackage rmdeps sign skipinteg source syncdeps' 'A L R S c d e f g h i m o p r s') _arch_ptr2comp opts diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in index 84ee93c..342803f 100644 --- a/contrib/zsh_completion.in +++ b/contrib/zsh_completion.in @@ -457,6 +457,7 @@ _makepkg_longopts=( '--ignorearch[Ignore incomplete arch field in PKGBUILD]' '--clean[Clean up work files after build]' '--nodeps[Skip all dependency checks]' + '--buildneeded[Skip building if the same version is already installed]' '--noextract[Do not extract source files (use existing src/ dir)]' '--force[Overwrite existing package]' '--geninteg[Generate integrity checks for source files]' diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index 498c79b..d45a703 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -58,6 +58,10 @@ Options will break the build process if all of the dependencies are not installed. +*\--buildneeded*:: + Do not build if the installed version and the version in the build script + are the same. + *-e, \--noextract*:: Do not extract source files or run the prepare() function (if present); use whatever source already exists in the $srcdir/ directory. This is diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index ebc24f7..c267e56 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -65,6 +65,7 @@ SKIPCHECKSUMS=0 SKIPPGPCHECK=0 INSTALL=0 NOBUILD=0 +ONLYNEWPKGVER=0 NODEPS=0 NOEXTRACT=0 RMDEPS=0 @@ -707,6 +708,12 @@ update_pkgver() { "$BUILDFILE" fi fi + if (( ONLYNEWPKGVER )); then + if run_pacman -T "$pkgname=$pkgver-$pkgrel" 2>/dev/null; then + msg "$(gettext "Skipping -- $pkgname-$pkgver-$pkgrel is already installed")" + exit 0 + fi + fi } # Print 'source not found' error message and exit makepkg @@ -2460,7 +2467,7 @@ ARGLIST=("$@") # Parse Command Line Options. OPT_SHORT="AcdefFghiLmop:rRsSV" -OPT_LONG=('allsource' 'asroot' 'check' 'clean' 'config:' 'force' 'geninteg' +OPT_LONG=('allsource' 'asroot' 'onlynewpkgver' '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' @@ -2503,6 +2510,7 @@ while true; do --nocheck) RUN_CHECK='n' ;; --nosign) SIGNPKG='n' ;; -o|--nobuild) NOBUILD=1 ;; + --buildneeded) ONLYNEWPKGVER=1 ;; -p) shift; BUILDFILE=$1 ;; --pkg) shift; IFS=, read -ra p <<<"$1"; PKGLIST+=("${p[@]}"); unset p ;; -r|--rmdeps) RMDEPS=1 ;; -- 1.8.1.1
On 16/01/13 11:29, Daniel Wallace wrote:
If I haven't bumped the pkgrel, or there have been no new commits, I don't want to rebuild the package. Similar to the --needed flag, but pertains to building instead of installing. ---
Many issues: 1) Your test if a packaged is installed ignores the epoch 2) I was going to say I don't think this handles split packages, but it is only for VCS packages... 3) There is this that I have been ignoring: https://bugs.archlinux.org/task/18709 4) I'm not sure this is the job of makepkg...
contrib/bash_completion.in | 4 ++-- contrib/zsh_completion.in | 1 + doc/makepkg.8.txt | 4 ++++ scripts/makepkg.sh.in | 10 +++++++++- 4 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/contrib/bash_completion.in b/contrib/bash_completion.in index b0901af..af382e8 100644 --- a/contrib/bash_completion.in +++ b/contrib/bash_completion.in @@ -74,8 +74,8 @@ _makepkg() { COMPREPLY=() _get_comp_words_by_ref cur prev if [[ $cur = -* && ! $prev =~ ^-(-(config|help)$|\w*[Chp]) ]]; then - opts=('allsource asdeps asroot check clean config force geninteg help holdver ignorearch - install log nobuild nocheck nocolor noconfirm nodeps noextract + opts=('allsource asdeps asroot buildneeded check clean config force geninteg help holdver + ignorearch install log nobuild nocheck nocolor noconfirm nodeps noextract noprogressbar nosign pkg repackage rmdeps sign skipinteg source syncdeps' 'A L R S c d e f g h i m o p r s') _arch_ptr2comp opts diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in index 84ee93c..342803f 100644 --- a/contrib/zsh_completion.in +++ b/contrib/zsh_completion.in @@ -457,6 +457,7 @@ _makepkg_longopts=( '--ignorearch[Ignore incomplete arch field in PKGBUILD]' '--clean[Clean up work files after build]' '--nodeps[Skip all dependency checks]' + '--buildneeded[Skip building if the same version is already installed]' '--noextract[Do not extract source files (use existing src/ dir)]' '--force[Overwrite existing package]' '--geninteg[Generate integrity checks for source files]' diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index 498c79b..d45a703 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -58,6 +58,10 @@ Options will break the build process if all of the dependencies are not installed.
+*\--buildneeded*:: + Do not build if the installed version and the version in the build script + are the same. + *-e, \--noextract*:: Do not extract source files or run the prepare() function (if present); use whatever source already exists in the $srcdir/ directory. This is diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index ebc24f7..c267e56 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -65,6 +65,7 @@ SKIPCHECKSUMS=0 SKIPPGPCHECK=0 INSTALL=0 NOBUILD=0 +ONLYNEWPKGVER=0 NODEPS=0 NOEXTRACT=0 RMDEPS=0 @@ -707,6 +708,12 @@ update_pkgver() { "$BUILDFILE" fi fi + if (( ONLYNEWPKGVER )); then + if run_pacman -T "$pkgname=$pkgver-$pkgrel" 2>/dev/null; then + msg "$(gettext "Skipping -- $pkgname-$pkgver-$pkgrel is already installed")" + exit 0 + fi + fi }
# Print 'source not found' error message and exit makepkg @@ -2460,7 +2467,7 @@ ARGLIST=("$@")
# Parse Command Line Options. OPT_SHORT="AcdefFghiLmop:rRsSV" -OPT_LONG=('allsource' 'asroot' 'check' 'clean' 'config:' 'force' 'geninteg' +OPT_LONG=('allsource' 'asroot' 'onlynewpkgver' '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' @@ -2503,6 +2510,7 @@ while true; do --nocheck) RUN_CHECK='n' ;; --nosign) SIGNPKG='n' ;; -o|--nobuild) NOBUILD=1 ;; + --buildneeded) ONLYNEWPKGVER=1 ;; -p) shift; BUILDFILE=$1 ;; --pkg) shift; IFS=, read -ra p <<<"$1"; PKGLIST+=("${p[@]}"); unset p ;; -r|--rmdeps) RMDEPS=1 ;;
participants (2)
-
Allan McRae
-
Daniel Wallace