]> sourceware.org Git - systemtap.git/commitdiff
Move %changelog pruning into diff check block
authorLukas Berk <lberk@redhat.com>
Fri, 23 Aug 2013 19:05:30 +0000 (15:05 -0400)
committerLukas Berk <lberk@redhat.com>
Fri, 23 Aug 2013 19:05:30 +0000 (15:05 -0400)
If there is no spec diff, then there's no need to even check for a
difference in the %changelog section.  Furthermore we should check
that there is even a %changelog section in the diff and only attempt
to prune accordingly

scripts/spin-rawhide - move pruning into file check statements

scripts/spin-rawhide

index cc7643d52ea4cb04578c830374d58ac09ed9664f..70e423d3f3358b89c01d40285eee8703fdf19039 100755 (executable)
@@ -55,15 +55,18 @@ cd systemtap
 
 git diff systemtap.spec ../systemtap-git/systemtap.spec > ../spec-diff
 
-# We don't need to know the difference in spec changelogs
-# changelogs should only ever grow, make sure we also trim the %changelog
-# context lines as well
-
-sed -i '/\%changelog/,$d' ../spec-diff
-tac ../spec-diff | sed '1,3d' | tac > spec-diff
-mv spec-diff ../spec-diff
-
 if [ -s ../spec-diff ]; then
+    CHANGELOG_PRESENT=`grep \%changelog ../spec-diff`
+    # the space in front of %changelog is because its a diff context line
+    if [ "$CHANGELOG_PRESENT" == " %changelog" ]; then
+       # We don't need to know the difference in spec changelogs
+       # changelogs should only ever grow, make sure we also trim the %changelog
+       # context lines as well
+       sed -i '/\%changelog/,$d' ../spec-diff
+       tac ../spec-diff | sed '1,3d' | tac > spec-diff
+       mv spec-diff ../spec-diff
+    fi
+    # end changelog diff if
     cat ../spec-diff
     echo "The above changes will apply to the fedora git tree,"
     echo "would you like to apply the patch? (yes/no):"
This page took 0.02634 seconds and 5 git commands to generate.