From owner-freebsd-ruby@FreeBSD.ORG Tue May 21 16:14:50 2013 Return-Path: Delivered-To: ruby@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 5CA0FEE8; Tue, 21 May 2013 16:14:50 +0000 (UTC) (envelope-from glarkin@FreeBSD.org) Received: from mail1.sourcehosting.net (mail1.sourcehosting.net [74.205.51.45]) by mx1.freebsd.org (Postfix) with ESMTP id 3A583BD9; Tue, 21 May 2013 16:14:49 +0000 (UTC) Received: from 66-189-39-69.dhcp.oxfr.ma.charter.com ([66.189.39.69] helo=Gregory-Larkins-iMac.local) by mail1.sourcehosting.net with esmtp (Exim 4.73 (FreeBSD)) (envelope-from ) id 1UepCy-000DDg-EB; Tue, 21 May 2013 12:14:43 -0400 Received: from Gregory-Larkins-iMac.local (localhost [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by Gregory-Larkins-iMac.local (Postfix) with ESMTPS id 3944B1F20028; Tue, 21 May 2013 12:14:39 -0400 (EDT) Message-ID: <519B9D6E.20803@FreeBSD.org> Date: Tue, 21 May 2013 12:14:38 -0400 From: Greg Larkin Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: "ports@FreeBSD.org" X-Enigmail-Version: 1.5.1 X-SA-Exim-Connect-IP: 66.189.39.69 X-SA-Exim-Mail-From: glarkin@FreeBSD.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail1.sourcehosting.net X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00, RCVD_IN_SORBS_DUL,RDNS_DYNAMIC,TVD_RCVD_IP autolearn=no version=3.3.1 Subject: [CFT] Installing multiple Rubygem port versions from the same directory Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SA-Exim-Version: 4.2 X-SA-Exim-Scanned: Yes (on mail1.sourcehosting.net) Cc: ruby@FreeBSD.org X-BeenThere: freebsd-ruby@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: glarkin@FreeBSD.org List-Id: FreeBSD-specific Ruby discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2013 16:14:50 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 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 - -- 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/ iEYEARECAAYFAlGbnW4ACgkQ0sRouByUApAJeACcDLLdzpNuGH4KYikgzB0+VW78 ekYAn3orS0K7MemO1RKYINUEs5G9fKcp =nc9B -----END PGP SIGNATURE-----