[pacman-contrib] [PATCH] updpkgsums: don't try to add nonexistent checksums

Daniel M. Capella polyzen at archlinux.org
Wed Jul 28 00:23:45 UTC 2021


Pushed, thank you!

On 5/21/21 12:16 AM, Eli Schwartz via pacman-contrib wrote:
> In the event there are no sources, there won't be sums either. awk won't
> find any to remove and replace inline, so it tries to print "" at the
> end of the file, and merely adds superfluous newlines.
>
> Abort early instead, since updpkgsums cannot be expected to process such
> a file.
>
> Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
> ---
>   src/updpkgsums.sh.in | 5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/src/updpkgsums.sh.in b/src/updpkgsums.sh.in
> index 41965f5..e5dbd2b 100644
> --- a/src/updpkgsums.sh.in
> +++ b/src/updpkgsums.sh.in
> @@ -99,6 +99,11 @@ newbuildfile=$(mktemp "${TMPDIR:-/tmp}/updpkgsums.XXXXXX")
>   trap "rm -rf '$BUILDDIR' '$newbuildfile'" EXIT
>   sumtypes=$(IFS='|'; echo "${known_hash_algos[*]}")
>   newsums=$(makepkg -g -p "$buildfile" "${MAKEPKG_OPTS[@]}") || die 'Failed to generate new checksums'
> +
> +if [[ -z $newsums ]]; then
> +	die "$buildfile does not contain sources to update"
> +fi
> +
>   awk -v sumtypes="$sumtypes" -v newsums="$newsums" '
>   	$0 ~"^[[:blank:]]*(" sumtypes ")sums(_[^=]+)?=", $0 ~ "\\)[[:blank:]]*(#.*)?$" {
>   		if (!w) {

-- 
Best,
Daniel <https://danielcapella.com>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xEA4F7B321A906AD9.asc
Type: application/pgp-keys
Size: 15463 bytes
Desc: OpenPGP public key
URL: <https://lists.archlinux.org/pipermail/pacman-contrib/attachments/20210727/5c080cfb/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-contrib/attachments/20210727/5c080cfb/attachment-0001.sig>


More information about the pacman-contrib mailing list