On Fri, Aug 3, 2018 at 3:19 AM Uwe Kleine-König
<[email protected]> wrote:
>
> Hello Jon,
>
> On Thu, Aug 02, 2018 at 09:49:59PM -0400, [email protected] 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)"
>
> ?
I was modeling the pattern found in `ptxd_make_world_update_md5()`
found in scripts/lib/ptxd_make_world_check_src.sh:
| ptxd_make_world_update_md5() {
| local PKG="$(ptxd_name_to_NAME "${pkg_label}")"
| set -- $(md5sum "${pkg_src}")
| local md5="${1}"
I can change it to the way you are suggesting, though
>
> 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.
There are two different sums going on here. This one captures the sum
of the series file, but in the next 2 hunks that you trimmed from your
response is the embedded in the series file the sha1 of the HEAD git
commit obtained via `git rev-parse HEAD` in the function _sha1sum.
This will also capture changes to commits in the git repo where the
subject line stays the same and therefore doesn't change the series
patch filename, but does change the HEAD sha1:
@@ -22,10 +44,8 @@ tag=base
if grep -q "$PTX_PATCHES_HEADER" .ptxdist/series; then
echo "Found series file generated by git-ptx-patches."
- lines=$(wc -l < .ptxdist/series)
- lines=$[lines-1]
- magic=$(head -n$lines .ptxdist/series | _md5sum)
- if grep -q "^$magic" .ptxdist/series; then
+ magic=$(git rev-parse HEAD)
+ if grep -q "^# $magic" .ptxdist/series; then
remove_old=yes
else
echo "Warning: .ptxdist/series was modified."
@@ -132,7 +152,9 @@ cat .ptxdist/series.0 > .ptxdist/series
git format-patch -M -N $GIT_EXTRA_ARGS ${tagopt} -o .ptxdist/patches/
${range} | sed -e 's,^.ptxdist/patches/,,' > .ptxdist/series.auto
cat .ptxdist/series.auto >> .ptxdist/series
cat .ptxdist/series.1 >> .ptxdist/series
-cat .ptxdist/series | _md5sum >> .ptxdist/series
+cat .ptxdist/series | _sha1sum >> .ptxdist/series
+
+update_series_md5
>
> 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?
Opps... that was a local package I was testing the feature with. I will fix :)
-Jon
_______________________________________________
ptxdist mailing list
[email protected]