Arch hook for commit messages
Rob Browning
rlb@defaultvalue.org
Tue, 15 Mar 2005 10:46:34 -0600
J=E9r=F4me Marant <jerome.marant@free.fr> writes:
> I know the configure is huge. But I'm surprised 'diff' does not work
> well with it. After all, there are not many changes.
Not sure, though I wouldn't be surprised if there actually are a lot
of changes given how long ago 21.3 was released (and given that I
doubt that they re-ran autoconf for the 21.4 releases).
>> OK. Is 1000 lines a reasonable length?
>
> Yes, it is.
OK. Here's the modified script I just used, in case you're
interested.
#! /bin/bash
## emacs.hook -- arch hook for emacs -*- shell-script -*-
## Borrowed from dpatch.hook
## Source this from ~/.arch-params/hook, and be happy.
ARCH_CATEGORY=3D$(tla parse-package-name --category ${ARCH_REVISION})
ARCH_BRANCH=3D$(tla parse-package-name --branch ${ARCH_REVISION})
ARCH_VERSION=3D$(tla parse-package-name --package-version ${ARCH_REVISION})
MAXLINES=3D1000
function truncate_if_needed ()
{
local logfile=3D"$1"
if test $(wc -l "${logfile}" | cut -d ' ' -f 1) -gt ${MAXLINES}; then
trunc=3D$(tempfile -p ahook)
echo > "${trunc}"
echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D" >> "${trunc}"
echo "WARNING: MESSAGE TRUNCATED TO ${MAXLINES} LINES" >> "${trunc}"
echo "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D" >> "${trunc}"
echo >> "${trunc}"
head -${MAXLINES} "${logfile}" >> "${trunc}"
cp "${trunc}" "${logfile}"
rm -f -- "${trunc}"
fi
}
=09
case ${ARCH_CATEGORY} in
emacs-debian|emacs-snapshot-debian)
MAILLIST=3Dpkg-emacs-commits@lists.alioth.debian.org
WITH_DIFFS=3D1
;;
*)
exit 0
;;
esac
case $1 in
commit)
logfile=3D$(tempfile -p ahook)
logdir=3D${logfile}.d
tla cat-archive-log "${ARCH_ARCHIVE}/${ARCH_REVISION}" >${logfile}
subj=3D$(grep "^Summary: " ${logfile} | head -n 1)
=09
echo >> ${logfile}
tla get "${ARCH_ARCHIVE}/${ARCH_REVISION}" ${logdir}
PN=3D$(expr $(echo ${ARCH_REVISION} \
| sed -e "s,^.*-\([0-9]\+\)$,\1,") - 1)
if [ ${PN} -eq -1 ]; then
PR=3D$(echo ${ARCH_REVISION} | sed -e "s,-patch-[0-9]\+$,-base-0,")
else
PR=3D$(echo ${ARCH_REVISION} | sed -e "s,-[0-9]\+$,-${PN},g")
fi
=09
tla changes -d ${logdir} ${WITH_DIFFS+--diffs} "${ARCH_ARCHIVE}/${PR}" \
| filterdiff -x '*/{arch}/*' >>${logfile}
=09
rm -rf ${logdir}
truncate_if_needed "${logfile}"
mail \
-s "[${ARCH_CATEGORY} commit] ${subj#Summary: } @ ${ARCH_VERSIO=
N}" \
${MAILLIST} < "${logfile}"
rm -f -- "${logfile}"
;;
import)
logfile=3D$(tempfile -p ahook)
tla cat-archive-log "${ARCH_ARCHIVE}/${ARCH_REVISION}" >${logfile}
subj=3D$(grep "^Summary: " ${logfile} | head -n 1)
truncate_if_needed "${logfile}"
mail \
-s "[${ARCH_CATEGORY} import] ${subj#Summary: } @ ${ARCH_VERSIO=
N}" \
${MAILLIST} < "${logfile}"
rm -f -- "${logfile}"
;;
esac
--=20
Rob Browning
rlb @defaultvalue.org and @debian.org; previously @cs.utexas.edu
GPG starting 2002-11-03 =3D 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 7=
3A4