Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

email-changes hook for reprepro

View email-changes.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
#!/bin/sh
 
[ -n "${REPREPRO_OUT_DIR}" ] || {
echo "needs to be run by reprepro!" >&2
exit 1
}
cd "${REPREPRO_OUT_DIR}" || exit 1
 
dsc() {
dsc="$(readlink --canonicalize "$1")"
tmp="$(mktemp -d)"
trap "rm -rf -- $tmp" EXIT
(cd -- "$tmp" && dpkg-source --no-copy -x "$dsc" > /dev/null)
cat <<EOF > "$tmp/mail"
✂--------------------- Changelog --------------------------
EOF
changelog="$(echo "$tmp"/*/debian/changelog)"
dpkg-parsechangelog -l"$changelog" \
${OLDVERSION:+--since "$OLDVERSION"} \
${VERSION:+--to "$VERSION"} \
>> "$tmp/mail"
cat <<EOF >> "$tmp/mail"
✂--------------------- DSC file ---------------------------
EOF
cat "$dsc" >> "$tmp/mail"
 
mail -s "[PACKAGES] $CODENAME/$COMPONENT: $ACTION $NAME" \
nobody@dailymotion.com < "$tmp/mail"
}
 
ACTION="$1"
CODENAME="$2"
PACKAGETYPE="$3"
COMPONENT="$4"
ARCHITECTURE="$5"
NAME="$6"
[ x"$PACKAGETYPE" = x"dsc" ] || {
echo "Should be a DSC package, not $PACKAGETYPE" >&2
exit 1
}
[ x"$ARCHITECTURE" = x"source" ] || {
echo "Should be a source package, not $ARCHITECTURE" >&2
exit 1
}
shift 6
 
case "$ACTION" in
add|info)
VERSION="$1" ; shift
[ x"$1" = x"--" ] || exit 2
shift
 
while [ "$#" -gt 0 ] ; do
case "$1" in
*.dsc)
dsc "$1"
;;
--)
exit 2
;;
esac
shift
done
;;
remove)
OLDVERSION="$1" ; shift
[ x"$1" = x"--" ] || exit 2
shift
while [ "$#" -gt 0 ] ; do
case "$1" in
*.dsc)
dsc "$1"
;;
--)
exit 2
;;
esac
shift
done
;;
replace)
VERSION="$1" ; shift
OLDVERSION="$1" ; shift
[ x"$1" = x"--" ] || exit 2
shift
while [ "$#" -gt 0 -a x"$1" != x"--" ]; do
case "$1" in
*.dsc)
dsc "$1"
;;
esac
shift
done
[ x"$1" = x"--" ] || exit 2
# Ignore replaced dsc
;;
esac
 
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.