summary refs log tree commit diff
diff options
context:
space:
mode:
authorVagrant Cascadian <vagrant@reproducible-builds.org>2020-02-07 16:06:17 -0800
committerVagrant Cascadian <vagrant@debian.org>2020-02-07 16:06:17 -0800
commitc526ddf482618edd22d0ad852e13f63c0477bb77 (patch)
tree381276bcca1e943b6db6bac83287860bab558e8e
parentd9e2f7b284f124b48b9fee150a3c06b5e0170049 (diff)
downloadguix-c526ddf482618edd22d0ad852e13f63c0477bb77.tar.gz
gnu: Add reprotest.
Added to diffoscope, to avoid triggering #37346.

* gnu/packages/diffoscope (reprotest): New variable.
* gnu/packages/patches/reprotest-support-guix.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add patch.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/diffoscope.scm68
-rw-r--r--gnu/packages/patches/reprotest-support-guix.patch79
3 files changed, 148 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index f105f11913..64ad653542 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1363,6 +1363,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/readline-link-ncurses.patch		\
   %D%/packages/patches/readline-6.2-CVE-2014-2524.patch		\
   %D%/packages/patches/reposurgeon-add-missing-docbook-files.patch	\
+  %D%/packages/patches/reprotest-support-guix.patch		\
   %D%/packages/patches/ri-li-modernize_cpp.patch		\
   %D%/packages/patches/ripperx-missing-file.patch		\
   %D%/packages/patches/rpcbind-CVE-2017-8779.patch		\
diff --git a/gnu/packages/diffoscope.scm b/gnu/packages/diffoscope.scm
index 534d859812..3b3540b5b0 100644
--- a/gnu/packages/diffoscope.scm
+++ b/gnu/packages/diffoscope.scm
@@ -44,6 +44,7 @@
   #:use-module (gnu packages java)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages llvm)
+  #:use-module (gnu packages man)
   #:use-module (gnu packages mono)
   #:use-module (gnu packages ocaml)
   #:use-module (gnu packages package-management)
@@ -224,6 +225,73 @@ Diffoscope has many optional dependencies; @code{diffoscope
 install.")
       (license license:gpl3+))))
 
+(define-public reprotest
+  (package
+    (name "reprotest")
+    (version "0.7.13")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://salsa.debian.org/reproducible-builds/reprotest.git")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (patches (search-patches "reprotest-support-guix.patch"))
+       (sha256
+        (base32
+         "0jj9sqxbdpypnc0y8md352wwzh1by6nyhmx5fwqnvrbznrng332f"))))
+    (inputs
+     `(("python-debian" ,python-debian)
+       ("python-distro" ,python-distro)
+       ("python-libarchive-c", python-libarchive-c)
+       ("python-rstr" ,python-rstr)))
+    (native-inputs
+     `(("diffoscope" ,diffoscope)
+       ("help2man" ,help2man)
+       ("libfaketime" ,libfaketime)
+       ("python-coverage" ,python-coverage)
+       ("python-docutils" ,python-docutils)
+       ("python-pytest " ,python-pytest)
+       ("python-tlsh" ,python-tlsh)
+       ("python-tox" ,python-tox)
+       ("unzip" ,unzip)
+       ("xxd" ,xxd)))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         ;; Neither glibc-locales nor glibc-utf8-locales have the C.UTF-8
+         ;; locale or several other locales used in reprotest.
+         (add-after 'unpack 'adjust-locales
+           (lambda _
+             (substitute* "reprotest/build.py"
+               (("'C.UTF-8'") "'en_US.UTF-8'")
+               (("'ru_RU.CP1251'") "'ru_RU.KOI8-R'")
+               (("'kk_KZ.RK1048'") "'kk_KZ'"))
+             (substitute* "reprotest/lib/adt_testbed.py"
+               (("export LANG=C.UTF-8") "export LANG=en_US.UTF-8"))
+             #t))
+         (add-after 'install 'install-doc
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((mandir1 (string-append
+                              (assoc-ref outputs "out") "/share/man/man1"))
+                    (docdir (string-append
+                             (assoc-ref outputs "out") "/share/doc/" ,name "-" ,version)))
+               (invoke "make" "-C" "doc")
+               (mkdir-p mandir1)
+               (install-file "doc/reprotest.1" mandir1)
+               (mkdir-p docdir)
+               (install-file "./README.rst" docdir)
+               (install-file "./README-dev.rst" docdir))
+             #t)))))
+    (home-page "https://salsa.debian.org/reproducible-builds/reprotest")
+    (synopsis "Build software and check it for reproducibility")
+    (description "Reprotest builds the same source code twice in different
+environments, and then checks the binaries produced by each build for
+differences.  If any are found, then diffoscope or diff is used to display
+them in detail for later analysis.")
+    (license (list license:gpl3+ license:gpl2+))))
+
 (define-public trydiffoscope
  (package
    (name "trydiffoscope")
diff --git a/gnu/packages/patches/reprotest-support-guix.patch b/gnu/packages/patches/reprotest-support-guix.patch
new file mode 100644
index 0000000000..621c4e3359
--- /dev/null
+++ b/gnu/packages/patches/reprotest-support-guix.patch
@@ -0,0 +1,79 @@
+From 31bd4fe777cbff3ebca74115e5735a8b8f584fa7 Mon Sep 17 00:00:00 2001
+From: Vagrant Cascadian <vagrant@reproducible-builds.org>
+Date: Thu, 6 Feb 2020 23:17:58 -0800
+Subject: [PATCH] Add support for GNU Guix.
+
+---
+ reprotest/lib/adt_testbed.py           |  2 ++
+ reprotest/lib/system_interface/guix.py | 39 ++++++++++++++++++++++++++
+ 2 files changed, 41 insertions(+)
+ create mode 100644 reprotest/lib/system_interface/guix.py
+
+diff --git a/reprotest/lib/adt_testbed.py b/reprotest/lib/adt_testbed.py
+index ef704d6..60bf763 100644
+--- a/reprotest/lib/adt_testbed.py
++++ b/reprotest/lib/adt_testbed.py
+@@ -40,6 +40,7 @@ import urllib.parse
+ from reprotest.lib.system_interface.debian import DebianInterface
+ from reprotest.lib.system_interface.arch import ArchInterface
+ from reprotest.lib.system_interface.fedora import FedoraInterface
++from reprotest.lib.system_interface.guix import GuixInterface
+ from reprotest.lib import adtlog
+ from reprotest.lib import VirtSubproc
+ 
+@@ -47,6 +48,7 @@ SYSTEM_INTERFACES = {
+         'debian': DebianInterface,
+         'arch': ArchInterface,
+         'fedora': FedoraInterface,
++        'guix': GuixInterface,
+         }
+ 
+ timeouts = {
+diff --git a/reprotest/lib/system_interface/guix.py b/reprotest/lib/system_interface/guix.py
+new file mode 100644
+index 0000000..2b06104
+--- /dev/null
++++ b/reprotest/lib/system_interface/guix.py
+@@ -0,0 +1,39 @@
++# adt_testbed.py is part of autopkgtest
++# autopkgtest is a tool for testing Debian binary packages. The
++# system_interface module is an addition for reprotest to make
++# this module distro-agnostic
++#
++# autopkgtest is Copyright (C) 2006-2015 Canonical Ltd.
++# the system_interface module is Copyright (C) 2017 Santiago Torres-Arias
++#
++# This program 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 2 of the License, or
++# (at your option) any later version.
++#
++# This program 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 this program; if not, write to the Free Software
++# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++#
++# See the file CREDITS for a full list of credits information (often
++# installed as /usr/share/doc/autopkgtest/CREDITS).
++import subprocess
++
++from . import SystemInterface
++
++class GuixInterface(SystemInterface):
++    """
++        SystemInterface implementation for GNU Guix hosts. Contains commands that
++        are specific to the GNU Guix toolchain.
++    """
++
++    def get_arch(self):
++        return ['uname', '-m']
++
++    def can_query_packages(self):
++        return False
+-- 
+2.20.1
+