guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: java: How to patch a jar-sources


From: Björn Höfling
Subject: Re: java: How to patch a jar-sources
Date: Mon, 15 Apr 2019 17:11:52 +0200

On Mon, 15 Apr 2019 14:26:41 +0200
Gábor Boskovits <address@hidden> wrote:

> Hello Björn,
> 
> 
> 
> Björn Höfling <address@hidden> ezt írta (időpont:
> 2019. ápr. 15., H 8:03):
> 
> > Hi Guix,
> >
> > I have a problem combining ".jar" sources with patches.
> >
> > Here is my sources definition:
> >
> > (define-public java-ecj
> >   (package (inherit java-ecj-3)
> >            (version "4.6.3")
> >            (source (origin
> >                      (method url-fetch)
> >                      (uri (string-append "
> > http://archive.eclipse.org/eclipse/downloads/drops4/R-";
> >                                          version
> >                                          "-201703010400/ecjsrc-"
> >                                          version
> >                                          ".jar"))
[..]

> > It looks like guix now wants to extract the jar-sources with "tar",
> > no longer with "jar". How can I tell Guix this is a jar-file to
> > extract from? Do I need to do that manually in a snippet? Any
> > examples? 
> I have not actually done this, as jar files are usually not sources.
> Do we have the source this file was generated from?
> Also what we do in the build system is use zip and unzip for
> extracting jar files.

jar-files can contain sources. The main intended use for this is to show
the sources to the developer in the IDE (Eclipse), but we can also use
it to build from.

As an example, look at the java-jgit package. It downloads from Maven
central a ...-sources.jar.

In my example the ecjsrc-...jar also contains .java source files, the
compiled version with .class files is named without the "src" in the
name.

Going with zip is an option, this might be a work-around. But actually,
I don't want to do everything by hand:

I thought in general you can put "whatever" (supported) file-extension
you like into the "source" field and by extension of the URI it will
select the proper unpacker (i.e. using "tar xvf" for .tar files, "tar
xzvf" for .tar.gz", "unzip" for .zip, etc).

This seams to work when just using the ".jar" URI, without patches (cmp
the java-jgit example). Only after I added the patches, it was trying
to use "tar x..", which of cause will fail on the .jar file. If noone
has a direct solution, maybe it's time for me to get my fingers dirty
and look into the source-extracting code.

Thanks,

Björn

Attachment: pgp6Wvn0g5XBg.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]