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

redhat: use new genlog.sh script to detect changes for dist-release

The current dist-release process has a flaw, where both its subtargets
(dist-release-changed and dist-release-finish) depends on setup-source
target to run (so genspec.sh is run twice). To avoid having to do the
work twice and do and revert changes before dist-release-finish is
called, we now detect changes by creating the changelog using genlog.sh
first to detect if there are really changes, and do the marker check
using an if condition instead of relying on git to see if there are
changes.

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

diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -572,18 +572,18 @@ dist-rpm-baseonly: dist-sources do-rpmbuild
 # unless you know what you're doing, you don't want to use the next four ones
 dist-release-finish: setup-source
        @cp $(SOURCES)/$(SPECCHANGELOG) $(REDHAT)/$(SPECCHANGELOG)
+       @echo $(MARKER) > $(REDHAT)/marker
        @$(GIT) add $(REDHAT)/$(SPECCHANGELOG)
        @$(GIT) add $(REDHAT)/marker
        @$(GIT) commit -s ../Makefile.rhelver $(REDHAT)/marker 
$(REDHAT)/$(SPECCHANGELOG) $(SPECFILE).template -m "[redhat] $(RELEASETAG)"
-dist-release-changed: setup-source
-       @cp $(SOURCES)/$(SPECCHANGELOG) $(REDHAT)/$(SPECCHANGELOG)
-       @echo $(MARKER) > $(REDHAT)/marker
-       @# if neither changelog nor marker was updated, skip bumping a release
-       @$(GIT) update-index -q --really-refresh
-       @if $(GIT) diff-index --quiet HEAD; then \
+dist-release-changed:
+       @CLOGF="$$(mktemp)"; \
+       trap 'rm -f "$$CLOGF"' SIGHUP SIGINT SIGTERM EXIT; \
+       $(REDHAT)/genlog.sh "$$CLOGF"; \
+       if [ "$(MARKER)" == "$$(cat $(REDHAT)/marker)" ] && \
+          [ "$$(wc -l $$CLOGF | cut -d ' ' -f 1)" -le 3 ]; then \
                echo "Nothing changed, skipping updates"; \
        else \
-               $(GIT) checkout -- $(REDHAT)/$(SPECCHANGELOG); \
                $(REDHAT)/scripts/new_release.sh; \
                $(MAKE) dist-release-finish; \
        fi

--
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