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

redhat: don't hardcode temporary changelog file

We always create a changelog file inside the sources directory, which
is temporary and always deleted at the end. Instead hardcoding the
temporary file name, create a real temporary file to be used with
genlog.sh script, given as its first argument.

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
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 LAST_MARKER=$(cat "${REDHAT}"/marker)
-clogf="$SOURCES/changelog"
+clogf="$1"
 # hide [redhat] entries from changelog
 HIDE_REDHAT=1;
 # hide entries for unsupported arches
@@ -70,8 +70,7 @@ fi
 # create empty file to avoid adding extra header to changelog
 LENGTH=$(grep -c "^-" "$clogf" | awk '{print $1}')
 if [ "$LENGTH" = 0 ]; then
-       rm -f "$clogf"
-       touch "$clogf"
+       echo -n > "$clogf"
 fi
 
 cat "$clogf" "$SOURCES/$SPECCHANGELOG" > "$clogf.full"
@@ -87,4 +86,4 @@ test -f "$SOURCES/$SPECFILE" &&
 
 echo "MARKER is $MARKER"
 
-rm -f "$clogf"{,.stripped};
+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
@@ -87,7 +87,9 @@ if [ -n "$RHSELFTESTDATA" ]; then
        exit 0
 fi
 
-"${0%/*}"/genlog.sh
+clogf=$(mktemp)
+trap 'rm -f "$clogf"' SIGHUP SIGINT SIGTERM EXIT
+"${0%/*}"/genlog.sh "$clogf"
 
 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