I have been reading
http://www.freebsd.org/cgi/query-pr.cgi?pr=82397 and
have a number of questions, esp. about how this would work in practice
from the FreeBSD developer's point of view. Also, please feel free to
correct me if any of the following info is inaccurate.
If I understand
do-install:
${RUBYGEMBIN} install --install-dir ${PREFIX}/lib/ruby/gems/${REV} \
${PORTSDIR}/distfiles/rubygem/${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}
correctly, ports essentially end up calling gem to install a .gem file placed
in ${PORTSDIR}/distfiles/rubygem/.
Yes, the port infrastructure will download the gem and install it for you in
${PREFIX}/lib/ruby/gem/1.8 that happens to be the default
/usr/local/lib/ruby/gem/1.8 if you did not change something.
If so,
* Is it possible to apply patches to RubyGems packages? What if the
RubyGems package differs substantially from the pristine sources (e.g.
if there's a complex build process using for instance a Rakefile,
probably with some source code massaging)... wouldn't that case
complicate patching?
Patching is possible as the .gem file is just an archive. The maintainer
could specify patches that would be applied to the files inside the gem. At
the moment there is no routine for extracting the gem and re-archiving it
with help from the ports system. But it would not be difficult to extend it
to do it for you.
The best way to add patches to the gem is to contact the gem's author and
the patches should be applied/included in the original software.
Normally patching should only be needed for C-extension gems.
* Don't you have to create the Makefile, distinfo, pkg-descr and
pkg-list (at least in part) manually for every single version released
through RubyGems?
For a new port you have to create Makefile, distinfo, pkg-descr and
pkg-plist.
The Makefile is not very complicated. Rake's looks like this:
PORTNAME= rake
PORTVERSION= 0.5.4
CATEGORIES= devel ruby
MASTER_SITES=
http://rubyforge.org/frs/download.php/4258/
MAINTAINER= (e-mail address removed)
COMMENT= Ruby Make
include <bsd.port.pre.mk>
include "${PORTSDIR}/devel/ruby-gems/Makefile.common"
include <bsd.port.post.mk>
The pkg-plist can be easily generated automatically with the port
sysutils/pkg_trackinst. Distinfo is created by doing a `make makesum` in the
ports directory.
When a new release is out, the maintainer has to edit the Makefile, distinfo
and pkg-plist in order to reflect the new version.
I worked on an automatic way to extrac pkg-plist from the gem-specification
but it turned out to be not trivial.
* If the answer to the previous question is affirmative, this means that
newly released RubyGems packages won't be available through the ports system
until a FreeBSD developer generates the pertinent data, right?
Yes, as with any program avaliable through the ports system. Normally this
will happen soon after the programs release.
* RubyGems packages installed via ports interfere with those installed
directly with gem install, don't they?
For the `gem` command they are not distinguishable but this should not harm
you if you do not try to manipulate the gems installed through the ports
system with the `gem` command.
* User scripts need to require 'rubygems' or set RUBYOPT to load
RubyGems packages installed via ports, right?
For user scripts nothing changes from the manual way of installing gems. The
ports system ist just a wrapper around the gem command for installing
rubygems.
The idea is that a FreeBSD user should only have to use the ports/package
system in order to install software. Only one command to manage installed
software and not `gem` for rubygems `pear` for PHP-Pear extension `perl
-MCPAN` for Perl libs and so on.
Just do cd `/usr/ports/my/program && make install clean` or `portupgrade
-a` and you are done.
The system is not perfect but I hope that it helps FreeBSD users.
Thanks in advance for the answers,
Greets,
Jonathan