unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Makefile.am: add a target that lists patches no longer used
@ 2015-05-18 23:34 Cyril Roelandt
  2017-04-20 19:15 ` Leo Famulari
  0 siblings, 1 reply; 5+ messages in thread
From: Cyril Roelandt @ 2015-05-18 23:34 UTC (permalink / raw)
  To: guix-devel

* list-useless-patches.sh: New file.
* Makefile.am (check-for-useless-patches): New target.
---
 Makefile.am             |  3 +++
 list-useless-patches.sh | 27 +++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100755 list-useless-patches.sh

diff --git a/Makefile.am b/Makefile.am
index 6478aeb..293c27e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -388,6 +388,9 @@ assert-final-inputs-self-contained:
 	$(top_builddir)/pre-inst-env "$(GUILE)"				\
 	  "$(top_srcdir)/build-aux/check-final-inputs-self-contained.scm"
 
+check-for-useless-patches:
+	$(top_srcdir)/list-useless-patches.sh
+
 .PHONY: sync-descriptions gen-ChangeLog clean-go
 .PHONY: assert-no-store-file-names assert-binaries-available
 .PHONY: assert-final-inputs-self-contained
diff --git a/list-useless-patches.sh b/list-useless-patches.sh
new file mode 100755
index 0000000..5aae1bb
--- /dev/null
+++ b/list-useless-patches.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# GNU Guix --- Functional package management for GNU
+# Copyright © 2015 Cyril Roelandt <tipecaml@gmail.com>
+#
+# This file is part of GNU Guix.
+#
+# GNU Guix is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+#
+# GNU Guix is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+# This lists patches in gnu-system.am that are not used anywhere.
+for file in $(grep ".*\.patch" gnu-system.am | awk '{print $1}'); do
+	git grep -q $(basename $file) gnu/packages/
+	if [ "$?" -ne "0" ]; then
+		echo "$file is no longer needed"
+	fi
+done
-- 
1.8.4.rc3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Makefile.am: add a target that lists patches no longer used
  2015-05-18 23:34 [PATCH] Makefile.am: add a target that lists patches no longer used Cyril Roelandt
@ 2017-04-20 19:15 ` Leo Famulari
  2017-04-21  4:20   ` Eric Bavier
  0 siblings, 1 reply; 5+ messages in thread
From: Leo Famulari @ 2017-04-20 19:15 UTC (permalink / raw)
  To: Cyril Roelandt; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 197 bytes --]

On Tue, May 19, 2015 at 01:34:10AM +0200, Cyril Roelandt wrote:
> * list-useless-patches.sh: New file.
> * Makefile.am (check-for-useless-patches): New target.

We should make use of this somehow!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Makefile.am: add a target that lists patches no longer used
  2017-04-20 19:15 ` Leo Famulari
@ 2017-04-21  4:20   ` Eric Bavier
  2017-04-21 17:41     ` Leo Famulari
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Bavier @ 2017-04-21  4:20 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 4187 bytes --]

On Thu, 20 Apr 2017 15:15:46 -0400
Leo Famulari <leo@famulari.name> wrote:

> On Tue, May 19, 2015 at 01:34:10AM +0200, Cyril Roelandt wrote:
> > * list-useless-patches.sh: New file.
> > * Makefile.am (check-for-useless-patches): New target.  
> 
> We should make use of this somehow!

Attached is my own shot at this.  It does not make use of git, so
should be fine as a regular test.  It doesn't check whether the files
listed in dist_patch_DATA actually exist, because `make dist` already
checks that.  I suppose it might be nice, if git a git checkout, to
check whether the used patches are all known to git...

Anyhow, currently the test fails with the following log output:

-----------BEGIN test-suite.log----------------
FAIL: tests/patches
===================

test-name: distributed patches are used
location: /home/bavier/projects/guix/tests/patches.scm:50
source:
+ (test-equal
+   "distributed patches are used"
+   '()
+   (lset-difference
+     string=?
+     distributed-patches
+     used-patches))
expected-value: ()
actual-value: ("/home/bavier/projects/guix/gnu/packages/patches/ath9k-htc-firmware-binutils.patch" "/home/bavier/projects/guix/gnu/packages/patches/ath9k-htc-firmware-gcc.patch" "/home/bavier/projects/guix/gnu/packages/patches/coreutils-cut-huge-range-test.patch" "/home/bavier/projects/guix/gnu/packages/patches/gawk-shell.patch" "/home/bavier/projects/guix/gnu/packages/patches/gcc-libiberty-printf-decl.patch" "/home/bavier/projects/guix/gnu/packages/patches/gcc-4.9.3-mingw-gthr-default.patch" "/home/bavier/projects/guix/gnu/packages/patches/gcj-arm-mode.patch" "/home/bavier/projects/guix/gnu/packages/patches/glibc-bootstrap-system.patch" "/home/bavier/projects/guix/gnu/packages/patches/grub-CVE-2015-8370.patch" "/home/bavier/projects/guix/gnu/packages/patches/grub-gets-undeclared.patch" "/home/bavier/projects/guix/gnu/packages/patches/grub-freetype.patch" "/home/bavier/projects/guix/gnu/packages/patches/guile-arm-fixes.patch" "/home/bavier/projects/guix/gnu/packages/patches/icu4c-CVE-2017-7867-CVE-2017-7868.patch" "/home/bavier/projects/guix/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch" "/home/bavier/projects/guix/gnu/packages/patches/ldc-disable-tests.patch" "/home/bavier/projects/guix/gnu/packages/patches/ldc-1.1.0-disable-dmd-tests.patch" "/home/bavier/projects/guix/gnu/packages/patches/ldc-1.1.0-disable-phobos-tests.patch" "/home/bavier/projects/guix/gnu/packages/patches/libgit2-use-after-free.patch" "/home/bavier/projects/guix/gnu/packages/patches/libxslt-CVE-2016-4738.patch" "/home/bavier/projects/guix/gnu/packages/patches/mplayer2-theora-fix.patch" "/home/bavier/projects/guix/gnu/packages/patches/patchelf-rework-for-arm.patch" "/home/bavier/projects/guix/gnu/packages/patches/pcre-CVE-2017-7186.patch" "/home/bavier/projects/guix/gnu/packages/patches/perl-net-ssleay-disable-ede-test.patch" "/home/bavier/projects/guix/gnu/packages/patches/readline-7.0-mingw.patch" "/home/bavier/projects/guix/gnu/packages/patches/soprano-find-clucene.patch" "/home/bavier/projects/guix/gnu/packages/patches/texlive-texmf-CVE-2016-10243.patch" "/home/bavier/projects/guix/gnu/packages/patches/util-linux-CVE-2017-2616.patch" "/home/bavier/projects/guix/gnu/packages/patches/xf86-video-ast-remove-mibstore.patch" "/home/bavier/projects/guix/gnu/packages/patches/xf86-video-intel-compat-api.patch" "/home/bavier/projects/guix/gnu/packages/patches/xf86-video-intel-glibc-2.20.patch")
result: FAIL

test-name: used patches are distributed
location: /home/bavier/projects/guix/tests/patches.scm:54
source:
+ (test-equal
+   "used patches are distributed"
+   '()
+   (lset-difference
+     string=?
+     used-patches
+     distributed-patches))
expected-value: ()
actual-value: ("/home/bavier/projects/guix/gnu/packages/patches/python-pbr-fix-man-page-support.patch" "/home/bavier/projects/guix/gnu/packages/patches/jacal-fix-texinfo.patch" "/home/bavier/projects/guix/gnu/packages/patches/vsearch-unbundle-cityhash.patch" "/home/bavier/projects/guix/gnu/packages/patches/hmmer-remove-cpu-specificity.patch")
result: FAIL
--------------END test-suite.log-----------------

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-tests-Add-patch-use-test.patch --]
[-- Type: text/x-patch, Size: 3387 bytes --]

From 751f10e180994db6c0df722c2b226e174d3b7a28 Mon Sep 17 00:00:00 2001
From: Eric Bavier <bavier@member.fsf.org>
Date: Thu, 20 Apr 2017 23:17:14 -0500
Subject: [PATCH] tests: Add patch use test.

* tests/patches.scm: New test.
* Makefile.am (SCM_TESTS): Add it.
(AM_TESTS_ENVIRONMENT): Export dist_patch_DATA.
---
 Makefile.am       |  8 ++++++--
 tests/patches.scm | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 2 deletions(-)
 create mode 100644 tests/patches.scm

diff --git a/Makefile.am b/Makefile.am
index a997ed8b9..5cd9be814 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -307,7 +307,8 @@ SCM_TESTS =					\
   tests/scripts-build.scm			\
   tests/containers.scm				\
   tests/pack.scm				\
-  tests/import-utils.scm
+  tests/import-utils.scm			\
+  tests/patches.scm
 
 if HAVE_GUILE_JSON
 
@@ -343,7 +344,10 @@ endif BUILD_DAEMON
 
 TESTS = $(SCM_TESTS) $(SH_TESTS)
 
-AM_TESTS_ENVIRONMENT = abs_top_srcdir="$(abs_top_srcdir)" GUILE_AUTO_COMPILE=0
+AM_TESTS_ENVIRONMENT = \
+  abs_top_srcdir="$(abs_top_srcdir)" \
+  dist_patch_DATA="$(dist_patch_DATA)" \ #for tests/patches.scm
+  GUILE_AUTO_COMPILE=0
 
 SCM_LOG_DRIVER =				\
   $(top_builddir)/test-env --quiet-stderr	\
diff --git a/tests/patches.scm b/tests/patches.scm
new file mode 100644
index 000000000..4c5a0c44a
--- /dev/null
+++ b/tests/patches.scm
@@ -0,0 +1,54 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (test-patches)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-64)
+  #:use-module (gnu packages)
+  #:use-module (guix packages)
+  #:use-module (guix sets)) 
+
+\f
+(define used-patches
+  (set->list
+   (fold-packages 
+    (lambda (package result) 
+      (set-union result 
+                 (list->set 
+                  (or (and=> (package-source package) 
+                             (lambda (o) 
+                               (filter string? ;ignore origin patches
+                                       (origin-patches o)))) 
+                      (list))))) 
+    (set))))
+
+(define distributed-patches
+  (map (λ (s) (string-append (getenv "abs_top_srcdir") "/" s))
+       (remove string-null? (string-split (getenv "dist_patch_DATA") #\space))))
+
+(test-begin "patches")
+
+(test-equal "distributed patches are used"
+  '()
+  (lset-difference string=? distributed-patches used-patches))
+
+(test-equal "used patches are distributed"
+  '()
+  (lset-difference string=? used-patches distributed-patches))
+
+(test-end)
-- 
2.12.2


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Makefile.am: add a target that lists patches no longer used
  2017-04-21  4:20   ` Eric Bavier
@ 2017-04-21 17:41     ` Leo Famulari
  2017-07-19 23:02       ` Ben Woodcroft
  0 siblings, 1 reply; 5+ messages in thread
From: Leo Famulari @ 2017-04-21 17:41 UTC (permalink / raw)
  To: Eric Bavier; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 3406 bytes --]

On Thu, Apr 20, 2017 at 11:20:23PM -0500, Eric Bavier wrote:
> Attached is my own shot at this.  It does not make use of git, so
> should be fine as a regular test.  It doesn't check whether the files
> listed in dist_patch_DATA actually exist, because `make dist` already
> checks that.  I suppose it might be nice, if git a git checkout, to
> check whether the used patches are all known to git...

I do think it's better to avoid depending on Git here.

> -----------BEGIN test-suite.log----------------
> FAIL: tests/patches
> ===================
> 
> test-name: distributed patches are used
> location: /home/bavier/projects/guix/tests/patches.scm:50
> source:
> + (test-equal
> +   "distributed patches are used"
> +   '()
> +   (lset-difference
> +     string=?
> +     distributed-patches
> +     used-patches))
> expected-value: ()
> actual-value: ("/home/bavier/projects/guix/gnu/packages/patches/ath9k-htc-firmware-binutils.patch" "/home/bavier/projects/guix/gnu/packages/patches/ath9k-htc-firmware-gcc.patch" "/home/bavier/projects/guix/gnu/packages/patches/coreutils-cut-huge-range-test.patch" "/home/bavier/projects/guix/gnu/packages/patches/gawk-shell.patch" "/home/bavier/projects/guix/gnu/packages/patches/gcc-libiberty-printf-decl.patch" "/home/bavier/projects/guix/gnu/packages/patches/gcc-4.9.3-mingw-gthr-default.patch" "/home/bavier/projects/guix/gnu/packages/patches/gcj-arm-mode.patch" "/home/bavier/projects/guix/gnu/packages/patches/glibc-bootstrap-system.patch" "/home/bavier/projects/guix/gnu/packages/patches/grub-CVE-2015-8370.patch" "/home/bavier/projects/guix/gnu/packages/patches/grub-gets-undeclared.patch" "/home/bavier/projects/guix/gnu/packages/patches/grub-freetype.patch" "/home/bavier/projects/guix/gnu/packages/patches/guile-arm-fixes.patch" "/home/bavier/projects/guix/gnu/packages/patches/icu4c-CVE-2017-7867-CVE-2017-7868.patch" "/home/bavier/projects/guix/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch" "/home/bavier/projects/guix/gnu/packages/patches/ldc-disable-tests.patch" "/home/bavier/projects/guix/gnu/packages/patches/ldc-1.1.0-disable-dmd-tests.patch" "/home/bavier/projects/guix/gnu/packages/patches/ldc-1.1.0-disable-phobos-tests.patch" "/home/bavier/projects/guix/gnu/packages/patches/libgit2-use-after-free.patch" "/home/bavier/projects/guix/gnu/packages/patches/libxslt-CVE-2016-4738.patch" "/home/bavier/projects/guix/gnu/packages/patches/mplayer2-theora-fix.patch" "/home/bavier/projects/guix/gnu/packages/patches/patchelf-rework-for-arm.patch" "/home/bavier/projects/guix/gnu/packages/patches/pcre-CVE-2017-7186.patch" "/home/bavier/projects/guix/gnu/packages/patches/perl-net-ssleay-disable-ede-test.patch" "/home/bavier/projects/guix/gnu/packages/patches/readline-7.0-mingw.patch" "/home/bavier/projects/guix/gnu/packages/patches/soprano-find-clucene.patch" "/home/bavier/projects/guix/gnu/packages/patches/texlive-texmf-CVE-2016-10243.patch" "/home/bavier/projects/guix/gnu/packages/patches/util-linux-CVE-2017-2616.patch" "/home/bavier/projects/guix/gnu/packages/patches/xf86-video-ast-remove-mibstore.patch" "/home/bavier/projects/guix/gnu/packages/patches/xf86-video-intel-compat-api.patch" "/home/bavier/projects/guix/gnu/packages/patches/xf86-video-intel-glibc-2.20.patch")

At least one of these is a false positive:
icu4c-CVE-2017-7867-CVE-2017-7868.patch

It's used in a grafted package.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Makefile.am: add a target that lists patches no longer used
  2017-04-21 17:41     ` Leo Famulari
@ 2017-07-19 23:02       ` Ben Woodcroft
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Woodcroft @ 2017-07-19 23:02 UTC (permalink / raw)
  To: Leo Famulari, Eric Bavier; +Cc: guix-devel

Hi Eric,


On 22/04/17 03:41, Leo Famulari wrote:
> On Thu, Apr 20, 2017 at 11:20:23PM -0500, Eric Bavier wrote:
>
>> -----------BEGIN test-suite.log----------------
>> FAIL: tests/patches
>> ===================
>>
>> test-name: distributed patches are used
>> location: /home/bavier/projects/guix/tests/patches.scm:50
>> source:
>> + (test-equal
>> +   "distributed patches are used"
>> +   '()
>> +   (lset-difference
>> +     string=?
>> +     distributed-patches
>> +     used-patches))
>> expected-value: ()
>> actual-value: ("/home/bavier/projects/guix/gnu/packages/patches/ath9k-htc-firmware-binutils.patch" "/home/bavier/projects/guix/gnu/packages/patches/ath9k-htc-firmware-gcc.patch" "/home/bavier/projects/guix/gnu/packages/patches/coreutils-cut-huge-range-test.patch" "/home/bavier/projects/guix/gnu/packages/patches/gawk-shell.patch" "/home/bavier/projects/guix/gnu/packages/patches/gcc-libiberty-printf-decl.patch" "/home/bavier/projects/guix/gnu/packages/patches/gcc-4.9.3-mingw-gthr-default.patch" "/home/bavier/projects/guix/gnu/packages/patches/gcj-arm-mode.patch" "/home/bavier/projects/guix/gnu/packages/patches/glibc-bootstrap-system.patch" "/home/bavier/projects/guix/gnu/packages/patches/grub-CVE-2015-8370.patch" "/home/bavier/projects/guix/gnu/packages/patches/grub-gets-undeclared.patch" "/home/bavier/projects/guix/gnu/packages/patches/grub-freetype.patch" "/home/bavier/projects/guix/gnu/packages/patches/guile-arm-fixes.patch" "/home/bavier/projects/guix/gnu/packages/patches/icu4c-CVE-2017-7867-CVE-2017-7868.patch" "/home/bavier/projects/guix/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch" "/home/bavier/projects/guix/gnu/packages/patches/ldc-disable-tests.patch" "/home/bavier/projects/guix/gnu/packages/patches/ldc-1.1.0-disable-dmd-tests.patch" "/home/bavier/projects/guix/gnu/packages/patches/ldc-1.1.0-disable-phobos-tests.patch" "/home/bavier/projects/guix/gnu/packages/patches/libgit2-use-after-free.patch" "/home/bavier/projects/guix/gnu/packages/patches/libxslt-CVE-2016-4738.patch" "/home/bavier/projects/guix/gnu/packages/patches/mplayer2-theora-fix.patch" "/home/bavier/projects/guix/gnu/packages/patches/patchelf-rework-for-arm.patch" "/home/bavier/projects/guix/gnu/packages/patches/pcre-CVE-2017-7186.patch" "/home/bavier/projects/guix/gnu/packages/patches/perl-net-ssleay-disable-ede-test.patch" "/home/bavier/projects/guix/gnu/packages/patches/readline-7.0-mingw.patch" "/home/bavier/projects/guix/gnu/packages/patches/soprano-find-clucene.patch" "/home/bavier/projects/guix/gnu/packages/patches/texlive-texmf-CVE-2016-10243.patch" "/home/bavier/projects/guix/gnu/packages/patches/util-linux-CVE-2017-2616.patch" "/home/bavier/projects/guix/gnu/packages/patches/xf86-video-ast-remove-mibstore.patch" "/home/bavier/projects/guix/gnu/packages/patches/xf86-video-intel-compat-api.patch" "/home/bavier/projects/guix/gnu/packages/patches/xf86-video-intel-glibc-2.20.patch")
> At least one of these is a false positive:
> icu4c-CVE-2017-7867-CVE-2017-7868.patch
>> test-name: used patches are distributed
>> location: /home/bavier/projects/guix/tests/patches.scm:54
>> source:
>> + (test-equal
>> +   "used patches are distributed"
>> +   '()
>> +   (lset-difference
>> +     string=?
>> +     used-patches
>> +     distributed-patches))
>> expected-value: ()
>> actual-value: ("/home/bavier/projects/guix/gnu/packages/patches/python-pbr-fix-man-page-support.patch" "/home/bavier/projects/guix/gnu/packages/patches/jacal-fix-texinfo.patch" "/home/bavier/projects/guix/gnu/packages/patches/vsearch-unbundle-cityhash.patch" "/home/bavier/projects/guix/gnu/packages/patches/hmmer-remove-cpu-specificity.patch")
>> result: FAIL
>>
While the first of these tests might not be ready, this second one seems 
to be - I was just burned by a mistake of my own that this test would 
have picked up. I added all 4 reported patches in to the set of 
distributed patches in ca8fb248d, but shall we add this second test in too?

Thanks, ben.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-07-19 23:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-18 23:34 [PATCH] Makefile.am: add a target that lists patches no longer used Cyril Roelandt
2017-04-20 19:15 ` Leo Famulari
2017-04-21  4:20   ` Eric Bavier
2017-04-21 17:41     ` Leo Famulari
2017-07-19 23:02       ` Ben Woodcroft

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).