Subject: [Pljava-dev] Retrying: RPMifying PL/Java

From: Devrim Gündüz <[email-masked]>
Date: Thu, 14 Jul 2016 18:39:17 +0300

Hi,

Work, holidays, etc, and I'm back to RPMifying PL/Java. 

I can build the jar file, but the issue is still there with installing it. Here
is the log:

# java -jar /usr/share/java/pljava-95.jar 
META-INF/ 
org/ 
org/gjt/ 
org/gjt/cuspy/ 
pljava/ 
/usr/pgsql-9.5/lib/ 
/usr/pgsql-9.5/lib/libpljava-so-1.5.0.so as bytes
/usr/pgsql-9.5/share/ 
/usr/pgsql-9.5/share/extension/ 
/usr/pgsql-9.5/share/extension/pljava.control as lines (ASCII)
/usr/pgsql-9.5/share/pljava/ 
/usr/pgsql-9.5/share/pljava/pljava--1.5.0-BETA1--1.5.0.sql as lines (UTF8)
/usr/pgsql-9.5/share/pljava/pljava--1.5.0-BETA2--1.5.0.sql as lines (UTF8)
/usr/pgsql-9.5/share/pljava/pljava--1.5.0-BETA3--1.5.0.sql as lines (UTF8)
/usr/pgsql-9.5/share/pljava/pljava--1.5.0.sql as lines (UTF8)
/usr/pgsql-9.5/share/pljava/pljava--unpackaged--1.5.0.sql as lines (UTF8)
/usr/pgsql-9.5/share/pljava/pljava-1.5.0.jar as bytes
/usr/pgsql-9.5/share/pljava/pljava-api-1.5.0.jar as bytes
/usr/pgsql-9.5/share/pljava/pljava-examples-1.5.0.jar as bytes

Unfortunately, the first 5 directories are installed under / and cause a mess
-- and I don't think they should be there.

How can I fix this? What am I missing?

Here is the spec and patch that I'm using:

https://git.postgresql.org/gitweb/?p=pgrpms.git;a=commit;h=b940b4ab383e6a35789f107a04d5b1e394cb2125

Regards,

-- 
Devrim GÜNDÜZ
Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR
_______________________________________________
Pljava-dev mailing list
[email-masked]
http://lists.pgfoundry.org/mailman/listinfo/pljava-dev

---

From: Chapman Flack <[email-masked]>
Date: Thu, 14 Jul 2016 13:28:03 -0400

> # java -jar /usr/share/java/pljava-95.jar 

...

> How can I fix this? What am I missing?

That's just plain weird, and right now I'm not where I can look
more closely. It looks as if the jar is being built with distinct
entries for parent directories of things, which isn't necessary,
and the ant/javascript code in pljava-packaging that assembles
the jar *isn't supposed to* create those parent directory entries.

That is, if you just run 'jar t' on the file exactly as Maven
produced it, you should only see entries in it for actual files.

So I don't know if a new ant version changed the API so it now
silently adds parent entries ... or something else is happening
in your build process that is overriding things (maybe there is
some automated step in rpmifying that extracts-and-rebuilds jars
using a tool that silently adds parent directory entries?).

Best I can do for now ....

-Chap

---

From: Chapman Flack <[email-masked]>
Date: Sat, 16 Jul 2016 16:47:04 -0400

Hi,

I've looked a little more at this, and remembered that this was the
same issue we were puzzled by in February.

>From what I see *directly* in your spec and patch, and so far I have
more questions than answers.  I think it would be helpful to pin
down _at what point_ the pljava-pg9.5-amd64-Linux-gpp.jar file
turns out to have intermediate directory entries in it.

For example, you could temporarily add a third line in the %build
section right after the mvn clean install:

jar tf ./%{sname}-packaging/target/%{sname}-pg9.5-amd64-Linux-gpp.jar

and check the output. In the universe I inhabit, there should *not* be
any intermediate directories listed ... only the paths that end in a
file. If that's what you see, then the build is happening normally,
and something is going wrong later.

If I understand the rpm building process right, it looks like you are
building an rpm that just contains the jar file (placed there with a
simplified name by the 'install' command), and later, when someone
deploys the rpm, that is when %post runs and extracts the jar.

So I would be interested in the output of 'jar tf' on that jar file
as it is stored in the rpm, compared to the same output immediately
after mvn generated the file.

I sort of wonder if the 'install' command has some sort of magic
built in if it is installing a .jar file, and it extracts/rebuilds/
compresses/rearranges the jar somehow, and in that process it is
adding intermediate directory levels for the originally contained
paths. If that's what happens, then the next question is whether
there is a way to make it not do that.

If, on the other hand, you see the extra entries in the jar
immediately after 'mvn clean install' before anything else has
happened, then (a) I'll be extremely surprised, and (b) it will
be a puzzle to figure out why, but because of (a) I'll wait to
work on (b) until the evidence actually points that way.

Cheers,
-Chap

incidentally, there might be easier ways to accomplish what the
patch currently does. All the changes to the <exec> elements should
be avoidable if the %build section just had

PATH=/usr/pgsql-9.5/bin:$PATH mvn clean install

and the one change in the javascript would be unnecessary if
the %post section said

java -jar %{_javadir}/%{name}.jar -Dpgconfig=/usr/pgsql-9.5/bin/pg_config

... then it looks like there'd be no need for a patch at all, and
adjustments for new versions would be simpler.
_______________________________________________
Pljava-dev mailing list
[email-masked]
http://lists.pgfoundry.org/mailman/listinfo/pljava-dev