all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Dr. Arne Babenhauserheide via Guix-patches" via <guix-patches@gnu.org>
To: 74500@debbugs.gnu.org
Subject: [bug#74500] pack: add ‘--file=FILE’ with the same meaning as for guix build
Date: Sun, 24 Nov 2024 00:37:46 +0100	[thread overview]
Message-ID: <87y119bjxx.fsf@web.de> (raw)


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

Hi,

the attached patch adds the option to use `guix pack --file=guix.scm` just
like you’d use `guix build --file=guix.scm` or `guix shell
--file=guix.scm`.

guix pack -f ... still means --format to preserve backwards
compatibility. Only the long option --file is added.


[-- Attachment #1.2: 0001-pack-add-file-FILE-with-the-same-meaning-as-for-guix.patch --]
[-- Type: text/x-patch, Size: 3704 bytes --]

From a1956bea3a33fed9a01246c9e5e394a7dd9daf6c Mon Sep 17 00:00:00 2001
Message-ID: <a1956bea3a33fed9a01246c9e5e394a7dd9daf6c.1732404894.git.arne_bab@web.de>
From: Arne Babenhauserheide <arne_bab@web.de>
Date: Sun, 24 Nov 2024 00:32:36 +0100
Subject: [PATCH] =?UTF-8?q?pack:=20add=20=E2=80=98--file=3DFILE=E2=80=99?=
 =?UTF-8?q?=20with=20the=20same=20meaning=20as=20for=20guix=20build?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* guix/scripts/pack.scm (%options): add --file=FILE, but no
  shorthand (that’s already taken for format).
* doc/guix.texi (Invoking guix pack): document --file

Change-Id: I87797fccdf218ead3b7f471a84034e8a8d566245
---
 doc/guix.texi         |  8 ++++++++
 guix/scripts/pack.scm | 11 +++++++++++
 2 files changed, 19 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 29bce718d4..aea8bf6063 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -7217,6 +7217,14 @@ Invoking guix pack
 build} (@pxref{Additional Build Options, @option{--expression} in
 @command{guix build}}).
 
+@item --file=@var{file}
+build a pack the code within @var{file} evaluates to.
+
+This has the same purpose as the same-named option in @command{guix
+build} (@pxref{Additional Build Options, @option{--file} in
+@command{guix build}}), but it has no shorthand, because @option{-f}
+already means @option{--format}.
+
 @anchor{pack-manifest}
 @item --manifest=@var{file}
 @itemx -m @var{file}
diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm
index 7c5fe76fe0..d588f40257 100644
--- a/guix/scripts/pack.scm
+++ b/guix/scripts/pack.scm
@@ -28,6 +28,7 @@
 
 (define-module (guix scripts pack)
   #:use-module (guix scripts)
+  #:autoload   (guix import json) (json->scheme-file)
   #:use-module (guix ui)
   #:use-module (guix gexp)
   #:use-module (guix utils)
@@ -1430,6 +1431,9 @@ (define %options
                  (lambda (opt name arg result)
                    (alist-cons 'derivation-only? #t result)))
 
+         (option '("file") #t #f
+                 (lambda (opt name arg result)
+                   (alist-cons 'file arg result)))
          (option '(#\f "format") #t #f
                  (lambda (opt name arg result)
                    (alist-cons 'format (string->symbol arg) result)))
@@ -1520,6 +1524,8 @@ (define (show-help)
   (show-deb-format-options)
   (show-rpm-format-options)
   (newline)
+  (display (G_ "
+      --file=FORMAT      build a pack the code within FILE evaluates to"))
   (display (G_ "
   -f, --format=FORMAT    build a pack in the given FORMAT"))
   (display (G_ "
@@ -1584,6 +1590,11 @@ (define-command (guix-pack . args)
            list))
         (('expression . exp)
          (read/eval-package-expression exp))
+        (('file . file)
+         (let ((file (or (and (string-suffix? ".json" file)
+                              (json->scheme-file file))
+                         file)))
+           (load* file (make-user-module '()))))
         (x #f)))
 
     (define (manifest-from-args store opts)

base-commit: 7c93145d9e027cb571bf7634192dfae5468ecde2
prerequisite-patch-id: 088a72da8c11e5d1c7087b4a5e8bb9c4a3b9b2af
prerequisite-patch-id: a092dba2c994aba4c74f1484621cebe53f548492
prerequisite-patch-id: 09ee3fdfcc708aeec9e6a7a54e2993e857e19aca
prerequisite-patch-id: 7957383d6685c848a7cbfa78e930adeaf528a2e1
prerequisite-patch-id: aa5d5050c29bbacf33790ca89f8c2690337f3ac7
prerequisite-patch-id: 2883dba4155a5a883cf03d43a130cb5f31de189c
prerequisite-patch-id: d14add7cc2f54106903ee5427a510b4204fb636f
prerequisite-patch-id: 2beca5d9522ccdc5c6751681bbf00d5107380fd8
-- 
2.46.0


[-- Attachment #1.3: Type: text/plain, Size: 101 bytes --]


Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

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

                 reply	other threads:[~2024-11-23 23:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y119bjxx.fsf@web.de \
    --to=guix-patches@gnu.org \
    --cc=74500@debbugs.gnu.org \
    --cc=arne_bab@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.