On 20/03/15 11:00, [email protected] wrote:
> From: Ivy Foster <[email protected]>

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
> 

Reply via email to