diff mbox

[pacman-dev] libmakepkg/integrity: use more shared functions to generate signatures

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

Commit Message

Eli Schwartz June 12, 2018, 11:28 a.m. UTC
The newly changed print_all_package_names function can iterate over the
list of all package files that will be created; this avoids the need to
independently recreate those filenames here.

Additionally, since debug packages may not actually exist, check if the
package file exists first. If the main package does not exist then
makepkg will have aborted before now, so there is no need to
special-case that here.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
---
 .../integrity/generate_signature.sh.in          | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

Comments

Dave Reisner June 12, 2018, 1:41 p.m. UTC | #1
On Tue, Jun 12, 2018 at 07:28:50AM -0400, Eli Schwartz wrote:
> The newly changed print_all_package_names function can iterate over the
> list of all package files that will be created; this avoids the need to
> independently recreate those filenames here.
> 
> Additionally, since debug packages may not actually exist, check if the
> package file exists first. If the main package does not exist then
> makepkg will have aborted before now, so there is no need to
> special-case that here.
> 
> Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
> ---
>  .../integrity/generate_signature.sh.in          | 17 ++---------------
>  1 file changed, 2 insertions(+), 15 deletions(-)
> 
> diff --git a/scripts/libmakepkg/integrity/generate_signature.sh.in b/scripts/libmakepkg/integrity/generate_signature.sh.in
> index 442fe031..3350ca50 100644
> --- a/scripts/libmakepkg/integrity/generate_signature.sh.in
> +++ b/scripts/libmakepkg/integrity/generate_signature.sh.in
> @@ -50,25 +50,12 @@ create_package_signatures() {
>  	if [[ $SIGNPKG != 'y' ]]; then
>  		return 0
>  	fi
> -	local pkg pkgarch pkg_file
> -	local fullver=$(get_full_version)
>  
>  	msg "$(gettext "Signing package(s)...")"
>  
> -	for pkg in "${pkgname[@]}"; do
> -		pkgarch=$(get_pkg_arch $pkg)
> -		pkg_file="$PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}"
> -
> -		create_signature "$pkg_file"
> -	done
> -
> -	# check if debug package needs a signature
> -	if ! check_option "debug" "y" || ! check_option "strip" "y"; then
> -		pkg=$pkgbase-@DEBUGSUFFIX@
> -		pkgarch=$(get_pkg_arch)
> -		pkg_file="$PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}"
> +	print_all_package_names | while read pkg_file; do

read -r

>  		if [[ -f $pkg_file ]]; then
>  			create_signature "$pkg_file"
>  		fi
> -	fi
> +	done
>  }
> -- 
> 2.17.1
diff mbox

Patch

diff --git a/scripts/libmakepkg/integrity/generate_signature.sh.in b/scripts/libmakepkg/integrity/generate_signature.sh.in
index 442fe031..3350ca50 100644
--- a/scripts/libmakepkg/integrity/generate_signature.sh.in
+++ b/scripts/libmakepkg/integrity/generate_signature.sh.in
@@ -50,25 +50,12 @@  create_package_signatures() {
 	if [[ $SIGNPKG != 'y' ]]; then
 		return 0
 	fi
-	local pkg pkgarch pkg_file
-	local fullver=$(get_full_version)
 
 	msg "$(gettext "Signing package(s)...")"
 
-	for pkg in "${pkgname[@]}"; do
-		pkgarch=$(get_pkg_arch $pkg)
-		pkg_file="$PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}"
-
-		create_signature "$pkg_file"
-	done
-
-	# check if debug package needs a signature
-	if ! check_option "debug" "y" || ! check_option "strip" "y"; then
-		pkg=$pkgbase-@DEBUGSUFFIX@
-		pkgarch=$(get_pkg_arch)
-		pkg_file="$PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}"
+	print_all_package_names | while read pkg_file; do
 		if [[ -f $pkg_file ]]; then
 			create_signature "$pkg_file"
 		fi
-	fi
+	done
 }