tags 827816 + patch
thanks

On Tue, 21 Jun 2016 13:07:17 +0200, Luca Capello wrote:
> Tested patch for ACTION=3Daccepted (thus to be extended later on) as soon
> as this bug get a number :-)

Here we are:

--8<---------------cut here---------------start------------->8---
From 044e268f9bd32f18165014667a8f3284cecab0ee Mon Sep 17 00:00:00 2001
From: Luca Capello <luca.cape...@infomaniak.com>
Date: Tue, 21 Jun 2016 13:17:23 +0200
Subject: [PATCH] docs/mail-changes.example: (#827816) new file

---
 debian/changelog          |  7 +++++
 debian/examples           |  1 +
 docs/mail-changes.example | 69 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 77 insertions(+)
 create mode 100755 docs/mail-changes.example

diff --git a/debian/changelog b/debian/changelog
index 1304fde..14c0ea3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+reprepro (4.17.1-2) UNRELEASED; urgency=medium
+
+  * debian/examples, docs/mail-changes.example:
+    + new file to notify processing of .changes files (Closes: #827816).
+
+ -- Luca Capello <luca.cape...@infomaniak.com>  Tue, 21 Jun 2016 13:16:06 +0200
+
 reprepro (4.17.1-1) unstable; urgency=medium
 
   * new bugfix release
diff --git a/debian/examples b/debian/examples
index 8754d4d..afc97a7 100644
--- a/debian/examples
+++ b/debian/examples
@@ -7,3 +7,4 @@ docs/copybyhand.example
 docs/outstore.py
 docs/sftp.py
 docs/outsftphook.py
+docs/mail-changes.example
diff --git a/docs/mail-changes.example b/docs/mail-changes.example
new file mode 100755
index 0000000..2402aaf
--- /dev/null
+++ b/docs/mail-changes.example
@@ -0,0 +1,69 @@
+#!/bin/sh
+#
+#
+# Copyright 2016 Luca Capello <luca.cape...@infomaniak.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02111-1301  USA
+#
+#
+# This is an example script that can be hooked into reprepro
+# to send an email after a .changes file is processed.
+#
+# All you have to do is to:
+# - copy it into you conf/ directory,
+# - add the following to any distribution in conf/distributions
+#   you want to have emails sent for:
+#Log:
+# --changes mail-changes.example
+# (note the space at the beginning of the second line).
+#
+# DEPENDENCIES: mailx
+
+
+set -e
+
+
+if test "x${REPREPRO_OUT_DIR:+set}" = xset ; then
+       # Note: due to cd, REPREPRO_*_DIR will no longer
+       # be usable. And only things relative to outdir will work...
+       cd "${REPREPRO_OUT_DIR}" || exit 1
+else
+       # this will also trigger if reprepro < 3.5.1 is used,
+       # in that case replace this with a manual cd to the
+       # correct directory...
+       cat "mail-accepted.example needs to be run by reprepro!" >&2
+       exit 1
+fi
+
+
+MAIL_TO="$USER"
+
+ACTION="$1"
+CODENAME="$2"
+PACKAGENAME="$3"
+PACKAGEVERSION="$4"
+CHANGESFILE="$5"
+
+if [ "x$ACTION" = "xaccepted" ]; then
+       MAIL_FROM="$(grep Changed-By $CHANGESFILE | \
+                     sed -e 's/Changed-By/From/')"
+       ARCHITECTURE="$(grep Architecture $CHANGESFILE | \
+                        sed -e 's/Architecture: //')"
+       MAIL_SUBJECT="Accepted $PACKAGENAME $PACKAGEVERSION ($ARCHITECTURE) 
into $CODENAME"
+       cat "$CHANGESFILE" | \
+        mail -a "$MAIL_FROM" -s "$MAIL_SUBJECT" "$MAIL_TO"
+fi
+
+
+exit 0
-- 
2.1.4

--8<---------------cut here---------------end--------------->8---

Thx, bye,
Gismo / Luca

-- 
Luca Capello
Administrateur GNU/Linux

Infomaniak Network SA

Attachment: signature.asc
Description: Digital signature

Reply via email to