This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository maintenancescripts. from 2368d2f git/hooks/x2go-post-receive-tag-pending: actually use ${fixed_in_version} instead of the global ${version} variable in send_mail (). new aaa583c git/hooks/x2go-post-receive-tag-pending: use git rev-parse instead of complicated git show call to map a rev to an object SHA. new f08a4df git/hooks/x2go-post-receive-tag-pending: add more missing quotes. new 49ad989 git/hooks/x2go-post-receive-tag-pending: rework quoting and whitespacing of cut call. new c437a32 git/hooks/x2go-post-receive-close-bugs: update description in top comment to actually mention what this script is outputting. new e8ccbbc git/hooks/x2go-post-receive-close-bugs: backport changes from x2go-post-receive-tag-pending. new 0cf0862 git/hooks/x2go-post-receive-close-bugs: add X-Mailer header, ported from git/hooks/x2go-post-receive-tag-pending. new a23c07e git/hooks/x2go-post-receive-close-bugs: drop useless use of cat. new 92f1708 git/hooks/x2go-post-receive-close-bugs: rework previous tag detection. The 8 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: git/hooks/x2go-post-receive-close-bugs | 156 +++++++++++++++++++++++--------- git/hooks/x2go-post-receive-tag-pending | 8 +- 2 files changed, 119 insertions(+), 45 deletions(-) -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository maintenancescripts. commit 0cf08620a9353460886614c3ea0ca2b60b5596f8 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Mar 5 19:10:31 2020 +0100 git/hooks/x2go-post-receive-close-bugs: add X-Mailer header, ported from git/hooks/x2go-post-receive-tag-pending. --- git/hooks/x2go-post-receive-close-bugs | 1 + 1 file changed, 1 insertion(+) diff --git a/git/hooks/x2go-post-receive-close-bugs b/git/hooks/x2go-post-receive-close-bugs index d92a119..e63a5d6 100755 --- a/git/hooks/x2go-post-receive-close-bugs +++ b/git/hooks/x2go-post-receive-close-bugs @@ -92,6 +92,7 @@ Subject: X2Go issue (in src:${PROJECT}) has been marked as closed Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit +X-Mailer: https://code.x2go.org/gitweb?p=maintenancescripts.git;a=blob;f=git/hooks/x2g... close #${bug} thanks -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository maintenancescripts. commit 92f1708b3b78d2ddf7edb555c480f1c79773b367 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Mar 5 19:17:54 2020 +0100 git/hooks/x2go-post-receive-close-bugs: rework previous tag detection. Add sanity checks. If we stumble upon a rev that looks invalid (according to git rev-parse), chances are that the previous rev doesn't have a parent (i.e., is a root commit) and looking further back for another tag doesn't make sense if we haven't found one yet. In that case, stop looking (and, for that matter, don't create an endless loop) and just use the empty tree object as the oldrev that will be baked into URL as the parent/base. --- git/hooks/x2go-post-receive-close-bugs | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/git/hooks/x2go-post-receive-close-bugs b/git/hooks/x2go-post-receive-close-bugs index 83497f7..625ea8b 100755 --- a/git/hooks/x2go-post-receive-close-bugs +++ b/git/hooks/x2go-post-receive-close-bugs @@ -135,13 +135,32 @@ while read oldrev newrev refname; do continue ;; esac - # find the last tag on this branch - tag="${refname/refs\/tags\//}" - oldrev="$(git rev-parse "${tag}")^" + + # Find the previous tag reachable from the current one. + emptytree="$(printf '' | git hash-object --stdin -t tree)" + oldrev="$(git rev-parse "${refname}" 2>'/dev/null')^" + if git rev-parse "${oldrev}" 2>'/dev/null'; then # rewind back from current ref back to the previous tag we find - while ! git describe "${oldrev}" --exact-match 2>/dev/null; do oldrev="${oldrev}^"; done - oldrev="$(git rev-parse "${oldrev}")" - oldtag="$(git tag --contains "${oldrev}" | head -n1)" + while ! git describe "${oldrev}" --exact-match 2>'/dev/null'; do + oldrev="${oldrev}^" + + # Sanity check - does the rev actually exist? + if ! git rev-parse "${oldrev}" 2>'/dev/null'; then + oldrev="${emptytree}" + break + fi + done + + # If we actually found something, massage it. + if [ "${oldrev}" != "${emptytree}" ]; then + oldrev="$(git rev-parse "${oldrev}")" + oldtag="$(git describe "${oldrev}" --exact-match 2>'/dev/null')" + else + oldtag='' + fi + else + oldrev="${emptytree}" + fi c="${tempdir}/${newrev}.changelog" d="${tempdir}/${newrev}.diff" -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository maintenancescripts. commit aaa583cb2816c1a07ee76dde8e47dc3e5b80a022 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Mar 4 17:13:40 2020 +0100 git/hooks/x2go-post-receive-tag-pending: use git rev-parse instead of complicated git show call to map a rev to an object SHA. --- git/hooks/x2go-post-receive-tag-pending | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/hooks/x2go-post-receive-tag-pending b/git/hooks/x2go-post-receive-tag-pending index e3b33a3..ccca08e 100755 --- a/git/hooks/x2go-post-receive-tag-pending +++ b/git/hooks/x2go-post-receive-tag-pending @@ -105,7 +105,7 @@ X2Go issue #${bug} (src:${PROJECT}) reported by you has been fixed in X2Go Git. You can see the changelog below, and you can check the diff of the fix at: - ${BASEURL};a=commitdiff;h=$(git show -s --pretty='format:%h' "${rev}") + ${BASEURL};a=commitdiff;h=$(git rev-parse "${rev}") The issue will most likely be fixed in src:${PROJECT} (${fixed_in_version}). -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository maintenancescripts. commit 49ad9895aed79b065b6ad833198b6be07a70d629 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Mar 4 22:39:02 2020 +0100 git/hooks/x2go-post-receive-tag-pending: rework quoting and whitespacing of cut call. --- git/hooks/x2go-post-receive-tag-pending | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/hooks/x2go-post-receive-tag-pending b/git/hooks/x2go-post-receive-tag-pending index 37d6f63..2cd33a2 100755 --- a/git/hooks/x2go-post-receive-tag-pending +++ b/git/hooks/x2go-post-receive-tag-pending @@ -166,7 +166,7 @@ while read oldrev newrev refname; do continue fi git show "${rev}" -- "debian/changelog" >"${d}" - version="$(get_version "${rev}" | sed -re 's/[0-9]+://' | cut -d"-" -f1)" + version="$(get_version "${rev}" | sed -re 's/[0-9]+://' | cut -d '-' -f '1')" bugs="$(get_bugs "${rev}")" for bug in ${bugs}; do if grep -qE '^\+.*\<'"${bug}"'\>' "${d}" && -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository maintenancescripts. commit a23c07e63c819e896518205c74961a2e59bb4ab7 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Mar 5 19:11:15 2020 +0100 git/hooks/x2go-post-receive-close-bugs: drop useless use of cat. --- git/hooks/x2go-post-receive-close-bugs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git/hooks/x2go-post-receive-close-bugs b/git/hooks/x2go-post-receive-close-bugs index e63a5d6..83497f7 100755 --- a/git/hooks/x2go-post-receive-close-bugs +++ b/git/hooks/x2go-post-receive-close-bugs @@ -153,7 +153,7 @@ while read oldrev newrev refname; do fi git show "${newrev}:debian/changelog" >"${c}" 2>'/dev/null' - cat "${c}" | sed 's/Fixes:/Closes:/i' | dpkg-parsechangelog -l- | sed 's/Closes:/Fixes:/i' | + sed 's/Fixes:/Closes:/i' < "${c}" | dpkg-parsechangelog -l- | sed 's/Closes:/Fixes:/i' | sed -e 's/^Source: /X2Go Component: src:/' \ -e 's/-0~x2go[0-9]//' \ -e 's/-0$//' \ -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository maintenancescripts. commit c437a32583f68643b2361f306c9e3bfd8763a5e0 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Mar 5 14:58:17 2020 +0100 git/hooks/x2go-post-receive-close-bugs: update description in top comment to actually mention what this script is outputting. The previous description was a copy of the bug-tagging script. --- git/hooks/x2go-post-receive-close-bugs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/git/hooks/x2go-post-receive-close-bugs b/git/hooks/x2go-post-receive-close-bugs index 59b8a33..afd3f32 100755 --- a/git/hooks/x2go-post-receive-close-bugs +++ b/git/hooks/x2go-post-receive-close-bugs @@ -7,10 +7,10 @@ # This software may be used and distributed according to the terms # of the MIT License, incorporated herein by reference. -# Purpose: this hook will tag Debian bugs as pending. The mail will -# include the commit message, and the portion of the diff corresponding -# to debian/changelog, plus a pointer to the URL that contains the full -# diff. It has some heuristics not to tag the same bug pending twice. +# Purpose: this hook will close Debian bugs, which, hopefully, have been +# marked as pending before. The mail will include a parsed portion of +# debian/changelog for the newly released version plus a pointer to the URL +# that contains the full diff. # # Usage: make this script your post-receive hook, or exec this script # from there. If you need to execute more than one script against -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository maintenancescripts. commit e8ccbbceb88a6b31baf021eac3e429aa2eaf36d8 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Mar 5 17:44:59 2020 +0100 git/hooks/x2go-post-receive-close-bugs: backport changes from x2go-post-receive-tag-pending. Both scripts should now be synced up when it comes to the common parts. --- git/hooks/x2go-post-receive-close-bugs | 116 ++++++++++++++++++++++++--------- 1 file changed, 85 insertions(+), 31 deletions(-) diff --git a/git/hooks/x2go-post-receive-close-bugs b/git/hooks/x2go-post-receive-close-bugs index afd3f32..d92a119 100755 --- a/git/hooks/x2go-post-receive-close-bugs +++ b/git/hooks/x2go-post-receive-close-bugs @@ -1,8 +1,9 @@ #! /bin/bash # -# Copyright (c) 2009 Adeodato Simó (dato@net.com.org.es) -# Copyright (c) 2013 Mike Gabriel (mike.gabriel@das-netzwerkteam.de) -# Copyright (c) 2015 Mihai Moldovan (ionic@ionic.de) +# Copyright © 2009 Adeodato Simó (dato@net.com.org.es) +# Copyright © 2013 Mike Gabriel (mike.gabriel@das-netzwerkteam.de) +# Copyright © 2013-2015 Guillem Jover <guillem@debian.org> +# Copyright © 2015-2020 Mihai Moldovan (ionic@ionic.de) # # This software may be used and distributed according to the terms # of the MIT License, incorporated herein by reference. @@ -22,14 +23,55 @@ set -e set -u -BASEURL="http://code.x2go.org/gitweb?p=${GIT_REPO_NAME}" +BASEURL="https://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 -function send_mail () { # send_mail bugno revno diff_file +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 fixed_in_version oldrevno newrevno diff_file local bug="${1}" local fixed_in_version="${2}" local oldrev="${3}" @@ -57,14 +99,14 @@ thanks Hello, we are very hopeful that X2Go issue #${bug} reported by you -has been resolved in the new release (${version}) of the +has been resolved in the new release (${fixed_in_version}) of the X2Go source project »src:${PROJECT}«. -You can view the complete changelog entry of src:${PROJECT} (${version}) +You can view the complete changelog entry of src:${PROJECT} (${fixed_in_version}) below, and you can use the following link to view all the code changes between this and the last release of src:${PROJECT}. - ${BASEURL};a=commitdiff;h=$(git rev-parse ${newrev});hp=$(git rev-parse ${oldrev}) + ${BASEURL};a=commitdiff;h=$(git rev-parse "${newrev}");hp=$(git rev-parse "${oldrev}") If you feel that the issue has not been resolved satisfyingly, feel free to reopen this bug report or submit a follow-up report with @@ -78,12 +120,20 @@ X2Go Git Admin (on behalf of the sender of this mail) --- EOF - cat "${diff}") | /usr/sbin/sendmail -oi -t + cat "${diff}") | ${SENDMAIL} } -## FIXME ## really go through this some time... while read oldrev newrev refname; do - if echo "${refname}" | egrep "refs/tags/" >/dev/null; then + # Only process tags. + # Bugs should only be getting closed as part of releases, which create new tags. + case "${refname}" in + ("refs/tags/"*) + : + ;; + (*) + continue + ;; + esac # find the last tag on this branch tag="${refname/refs\/tags\//}" oldrev="$(git rev-parse "${tag}")^" @@ -92,27 +142,31 @@ while read oldrev newrev refname; do oldrev="$(git rev-parse "${oldrev}")" oldtag="$(git tag --contains "${oldrev}" | head -n1)" - c="${tempdir}/${newrev}.changelog" - d="${tempdir}/${newrev}.diff" - - git show "${newrev}:debian/changelog" >"${c}" 2>/dev/null - cat "${c}" | sed 's/Fixes:/Closes:/i' | dpkg-parsechangelog -l- | sed 's/Closes:/Fixes:/i' | - sed -e 's/^Source: /X2Go Component: src:/' \ - -e 's/-0~x2go[0-9]//' \ - -e 's/-0$//' \ - -e 's/^Distribution: unstable/Status: RELEASE/' \ - -e 's/ unstable;/ RELEASED;/' \ - -e 's/^Distribution: UNRELEASED/Status: PREVIEW/' \ - -e 's/ UNRELEASED;/ PREVIEW;/' \ - | egrep -v "^(Urgency:|Maintainer:).*" > "${d}" - #git diff "${oldrev}..${newrev}" -- "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 - info "Marking X2Go issue #${bug} as resolved/closed." - send_mail "${bug}" "${version}" "${oldrev}" "${newrev}" "${d}" - done + c="${tempdir}/${newrev}.changelog" + d="${tempdir}/${newrev}.diff" + + # Check if this branch has a debian/changelog file to begin with and skip processing if there's + # none. + if ! git cat-file -e "${newrev}:debian/changelog" 2>'/dev/null'; then + continue fi + + git show "${newrev}:debian/changelog" >"${c}" 2>'/dev/null' + cat "${c}" | sed 's/Fixes:/Closes:/i' | dpkg-parsechangelog -l- | sed 's/Closes:/Fixes:/i' | + sed -e 's/^Source: /X2Go Component: src:/' \ + -e 's/-0~x2go[0-9]//' \ + -e 's/-0$//' \ + -e 's/^Distribution: unstable/Status: RELEASE/' \ + -e 's/ unstable;/ RELEASED;/' \ + -e 's/^Distribution: UNRELEASED/Status: PREVIEW/' \ + -e 's/ UNRELEASED;/ PREVIEW;/' \ + | grep -Ev "^(Urgency:|Maintainer:).*" > "${d}" + version="$(get_version "${rev}" | sed -re 's/[0-9]+://' | cut -d '-' -f '1')" + bugs="$(get_bugs "${rev}")" + for bug in ${bugs}; do + info "Marking X2Go issue #${bug} as resolved/closed." + send_mail "${bug}" "${version}" "${oldrev}" "${newrev}" "${d}" + done done # vi: et -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository maintenancescripts. commit f08a4df1060b2717d2cbacd1e2aaa035368fa4a9 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Mar 4 17:57:28 2020 +0100 git/hooks/x2go-post-receive-tag-pending: add more missing quotes. --- git/hooks/x2go-post-receive-tag-pending | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/git/hooks/x2go-post-receive-tag-pending b/git/hooks/x2go-post-receive-tag-pending index ccca08e..37d6f63 100755 --- a/git/hooks/x2go-post-receive-tag-pending +++ b/git/hooks/x2go-post-receive-tag-pending @@ -162,12 +162,12 @@ while read oldrev newrev refname; do d="${tempdir}/${rev}.diff" # Check if this branch has a debian/changelog file to begin with and skip processing if there's # none. - if ! git cat-file -e "${rev}:debian/changelog" 2>/dev/null; then + if ! git cat-file -e "${rev}:debian/changelog" 2>'/dev/null'; then continue fi git show "${rev}" -- "debian/changelog" >"${d}" - version=$(get_version "${rev}" | sed -re 's/[0-9]+://' | cut -d"-" -f1) - bugs=$(get_bugs "${rev}") + 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 -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/maintenancescripts.git