[X2Go-Commits] [maintenancescripts] 01/05: git/hooks/x2go-post-receive-tag-pending: merge in upstream changes.

git-admin at x2go.org git-admin at x2go.org
Thu Jan 2 13:07:58 CET 2020


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository maintenancescripts.

commit 326573e2f1367641cd7d6358104c74adffe29e50
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Jan 2 12:48:21 2020 +0100

    git/hooks/x2go-post-receive-tag-pending: merge in upstream changes.
---
 git/hooks/x2go-post-receive-tag-pending | 84 ++++++++++++++++++++++++---------
 1 file changed, 62 insertions(+), 22 deletions(-)

diff --git a/git/hooks/x2go-post-receive-tag-pending b/git/hooks/x2go-post-receive-tag-pending
index 2938f94..124d42c 100755
--- a/git/hooks/x2go-post-receive-tag-pending
+++ b/git/hooks/x2go-post-receive-tag-pending
@@ -1,7 +1,8 @@
 #! /bin/bash
 #
-# Copyright (c) 2009 Adeodato Simó (dato at net.com.org.es)
-# Copyright (c) 2013 Mike Gabriel (mike.gabriel at das-netzwerkteam.de)
+# Copyright © 2009 Adeodato Simó (dato at net.com.org.es)
+# Copyright © 2013 Mike Gabriel (mike.gabriel at das-netzwerkteam.de)
+# Copyright © 2013-2015 Guillem Jover <guillem at debian.org>
 # Copyright (c) 2015 Mihai Moldovan (ionic at ionic.de)
 #
 # This software may be used and distributed according to the terms
@@ -26,9 +27,52 @@ BASEURL="http://code.x2go.org/gitweb?p=${GIT_REPO_NAME}"
 
 PROJECT="${SHORT_GIT_REPO_NAME}"
 
+SENDMAIL="/usr/sbin/sendmail -oi -t"
+
 tempdir="$(mktemp -d)"
 trap "rm -rf \"${tempdir}\"" EXIT
 
+DPKG_VERSION=$(perl -MDpkg -e 'print $Dpkg::version')
+
+case "$DPKG_VERSION" in
+1.16.*)
+  get_version()
+  {
+    local rev="$1"
+    local c="$tempdir/${rev}.changelog"
+
+    git show ${rev}:debian/changelog | sed -re 's/Fixes:/Closes:/i' > "$c" 2>/dev/null
+    dpkg-parsechangelog -l"$c" | sed -rne 's/^Version: *//pi'
+  }
+  get_bugs()
+  {
+    local rev="$1"
+    local c="$tempdir/${rev}.changelog"
+
+    git show ${rev}:debian/changelog | sed -re 's/Fixes:/Closes:/i' > "$c" 2>/dev/null
+    dpkg-parsechangelog -l"$c" | sed -rne 's/^Closes: *//pi'
+  }
+  ;;
+*)
+  get_version()
+  {
+    local rev="$1"
+
+    git show ${rev}:debian/changelog 2>/dev/null \
+      | sed -re 's/Fixes:/Closes:/i' \
+      | dpkg-parsechangelog -l- -SVersion
+  }
+  get_bugs()
+  {
+    local rev="$1"
+
+    git show ${rev}:debian/changelog 2>/dev/null \
+      | sed -re 's/Fixes:/Closes:/i' \
+      | dpkg-parsechangelog -l- -SCloses
+  }
+  ;;
+esac
+
 function send_mail () { # send_mail bugno revno diff_file
     local bug="${1}"
     local fixed_in_version="${2}"
@@ -55,7 +99,7 @@ tag #${bug} pending
 fixed #${bug} ${version}
 thanks
 
-Hello,
+Hi!
 
 X2Go issue #${bug} (src:${PROJECT}) reported by you has been
 fixed in X2Go Git. You can see the changelog below, and you can
@@ -70,29 +114,25 @@ X2Go Git Admin (on behalf of the sender of this mail)
 
 ---
 EOF
-    cat "${diff}") | /usr/sbin/sendmail -oi -t
+    cat "${diff}") | ${SENDMAIL}
 }
 
 while read oldrev newrev refname; do
-  if echo "${refname}" | egrep -v "refs/tags/" >/dev/null && echo "${refname}" | egrep "refs/heads/(master|release/.*)" >/dev/null; then
-    git rev-parse --not | grep -v "$(git rev-parse ${refname})" | \
-    git rev-list --reverse --stdin "${oldrev}..${newrev}" | \
-    while read rev; do
-      c="${tempdir}/${rev}.changelog"
-      d="${tempdir}/${rev}.diff"
-      git show "${rev}:debian/changelog" >"${c}" 2>/dev/null
-      git show "${rev}" -- "debian/changelog" >"${d}"
-      version=$(cat "${c}" | sed 's/Fixes:/Closes:/i' | dpkg-parsechangelog -l- | sed -rne 's/^Version: *//pi' -e 's/[0-9]+://' | cut -d"-" -f1)
-      bugs=$(cat "${c}" | sed 's/Fixes:/Closes:/i' | dpkg-parsechangelog -l- | sed -rne 's/^Closes: *//pi')
-      for bug in ${bugs}; do
-        if  grep -qE '^\+.*\<'"${bug}"'\>' "${d}" &&
-            ! grep -qE  '^-.*\<'"${bug}"'\>' "${d}"; then
-          info "Marking X2Go issue #${bug} as pending for release (${version})."
-          send_mail "${bug}" "${version}" "${rev}" "${d}"
-        fi
-      done
+  git rev-parse --not --tags --not --branches='master' --branches='release/*' | grep -v "$(git rev-parse ${refname})" | \
+  git rev-list --reverse --stdin "${oldrev}..${newrev}" | \
+  while read rev; do
+    d="${tempdir}/${rev}.diff"
+    git show "${rev}" -- "debian/changelog" >"${d}"
+    version=$(get_version "${rev}" | sed -re 's/[0-9]+://' | cut -d"-" -f1)
+    bugs=$(get_bugs "${rev}")
+    for bug in ${bugs}; do
+      if  grep -qE '^\+.*\<'"${bug}"'\>' "${d}" &&
+          ! grep -qE  '^-.*\<'"${bug}"'\>' "${d}"; then
+        info "Marking X2Go issue #${bug} as pending for release (${version})."
+        send_mail "${bug}" "${version}" "${rev}" "${d}"
+      fi
     done
-  fi
+  done
 done
 
 # vi: et

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git


More information about the x2go-commits mailing list