From: Zhang Qiang Date: Tue, 6 Dec 2011 04:49:48 +0000 (+0800) Subject: fix packaging issue while adding new patch X-Git-Tag: v0.1~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d7ab04f4fadb328e29ea37fb19e804a63e64ba20;p=tools%2Fgbs.git fix packaging issue while adding new patch This scripts can't work if 'Patch' info contains in specfile, so we should pattern 'Patch' from the beginning of lines. Also sort patch number first, then select the last one. --- diff --git a/data/packaging.sh b/data/packaging.sh index e89e6fd..0d4b6d9 100644 --- a/data/packaging.sh +++ b/data/packaging.sh @@ -142,14 +142,14 @@ update_patches() # no new patch if [ -n "$newadd_patch" ]; then # Find the insert line num - line_num=$(grep Patch[0-9]* -r $spec -n|tail -1|cut -d':' -f1) + line_num=$(grep "^Patch[0-9]*" -r $spec -n|tail -1|cut -d':' -f1) # No patch. Insert after Source if [ -z "$line_num" ]; then line_num=$(grep Source[0-9]* -r $spec -n|tail -1|cut -d':' -f1) num=0 else # The first patch number - num=$(grep Patch[0-9]* $spec |tail -1|sed 's/Patch\([0-9]*\):.*/\1/') + num=$(grep "^Patch[0-9]*" $spec |sed 's/Patch\([0-9]*\):.*/\1/' |sort -n |tail -1) num=$(expr $num + 1) fi