Date: Tue, 21 May 2013 12:18:54 -0400 From: Greg Larkin <glarkin@FreeBSD.org> To: glarkin@FreeBSD.org Cc: "ports@FreeBSD.org" <ports@FreeBSD.org>, ruby@FreeBSD.org Subject: Re: [CFT] Installing multiple Rubygem port versions from the same directory Message-ID: <519B9E6E.3000607@FreeBSD.org> In-Reply-To: <519B9D6E.20803@FreeBSD.org> References: <519B9D6E.20803@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 5/21/13 12:14 PM, Greg Larkin wrote: > > Greetings, > > A while back, I started working on ports for the vagrant > (http://www.vagrantup.com/) and veewee > (https://github.com/jedi4ever/veewee) tools. At the time, vagrant > was packaged as a Ruby gem with a variety of other gem > dependencies. Some of the dependencies were already in the ports > tree, but they were the wrong versions. > > Gem dependency lists are often very specific regarding acceptable > versions, and the ports tree had a couple of examples of gems that > were duplicated so that different major versions could be used as > dependencies for other ports (e.g. devel/rubygem-json and > devel/rubygem-json146). > > I have been working on a way to install any version of a gem from > a single ports tree directory, as well as install multiple > simultaneous versions of the same gem. I'd like to offer my > patches for review, comments and testing, and you can find them > here: > > http://people.freebsd.org/~glarkin/diffs/usr-ports-Mk-rubygem-versions.diff > > http://people.freebsd.org/~glarkin/diffs/usr-ports-devel-rubygem-port-examples.diff > > Both diffs were generated against r318392. The first one patches > Mk/bsd.ruby.mk and creates Mk/bsd.rubygem-versions.mk. The second > one patches devel/rubygem-childprocess and devel/rubygem-ffi to > show how the new multi-version support works. > > One of the key features in bsd.rubygem-versions.mk is that it > creates additional version-specific targets like "install-1.3.4", > "clean-3.0.19", etc., based on the list of versions for each gem. > > Here is the process for adding multi-version support to a gem > port: > > cd /usr/ports/devel/rubygem-foobar mkdir -p files # Or "svn > mkdir files", if it doesn't exist make gem-versions # Creates the > version list helper files # # Fix *_DEPENDS in Makefile, if > necessary (see below) # make install-0.0.6 clean-0.0.6 make > install-1.4.5 clean-1.4.5 make install-0.9 clean-0.9 # # etc... > > Since each gem version may need a different dependency list, I > added version-specific *_DEPENDS support like so: > > # Using the examples from above: RUN_DEPENDS006+= > rubygem-quux123>=1.2.3:${PORTSDIR}/devel/rubygem-quux:install-1.2.3 > \ > > rubygem-bar0019<=0.0.999:${PORTSDIR}/devel/rubygem-bar:install-0.0.19 > > # > RUN_DEPENDS09+= > rubygem-quux1210>=1.2.3:${PORTSDIR}/devel/rubygem-quux:install-1.2.10 > \ > > rubygem-quux1210<=1.2.999:${PORTSDIR}/devel/rubygem-quux:install-1.2.10 > \ > > rubygem-bar0019<=0.0.999:${PORTSDIR}/devel/rubygem-bar:install-0.0.19 > > # > RUN_DEPENDS145+= > rubygem-quux23<=2.3.999:${PORTSDIR}/devel/rubygem-quux:install-2.3.10 > \ > > rubygem-bar0019<=0.0.999:${PORTSDIR}/devel/rubygem-bar:install-0.0.19 > \ > > rubygem-null222>=1.0.3:${PORTSDIR}/devel/rubygem-null:install-2.2.2 > > In the first example, the quux gem must be at least version 1.2.3 > and that one is installed. If version 4.0.10 were available, that > would be acceptable as well. The bar gem version must be >= 0.0.1 > and < 0.1 (cf: http://docs.rubygems.org/read/chapter/16#page74). > Since there is no "~>" operator in our depends system yet, I'm > manually approximating it here by testing against and upper version > of 0.0.999 and counting on the port maintainer to call the proper > install target for the dependency. > > In the second example, quux has a slightly more complex version > requirement, namely ">=1.2.3, ~>1.2". Any version of quux at > least 1.2.3 and less than 1.3 is acceptable. > > In the last example, the null gem must be at least version 1.0.3, > but there is no upper bound. The port maintainer has decided to > install version 2.2.2, which may or may not be the most recent > one. > > I look forward to your feedback, Greg > > And I forgot a rather key command in the description above. It should read: cd /usr/ports/devel/rubygem-foobar mkdir -p files # Or "svn mkdir files", if it doesn't exist make gem-versions # Creates the version list helper files make makesum-all # Update the distinfo file with all versions Regards, Greg - -- Greg Larkin http://www.FreeBSD.org/ - The Power To Serve http://www.sourcehosting.net/ - Ready. Set. Code. http://twitter.com/cpucycle/ - Follow you, follow me -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (Darwin) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlGbnm4ACgkQ0sRouByUApCetQCfRkLnluBzOzT51zPtQ7HuevGT XXMAn2sETR7A7kKbbCu/+Jik2EYzcznG =PzWW -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?519B9E6E.3000607>