From owner-freebsd-java@FreeBSD.ORG Fri Apr 15 17:47:46 2011 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id B527910656D2; Fri, 15 Apr 2011 17:47:45 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: John Baldwin Date: Fri, 15 Apr 2011 13:47:36 -0400 User-Agent: KMail/1.6.2 References: <4D9F1E05.4070900@FreeBSD.org> <201104081628.25082.jkim@FreeBSD.org> <201104151227.05954.jhb@freebsd.org> In-Reply-To: <201104151227.05954.jhb@freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201104151347.38234.jkim@FreeBSD.org> Cc: freebsd-java@freebsd.org Subject: Re: Version number of openjdk6 port X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Apr 2011 17:47:46 -0000 On Friday 15 April 2011 12:27 pm, John Baldwin wrote: > On Friday, April 08, 2011 4:28:18 pm Jung-uk Kim wrote: > > On Friday 08 April 2011 03:48 pm, John Baldwin wrote: > > > On 4/8/11 3:11 PM, Jung-uk Kim wrote: > > > > On Friday 08 April 2011 10:39 am, John Baldwin wrote: > > > >> Please consider using a better version number for the > > > >> openjdk6 port. Right now it uses a version number of 'b20_7' > > > >> which due to the way package version works, is considered > > > >> less than 0: > > > >> > > > >> % pkg_version -t 0 b20_7 > > > >> > > > >> > > > >> Why does this matter? cfengine uses 'pkg_info -E > > > >> pkg_name>0' to test if a package is installed. > > > > > > > > Then, I would say cfengine is broken. "0" in that version > > > > match string is package dependent, not major, minor, or > > > > whatever. For example: > > > > > > > > %pkg_info -E 'avahi>0.6.20' > > > > avahi-0.6.29 > > > > %pkg_info -E 'openjdk6>b0' > > > > openjdk6-b22_4 > > > > %pkg_info -E 'mplayer>1.0.r0' > > > > mplayer-1.0.r20110329 > > > > > > Hmm, I can probably workaround this then using an explicit > > > comparison rule (so it doesn't use >0). It would be nice if we > > > had an official way to match a package with "any version". > > > Perhaps "pkg_info -E 'pkg-*'" if we assume that package names > > > can never have dashes in them (to avoid problems, with, say, > > > 'foo-*' matching both foo-1.0 and foo-bar-1.0.). Oh, we > > > already have those types of packages: > > > > > > xorg-7.5 X.Org complete distribution metaport > > > xorg-apps-7.5_1 X.org apps meta-port > > > > > > The problem is how can software generically say "is any version > > > of the foo package installed". It would seem we don't support > > > that currently? > > > > The key here is package origin, not the package name itself. > > > > %pkg_info -qO java/openjdk6 > > openjdk6-b22_4 > > %pkg_info -qO x11/xorg-apps > > xorg-apps-7.5.1 > > > > It is always safe to find its origin because there may be > > prefixes and postfixes. > > > > %pkg_info -qoX ko-openoffice.org > > editors/openoffice.org-3-devel > > > > I think this would be the worse case in the ports tree: > > > > %pkg_info -qo apr-ipv6-devrandom-gdbm-db42-1.4.2.1.3.10 > > devel/apr1 > > Unfortunately our package system is way too simple to handle > something like that. What you get is a file and you can't say > 'pkg_add java/openjdk6', you have to give it a path. Even if you > try to use pkg_add -r, then you are still passing different things. > I.e. if my directive was 'install the openjdk6' package, how is it > supposed to map that to 'java/openjdk6' to query if it is already > installed? Yeah, our packaging system is not powerful enough to handle complex tasks. However, if you are creative enough, you can do it. :-P Long time ago, I had to do something like this for my $JOB: #!/bin/sh PKG_DIR=/usr/ports/packages/All PKGS=`find ${PKG_DIR} -name "*.tbz" | sed "s#^${PKG_DIR}/##g"` PKG_ORGS= for i in ${PKGS}; do o=`pkg_info -oq ${i}` PKG_ORGS="${PKG_ORGS} ${o}" done # Do some stuff by PKGS:PKG_ORGS pairs, e.g., upgrade packages # if there are new ones. This is overly simplified version but you know what I mean. Jung-uk Kim