autodist-tool: makepatch: support for patch type autodetection

This commit is contained in:
Silvan Calarco 2012-10-18 00:55:22 +02:00
parent 12b3759777
commit 76032ddcb4

View File

@ -1,7 +1,7 @@
#!/bin/bash
#
# autodist-tool
# Copyright (c) 2008-2010 by Silvan Calarco <silvan.calarco@mambasoft.it>
# Copyright (c) 2008-2012 by Silvan Calarco <silvan.calarco@mambasoft.it>
#
. /etc/autodist/config
me=(${0##*/} $VERSION "Tue Oct 28 2008")
@ -30,7 +30,7 @@ ${me[0]} ${me[1]}
echo "
"$"Usage"":
$me makepatch package [build|update|remove]
$me makepatch package [auto|build|update|remove]
$me schedule job_regexp..
$me unschedule job_regexp..
$me skip job_regexp..
@ -83,6 +83,28 @@ if [ "$COMMAND" = "makepatch" ]; then
rm -f $AUTOUPDATEDIR/spec-patches-build/$JOB.spec.patch
echo
exit 0
elif [ "$OPERATION" = "auto" ]; then
if [ -e $spec_dir/.$JOB.spec.autodist.prebuild -a ! -e $AUTOUPDATEDIR/spec-patches-update/$JOB.spec.patch ]; then
OPERATION=build
elif [ -e $spec_dir/.$JOB.spec.autodist.preupdate -a ! -e $AUTOUPDATEDIR/spec-patches-build/$JOB.spec.patch ]; then
OPERATION=update
else
echo "Error: unable to autodetect patch type."
exit 1
fi
fi
if [ ! -e $spec_dir/.$JOB.spec.autodist.pre$OPERATION ]; then
echo "Error: pre$OPERATION specfile missing; make sure you prepare and update the package using autodist."
exit 1
fi
if [ "$OPERATION" = "build" -a -e $AUTOUPDATEDIR/spec-patches-update/$JOB.spec.patch ]; then
echo "Error: trying to make a build patch when an update patch already exists! Remove or create a update patch instead."
exit 1
elif [ "$OPERATION" = "update" -a -e $AUTOUPDATEDIR/spec-patches-build/$JOB.spec.patch ]; then
echo "Error: trying to make an update patch when a build patch already exists! Remove or create a build patch instead."
exit 1
fi
diff $spec_dir/.$JOB.spec.autodist.pre$OPERATION $spec_dir/$JOB.spec > \