From: Ondrej Mosnacek <[email protected]>

redhat/Makefile: fix setup-source and document its caveat

The current definition of setup-source is racy, since it may cause
dist-clean-sources and _setup-source to be "built" in parallel and the
former caould then remove the results of the latter. Fix it to ensure
the right ordering and document the condition that must be preserved to
keep dist-clean-sources from racing with other targets.

Signed-off-by: Ondrej Mosnacek <[email protected]>

diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -638,7 +638,11 @@ dist-get-buildreqs: setup-source
                echo "PASS: All build dependencies found."; \
        fi
 
-_setup-source: dist-git-version-check
+# IMPORTANT: All targets whose recipes read/modify files under $(SOURCES)
+# MUST depend on setup-source (at least indirectly). Otherwise such
+# recipes may be ordered before/in parallel with dist-clean-sources
+# (prerequisite of setup-source), which would then delete their results.
+setup-source: dist-clean-sources dist-git-version-check
        @if [ ! -e $(REDHAT)/$(SPECFILE).template ]; then \
                echo "Creating $(REDHAT)/$(SPECFILE).template as a copy of 
$(REDHAT)/kernel.spec.template"; \
                cp $(REDHAT)/kernel.spec.template 
$(REDHAT)/$(SPECFILE).template; \
@@ -660,8 +664,6 @@ _setup-source: dist-git-version-check
        @$(REDHAT)/scripts/genspec/genspec.sh
        @cp $(SOURCES)/$(SPECFILE) $(SOURCES)/../SPECS/
 
-setup-source: dist-clean-sources _setup-source
-
 generate-testpatch-tmp:
        @$(GIT) diff --no-renames HEAD ":(exclude,top).get_maintainer.conf" \
                ":(exclude,top).gitattributes" \

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2892
--
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
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/[email protected]
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to