Changeset View
Changeset View
Standalone View
Standalone View
Tools/scripts/tindex
#!/bin/sh | #!/bin/sh | ||||
# | # | ||||
# INDEX build tinderbox script. Build an INDEX for all supported FreeBSD branches | # INDEX build tinderbox script. Build an INDEX for all supported FreeBSD branches | ||||
# using the latest value of OSVERSION according to the src trees. If the build | # using the latest value of OSVERSION according to the src trees. If the build | ||||
# fails, yowl about it on ${REPORT_ADDRESS} If not, copy the index to www.freebsd.org so | # fails, yowl about it on ${REPORT_ADDRESS} If not, copy the index to www.freebsd.org so | ||||
# that 'make fetchindex' sees it. | # that 'make fetchindex' sees it. | ||||
# | # | ||||
# When INDEX is broken, assemble the list of committers who touched files | # When INDEX is broken, assemble the list of committers who touched files | ||||
# on the most recent 'svn update', and put those committers "on the hook". | # on the most recent 'git pull', and put those committers "on the hook". | ||||
# These committers all stay on the hook until INDEX is buildable again. | # These committers all stay on the hook until INDEX is buildable again. | ||||
# | # | ||||
# MAINTAINER= portmgr@FreeBSD.org | # MAINTAINER= portmgr@FreeBSD.org | ||||
# | # | ||||
# -------------------------------------------------------- | # -------------------------------------------------------- | ||||
# Change these! | # Change these! | ||||
Show All 21 Lines | if [ "${ARCH}" = "" ]; then | ||||
export MACHINE_ARCH=i386 | export MACHINE_ARCH=i386 | ||||
fi | fi | ||||
# -------------------------------------------------------- | # -------------------------------------------------------- | ||||
blame() { | blame() { | ||||
# Find out who is responsible for current version of file $1 | # Find out who is responsible for current version of file $1 | ||||
# Fastest way to extract is from svn info | git log --no-patch --max-count=1 --format='%ce' $1 | ||||
uqs: I think going with %ce is more future proof, we already have "committers" w/o @FreeBSD.org in… | |||||
Done Inline ActionsYes, it is only used in the "Committers on the hook:" line in the "index failed" mail anyway. rene: Yes, it is only used in the "Committers on the hook:" line in the "index failed" mail anyway. | |||||
who=$(${SVN} info $1 2>/dev/null | grep '^Last Changed Author' | awk '{print $4}') | |||||
echo $who | |||||
} | } | ||||
indexfail() { | indexfail() { | ||||
BRANCH=$1 | BRANCH=$1 | ||||
# Leave a cookie behind so that we know when the index is fixed | # Leave a cookie behind so that we know when the index is fixed | ||||
touch ${PORTSDIR}/broken.${BRANCH} | touch ${PORTSDIR}/broken.${BRANCH} | ||||
Show All 14 Lines | if [ "$len" -gt "40" ]; then | ||||
echo "[...]" | echo "[...]" | ||||
tail -20 index.err | tail -20 index.err | ||||
else | else | ||||
cat index.err | cat index.err | ||||
fi | fi | ||||
# Find out which committers are on the hook | # Find out which committers are on the hook | ||||
commits=$(grep ^U ${PORTSDIR}/svn.log | grep -v INDEX | awk '{print $2}') | commits=$(${GIT} diff --name-only ${OLD_HEAD}) | ||||
for i in ${commits}; do | for i in ${commits}; do | ||||
blame $i >> ${PORTSDIR}/hook | blame $i >> ${PORTSDIR}/hook | ||||
done | done | ||||
sort -u ${PORTSDIR}/hook > ${PORTSDIR}/hook.new | sort -u ${PORTSDIR}/hook > ${PORTSDIR}/hook.new | ||||
mv ${PORTSDIR}/hook.new ${PORTSDIR}/hook | mv ${PORTSDIR}/hook.new ${PORTSDIR}/hook | ||||
echo | echo | ||||
echo "Committers on the hook:" | echo "Committers on the hook:" | ||||
tr -s '\n' ' ' < ${PORTSDIR}/hook | tr -s '\n' ' ' < ${PORTSDIR}/hook | ||||
echo | echo | ||||
echo | echo | ||||
echo "Most recent SVN update was:"; | echo "Most recent Git update was:"; | ||||
grep -v '/work$' svn.log | grep -v '^\?' | (IFS=""; echo ${commits}) | ||||
) | mail -s "INDEX build failed for ${BRANCH}" ${REPORT_ADDRESS} | ) | mail -s "INDEX build failed for ${BRANCH}" ${REPORT_ADDRESS} | ||||
exit 1 | exit 1 | ||||
} | } | ||||
checkfixed() { | checkfixed() { | ||||
BRANCH=$1 | BRANCH=$1 | ||||
# If the cookie exists that means that this is the first build for which the | # If the cookie exists that means that this is the first build for which the | ||||
Show All 24 Lines | |||||
${GIT} -C ${SRCDIR13} pull --rebase -q | ${GIT} -C ${SRCDIR13} pull --rebase -q | ||||
OSVERSION13=$(awk '/^#define[[:blank:]]__FreeBSD_version/ {print $3}' < ${SRCDIR13}/sys/sys/param.h) | OSVERSION13=$(awk '/^#define[[:blank:]]__FreeBSD_version/ {print $3}' < ${SRCDIR13}/sys/sys/param.h) | ||||
${GIT} -C ${SRCDIR14} pull --rebase -q | ${GIT} -C ${SRCDIR14} pull --rebase -q | ||||
OSVERSION14=$(awk '/^#define[[:blank:]]__FreeBSD_version/ {print $3}' < ${SRCDIR14}/sys/sys/param.h) | OSVERSION14=$(awk '/^#define[[:blank:]]__FreeBSD_version/ {print $3}' < ${SRCDIR14}/sys/sys/param.h) | ||||
cd ${PORTSDIR} | cd ${PORTSDIR} | ||||
rm -f INDEX-11 INDEX-11.bz2 INDEX-12 INDEX-12.bz2 INDEX-13 INDEX-13.bz2 INDEX-14 INDEX-14.bz2 | rm -f INDEX-11 INDEX-11.bz2 INDEX-12 INDEX-12.bz2 INDEX-13 INDEX-13.bz2 INDEX-14 INDEX-14.bz2 | ||||
(${SVN} up 2>1 ) > svn.log | OLD_HEAD=$(${GIT} rev-parse HEAD) | ||||
if grep -q ^C svn.log ; then | if ! ${GIT} pull --ff-only > git.log 2>&1 ; then | ||||
(echo "svn update failed with conflicts:"; | (echo "Git update failed with conflicts:"; | ||||
grep ^C svn.log) | mail -s "Ports svn up failed" ${ERROR_ADDRESS} | cat git.log) | mail -s "Ports Git update failed" ${ERROR_ADDRESS} | ||||
exit 1 | exit 1 | ||||
fi | fi | ||||
for branch in 11.x 12.x 13.x 14.x; do | for branch in 11.x 12.x 13.x 14.x; do | ||||
release=$(echo $branch | sed -e 's,.x,,') | release=$(echo $branch | sed -e 's,.x,,') | ||||
eval _osver=\$OSVERSION${release} | eval _osver=\$OSVERSION${release} | ||||
eval _uname_r="$(( ${_osver} / 100000 )).0-RELEASE" | eval _uname_r="$(( ${_osver} / 100000 )).0-RELEASE" | ||||
export OSVERSION=${_osver} | export OSVERSION=${_osver} | ||||
export UNAME_r=${_uname_r} | export UNAME_r=${_uname_r} | ||||
echo "Building INDEX for ${branch} with OSVERSION=${OSVERSION}" | echo "Building INDEX for ${branch} with OSVERSION=${OSVERSION}" | ||||
cd ${PORTSDIR} | cd ${PORTSDIR} | ||||
((make index 2> index.err) > index.out) || indexfail ${branch} | ( (make index 2> index.err) > index.out) || indexfail ${branch} | ||||
if [ -s index.err ]; then | if [ -s index.err ]; then | ||||
indexfail ${branch} | indexfail ${branch} | ||||
fi | fi | ||||
checkfixed ${branch} | checkfixed ${branch} | ||||
bzip2 -kf ${PORTSDIR}/INDEX-${release} | bzip2 -kf ${PORTSDIR}/INDEX-${release} | ||||
mv ${PORTSDIR}/INDEX-${release} ${PORTSDIR}/INDEX-${release}.bz2 ${OUTDIR} | mv ${PORTSDIR}/INDEX-${release} ${PORTSDIR}/INDEX-${release}.bz2 ${OUTDIR} | ||||
done | done | ||||
# All indexes built successfully, clear the hook | # All indexes built successfully, clear the hook | ||||
rm -f ${PORTSDIR}/hook | rm -f ${PORTSDIR}/hook |
I think going with %ce is more future proof, we already have "committers" w/o @FreeBSD.org in src. we might relax that in the future ...