diff mbox

[pacman-dev] makepkg --packagelist: just list the built package files we will build

Message ID 20171030183712.26034-1-eschwartz@archlinux.org
State Superseded, archived
Headers show

Commit Message

Eli Schwartz Oct. 30, 2017, 6:37 p.m. UTC
Currently this seems to be only theoretically useful. The most likely
reason for wanting a packagelist is in order to script makepkg and
derive the filenames for the packages we want to install or repo-add,
but in the current implementation this requires a lot of additional
post-processing which must be duplicated in every utility to wrap
makepkg.

- It is of minimal use to know what packages might get created on some
  other device utilizing a different CPU/OS architecture, so don't list
  them.
- It is non-trivial to reimplement makepkg's logic for sourcing any of
  several makepkg.conf configuration files, then applying environment
  overrides in order to get the PKGDEST and PKGEXT, so include them
  directly in the returned filenames.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
---
 scripts/libmakepkg/util/pkgbuild.sh.in | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

Comments

Allan McRae Dec. 7, 2017, 5:57 a.m. UTC | #1
On 31/10/17 04:37, Eli Schwartz wrote:
> Currently this seems to be only theoretically useful. The most likely
> reason for wanting a packagelist is in order to script makepkg and
> derive the filenames for the packages we want to install or repo-add,
> but in the current implementation this requires a lot of additional
> post-processing which must be duplicated in every utility to wrap
> makepkg.
> 
> - It is of minimal use to know what packages might get created on some
>   other device utilizing a different CPU/OS architecture, so don't list
>   them.
> - It is non-trivial to reimplement makepkg's logic for sourcing any of
>   several makepkg.conf configuration files, then applying environment
>   overrides in order to get the PKGDEST and PKGEXT, so include them
>   directly in the returned filenames.
> 
> Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>

Needs makepkg man page update too.

> ---
>  scripts/libmakepkg/util/pkgbuild.sh.in | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/scripts/libmakepkg/util/pkgbuild.sh.in b/scripts/libmakepkg/util/pkgbuild.sh.in
> index 2a4bd3af..6cfda0b3 100644
> --- a/scripts/libmakepkg/util/pkgbuild.sh.in
> +++ b/scripts/libmakepkg/util/pkgbuild.sh.in
> @@ -149,14 +149,12 @@ print_all_package_names() {
>  	local version=$(get_full_version)
>  	local architecture pkg opts a
>  	for pkg in ${pkgname[@]}; do
> -		get_pkgbuild_attribute "$pkg" 'arch' 1 architecture
> +		architecture=$(get_pkg_arch $pkg)
>  		get_pkgbuild_attribute "$pkg" 'options' 1 opts
> -		for a in ${architecture[@]}; do
> -			printf "%s-%s-%s\n" "$pkg" "$version" "$a"
> -			if in_opt_array "debug" ${opts[@]} && in_opt_array "strip" ${opts[@]}; then
> -				printf "%s-%s-%s-%s\n" "$pkg" "@DEBUGSUFFIX@" "$version" "$a"
> -			fi
> -		done
> +		printf "%s/%s-%s-%s%s\n" "$PKGDEST" "$pkg" "$version" "$architecture" "$PKGEXT"
> +		if in_opt_array "debug" ${opts[@]} && in_opt_array "strip" ${opts[@]}; then
> +			printf "%s/%s-%s-%s-%s%s\n" "$PKGDEST" "$pkg" "@DEBUGSUFFIX@" "$version" "$architecture" "$PKGEXT"
> +		fi
>  	done
>  }
>  
>
diff mbox

Patch

diff --git a/scripts/libmakepkg/util/pkgbuild.sh.in b/scripts/libmakepkg/util/pkgbuild.sh.in
index 2a4bd3af..6cfda0b3 100644
--- a/scripts/libmakepkg/util/pkgbuild.sh.in
+++ b/scripts/libmakepkg/util/pkgbuild.sh.in
@@ -149,14 +149,12 @@  print_all_package_names() {
 	local version=$(get_full_version)
 	local architecture pkg opts a
 	for pkg in ${pkgname[@]}; do
-		get_pkgbuild_attribute "$pkg" 'arch' 1 architecture
+		architecture=$(get_pkg_arch $pkg)
 		get_pkgbuild_attribute "$pkg" 'options' 1 opts
-		for a in ${architecture[@]}; do
-			printf "%s-%s-%s\n" "$pkg" "$version" "$a"
-			if in_opt_array "debug" ${opts[@]} && in_opt_array "strip" ${opts[@]}; then
-				printf "%s-%s-%s-%s\n" "$pkg" "@DEBUGSUFFIX@" "$version" "$a"
-			fi
-		done
+		printf "%s/%s-%s-%s%s\n" "$PKGDEST" "$pkg" "$version" "$architecture" "$PKGEXT"
+		if in_opt_array "debug" ${opts[@]} && in_opt_array "strip" ${opts[@]}; then
+			printf "%s/%s-%s-%s-%s%s\n" "$PKGDEST" "$pkg" "@DEBUGSUFFIX@" "$version" "$architecture" "$PKGEXT"
+		fi
 	done
 }