GNU bug report logs -
#28602
Unpack fails with no error message when using a .zip source
Previous Next
Reported by: nee <nee <at> cock.li>
Date: Mon, 25 Sep 2017 20:11:01 UTC
Severity: normal
Tags: patch
Done: zimoun <zimon.toutoune <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #19 received at 28602 <at> debbugs.gnu.org (full text, mbox):
Hi,
Thanks for the patch and sorry for the delay.
On Mon, 09 Oct 2017 at 23:00, nee <nee <at> cock.li> wrote:
> Hello here is a patch to fix this bug. It changes the gnu-build-system,
> so the hashes of almost all packages will also change. I guess
> core-updates is the right branch for this.
>
>>From 089b9741a734f0682a671df6c0c36dfefcbd407c Mon Sep 17 00:00:00 2001
> From: nee <nee.git <at> cock.li>
> Date: Mon, 9 Oct 2017 22:49:12 +0200
> Subject: [PATCH] guix: gnu-build-system: warn about missing unzip input during
> unpack.
>
> ---
> guix/build/gnu-build-system.scm | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
> index e37b75140..c16d15964 100644
> --- a/guix/build/gnu-build-system.scm
> +++ b/guix/build/gnu-build-system.scm
> @@ -67,6 +67,21 @@ See https://reproducible-builds.org/specs/source-date-epoch/."
> #f
> dir))
>
> +(define (unzip filepath)
> + "Unzip archive file.
> +Warn the user when unzip fails and the executable is not present."
> + (define exit-code (system* "unzip" filepath))
> + (define program-not-found-code 32512)
> + (cond ((zero? exit-code) #t)
> + ((eqv? exit-code program-not-found-code)
> + (format (current-error-port)
> + "warning: Archive with .zip suffix failed to unpack.
> +Please add unzip as native-input to the package,
> +e.g. (native-inputs `((\"unzip\" ,unzip)))")
> + (newline (current-error-port))
> + #f)
> + (else #f)))
Give a look at 'invoke' from (guix build utils).
> (define* (set-paths #:key target inputs native-inputs
> (search-paths '()) (native-search-paths '())
> #:allow-other-keys)
> @@ -154,7 +169,7 @@ working directory."
> #:keep-mtime? #t)
> #t)
> (and (if (string-suffix? ".zip" source)
> - (zero? (system* "unzip" source))
> + (unzip source)
> (zero? (system* "tar" "xvf" source)))
> (chdir (first-subdirectory ".")))))
After 9a87649c863e1ff8b073b356875eb05eecedbcf7, this part uses 'invoke'.
Instead of your 'unzip', the exception raised by 'invoke' should be
catched and then should trigger the hint message. WDYT?
All the best,
simon
This bug report was last modified 3 years and 63 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.