[pacman-dev] [PATCH 05/11] makepkg: skip integrity checking early

Dave Reisner d at falconindy.com
Tue Jun 26 20:01:57 EDT 2012


On Wed, Jun 27, 2012 at 08:58:11AM +1000, Allan McRae wrote:
> If "SKIP" is provided for an integrity check, abort checking as soon
> as possible.
> 
> Signed-off-by: Allan McRae <allan at archlinux.org>
> ---
>  scripts/makepkg.sh.in | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 2a8866f..985bbbd 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -736,6 +736,12 @@ check_checksums() {
>  				file="$(get_filename "$file")"
>  				printf "%s" "    $file ... " >&2
>  
> +				if [[ ${integrity_sums[$idx]} = 'SKIP' ]]; then
> +					echo "$(gettext "Skipped")" >&2
> +					idx=$((idx + 1))
> +					continue
> +				fi
> +
>  				if ! file="$(get_filepath "$file")"; then
>  					printf -- "$(gettext "NOT FOUND")\n" >&2
>  					errors=1
> @@ -743,18 +749,14 @@ check_checksums() {
>  				fi
>  
>  				if (( $found )) ; then
> -					if [[ ${integrity_sums[$idx]} = 'SKIP' ]]; then
> -						echo "$(gettext "Skipped")" >&2
> +					local expectedsum=$(tr '[:upper:]' '[:lower:]' <<< "${integrity_sums[$idx]}")

While you're touching this, we're bash4 capable now, so we could skip
the fork and use a PE instead: "${integrity_sums[idx],,}"

> +					local realsum="$(openssl dgst -${integ} "$file")"
> +					realsum="${realsum##* }"
> +					if [[ $expectedsum = "$realsum" ]]; then
> +						printf -- "$(gettext "Passed")\n" >&2
>  					else
> -						local expectedsum=$(tr '[:upper:]' '[:lower:]' <<< "${integrity_sums[$idx]}")
> -						local realsum="$(openssl dgst -${integ} "$file")"
> -						realsum="${realsum##* }"
> -						if [[ $expectedsum = "$realsum" ]]; then
> -							printf -- "$(gettext "Passed")\n" >&2
> -						else
> -							printf -- "$(gettext "FAILED")\n" >&2
> -							errors=1
> -						fi
> +						printf -- "$(gettext "FAILED")\n" >&2
> +						errors=1
>  					fi
>  				fi
>  
> -- 
> 1.7.11.1
> 
> 


More information about the pacman-dev mailing list