mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Jon Ringle <jringle@gridpoint.com>
Subject: Re: [ptxdist] [PATCH] Detect changes in package patch series
Date: Fri, 3 Aug 2018 09:19:42 +0200	[thread overview]
Message-ID: <20180803071942.mez43finiz5rekvi@pengutronix.de> (raw)
In-Reply-To: <1533260999-9926-1-git-send-email-jon@ringle.org>

Hello Jon,

On Thu, Aug 02, 2018 at 09:49:59PM -0400, jon@ringle.org wrote:
> diff --git a/scripts/git-ptx-patches b/scripts/git-ptx-patches
> index f2568f9..738a4ac 100755
> --- a/scripts/git-ptx-patches
> +++ b/scripts/git-ptx-patches
> @@ -2,11 +2,33 @@
>  
>  PTX_PATCHES_HEADER="# generated by git-ptx-patches"
>  
> -function _md5sum() {
> -	local sum=$(md5sum)
> +function _sha1sum() {
> +	local sum=$(git rev-parse HEAD)
>  	echo "# $sum git-ptx-patches magic"
>  }
>  
> +update_series_md5() {
> +	local makefile="$(readlink -f .ptxdist/rule.make)"
> +	source .ptxdist/rule.env
> +	set -- $(md5sum .ptxdist/series)
> +	local md5="${1}"

Is this better than:

	local md5="$(md5sum .ptxdist/series)"

?

If I understand this right, this catches updates to the patch series
that change the series but if I only amend a patch this goes unnoticed.

Given that md5 is considered weak today, maybe use something more modern
instead (e.g. sha256?).

> +	local count=$(grep "^${PKG}_SERIES_MD5[	 ]*:=" "${makefile}" 2> /dev/null | wc -l)
> +	if [ "${count}" -gt 1 ]; then
> +		echo "Error: Could not update patch series md5sum for '${pkg_label}': ${PKG}_SERIES_MD5 found ${count} times in '${makefile}'."
> +		exit 1
> +	fi
> +	local current_md5=$(grep "^PUGIXML_SERIES_MD5[	 ]*:= " ${makefile} |cut -f2 -d=|xargs)

PUGIXML?

> +	if [ "${current_md5}" != "${md5}" ]; then
> +		sed -i "s/^\(\<${PKG}_SERIES_MD5[	 ]*:=\) *[a-f0-9]*\$/\1 ${md5}/" "${makefile}"
> +		if ! grep -q "${md5}\$" .ptxdist/rule.make; then
> +			echo "Warning: ${PKG}_SERIES_MD5 is missing from '${makefile}'."
> +		else
> +			echo "New patch series checksum for '${pkg_label}': ${md5} in '${makefile}'."
> +		fi
> +	fi
> +}
> +
>  if [ ! -L .ptxdist/patches ]; then
>  	echo "Error: This is not patched by ptxdist. Aborting."
>  	exit 1

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

  reply	other threads:[~2018-08-03  7:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03  1:49 jon
2018-08-03  7:19 ` Uwe Kleine-König [this message]
2018-08-03  7:36   ` Jon Ringle
2018-08-03  7:57     ` Jon Ringle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180803071942.mez43finiz5rekvi@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=jringle@gridpoint.com \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox