aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2017, 2021 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2017–2022 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2018, 2019 Rutger Helling <rhelling@mykolab.com>
;;; Copyright © 2019 Vagrant Cascadian <vagrant@reproducible-builds.org>
;;; Copyright © 2022, 2023 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; 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 (gnu packages diffoscope)
  #:use-module (gnu packages)
  #:use-module (gnu packages acl)
  #:use-module (gnu packages admin)
  #:use-module (gnu packages android)
  #:use-module (gnu packages backup)
  #:use-module (gnu packages base)
  #:use-module (gnu packages bootloaders)
  #:use-module (gnu packages cdrom)
  #:use-module (gnu packages check)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages cpio)
  #:use-module (gnu packages dbm)
  #:use-module (gnu packages gettext)
  #:use-module (gnu packages ghostscript)
  #:use-module (gnu packages gnome)
  #:use-module (gnu packages gnupg)
  #:use-module (gnu packages haskell)
  #:use-module (gnu packages image)
  #:use-module (gnu packages imagemagick)
  #:use-module (gnu packages java)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages llvm)
  #:use-module (gnu packages man)
  #:use-module (gnu packages maths)
  #:use-module (gnu packages ocaml)
  #:use-module (gnu packages package-management)
  #:use-module (gnu packages pascal)
  #:use-module (gnu packages patchutils)
  #:use-module (gnu packages pdf)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages python-build)
  #:use-module (gnu packages python-check)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages sqlite)
  #:use-module (gnu packages ssh)
  #:use-module (gnu packages statistics)
  #:use-module (gnu packages textutils)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages video)
  #:use-module (gnu packages vim)
  #:use-module (gnu packages web)
  #:use-module (guix build-system python)
  #:use-module (guix build-system pyproject)
  #:use-module (guix gexp)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (ice-9 match))

(define-public diffoscope
  (package
    (name "diffoscope")
    (version "284")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://salsa.debian.org/reproducible-builds/diffoscope.git")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1nl5njb4harq4f3xks0fj92nwxkpfzywpkrakh7jy2l9ngic1vb2"))))
    (build-system python-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          ;; These tests are broken because our `file` package has a
          ;; bug in berkeley-db and wasm file type detection.
          (add-after 'unpack 'remove-broken-file-type-detection-test
            (lambda _
              (delete-file "tests/comparators/test_berkeley_db.py")
              (delete-file "tests/comparators/test_wasm.py")))
          (add-after 'unpack 'embed-tool-references
            (lambda* (#:key inputs #:allow-other-keys)
              (define (bin command)
                (search-input-file inputs (string-append "bin/" command)))
              (substitute* "diffoscope/comparators/utils/compare.py"
                (("\\[\"(xxd)\"," _ command)
                 (string-append "[\"" (bin command) "\",")))
              (substitute* "diffoscope/diff.py"
                (("@tool_required\\(\"diff\"\\)") "")
                (("get_tool_name\\(\"(diff)\"\\)" _ command)
                 (string-append "get_tool_name(\"" (bin command) "\")")))
              (substitute* "diffoscope/comparators/directory.py"
                (("@tool_required\\(\"stat\"\\)") "")
                (("@tool_required\\(\"getfacl\"\\)") "")
                (("\\[\"(stat)\"," _ command)
                 (string-append "[\"" (bin command) "\","))
                (("\\[\"(getfacl)\"," _ command)
                 (string-append "[\"" (bin command) "\",")))))
          (add-after 'build 'build-man-page
            (lambda _
              (invoke "make" "-C" "doc")))
          (add-before 'check 'writable-test-data
            (lambda _
              ;; Tests may need write access to tests directory.
              (for-each make-file-writable (find-files "tests"))))
          (add-before 'check 'fix-failing-test
            (lambda _
              ;; There is no user name mapping in the build environment.
              ;; Pytest made it so much harder than should be necessary,
              ;; so I'm leaving… this here in case I ever need it again:
              ;; (substitute* "tests/comparators/test_squashfs.py"
              ;;   (("^def test_symlink_root.*" match)     ; no, I don't
              ;;    (string-append                         ; know Python
              ;;     match "\n    raise ValueError("       ; why do you
              ;;     "differences_root[1].unified_diff)\n"))) ; ask
              (substitute* "tests/data/squashfs_root_expected_diff"
                (("root/root")
                 '"0/0      "))))
          (add-before 'check 'delete-failing-test
            ;; Please add new tests to fix-failing-test and not here ;-)
            (lambda _
              ;; This requires /sbin to be in $PATH.
              (delete-file "tests/test_tools.py")))
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               ;; Increase verbosity of tests and provide a summary
               (invoke "pytest" "-vv" "-r" "sxX"))))
          (add-after 'install 'install-man-page
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
                     (man (string-append out "/share/man/man1")))
                (install-file "doc/diffoscope.1" man)))))))
    (inputs (list rpm                   ;for rpm-python
                  python-debian
                  python-libarchive-c
                  python-magic
                  python-tlsh
                  acl                   ;for getfacl
                  coreutils             ;for stat
                  diffutils             ;for diff
                  xxd))
    (native-inputs
     (append
      (list help2man

            ;; Below are packages used for tests.
            binwalk
            python-pytest
            python-chardet
            python-h5py
            python-pypdf
            python-progressbar33

            abootimg
            bdb
            binutils
            bzip2
            cdrkit-libre
            colord
            cpio
            docx2txt
            dtc
            e2fsprogs
            ffmpeg)

      (match (%current-system)
        ;; fpc is only available on x86 currently.
        ((or "x86_64-linux" "i686-linux")
         (list fpc))
        (_ '()))

      (list gettext-minimal
            ghostscript
            `(,giflib "bin")
            gnumeric
            gnupg
            hdf5
            html2text
            imagemagick
            libarchive
            llvm
            lz4
            lzip
            ocaml
            odt2txt
            openssh
            openssl
            p7zip
            perl
            pgpdump
            poppler
            python-jsbeautifier
            r-minimal
            rpm
            sng
            sqlite
            squashfs-tools
            tcpdump
            u-boot-tools
            unzip
            wabt
            xxd
            xz
            zip
            zstd)

      ;; Also for tests.  The test suite skips tests when these are missing.
      (match (%current-system)
        ;; ghc is only available on x86 currently.
        ((or "x86_64-linux" "i686-linux")
         (list ghc))
        (_ '()))
      (match (%current-system)
        ;; openjdk and dependent packages are only
        ;; available on x86_64 currently.
        ((or "x86_64-linux")
         ;; No unversioned openjdk available.
         (list `(,openjdk12 "jdk")
               enjarify))
        (_ '()))))
    (home-page "https://diffoscope.org/")
    (synopsis "Compare files, archives, and directories in depth")
    (description
     "Diffoscope tries to get to the bottom of what makes files or directories
different.  It recursively unpacks archives of many kinds and transforms
various binary formats into more human readable forms to compare them.  It can
compare two tarballs, ISO images, or PDFs just as easily.

Diffoscope has many optional dependencies; @code{diffoscope
--list-missing-tools guix} will display optional packages to
install.")
    (license license:gpl3+)))

(define-public reprotest
  (package
    (name "reprotest")
    (version "0.7.28")
    (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))
       (sha256
        (base32 "06jm82w05qsx3wskch3fm5mpkpj5jmq7r4yram4ixprxc5j8flg8"))))
    (build-system pyproject-build-system)
    (arguments
     (list
      ;; TODO: all tests failed during creation: PermissionError: [Errno 13]
      ;; Permission denied.
      #:tests? #f
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'install 'install-doc
            (lambda _
              (let* ((mandir1 (string-append
                               #$output "/share/man/man1"))
                     (docdir (string-append
                              #$output "/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)))))))
    (native-inputs
     (list diffoscope
           help2man
           libfaketime
           python-docutils
           python-magic
           python-pytest
           python-setuptools
           python-tlsh
           python-wheel
           unzip
           xxd))
    (propagated-inputs
     (list python-debian
           python-distro
           python-libarchive-c
           python-rstr))
    (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")
    (version "67.0.8")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://salsa.debian.org/reproducible-builds/trydiffoscope.git")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0k698g4fws63rnav4pvfsf1hfds867xan59mmv5zw71r58lm6cxb"))))
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               (add-after 'install 'install-doc
                 (lambda _
                   (let* ((share (string-append #$output "/share/")))
                     (mkdir-p (string-append share "/man/man1/"))
                     (invoke "rst2man.py" "trydiffoscope.1.rst"
                             (string-append share "/man/man1/trydiffoscope.1"))
                     (mkdir-p (string-append
                               share "/doc/" #$name "-" #$version))
                     (install-file
                      "./README.rst"
                      (string-append share "/doc/" #$name "-" #$version))))))))
    (propagated-inputs
     (list python-requests))
    (native-inputs
     (list gzip python-docutils))
    (build-system python-build-system)
    (home-page "https://try.diffoscope.org")
    (synopsis "Client for remote diffoscope service")
    (description "This is a client for the @url{https://try.diffoscope.org,
remote diffoscope service}.

Diffoscope tries to get to the bottom of what makes files or directories
different.  It recursively unpacks archives of many kinds and transforms
various binary formats into more human readable forms to compare them.  It can
compare two tarballs, ISO images, or PDFs just as easily.

Results are displayed by default, stored as local text or html files, or made
available via a URL on @url{https://try.diffoscope.org}.  Results stored on the
server are purged after 30 days.")
    (license license:gpl3+)))
* gnu/system.scm (operating-system-bootcfg): Specify the Btrfs subvolume file name the store resides on to the `operating-system-bootcfg' procedure, using the new BTRFS-SUBVOLUME-FILE-NAME argument. * doc/guix.texi (File Systems): Add a Btrfs subsection to document the use of subvolumes. * gnu/tests/install.scm (%btrfs-root-on-subvolume-os) (%btrfs-root-on-subvolume-os-source) (%btrfs-root-on-subvolume-installation-script) (%test-btrfs-root-on-subvolume-os): New variables. Maxim Cournoyer 2020-05-19gnu: grub: Allow a PNG image and replace "aspect-ratio" with "resolution"....* gnu/bootloaders/grub.scm (<grub-image>): Remove this record and replace it by ... (<grub-theme>)[image]: ... this field with the default from %background-image, (<grub-theme>)[resolution]: ... this field with the defaults from 'width' and 'height' of 'grub-background-image'. (<grub-theme>)[images]: Remove this field. (svg->png): Rename to ... (image->png): ... and use 'copy-file' instead of 'svg->png', if the suffix of the image file is not ".svg". (grub-background-image): Remove the arguments 'width' and 'height'. (grub-theme-image): Add function. (grub-theme-resolution): Add function. (grub-theme-gfxmode): Add function. (grub-image): Remove function. (grub-image?): Remove function. (grub-image-aspect-ratio): Remove function. (grub-image-file): Remove function. (grub-theme-images): Remove function. (%default-theme): Remove variable. (%background-image): Remove variable. Using image formats different to SVG was not possible. For a <grub-image> to be chosen, the 'aspect-ratio' of it had to be 4/3, as the resolution of any image was defaulting to 1024 x 768. There was no code to determine the proper boot-resolution to make any use of a list of images with different aspect-ratios. It seems to be a better solution to only define a single image with any format, and use a given resolution only for the conversion from a SVG file. This also makes the use of a special <grub-image> record unnecessary. Moving the default values from '%background-image' and '%default-theme' into <grub-theme> makes a customisation easier without (inherit) and allows to remove the undocumented variables %background-image' and '%default-theme'. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> Stefan 2020-05-16bootloader: grub: Refer to the native 'grub-mklayout' and font file....* gnu/bootloader/grub.scm (eye-candy): Refer to the native FONT-FILE. (keyboard-layout-file): Refer to the native 'grub-mklayout'. Ludovic Courtès 2020-04-23Merge branch 'master' into core-updates... Conflicts: etc/news.scm gnu/local.mk gnu/packages/bootloaders.scm gnu/packages/linphone.scm gnu/packages/linux.scm gnu/packages/tls.scm gnu/system.scm Marius Bakke 2020-04-20gnu: Add u-boot-pinebook-pro-rk3399....* gnu/packages/bootloaders (u-boot-pinebook-pro-rk3399): New variable. * gnu/packages/patches/u-boot-DT-for-Pinebook-Pro.patch: New file. * gnu/packages/patches/u-boot-add-boe-nv140fhmn49-display.patch: New file. * gnu/packages/patches/u-boot-gpio-keys-binding-cons.patch: New file. * gnu/packages/patches/u-boot-leds-common-binding-con.patch: New file. * gnu/packages/patches/u-boot-support-Pinebook-Pro-laptop.patch: New file. * gnu/packages/patches/u-boot-video-rockchip-fix-build.patch: New file. * gnu/local.mk (dist_patch_DATA): Add new patches. * gnu/bootloader/u-boot.scm (install-pinebook-pro-rk3399-u-boot, u-boot-pinebook-pro-rk3399-bootloader): New variable. Co-authored-by: Jan Nieuwenhuizen <janneke@gnu.org> Vagrant Cascadian 2020-04-08Merge branch 'master' into core-updates... Conflicts: etc/news.scm gnu/local.mk gnu/packages/check.scm gnu/packages/cross-base.scm gnu/packages/gimp.scm gnu/packages/java.scm gnu/packages/mail.scm gnu/packages/sdl.scm gnu/packages/texinfo.scm gnu/packages/tls.scm gnu/packages/version-control.scm Marius Bakke 2020-04-06system: Allow for comma-separated keyboard layouts....Reported by Florian Pelz <pelzflorian@pelzflorian.de>. * gnu/bootloader/grub.scm (keyboard-layout-file): Replace commas with hyphens in the first argument to 'computed-file'. * gnu/system/keyboard.scm (keyboard-layout->console-keymap): Likewise. * doc/guix.texi (Keyboard Layout): Add example. Ludovic Courtès 2020-03-29gnu: bootloader: Add grub-minimal-bootloader....* gnu/bootloader/grub.scm (grub-minimal-bootloader): New variable. Jan Nieuwenhuizen 2020-03-17bootloader: grub: Refactor eye-candy a bit....* gnu/bootloader/grub.scm (eye-candy)[setup-gfxterm-body]: Define the GFXMODE binding using AND-LET* instead of chained AND=>. Add a comment about supporting graphical mode on other systems than x86. Generate configuration string using FORMAT rather than STRING-APPEND. Maxim Cournoyer 2020-03-17bootloader: grub: Use the all_video module in graphic mode....* gnu/bootloader/grub.scm (eye-candy): Load the module 'all_video' which automatically loads all the available and relevant video modules. Maxim Cournoyer 2020-02-02gnu: Add u-boot-cubietruck-bootloader....* gnu/bootloader/u-boot.scm (u-boot-cubietrack-bootloader): New variable. Julien Lepiller 2020-01-25bootloader: grub: Add gfxmode (resolution) override....* gnu/bootloader/grub.scm (<grub-theme>): Add `gfxmode' entry. (eye-candy): Use it. * doc/guix.texi (Bootloader Configuration): Document it. Jan Nieuwenhuizen 2020-01-07Revert "bootloader: grub: Add gfxmode (resolution) override."...This reverts commit a23091880d4dc6115acbfa3b7ef09d731fc5abb0. It causes ‘guix pull’ to fail: <https://paste.debian.net/plain/1125061>. Tobias Geerinckx-Rice 2020-01-07bootloader: grub: Add gfxmode (resolution) override....* gnu/bootloader/grub.scm (<grub-theme>): Add `gfxmode' entry. (eye-candy): Use it. * doc/guix.texi (Bootloader Configuration): Document it. Jan Nieuwenhuizen 2020-01-06Adjust module autoloads....In Guile < 2.9.7, autoloading a module would give you access to all its bindings. In future versions, autoloading a module gives access only to the listed bindings, as per #:select (see <https://bugs.gnu.org/38895>). This commit adjusts autoloads to the new semantics, allowing Guix to be built with Guile 2.9.7/2.9.8. * guix/build/download.scm <top level>: Remove call to 'module-autoload!'. (load-gnutls): New procedure. (tls-wrap): Call it. * guix/git.scm <top level>: Remove call to 'module-autoload!'. (load-git-submodules): New procedure. (update-submodules): Call it instead of 'resolve-interface'. * gnu/bootloader/grub.scm: Replace #:autoload with #:use-module. * gnu/packages.scm: Likewise. * gnu/packages/ssh.scm: Likewise. * gnu/packages/tex.scm: Likewise. * gnu/services/cuirass.scm: Likewise. * gnu/services/mcron.scm: Likewise. * guix/lint.scm: Augment list of bindings in #:autoload. * guix/scripts/build.scm: Likewise. * guix/scripts/gc.scm: Likewise. * guix/scripts/pack.scm: Likewise. * guix/scripts/publish.scm: Likewise. * guix/scripts/pull.scm: Likewise. * guix/utils.scm: Remove unnecessary #:autoload clauses; replace one of them with #:use-module. Ludovic Courtès 2020-01-03bootloader: Mark "grub.cfg" and "extlinux.conf" as non-substitutable....Suggested by <pkill9@runbox.com>. * gnu/bootloader/grub.scm (grub-configuration-file): Pass #:options to 'computed-file'. * gnu/bootloader/extlinux.scm (extlinux-configuration-file): Likewise. Ludovic Courtès 2019-12-23bootloader: grub: Add firmware setup entry....* gnu/bootloader/grub.scm (grub-configuration-file): Add 'Firmware setup' entry for EFI platform. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org> Brice Waegeneire 2019-12-14gnu: Add u-boot-pine64-lts-bootloader....* gnu/bootloader/u-boot.scm (u-boot-pine64-lts-bootloader): New variable. Mathieu Othacehe 2019-10-18gnu: Add u-boot-firefly-rk3399....* gnu/packages/bootloaders (u-boot-firefly-rk3399): New variable. * gnu/bootloader/u-boot (install-firefly-rk3399-u-boot): New variable. (u-boot-firefly-rk3399-bootloader): New variable. * gnu/system/install (define firefly-rk3399-installation-os): New variable. Vagrant Cascadian 2019-10-18gnu: Add u-boot-rock64-rk3328....* gnu/packages/bootloaders (u-boot-rock64-rk3328): New variable. * gnu/bootloader/u-boot (install-rock64-rk3328-u-boot): New variable. (u-boot-rock64-rk3328-bootloader): New variable. * gnu/system/install (define rock64-installation-os): New variable. Vagrant Cascadian 2019-10-18gnu: Add u-boot-rockpro64-rk3399...* gnu/packages/bootloaders.scm (u-boot-rockpro64-rk3399): New exported variable. (u-boot-2019.10): New variable. * gnu/bootloader/u-boot.scm (u-boot-rockpro64-rk3399-bootloader): New exported variable. (install-rockpro64-rk3399-u-boot): New variable. * gnu/system/install.scm (rockpro64-installation-os): New exported variable. Adjusted-by: Vagrant Cascadian <vagrant@debian.org> Signed-off-by: Caliph Nomble <nomble@palism.com> Signed-off-by: Vagrant Cascadian <vagrant@debian.org> Caliph Nomble