unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: nee <nee@cock.li>
To: 28602@debbugs.gnu.org
Subject: bug#28602: [PATCH] guix: gnu-build-system: warn about missing unzip input unzip
Date: Mon, 9 Oct 2017 23:00:29 +0200	[thread overview]
Message-ID: <7075db45-09ad-f2d7-1bd4-27f2c9755a42@cock.li> (raw)
In-Reply-To: <2c2ccbd7-bb47-5292-74d9-e4c7fdc2c990@cock.li>

[-- Attachment #1: Type: text/plain, Size: 179 bytes --]

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.


[-- Attachment #2: 0001-guix-gnu-build-system-warn-about-missing-unzip-input.patch --]
[-- Type: text/x-patch, Size: 1736 bytes --]

From 089b9741a734f0682a671df6c0c36dfefcbd407c Mon Sep 17 00:00:00 2001
From: nee <nee.git@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)))
+
 (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 ".")))))
 
-- 
2.14.1


  parent reply	other threads:[~2017-10-09 21:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-25 20:10 bug#28602: Unpack fails with no error message when using a .zip source nee
2017-10-04 18:17 ` Adonay Felipe Nogueira
2017-10-09 21:05   ` nee
2017-10-09 21:00 ` nee [this message]
2021-07-05 11:46   ` zimoun
2021-11-26  1:49     ` bug#28602: [core-updates] " zimoun
2022-01-04 22:55       ` bug#28602: " zimoun
2022-03-23 10:37         ` zimoun

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=7075db45-09ad-f2d7-1bd4-27f2c9755a42@cock.li \
    --to=nee@cock.li \
    --cc=28602@debbugs.gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).