Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Mar 2004 16:34:18 +0100
From:      Herve Quiroz <herve.quiroz@esil.univ-mrs.fr>
To:        freebsd-java@FreeBSD.ORG
Subject:   RFC: PKGNAMEPREFIX for Java ports
Message-ID:  <20040308153418.GA33232@arabica.esil.univ-mrs.fr>

next in thread | raw e-mail | index | archive | help
Hi all,


After a full week spent at installing ports and coding, I thought of something
I would like to discuss: the potential use of a Java specific PKGNAMEPREFIX for
Java ports.  Please note that I am not asking for any actual action on the
subject. That's just a casual "request for comments". In fact, each time I port
a Java application or library I am faced with the same dilemna : 'java/myport'
or 'devel/myport'? So I felt like "publishing" my random thoughts on the
subject to have an idea of other people's opinion. Feedback is obviously
welcome.

I realized that many languages have their ports build and install with a
language specific PKGNAMEPREFIX, for example py23-BitTorrent,
p5-Mail-SpamAssassin, ruby18-bdb1...

On the other hand, Java seems to have a particular status as it has its own
directory in the ports tree (there's no 'perl' nor 'python' directory for
example). Furthermore, there seems to be no common (nor official) scheme
regarding the location of Java ports in the ports tree: e.g. 'xmlenc'[1] and
'jdom'[2] are both related to XML processing but the former is in 'textproc'
whereas the later is in 'java'. Both approaches have enough advantages to stand
up against each other. What I have found so far (but I am pretty sure there are
plenty of other reasons):

- Every Java port in 'java' directory: "because this way you may quickly find a
  Java libray", or "because most Java libraries would end up in 'devel'
  anyway"...

- Every Java port in the right category directory: "because it is the right way
  for ANY port", or "because some Java ports use native code (read C code), or the
  contrary".

AFAIK, there is no 'java' directory in pkgsrc[3] (NetBSD). JDKs are in 'lang'
and any other Java package is located in a directory related to its category.

Within Gentoo[4], there is no 'java' neither. But one category is suffixed with
'-java': 'dev-java'.

So I was wondering why we (the Java porters) have so much freedom in the way we
are locating our ports. Is there any "historical" reason or so?

Then I wondered if there were a way to have everybody agree on the subject. So
here are my two eurocents on the subject:

What if we used the same as any other language? A language specific
PKGNAMEPREFIX and Java ports located in directories related to their category?
This way, we have (almost) the best of both worlds. One may quickly find all
java ports (make search name='java-') whereas ports are abiding to common
category/directory rules.

An an example, let's have a look at one of the ports I maintain, trove4j (GNU
Trove: High performance collections for Java). The port is currently located in
'java/trove4j' and installs the package 'trove4j-1.0.2_1'. As it is a
development library, using the forecited port/package naming convention, the
port would end up in 'devel/java-trove4j' and would install package
'java-trove4j-1.0.2_1'. Still the port's name (as of ${PORTNAME}) would stay
the same: 'trove4j'.

Now let's extend our naming convention to support java versioning within
package names just like it is the case with Python ports. Indeed, we could use
different values for the variable we will now call JAVA_PKGNAMEPREFIX,
according to the version of Java the port is built/run with. Let's consider I
have JDK 1.4.2 installed and that bsd.java.mk registers it as the JDK
dependency of the trove4j port at build time (Advertising: please support the
bsd.java.mk-2.0 effort[5]). My port (still located at the place, namely
'devel/java-trove4j') would now install package 'java14-trove4j'.

Amongst the good points when using such a naming convention for java ports:

- It becomes easy to list Java ports: 'cd /usr/ports && make seach name=java-'

- It becomes easy to find out java packages: 'pkg_info -cqx java-'

- Java ports may be located in the ports tree the same (right) way as any other
  port (that is using representative category directories) without invalidating
  the first property above.
  
- It becomes clearly apparent which JDK was used to build which port. In some
  cases, some tasks are performed at build time that are relative to the
  version of Java that is used. For instance, let's consider the
  jakarta-commons-logging port[6]. When built with JDK 1.4,
  jakarta-commons-logging compiles support for JDK 1.4 Logging API. Having
  'java14-' or 'java13-' as a package name prefix would allow users to
  determine precisely which logging APIs the package supports. No need for
  PKGNAMESUFFIX anymore.

Now the downside:

  - What if I installed a port using JDK 1.3 then installed a new JDK (1.4 for
	instance) and enforced the removal of JDK 1.3 (regardless of packages
	requiring it to run)?. A quick 'pkgdb -F' would allow me to replace JDK 1.3
	with JDK 1.4 everywhere this is needed. Hence my forecited port will end up
	registered with JDK 1.4 as a dependency but with a prefix that is still
	'java13-'. IMHO, that is not really a problem. If one decides to force the
	deinstall of a package on which depend other packages, he goes against the
	common rules and thus does it at his own risk.

There are probably many other negative or positive points with such a naming
convention. I you think about one and want to discuss it, you are welcome.

At the end this message you will find a quick survey of ports already using
PKGNAMEPREFIX and ports that have 'java-' directly is their name (PORTNAME).


Herve


[1] xmlenc FreeBSD port
http://www.freshports.org/textproc/xmlenc/

[2] dom4j FreeBSD port
http://www.freshports.org/java/dom4j/

[3] The NetBSD pkgsrc package database
ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc/lang/README.html

[4] The Gentoo package database
http://packages.gentoo.org/categories/

[5] bsd.java.mk-2.0 effort
http://www.esil.univ-mrs.fr/~hquiroz/freebsd/bsd.java.mk-2.0.html

[6] jakarta-commons-logging FreeBSD port
http://www.freshports.org/java/jakarta-commons-logging/


Ports using PKGNAMEPREFIX (java-):
  - databases/java-sqlrelay
  - java/java-checkstyle
  - java/java-getopt
  - net/java-beepcore

Ports named with a 'java-' prefix but not using PKGNAMEPREFIX:
  - comms/java-commapi
  - comms/java-commapi-freebsd
  - java/java-cup
  - java/java-tutorial



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040308153418.GA33232>