GNU bug report logs -
#61052
[PATCH] download: Add url-fetch/xz-file.
Previous Next
Reported by: Hilton Chain <hako <at> ultrarare.space>
Date: Wed, 25 Jan 2023 09:09:01 UTC
Severity: normal
Tags: moreinfo, patch
Done: Hilton Chain <hako <at> ultrarare.space>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61052 in the body.
You can then email your comments to 61052 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#61052
; Package
guix-patches
.
(Wed, 25 Jan 2023 09:09:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Hilton Chain <hako <at> ultrarare.space>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Wed, 25 Jan 2023 09:09:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* guix/download.scm (url-fetch/xz-file): New variable.
---
guix/download.scm | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/guix/download.scm b/guix/download.scm
index 2e9ecb43fc..cce62c4185 100644
--- a/guix/download.scm
+++ b/guix/download.scm
@@ -41,6 +41,7 @@ (define-module (guix download)
(url-fetch* . url-fetch)
url-fetch/executable
url-fetch/tarbomb
+ url-fetch/xz-file
url-fetch/zipbomb
download-to-store))
@@ -602,6 +603,48 @@ (define tar
#:graft? #f
#:local-build? #t)))
+(define* (url-fetch/xz-file url hash-algo hash
+ #:optional name
+ #:key (system (%current-system))
+ (guile (default-guile)))
+ "Similar to 'url-fetch' but decompress the xz file at URL as the result.
+This is mainly used for adding xz-compressed patches to a origin definition."
+ (define file-name
+ (match url
+ ((head _ ...)
+ (basename head))
+ (_
+ (basename url))))
+ (define xz
+ (module-ref (resolve-interface '(gnu packages compression)) 'xz))
+
+ (mlet %store-monad ((drv (url-fetch* url hash-algo hash
+ (or name (basename file-name ".xz"))
+ #:system system
+ #:guile guile))
+ (guile (package->derivation guile system)))
+ ;; Take the xz file, and simply decompress it.
+ ;; Use ungrafted xz so that the resulting file doesn't depend on whether
+ ;; grafts are enabled.
+ (gexp->derivation (or name file-name)
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+ (setenv "XZ_OPT"
+ (string-join (%xz-parallel-args)))
+
+ (copy-file #$drv #$file-name)
+ (make-file-writable #$file-name)
+ (invoke (string-append #+xz "/bin/unxz")
+ #$file-name)
+
+ (copy-file (basename #$file-name ".xz")
+ #$output)))
+ #:system system
+ #:guile-for-build guile
+ #:graft? #f
+ #:local-build? #t)))
+
(define* (url-fetch/zipbomb url hash-algo hash
#:optional name
#:key (system (%current-system))
base-commit: 718223c58c20fa066527fb30da2b5dccca82913f
--
2.39.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#61052
; Package
guix-patches
.
(Sat, 25 Feb 2023 17:49:01 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi,
Hilton Chain <hako <at> ultrarare.space> skribis:
> * guix/download.scm (url-fetch/xz-file): New variable.
This LGTM, but do you know of a package that would use it?
I think we should add it if and only if it’s going to be used in Guix
proper.
Thanks,
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#61052
; Package
guix-patches
.
(Sat, 25 Feb 2023 19:26:02 GMT)
Full text and
rfc822 format available.
Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi Hilton,
I agree with Ludo' and also wonder if a generic
‘url-fetch/compressed-file’ wouldn't be better. There are closure
arguments to be made for this xz-only approach. I don't know if they're
convincing. Cluebats welcome.
(I was going to bring up ‘url-fetch/tarbomb’ as an example, but it
doesn't actually handle anything besides gzip! Madness.)
On 2023-01-25 10:07, Hilton Chain wrote:
> + (setenv "XZ_OPT"
> + (string-join (%xz-parallel-args)))
Why set this kluge…
> + (invoke (string-append #+xz "/bin/unxz")
> + #$file-name)
…when we have full control over xz's arguments?
Kind regards,
T G-R
Sent from a Web browser. Excuse or enjoy my brevity.
Added tag(s) moreinfo.
Request was from
Ludovic Courtès <ludo <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Thu, 16 Mar 2023 11:07:02 GMT)
Full text and
rfc822 format available.
Reply sent
to
Hilton Chain <hako <at> ultrarare.space>
:
You have taken responsibility.
(Mon, 03 Jul 2023 07:38:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Hilton Chain <hako <at> ultrarare.space>
:
bug acknowledged by developer.
(Mon, 03 Jul 2023 07:38:02 GMT)
Full text and
rfc822 format available.
Message #18 received at 61052-close <at> debbugs.gnu.org (full text, mbox):
On Sun, 26 Feb 2023 03:25:24 +0800,
Tobias Geerinckx-Rice wrote:
>
> Hi Hilton,
>
> I agree with Ludo' and also wonder if a generic
> ‘url-fetch/compressed-file’ wouldn't be better. There are closure
> arguments to be made for this xz-only approach. I don't know if
> they're convincing. Cluebats welcome.
>
> (I was going to bring up ‘url-fetch/tarbomb’ as an example, but it
> doesn't actually handle anything besides gzip! Madness.)
>
> On 2023-01-25 10:07, Hilton Chain wrote:
> > + (setenv "XZ_OPT"
> > + (string-join (%xz-parallel-args)))
>
> Why set this kluge…
>
> > + (invoke (string-append #+xz "/bin/unxz")
> > + #$file-name)
>
> …when we have full control over xz's arguments?
>
> Kind regards,
>
> T G-R
>
> Sent from a Web browser. Excuse or enjoy my brevity.
Sorry for the long delay...
Yes, I would prefer a generic approach. But currently I don't have a
usecase with this url-fetch/xz-file or something more generic, so I'll
close the issue for now.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Mon, 31 Jul 2023 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 284 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.