From: "Björn Höfling" <bjoern.hoefling@bjoernhoefling.de>
To: 35312@debbugs.gnu.org
Subject: [bug#35312] core-update: Handle jar-files with patches
Date: Thu, 18 Apr 2019 07:06:21 +0200 [thread overview]
Message-ID: <20190418070621.09cd7307@alma-ubu> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 666 bytes --]
Please review carefully, this is my first work below the gexp-border.
This patch is the outcome of my question at:
https://lists.gnu.org/archive/html/guix-devel/2019-04/msg00226.html
When a jar-file had patches, it was not recognized and wrongly handled
with "tar xz".
There is one open question: For patch-and-repack, the flags defaults
to '("p1"), but for jar-files we would usually need a "p0". That would
mean for jar-sources with patches, one would need to manually add the
patch-flags with "p0" to the origin. This is not nice. On the other
hand, I would not like to override the patch-flags for jar-files to
always "p0".
WDYT?
Björn
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-guix-Handle-patching-of-jar-files-correctly.patch --]
[-- Type: text/x-patch, Size: 2895 bytes --]
From 84098800908c732facea1196cbc51b06128ff2ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20H=C3=B6fling?=
<bjoern.hoefling@bjoernhoefling.de>
Date: Thu, 18 Apr 2019 06:27:39 +0200
Subject: [PATCH] guix: Handle patching of jar-files correctly.
When jar-files are used as origins with patches, they were not
handled correctly and unpacked with the default "tar xz" command.
This fix adds a case for jar-files.
* guix/packages.scm (%standard-inputs): Add entry for jar-files.
(patch-and-repack)(decompression-type): Handle "jar" suffix.
patch-and-repack)(build): Unpack jar-files with unzip.
Don't change into first-file for jar-files.
See discussion at:
<https://lists.gnu.org/archive/html/guix-devel/2019-04/msg00226.html>.
---
guix/packages.scm | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/guix/packages.scm b/guix/packages.scm
index a961dc3973..5af2c25cd9 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -436,6 +436,7 @@ identifiers. The result is inferred from the file names of patches."
("gzip" ,(ref '(gnu packages compression) 'gzip))
("lzip" ,(ref '(gnu packages compression) 'lzip))
("unzip" ,(ref '(gnu packages compression) 'unzip))
+ ("jar" ,(ref '(gnu packages compression) 'unzip))
("patch" ,(ref '(gnu packages base) 'patch))
("locales" ,(ref '(gnu packages base) 'glibc-utf8-locales)))))
@@ -492,6 +493,7 @@ specifies modules in scope when evaluating SNIPPET."
((string-suffix? "bz2" source-file-name) "bzip2")
((string-suffix? "lz" source-file-name) "lzip")
((string-suffix? "zip" source-file-name) "unzip")
+ ((string-suffix? "jar" source-file-name) "jar")
(else "xz")))
(define original-file-name
@@ -585,12 +587,17 @@ specifies modules in scope when evaluating SNIPPET."
(directory (string-drop base (+ 1 dash))))
(mkdir directory)
(copy-recursively #+source directory))
- #+(if (string=? decompression-type "unzip")
+ #+(if (or
+ (string=? decompression-type "unzip")
+ (string=? decompression-type "jar"))
#~(invoke "unzip" #+source)
#~(invoke (string-append #+tar "/bin/tar")
"xvf" #+source)))
- (let ((directory (first-file ".")))
+ ;; jar-files have their contents directly in the root folder
+ (let ((directory (if (string=? #+decompression-type "jar")
+ "."
+ (first-file "."))))
(format (current-error-port)
"source is under '~a'~%" directory)
(chdir directory)
--
2.21.0
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next reply other threads:[~2019-04-18 5:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-18 5:06 Björn Höfling [this message]
2019-06-27 14:15 ` [bug#35312] core-update: Handle jar-files with patches swedebugia
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=20190418070621.09cd7307@alma-ubu \
--to=bjoern.hoefling@bjoernhoefling.de \
--cc=35312@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 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.