From: Lukas Berk Date: Fri, 23 Aug 2013 19:05:30 +0000 (-0400) Subject: Move %changelog pruning into diff check block X-Git-Tag: release-2.4~141 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=2e9858c93fd1719acad4af1b1473ea1549b0cb24;p=systemtap.git Move %changelog pruning into diff check block 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 --- diff --git a/scripts/spin-rawhide b/scripts/spin-rawhide index cc7643d52..70e423d3f 100755 --- a/scripts/spin-rawhide +++ b/scripts/spin-rawhide @@ -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):"