[pacman-dev] [PATCH] makepkg: respect --ignorearch when verifying source or printing packagelist

Allan McRae allan at archlinux.org
Sun Apr 29 11:28:14 UTC 2018


On 04/04/18 07:50, Eli Schwartz wrote:
> --verifysource is often used to validate the PKGBUILD before uploading
> to the AUR, but currently there is no way to trivially check all sources.
> By default we don't check sources we won't use, because it forces
> downloading those sources, but in certain cases the user might need to
> check them regardless...
> 

We looked at this when architecture dependent sources were added and
many or even most packages with architecture independent sources have
sources with the same filename from a different source path, or change
the source to have the same filename to make the rest of the PKGBUILD
easier.  So that was not implemented.

> --packagelist is usually used to derive the built package names for the
> user's machine, but in some cases, e.g. repo building, we might want to
> get the packagelist for all supported arches. This is primarily
> motivated by the desire to use this in the dbscripts testsuite (which
> tests for i686 and x86_64). While dbscripts could use `for a in
> ${ARCHES[@]}; do CARCH=$a makepkg --packagelist` it seemed easier to add
> this directly in makepkg once I was already changing --verifysource.

I'm not adding a feature to support a testsuite and not an actual usage.
 Do the loop.

> This partially reverts d8591dd3418d55c5736022ef003891fc03b953e0 but
> ensures the use is controllable.
> 
> Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
> ---
>  doc/makepkg.8.txt                      | 13 ++++++++-----
>  scripts/libmakepkg/util/pkgbuild.sh.in | 14 ++++++++++----
>  scripts/makepkg.sh.in                  | 11 ++++++++---
>  3 files changed, 26 insertions(+), 12 deletions(-)
> 
> diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt
> index a065b795..42abceae 100644
> --- a/doc/makepkg.8.txt
> +++ b/doc/makepkg.8.txt
> @@ -37,9 +37,10 @@ your logs and output are not localized.
>  Options
>  -------
>  *-A, \--ignorearch*::
> -	Ignore a missing or incomplete arch field in the build script. This is
> -	for rebuilding packages from source when the PKGBUILD may be slightly
> -	outdated and not updated with an `arch=('yourarch')` field.
> +	Ignore a missing or incomplete arch field in the build script, when
> +	building packages. This is for rebuilding packages from source when
> +	the PKGBUILD may be slightly outdated and not updated with an `arch=('yourarch')`
> +	field. Act on all available arches, when performing other actions.
>  
>  *-c, \--clean*::
>  	Clean up leftover work files and directories after a successful build.
> @@ -66,7 +67,8 @@ Options
>  	if required and perform the integrity checks. No extraction or build is
>  	performed. Dependencies specified in the PKGBUILD will not be handled
>  	unless `--syncdeps` is used. Useful for performing subsequent offline
> -	builds.
> +	builds. When `--ignorearch` is used, verify all split arch sources instead
> +	of just the sources for the current arch.
>  
>  *-f, \--force*::
>  	makepkg will not build a package if a built package already exists in
> @@ -201,7 +203,8 @@ Options
>  
>  *\--packagelist*::
>  	List the package filenames that would be produced without building. Listed
> -	package filenames include PKGDEST and PKGEXT.
> +	package filenames include PKGDEST and PKGEXT. When `--ignorearch` is used,
> +	list filenames for all supported arches.
>  
>  *\--printsrcinfo*::
>  	Generate and print the SRCINFO file to stdout.
> diff --git a/scripts/libmakepkg/util/pkgbuild.sh.in b/scripts/libmakepkg/util/pkgbuild.sh.in
> index 2db46f1f..e23208c3 100644
> --- a/scripts/libmakepkg/util/pkgbuild.sh.in
> +++ b/scripts/libmakepkg/util/pkgbuild.sh.in
> @@ -182,11 +182,17 @@ print_all_package_names() {
>  	local version=$(get_full_version)
>  	local architecture pkg opts a
>  	for pkg in ${pkgname[@]}; do
> -		architecture=$(get_pkg_arch $pkg)
> -		printf "%s/%s-%s-%s%s\n" "$PKGDEST" "$pkg" "$version" "$architecture" "$PKGEXT"
> -		if check_option "debug" "y" && check_option "strip" "y"; then
> -			printf "%s/%s-%s-%s-%s%s\n" "$PKGDEST" "$pkg" "@DEBUGSUFFIX@" "$version" "$architecture" "$PKGEXT"
> +		if (( IGNOREARCH )); then
> +			get_pkgbuild_attribute "$pkg" 'arch' 1 architecture
> +		else
> +			architecture=$(get_pkg_arch $pkg)
>  		fi
> +		for a in "${architecture[@]}"; do
> +			printf "%s/%s-%s-%s%s\n" "$PKGDEST" "$pkg" "$version" "$a" "$PKGEXT"
> +			if check_option "debug" "y" && check_option "strip" "y"; then
> +				printf "%s/%s-%s-%s-%s%s\n" "$PKGDEST" "$pkg" "@DEBUGSUFFIX@" "$version" "$a" "$PKGEXT"
> +			fi
> +		done
>  	done
>  }
>  
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index bc2d0061..584c10a8 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1262,7 +1262,7 @@ while true; do
>  		--nosign)         SIGNPKG='n' ;;
>  		-o|--nobuild)     NOBUILD=1 ;;
>  		-p)               shift; BUILDFILE=$1 ;;
> -		--packagelist)    PACKAGELIST=1 IGNOREARCH=1;;
> +		--packagelist)    PACKAGELIST=1 ;;
>  		--printsrcinfo)   PRINTSRCINFO=1 IGNOREARCH=1;;
>  		-r|--rmdeps)      RMDEPS=1 ;;
>  		-R|--repackage)   REPKG=1 ;;
> @@ -1631,8 +1631,13 @@ if (( !REPKG )); then
>  	if (( NOEXTRACT && ! VERIFYSOURCE )); then
>  		warning "$(gettext "Using existing %s tree")" "\$srcdir/"
>  	else
> -		download_sources
> -		check_source_integrity
> +		if (( VERIFYSOURCE && IGNOREARCH )); then
> +			download_sources allarch
> +			check_source_integrity all
> +		else
> +			download_sources
> +			check_source_integrity
> +		fi
>  		(( VERIFYSOURCE )) && exit $E_OK
>  
>  		if (( CLEANBUILD )); then
> 


More information about the pacman-dev mailing list