From: Don Zickus <[email protected]>

Long ago, we needed the ability to filter out files and directories
from patches.  Now that ability is built into git a few years ago,
let's use that instead of filterdiff.

One less tool to depend on and require.

Cc: Bastien Nocera <[email protected]>
Cc: Herton Krzesinski <[email protected]>
Signed-off-by: Don Zickus <[email protected]>
---
 redhat/Makefile        | 23 ++++++++++-------------
 redhat/Makefile.common |  1 -
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/redhat/Makefile b/redhat/Makefile
index 7130f4e25c8c..3fba4e7817ac 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -216,18 +216,17 @@ setup-source: dist-git-version-check dist-clean-sources
        @$(REDHAT)/genspec.sh $(SOURCES) $(SOURCES)/$(SPECFILE) 
$(SOURCES)/$(CHANGELOG) $(PKGRELEASE) $(RPMKVERSION) $(RPMKPATCHLEVEL) 
$(RPMKSUBLEVEL) $(DISTRO_BUILD) $(RELEASED_KERNEL) $(SPECRELEASE) $(__ZSTREAM) 
"$(BUILDOPTS)" $(MARKER) `cat $(REDHAT)/marker` $(SINGLE_TARBALL) 
$(TARFILE_RELEASE) $(SNAPSHOT) $(BUILDID)
        @cp $(SOURCES)/$(SPECFILE) $(SOURCES)/../SPECS/
 
-sources-rh: $(TARBALL)
+generate-testpatch-tmp:
+       @git diff --no-renames HEAD ":(exclude,top).get_maintainer.conf" \
+               ":(exclude,top).gitattributes" \
+               ":(exclude,top).gitignore" \
+               ":(exclude,top)makefile" \
+               ":(exclude,top)Makefile.rhelver" \
+               ":(exclude,top)redhat" > $(TESTPATCH).tmp
+
+sources-rh: $(TARBALL) generate-testpatch-tmp
        @cp -l $(TARBALL) $(SOURCES)/ || cp $(TARBALL) $(SOURCES)/
        @touch $(TESTPATCH)
-       @git diff --no-renames HEAD > $(TESTPATCH).tmp
-       @# 1) filterdiff will return crap from the patches it just filtered,
-       @#    that's why egrep is needed so if there're changes under redhat/
-       @#    but not everywhere else, it will be empty just like
-       @#    linux-kernel-test.patch
-       @# 2) egrep -v will return "1" if it sucessfully removed index and diff
-       @#    lines, which will be considered an error
-       @($(FILTERDIFF) $(TESTPATCH).tmp | egrep -v "^index|^diff" 
>$(TESTPATCH).tmp2; true)
-       @mv $(TESTPATCH).tmp2 $(TESTPATCH).tmp
        @diff $(TESTPATCH).tmp $(TESTPATCH) > /dev/null || \
                echo "WARNING: There are uncommitted changes in your tree or 
the changes are not in sync with linux-kernel-test.patch.  Either commit the 
changes or run 'make dist-test-patch'"
        @rm $(TESTPATCH).tmp
@@ -264,9 +263,7 @@ sources-rh: $(TARBALL)
 
 dist-sources: setup-source dist-configs-check dist-kabi dist-kabi-dup 
sources-rh
 
-dist-test-patch:
-       @git diff --no-renames HEAD > $(TESTPATCH);
-       @($(FILTERDIFF) $(TESTPATCH) | egrep -v "^index|^diff" 
>$(TESTPATCH).tmp; true)
+dist-test-patch: generate-testpatch-tmp
        @mv $(TESTPATCH).tmp $(TESTPATCH);
 
 dist-all-rpms: dist-sources
diff --git a/redhat/Makefile.common b/redhat/Makefile.common
index b335f3c77c7d..fc3189b6948e 100644
--- a/redhat/Makefile.common
+++ b/redhat/Makefile.common
@@ -81,7 +81,6 @@ RPM:=$(REDHAT)/rpm
 SRPMS:=$(RPM)/SRPMS
 SOURCES:=$(RPM)/SOURCES
 TESTPATCH:=$(REDHAT)/linux-kernel-test.patch
-FILTERDIFF:=/usr/bin/filterdiff -x '*redhat/*' -x '*/.gitignore' -x 
'*/makefile' -x '*/Makefile'
 ARCH_LIST=aarch64 ppc64le s390x x86_64
 # Make can't match on a regex to match fc31, fc32 so add another check here
 # A unified tarball means that the tarball in the srpm contains both the
-- 
GitLab
_______________________________________________
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]

Reply via email to