From: Herton R. Krzesinski <her...@redhat.com>

redhat: move changelog addition to the spec file back into genspec.sh

In the next change, we want to detect at the Makefile level if we have new
changelog entries before we touch the spec file, so it makes sense to have
changelog addition being done in genspec.sh.

Signed-off-by: Herton R. Krzesinski <her...@redhat.com>

diff --git a/redhat/genlog.sh b/redhat/genlog.sh
index blahblah..blahblah 100755
--- a/redhat/genlog.sh
+++ b/redhat/genlog.sh
@@ -36,13 +36,13 @@ git log --topo-order --no-merges -z "$GIT_NOTES" 
"$GIT_FORMAT" \
 
 if [ "$HIDE_REDHAT" = "1" ]; then
        grep -v -e "^- \[redhat\]" "$clogf" |
-               sed -e 's!\[Fedora\]!!g' > "$clogf.stripped"
-       cp "$clogf.stripped" "$clogf"
+               sed -e 's!\[Fedora\]!!g' > "$clogf.tmp"
+       mv -f "$clogf.tmp" "$clogf"
 fi
 
 if [ "$HIDE_UNSUPPORTED_ARCH" = "1" ]; then
-       grep -E -v "^- 
\[(alpha|arc|arm|avr32|blackfin|c6x|cris|frv|h8300|hexagon|ia64|m32r|m68k|metag|microblaze|mips|mn10300|openrisc|parisc|score|sh|sparc|tile|um|unicore32|xtensa)\]"
 "$clogf" > "$clogf.stripped"
-       cp "$clogf.stripped" "$clogf"
+       grep -E -v "^- 
\[(alpha|arc|arm|avr32|blackfin|c6x|cris|frv|h8300|hexagon|ia64|m32r|m68k|metag|microblaze|mips|mn10300|openrisc|parisc|score|sh|sparc|tile|um|unicore32|xtensa)\]"
 "$clogf" > "$clogf.tmp"
+       mv -f "$clogf.tmp" "$clogf"
 fi
 
 # If the markers aren't the same then this a rebase.
@@ -60,17 +60,4 @@ if [ "$LENGTH" = 0 ]; then
        echo -n > "$clogf"
 fi
 
-cat "$clogf" "$SOURCES/$SPECCHANGELOG" > "$clogf.full"
-mv -f "$clogf.full" "$SOURCES/$SPECCHANGELOG"
-
-# genlog.py generates Resolves lines as well, strip these from RPM changelog
-grep -v -e "^Resolves: " "$SOURCES/$SPECCHANGELOG" > "$clogf".stripped
-
-test -f "$SOURCES/$SPECFILE" &&
-       sed -i -e "
-       /%%SPECCHANGELOG%%/r $clogf.stripped
-       /%%SPECCHANGELOG%%/d" "$SOURCES/$SPECFILE"
-
 echo "MARKER is $MARKER"
-
-rm -f "$clogf".stripped;
diff --git a/redhat/genspec.sh b/redhat/genspec.sh
index blahblah..blahblah 100755
--- a/redhat/genspec.sh
+++ b/redhat/genspec.sh
@@ -88,9 +88,20 @@ if [ -n "$RHSELFTESTDATA" ]; then
 fi
 
 clogf=$(mktemp)
-trap 'rm -f "$clogf"' SIGHUP SIGINT SIGTERM EXIT
+trap 'rm -f "$clogf" "$clogf".stripped' SIGHUP SIGINT SIGTERM EXIT
 "${0%/*}"/genlog.sh "$clogf"
 
+cat "$clogf" "$SOURCES/$SPECCHANGELOG" > "$clogf.full"
+mv -f "$clogf.full" "$SOURCES/$SPECCHANGELOG"
+
+# genlog.py generates Resolves lines as well, strip these from RPM changelog
+grep -v -e "^Resolves: " "$SOURCES/$SPECCHANGELOG" > "$clogf".stripped
+
+test -f "$SOURCES/$SPECFILE" &&
+       sed -i -e "
+       /%%SPECCHANGELOG%%/r $clogf.stripped
+       /%%SPECCHANGELOG%%/d" "$SOURCES/$SPECFILE"
+
 if [ "$DISTRO" == "fedora" ]; then
        # The tarball in the SRPM contains only the upstream sources.
 

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1980
_______________________________________________
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to