all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#35312] core-update: Handle jar-files with patches
@ 2019-04-18  5:06 Björn Höfling
  2019-06-27 14:15 ` swedebugia
  0 siblings, 1 reply; 2+ messages in thread
From: Björn Höfling @ 2019-04-18  5:06 UTC (permalink / raw)
  To: 35312


[-- 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 --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [bug#35312] core-update: Handle jar-files with patches
  2019-04-18  5:06 [bug#35312] core-update: Handle jar-files with patches Björn Höfling
@ 2019-06-27 14:15 ` swedebugia
  0 siblings, 0 replies; 2+ messages in thread
From: swedebugia @ 2019-06-27 14:15 UTC (permalink / raw)
  To: 35312

On 2019-04-18 07:06, Björn Höfling wrote:
> 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
> 
This seem to have fallen through the cracks. Can someone with gexp 
knowledge review this?

-- 
Cheers Swedebugia

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-27 14:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-18  5:06 [bug#35312] core-update: Handle jar-files with patches Björn Höfling
2019-06-27 14:15 ` swedebugia

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.