From 76032ddcb4d8c6dd7c2e15dd463814c371616630 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Thu, 18 Oct 2012 00:55:22 +0200 Subject: [PATCH] autodist-tool: makepatch: support for patch type autodetection --- autodist-tool | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/autodist-tool b/autodist-tool index 0b52ae4..fdaeee1 100755 --- a/autodist-tool +++ b/autodist-tool @@ -1,7 +1,7 @@ #!/bin/bash # # autodist-tool -# Copyright (c) 2008-2010 by Silvan Calarco +# Copyright (c) 2008-2012 by Silvan Calarco # . /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 > \