httpd/pullrev.sh

66 lines
1.6 KiB
Bash
Raw Normal View History

2012-05-31 13:30:31 +00:00
#!/bin/sh -e
if [ $# -lt 1 ]; then
echo "What?"
exit 1
fi
repo="https://svn.apache.org/repos/asf/httpd/httpd/trunk"
2021-10-12 13:01:42 +00:00
#repo="https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x"
2023-12-08 11:09:28 +00:00
ver=2.4.58
prefix="httpd-${ver}"
suffix="${SUFFIX:-r$1${2:++}}"
fn="${prefix}-${suffix}.patch"
vcurl="http://svn.apache.org/viewvc?view=revision&revision="
if test -f ${fn}; then
mv -v -f ${fn} ${fn}\~
2012-05-31 13:28:46 +00:00
echo "# $0 $*" > ${fn}
sed '1{/#.*pullrev/d;};/^--- /,$d' < ${fn}\~ >> ${fn}
else
2012-05-31 13:28:46 +00:00
echo "# $0 $*" > ${fn}
fi
new=0
for r in $*; do
case $r in
http*) url=$r ;;
*) url=${vcurl}${r} ;;
esac
if ! grep -q "^${url}" ${fn}; then
echo "${url}"
new=1
fi
done >> ${fn}
[ $new -eq 0 ] || echo >> ${fn}
prev=/dev/null
for r in $*; do
echo "+ fetching ${r}"
this=`mktemp /tmp/pullrevXXXXXX`
case $r in
http*) curl -s "$r" | filterdiff --strip=3 ;;
*) svn diff -c ${r} ${repo} ;;
esac | filterdiff --remove-timestamps --clean \
2023-12-08 11:09:28 +00:00
-x 'CHANGES' -x '*/next-number' -x 'STATUS' -x '*.xml' -x 'changes-entries/*' \
--addprefix="${prefix}/" > ${this}
next=`mktemp /tmp/pullrevXXXXXX`
if ! combinediff -w ${prev} ${this} > ${next}; then
echo "Failed combining previous ${prev} with ${this}";
exit 1
fi
rm -f "${this}"
[ "${prev}" = "/dev/null" ] || rm -f "${prev}"
prev=${next}
done
cat ${prev} >> ${fn}
vi "${fn}"
echo "+ git add ${fn}"
git add "${fn}"
echo "+ spec template:"
echo "PatchN: ${fn}"
2023-12-08 11:09:28 +00:00
echo "%patch -PN -p1 -b .${suffix}"