mbox

[bug#45773,core-updates,0/1] Allow patch-and-repack to work with plain files.

Message ID 20210110200231.24214-1-maxim.cournoyer@gmail.com
Headers show

Message

Maxim Cournoyer Jan. 10, 2021, 8:02 p.m. UTC
While attempting to reproduce the now closed issue
<http://issues.guix.gnu.org/30116>, I stumbled upon another annoyance, which
is that the patch-and-repack procedure used as part of an origin derivation
didn't support single files, so the following failed, for example:

<#part type="text/plain" filename="/home/maxim/src/guix-core-updates/repro.scm" disposition=inline description="Script exhibiting problem">
<#/part>

The following patch fixes that, allowing to use plain files with any of the
already supported compressors, or non-tarball archived that would include a
single directory (the same convention as used for our tarballs).

Maxim Cournoyer (1):
  guix: packages: Allow patch-and-repack to work with plain files.

 guix/packages.scm  | 96 +++++++++++++++++++++++++++++++---------------
 tests/packages.scm | 87 +++++++++++++++++++++++++++++++++++++++--
 2 files changed, 149 insertions(+), 34 deletions(-)

Comments

Maxim Cournoyer Jan. 10, 2021, 10:07 p.m. UTC | #1
Hello,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> While attempting to reproduce the now closed issue
> <http://issues.guix.gnu.org/30116>, I stumbled upon another annoyance, which
> is that the patch-and-repack procedure used as part of an origin derivation
> didn't support single files, so the following failed, for example:
>
> <#part type="text/plain" filename="/home/maxim/src/guix-core-updates/repro.scm" disposition=inline description="Script exhibiting problem">
> <#/part>

That didn't work out well :-).

Here's the attachment that I meant to send along the cover letter.
;;; Run script with: ./pre-inst-env guile -e main -s repro.scm

(use-modules (gnu packages base)
             (gnu packages bootstrap)
             (guix build utils)
             (guix derivations)
             (guix download)
             (guix packages)
             (guix store))

(define %test-file-uri
  "https://raw.githubusercontent.com/realgud/realgud/master/realgud/common/bp-image-data.el")

(define (main _)
  (let ((source (origin
                  (method url-fetch)
                  (uri %test-file-uri)
                  (modules '((guix build utils)))
                  (patch-inputs `(("tar"   ,%bootstrap-coreutils&co)
                                  ("xz"    ,%bootstrap-coreutils&co)
                                  ("locales" ,glibc-utf8-locales)))
                  (snippet
                   '(begin
                      (with-fluids ((%default-port-encoding "ISO-8859-1")
                                    (%default-port-conversion-strategy 'error))
                        (substitute* "bp-image-data.el"
                          (("something")
                           "something else")))))
                  (sha256
                   (base32
                    "1qpn2zhh2qw579bhgjyxvf670r4kibaxls589hkm2yhwfvsjvs68")))))
    (with-store store
      (build-derivations store
                         (list (run-with-store store
                                 (origin->derivation source)))))))
Thanks,

Maxim