[pacman-dev] [PATCH v3 2/2] Add makepkg option --packagelist; fix bug #42150

Allan McRae allan at archlinux.org
Wed Mar 25 05:09:29 UTC 2015


On 21/03/15 10:19, joyfulgirl at archlinux.us wrote:
> From: Ivy Foster <joyfulgirl at 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 at 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
> 


More information about the pacman-dev mailing list