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

From: Maxim Cournoyer <[email-masked]>
Date: Sun, 10 Jan 2021 17:07:43 -0500

Hello,

Maxim Cournoyer <[email-masked]> 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