[OS-BUILD PATCHv5 2/9] redhat: don't hardcode temporary changelog file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Herton R. Krzesinski <herton@xxxxxxxxxx>

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 <herton@xxxxxxxxxx>

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@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux