[pacman-dev] [PATCH] Add makepkg option --printproducts; fix bug #42150
From: Ivy Foster <joyfulgirl@archlinux.us> makepkg --printproducts prints the name of each package that would normally be produced, minus $PKGEXT, and exits. --- doc/makepkg.8.txt | 2 ++ scripts/makepkg.sh.in | 26 +++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) mode change 100644 => 100755 scripts/makepkg.sh.in diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index 31a2ef7..e266e96 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -203,6 +203,8 @@ Options (Passed to pacman) Prevent pacman from displaying a progress bar; useful if you are redirecting makepkg output to file. +*\--printproducts*:: + Instead of building, list packages that would be produced, without PKGEXT. Additional Features ------------------- diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in old mode 100644 new mode 100755 index 168f334..a69f8bc --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -2834,6 +2834,19 @@ run_split_packaging() { pkgname=${pkgname_backup[@]} } +print_all_package_names() { + local version=$(get_full_version) + local architecture=$(get_pkg_arch) + for pkg in ${pkgname[@]}; do + architecture=$(get_pkg_arch "$pkg") + printf "%s-%s-%s\n" "$pkg" "$version" "$architecture" + pkgbuild_get_attribute $pkg 'options' 1 opts + if in_opt_array "debug" ${opts[@]} && in_opt_array "strip" ${opts[@]}; then + printf "%s-%s-%s-%s\n" "$pkg" "@DEBUGSUFFIX@" "$pkgver" "$architecture" + fi + done +} + # Canonicalize a directory path if it exists canonicalize_path() { local path="$1"; @@ -2894,6 +2907,7 @@ usage() { 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 " --pkg <list> Only build listed packages from a split package")\n" + printf -- "$(gettext " --printproducts Only list packages that would be produced, without PKGEXT")\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" @@ -2938,9 +2952,9 @@ ARGLIST=("$@") OPT_SHORT="AcCdefFghiLmop:rRsSV" OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg' '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') + 'nocolor' 'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'pkg:' + 'printproducts' 'repackage' 'rmdeps' 'sign' 'skipchecksums' 'skipinteg' + 'skippgpcheck' 'source' 'syncdeps' 'verifysource' 'version') # Pacman Options OPT_LONG+=('asdeps' 'noconfirm' 'needed' 'noprogressbar') @@ -2983,6 +2997,7 @@ while true; do -o|--nobuild) NOBUILD=1 ;; -p) shift; BUILDFILE=$1 ;; --pkg) shift; IFS=, read -ra p <<<"$1"; PKGLIST+=("${p[@]}"); unset p ;; + --printproducts) PRINTPRODUCTS=1; IGNOREARCH=1; NOEXTRACT=1; NOBUILD=1; SKIPCHECKSUMS=1; SKIPPGPCHECK=1; FORCE=1 ;; -r|--rmdeps) RMDEPS=1 ;; -R|--repackage) REPKG=1 ;; --sign) SIGNPKG='y' ;; @@ -3268,6 +3283,11 @@ if (( ! PKGVERFUNC )); then check_build_status fi +if (( PRINTPRODUCTS )); then + print_all_package_names + exit 0 +fi + # Run the bare minimum in fakeroot if (( INFAKEROOT )); then if (( SOURCEONLY )); then -- 2.3.3
On 20/03/15 11:00, joyfulgirl@archlinux.us wrote:
From: Ivy Foster <joyfulgirl@archlinux.us>
New contributor - yay!
makepkg --printproducts prints the name of each package that would normally be produced, minus $PKGEXT, and exits.
Is --packagelist a better or more informative name?
--- doc/makepkg.8.txt | 2 ++ scripts/makepkg.sh.in | 26 +++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) mode change 100644 => 100755 scripts/makepkg.sh.in
diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index 31a2ef7..e266e96 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -203,6 +203,8 @@ Options (Passed to pacman) Prevent pacman from displaying a progress bar; useful if you are redirecting makepkg output to file.
+*\--printproducts*:: + Instead of building, list packages that would be produced, without PKGEXT.
I'm not a fan of the multiple commas here. Maybe we can rephrase this.
Additional Features ------------------- diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in old mode 100644 new mode 100755 index 168f334..a69f8bc --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -2834,6 +2834,19 @@ run_split_packaging() { pkgname=${pkgname_backup[@]} }
+print_all_package_names() { + local version=$(get_full_version) + local architecture=$(get_pkg_arch)
The =$(get_pkg_arch) is overwritten in the loop below. Remove. Make "pkg" local too. local architecture pkg
+ for pkg in ${pkgname[@]}; do + architecture=$(get_pkg_arch "$pkg") + printf "%s-%s-%s\n" "$pkg" "$version" "$architecture" + pkgbuild_get_attribute $pkg 'options' 1 opts + if in_opt_array "debug" ${opts[@]} && in_opt_array "strip" ${opts[@]}; then + printf "%s-%s-%s-%s\n" "$pkg" "@DEBUGSUFFIX@" "$pkgver" "$architecture" + fi + done +}
OK.
+ # Canonicalize a directory path if it exists canonicalize_path() { local path="$1"; @@ -2894,6 +2907,7 @@ usage() { 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 " --pkg <list> Only build listed packages from a split package")\n" + printf -- "$(gettext " --printproducts Only list packages that would be produced, without PKGEXT")\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" @@ -2938,9 +2952,9 @@ ARGLIST=("$@") OPT_SHORT="AcCdefFghiLmop:rRsSV" OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg' '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') + 'nocolor' 'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'pkg:' + 'printproducts' 'repackage' 'rmdeps' 'sign' 'skipchecksums' 'skipinteg' + 'skippgpcheck' 'source' 'syncdeps' 'verifysource' 'version')
# Pacman Options OPT_LONG+=('asdeps' 'noconfirm' 'needed' 'noprogressbar') @@ -2983,6 +2997,7 @@ while true; do -o|--nobuild) NOBUILD=1 ;; -p) shift; BUILDFILE=$1 ;; --pkg) shift; IFS=, read -ra p <<<"$1"; PKGLIST+=("${p[@]}"); unset p ;; + --printproducts) PRINTPRODUCTS=1; IGNOREARCH=1; NOEXTRACT=1; NOBUILD=1; SKIPCHECKSUMS=1; SKIPPGPCHECK=1; FORCE=1 ;;
Woah... that is a lot of options being enabled! NOEXTRACT, NOBUILD, SKIPCHECKSUMS, SKIPPGPCHECK are all unneeded. FORCE can be removed if the "if (( PRINTPRODUCTS ))" statement is moved up a couple of lines. IGNOREARCH is interesting. If that is added a PKGBUILD with arch=('i686') will work with --printproducts on an x86_64 system, but all the packages will be listed as if they are built for x86_64. So either we remove IGNROEARCH, or we could print this like: foo-bar-1.0-1-@CARCH@ foo-baz-1.0-1-any I think the later is more useful. @heftig: you opened the feature request. What do you think?
-r|--rmdeps) RMDEPS=1 ;; -R|--repackage) REPKG=1 ;; --sign) SIGNPKG='y' ;; @@ -3268,6 +3283,11 @@ if (( ! PKGVERFUNC )); then check_build_status fi
+if (( PRINTPRODUCTS )); then + print_all_package_names + exit 0 +fi +
OK. See above about moving this up.
# Run the bare minimum in fakeroot if (( INFAKEROOT )); then if (( SOURCEONLY )); then
On 20 Mar 2015, at 4:19 pm +1000, Allan McRae wrote:
On 20/03/15 11:00, joyfulgirl@archlinux.us wrote:
From: Ivy Foster <joyfulgirl@archlinux.us>
New contributor - yay!
[patch] [notes]
Thanks! I'll fix it up as you've suggested. When that's done, should I send the changes as a patch that's a sequel to the first, or should I create a unified patch with everything?
From: Ivy Foster <joyfulgirl@archlinux.us>
I'm not really sure why that is here. Did you set the envelope sender in git (git config --global sendemail.envelopesender) or am I missing some difference between the two addresses?
New contributor - yay!
[patch] [notes]
Thanks! I'll fix it up as you've suggested. When that's done, should I send the changes as a patch that's a sequel to the first, or should I create a unified patch with everything?
Send the updated patch with subject [PATCH v2] instead of [PATCH] (use the -v2 option of git format-patch) and list the changes after the "---" marker. That list of changes is mainly a habit of mine, but it allows the readers to easily check if all of their concerns should have been addressed. Not so much an issue here so feel free to omit it. I'm not sure how others on this list feel about it. Also use --in-reply-to with the Message-ID of your initial patch (or write In-Reply-To: <...> in the generated email's headers). You can find the id in the email source and you can probably configure your client to display additional headers instead of simply From/To/CC/Subject/... . With that header we get proper threading so it's easy to review discussion and previous versions of the patch. Of course those options also work with git send-email if you use that. Be sure to use --annotate to be able to add the comment after the marker though. Florian
On 20 Mar 2015, at 9:29 pm +0100, Florian Pritz wrote:
From: Ivy Foster <joyfulgirl@archlinux.us>
I'm not really sure why that is here. Did you set the envelope sender in git (git config --global sendemail.envelopesender) or am I missing some difference between the two addresses?
You're right, it's from envelopesender. Without that, msmtp clobbered my From line and changed the sender to my other email address, which isn't subscribed. Sorry.
New contributor - yay!
[patch] [notes]
Thanks! I'll fix it up as you've suggested. When that's done, should I send the changes as a patch that's a sequel to the first, or should I create a unified patch with everything?
[very thorough reply]
Thank you very much!
On 21.03.2015 01:23, Ivy Foster wrote:
On 20 Mar 2015, at 9:29 pm +0100, Florian Pritz wrote:
From: Ivy Foster <joyfulgirl@archlinux.us>
I'm not really sure why that is here. Did you set the envelope sender in git (git config --global sendemail.envelopesender) or am I missing some difference between the two addresses?
You're right, it's from envelopesender. Without that, msmtp clobbered my From line and changed the sender to my other email address, which isn't subscribed. Sorry.
If you also set it in git you should be able to get rid of that extra From line in the mail body (at least I don't have it and I'm pretty sure I did just that). Not that it's bad, but it looks a bit weird.
From: Ivy Foster <joyfulgirl@archlinux.us> makepkg --packagelist prints the name of each package that would normally be produced, minus $PKGEXT, and exits. Also fixed get_pkg_arch to treat arch as an array when querying pkgbuild_get_attribute. Signed-off-by: Ivy Foster <joyfulgirl@archlinux.us> --- Changes from v1: - renamed option to --packagelist - Rephrased description in manpage - Cleaned up variables - Don't set NOEXTRACT, NOBUILD, SKIPCHECKSUMS, SKIPPGPCHECK, FORCE, or IGNOREARCH - Move up check to see whether to run print_all_package_names and exit - Make get_pkg_arch treat arch as an array. According to my grepping of abs, there are no official packages that still use a non-array arch. doc/makepkg.8.txt | 3 +++ scripts/makepkg.sh.in | 28 ++++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) mode change 100644 => 100755 scripts/makepkg.sh.in diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index 31a2ef7..ce4364b 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -203,6 +203,9 @@ Options (Passed to pacman) Prevent pacman from displaying a progress bar; useful if you are redirecting makepkg output to file. +*\--packagelist*:: + Instead of building, list packages that would be produced. Listed + package names do not include PKGEXT. Additional Features ------------------- diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in old mode 100644 new mode 100755 index 168f334..3c2e381 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -879,7 +879,7 @@ get_pkg_arch() { fi else local arch_override - pkgbuild_get_attribute "$1" arch 0 arch_override + pkgbuild_get_attribute "$1" arch 1 arch_override (( ${#arch_override[@]} == 0 )) && arch_override=("${arch[@]}") if [[ $arch_override = "any" ]]; then printf "%s\n" "any" @@ -2834,6 +2834,19 @@ run_split_packaging() { pkgname=${pkgname_backup[@]} } +print_all_package_names() { + local version=$(get_full_version) + local architecture pkg opts + for pkg in ${pkgname[@]}; do + architecture=$(get_pkg_arch $pkg) + pkgbuild_get_attribute "$pkg" 'options' 1 opts + printf "%s-%s-%s\n" "$pkg" "$version" "$architecture" + if in_opt_array "debug" ${opts[@]} && in_opt_array "strip" ${opts[@]}; then + printf "%s-%s-%s-%s\n" "$pkg" "@DEBUGSUFFIX@" "$pkgver" "$architecture" + fi + done +} + # Canonicalize a directory path if it exists canonicalize_path() { local path="$1"; @@ -2893,6 +2906,7 @@ usage() { 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 " --packagelist Only list packages that would be produced, without PKGEXT")\n" printf -- "$(gettext " --pkg <list> Only build listed packages from a split package")\n" printf -- "$(gettext " --sign Sign the resulting package with %s")\n" "gpg" printf -- "$(gettext " --skipchecksums Do not verify checksums of the source files")\n" @@ -2938,9 +2952,9 @@ ARGLIST=("$@") OPT_SHORT="AcCdefFghiLmop:rRsSV" OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg' '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') + 'nocolor' 'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'packagelist' + 'pkg:' 'repackage' 'rmdeps' 'sign' 'skipchecksums' 'skipinteg' + 'skippgpcheck' 'source' 'syncdeps' 'verifysource' 'version') # Pacman Options OPT_LONG+=('asdeps' 'noconfirm' 'needed' 'noprogressbar') @@ -2983,6 +2997,7 @@ while true; do -o|--nobuild) NOBUILD=1 ;; -p) shift; BUILDFILE=$1 ;; --pkg) shift; IFS=, read -ra p <<<"$1"; PKGLIST+=("${p[@]}"); unset p ;; + --packagelist) PACKAGELIST=1 ;; -r|--rmdeps) RMDEPS=1 ;; -R|--repackage) REPKG=1 ;; --sign) SIGNPKG='y' ;; @@ -3264,6 +3279,11 @@ if { [[ -z $SIGNPKG ]] && check_buildenv "sign" "y"; } || [[ $SIGNPKG == 'y' ]]; fi fi +if (( PACKAGELIST )); then + print_all_package_names + exit 0 +fi + if (( ! PKGVERFUNC )); then check_build_status fi -- 2.3.3
On 20/03, joyfulgirl@archlinux.us wrote:
Also fixed get_pkg_arch to treat arch as an array when querying pkgbuild_get_attribute.
That is an unrelated change that doesn’t really belong in the same commit. -- Sincerely, Johannes Löthberg PGP Key ID: 0x50FB9B273A9D0BB5 https://theos.kyriasis.com/~kyrias/
On 21 Mar 2015, at 12:54 am +0100, Johannes Löthberg wrote:
On 20/03, joyfulgirl@archlinux.us wrote:
Also fixed get_pkg_arch to treat arch as an array when querying pkgbuild_get_attribute.
That is an unrelated change that doesn’t really belong in the same commit.
I'll redo the patch(es) and resubmit, then. My rationale for including it, if it helps, is that it would always return $CARCH rather than "any" in cases where arch=("any"). Thanks!
From: Ivy Foster <joyfulgirl@archlinux.us> Signed-off-by: Ivy Foster <joyfulgirl@archlinux.us> --- v3: Separate change to get_pkg_arch into separate commit scripts/makepkg.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 scripts/makepkg.sh.in diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in old mode 100644 new mode 100755 index 168f334..5b3bffd --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -879,7 +879,7 @@ get_pkg_arch() { fi else local arch_override - pkgbuild_get_attribute "$1" arch 0 arch_override + pkgbuild_get_attribute "$1" arch 1 arch_override (( ${#arch_override[@]} == 0 )) && arch_override=("${arch[@]}") if [[ $arch_override = "any" ]]; then printf "%s\n" "any" -- 2.3.3
From: Ivy Foster <joyfulgirl@archlinux.us> makepkg --packagelist prints the name of each package that would normally be produced, minus $PKGEXT, and exits. Signed-off-by: Ivy Foster <joyfulgirl@archlinux.us> --- v3: Separate change to get_pkg_arch into another commit doc/makepkg.8.txt | 3 +++ scripts/makepkg.sh.in | 26 +++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index 31a2ef7..ce4364b 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -203,6 +203,9 @@ Options (Passed to pacman) Prevent pacman from displaying a progress bar; useful if you are redirecting makepkg output to file. +*\--packagelist*:: + Instead of building, list packages that would be produced. Listed + package names do not include PKGEXT. Additional Features ------------------- diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 5b3bffd..3c2e381 100755 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -2834,6 +2834,19 @@ run_split_packaging() { pkgname=${pkgname_backup[@]} } +print_all_package_names() { + local version=$(get_full_version) + local architecture pkg opts + for pkg in ${pkgname[@]}; do + architecture=$(get_pkg_arch $pkg) + pkgbuild_get_attribute "$pkg" 'options' 1 opts + printf "%s-%s-%s\n" "$pkg" "$version" "$architecture" + if in_opt_array "debug" ${opts[@]} && in_opt_array "strip" ${opts[@]}; then + printf "%s-%s-%s-%s\n" "$pkg" "@DEBUGSUFFIX@" "$pkgver" "$architecture" + fi + done +} + # Canonicalize a directory path if it exists canonicalize_path() { local path="$1"; @@ -2893,6 +2906,7 @@ usage() { 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 " --packagelist Only list packages that would be produced, without PKGEXT")\n" printf -- "$(gettext " --pkg <list> Only build listed packages from a split package")\n" printf -- "$(gettext " --sign Sign the resulting package with %s")\n" "gpg" printf -- "$(gettext " --skipchecksums Do not verify checksums of the source files")\n" @@ -2938,9 +2952,9 @@ ARGLIST=("$@") OPT_SHORT="AcCdefFghiLmop:rRsSV" OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg' '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') + 'nocolor' 'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'packagelist' + 'pkg:' 'repackage' 'rmdeps' 'sign' 'skipchecksums' 'skipinteg' + 'skippgpcheck' 'source' 'syncdeps' 'verifysource' 'version') # Pacman Options OPT_LONG+=('asdeps' 'noconfirm' 'needed' 'noprogressbar') @@ -2983,6 +2997,7 @@ while true; do -o|--nobuild) NOBUILD=1 ;; -p) shift; BUILDFILE=$1 ;; --pkg) shift; IFS=, read -ra p <<<"$1"; PKGLIST+=("${p[@]}"); unset p ;; + --packagelist) PACKAGELIST=1 ;; -r|--rmdeps) RMDEPS=1 ;; -R|--repackage) REPKG=1 ;; --sign) SIGNPKG='y' ;; @@ -3264,6 +3279,11 @@ if { [[ -z $SIGNPKG ]] && check_buildenv "sign" "y"; } || [[ $SIGNPKG == 'y' ]]; fi fi +if (( PACKAGELIST )); then + print_all_package_names + exit 0 +fi + if (( ! PKGVERFUNC )); then check_build_status fi -- 2.3.3
On 21/03/15 10:19, joyfulgirl@archlinux.us wrote:
From: Ivy Foster <joyfulgirl@archlinux.us>
makepkg --packagelist prints the name of each package that would normally be produced, minus $PKGEXT, and exits.
Signed-off-by: Ivy Foster <joyfulgirl@archlinux.us> ---
Delete the bug number from the subject line, it can be added as a note to the commit message. I have added some changes below. This allows two things 1) we can run --packagelist on any PKGBUILD no matter the architecture we are running and the architecture required to build the PKGBUILD 2) it lists all package products - so both foo-1-1-i686 and foo-1-1-x86_64. It is easy to filter the unwanted ones away. I have made the changes on my patchqueue branch. Let me know if you approve and I can push the patch. https://projects.archlinux.org/users/allan/pacman.git/log/?h=patchqueue Thanks, Allan
v3: Separate change to get_pkg_arch into another commit doc/makepkg.8.txt | 3 +++ scripts/makepkg.sh.in | 26 +++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index 31a2ef7..ce4364b 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -203,6 +203,9 @@ Options (Passed to pacman) Prevent pacman from displaying a progress bar; useful if you are redirecting makepkg output to file.
+*\--packagelist*:: + Instead of building, list packages that would be produced. Listed
List the packages that would be produced without building.
+ package names do not include PKGEXT.
Additional Features ------------------- diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 5b3bffd..3c2e381 100755 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -2834,6 +2834,19 @@ run_split_packaging() { pkgname=${pkgname_backup[@]} }
+print_all_package_names() { + local version=$(get_full_version) + local architecture pkg opts
local architecture pkg opts a
+ for pkg in ${pkgname[@]}; do + architecture=$(get_pkg_arch $pkg)
pkgbuild_get_attribute "$pkg" 'arch' 1 architectures
+ pkgbuild_get_attribute "$pkg" 'options' 1 opts
for a in ${architectures[@]}; do
+ printf "%s-%s-%s\n" "$pkg" "$version" "$architecture" + if in_opt_array "debug" ${opts[@]} && in_opt_array "strip" ${opts[@]}; then + printf "%s-%s-%s-%s\n" "$pkg" "@DEBUGSUFFIX@" "$pkgver" "$architecture" + fi
done
+ done +} + # Canonicalize a directory path if it exists canonicalize_path() { local path="$1"; @@ -2893,6 +2906,7 @@ usage() { 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 " --packagelist Only list packages that would be produced, without PKGEXT")\n" printf -- "$(gettext " --pkg <list> Only build listed packages from a split package")\n" printf -- "$(gettext " --sign Sign the resulting package with %s")\n" "gpg" printf -- "$(gettext " --skipchecksums Do not verify checksums of the source files")\n" @@ -2938,9 +2952,9 @@ ARGLIST=("$@") OPT_SHORT="AcCdefFghiLmop:rRsSV" OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg' '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') + 'nocolor' 'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'packagelist' + 'pkg:' 'repackage' 'rmdeps' 'sign' 'skipchecksums' 'skipinteg' + 'skippgpcheck' 'source' 'syncdeps' 'verifysource' 'version')
# Pacman Options OPT_LONG+=('asdeps' 'noconfirm' 'needed' 'noprogressbar') @@ -2983,6 +2997,7 @@ while true; do -o|--nobuild) NOBUILD=1 ;; -p) shift; BUILDFILE=$1 ;; --pkg) shift; IFS=, read -ra p <<<"$1"; PKGLIST+=("${p[@]}"); unset p ;; + --packagelist) PACKAGELIST=1 ;;
--packagelist) PACKAGELIST=1 IGNOREARCH=1 ;;
-r|--rmdeps) RMDEPS=1 ;; -R|--repackage) REPKG=1 ;; --sign) SIGNPKG='y' ;; @@ -3264,6 +3279,11 @@ if { [[ -z $SIGNPKG ]] && check_buildenv "sign" "y"; } || [[ $SIGNPKG == 'y' ]]; fi fi
+if (( PACKAGELIST )); then + print_all_package_names + exit 0 +fi + if (( ! PKGVERFUNC )); then check_build_status fi
On 25 Mar 2015, at 3:09 pm +1000, Allan McRae wrote:
On 21/03/15 10:19, joyfulgirl@archlinux.us wrote:
From: Ivy Foster <joyfulgirl@archlinux.us>
Delete the bug number from the subject line, it can be added as a note to the commit message.
Thanks, I'll keep that in mind in the future.
Also - BAD! file permission change.
Whoops! Sorry about that. I set up my editor to mark shell scripts as executable on save, and then promptly forgot I'd done that.
I have added some changes below. This allows two things 1) we can run --packagelist on any PKGBUILD no matter the architecture we are running and the architecture required to build the PKGBUILD 2) it lists all package products - so both foo-1-1-i686 and foo-1-1-x86_64. It is easy to filter the unwanted ones away.
I have made the changes on my patchqueue branch. Let me know if you approve and I can push the patch.
https://projects.archlinux.org/users/allan/pacman.git/log/?h=patchqueue
Looks good to me! Thanks for the feedback. Anything else I need to do for this to go in? Ivy
On 03/25/15 at 03:09pm, Allan McRae wrote:
On 21/03/15 10:19, joyfulgirl@archlinux.us wrote:
From: Ivy Foster <joyfulgirl@archlinux.us>
makepkg --packagelist prints the name of each package that would normally be produced, minus $PKGEXT, and exits.
Signed-off-by: Ivy Foster <joyfulgirl@archlinux.us> ---
Delete the bug number from the subject line, it can be added as a note to the commit message.
I have added some changes below. This allows two things 1) we can run --packagelist on any PKGBUILD no matter the architecture we are running and the architecture required to build the PKGBUILD 2) it lists all package products - so both foo-1-1-i686 and foo-1-1-x86_64. It is easy to filter the unwanted ones away.
I have made the changes on my patchqueue branch. Let me know if you approve and I can push the patch. https://projects.archlinux.org/users/allan/pacman.git/log/?h=patchqueue
Thanks, Allan
v3: Separate change to get_pkg_arch into another commit doc/makepkg.8.txt | 3 +++ scripts/makepkg.sh.in | 26 +++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-)
<snip>
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 5b3bffd..3c2e381 100755 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -2834,6 +2834,19 @@ run_split_packaging() { pkgname=${pkgname_backup[@]} }
+print_all_package_names() { + local version=$(get_full_version) + local architecture pkg opts
local architecture pkg opts a
+ for pkg in ${pkgname[@]}; do + architecture=$(get_pkg_arch $pkg)
pkgbuild_get_attribute "$pkg" 'arch' 1 architectures
+ pkgbuild_get_attribute "$pkg" 'options' 1 opts
for a in ${architectures[@]}; do
+ printf "%s-%s-%s\n" "$pkg" "$version" "$architecture" + if in_opt_array "debug" ${opts[@]} && in_opt_array "strip" ${opts[@]}; then + printf "%s-%s-%s-%s\n" "$pkg" "@DEBUGSUFFIX@" "$pkgver" "$architecture"
s/pkgver/version/ s/architecture/a/
On 21/03/15 10:19, joyfulgirl@archlinux.us wrote:
From: Ivy Foster <joyfulgirl@archlinux.us>
Signed-off-by: Ivy Foster <joyfulgirl@archlinux.us> --- v3: Separate change to get_pkg_arch into separate commit scripts/makepkg.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 scripts/makepkg.sh.in
This took me a whole lot of reviewing for a single character change! I only knew that this could potentially break something on the basis of skimming IRC chat a while ago. So I tested... pkgname=f arch=('any') package_f() { arch='x86_64' #1 arch=('x86_64') #2 arch=('i686 'x86_64') #3 } for the --packagelist patch, currently #1 works and #2 and #3 fail. After the patch, #2 and #3 succeed and #1 fails. All our documentation says that arch should be an array, so the patch is correct. In fact, the .SRCINFO generating code uses the array version of pkgbuild_get_attribute, and so "fails" when the arch variable is not an array. This issue was never exposed because we don't use get_pkg_arch with a parameter very often, and I guess no-one has looked at a .SRCINFO file from a bad PKGBUILD before. TODO: We should probably add a PKGBUILD lint function that confirms the fields we expect to be arrays are in fact arrays. And that those that are not arrays are not arrays. tl;dr - Ack. I'll expand the commit message.
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in old mode 100644 new mode 100755 index 168f334..5b3bffd --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -879,7 +879,7 @@ get_pkg_arch() { fi else local arch_override - pkgbuild_get_attribute "$1" arch 0 arch_override + pkgbuild_get_attribute "$1" arch 1 arch_override (( ${#arch_override[@]} == 0 )) && arch_override=("${arch[@]}") if [[ $arch_override = "any" ]]; then printf "%s\n" "any"
On 25/03/15 14:39, Allan McRae wrote:
On 21/03/15 10:19, joyfulgirl@archlinux.us wrote:
From: Ivy Foster <joyfulgirl@archlinux.us>
Signed-off-by: Ivy Foster <joyfulgirl@archlinux.us> --- v3: Separate change to get_pkg_arch into separate commit scripts/makepkg.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 scripts/makepkg.sh.in
Also - BAD! file permission change.
This took me a whole lot of reviewing for a single character change! I only knew that this could potentially break something on the basis of skimming IRC chat a while ago. So I tested...
pkgname=f arch=('any')
package_f() { arch='x86_64' #1 arch=('x86_64') #2 arch=('i686 'x86_64') #3
}
for the --packagelist patch, currently #1 works and #2 and #3 fail. After the patch, #2 and #3 succeed and #1 fails.
All our documentation says that arch should be an array, so the patch is correct. In fact, the .SRCINFO generating code uses the array version of pkgbuild_get_attribute, and so "fails" when the arch variable is not an array.
This issue was never exposed because we don't use get_pkg_arch with a parameter very often, and I guess no-one has looked at a .SRCINFO file from a bad PKGBUILD before.
TODO: We should probably add a PKGBUILD lint function that confirms the fields we expect to be arrays are in fact arrays. And that those that are not arrays are not arrays.
tl;dr - Ack. I'll expand the commit message.
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in old mode 100644 new mode 100755 index 168f334..5b3bffd --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -879,7 +879,7 @@ get_pkg_arch() { fi else local arch_override - pkgbuild_get_attribute "$1" arch 0 arch_override + pkgbuild_get_attribute "$1" arch 1 arch_override (( ${#arch_override[@]} == 0 )) && arch_override=("${arch[@]}") if [[ $arch_override = "any" ]]; then printf "%s\n" "any"
On 25 Mar 2015, at 2:39 pm +1000, Allan McRae wrote:
On 21/03/15 10:19, joyfulgirl@archlinux.us wrote:
From: Ivy Foster <joyfulgirl@archlinux.us>
This took me a whole lot of reviewing for a single character change!
Yeah, I was afraid it might. I did some grepping of my own to make sure nothing in the repos was using a singleton $arch, but I'm reassured that you found the same thing.
tl;dr - Ack. I'll expand the commit message.
Thanks! Ivy
participants (6)
-
Allan McRae
-
Andrew Gregory
-
Florian Pritz
-
Ivy Foster
-
Johannes Löthberg
-
joyfulgirl@archlinux.us