From: Jonathan Weiss Date: 2005-07-22T06:04:57+09:00 Subject: Re: Rubygems now integrated in the FreeBSD ports tree > Thanks for the *quick* reply :) > > On Thu, Jul 21, 2005 at 09:23:46PM +0200, Jonathan Weiss wrote: >>> 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. > > I see. It'd be necessary to modify the do-install target to patch the > extracted files, right? Or you could define a pre-install target, patch the source and rebuild the gem. > >> 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. > > Yes, this makes sense anyway in most cases, since we're often dealing with > (potential) upstream patches. And I guess FreeBSD-specific (if any) patches > would be handled as you said. I believe it's still good to be able to patch > at that level because the original author could be MIA, or even disappear > completely after a while. > > This is true, I will think about what's the best way to support patches. >> 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: > [very clean Makefile] >> MASTER_SITES= http://rubyforge.org/frs/download.php/4258/ >> >> 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. > > Would it be possible to point to the original .gem (also specifying the > checksum) instead of putting it under ${PORTSDIR}/distfiles/rubygem/ ? > I don't really know the FreeBSD infrastructure but I suspect the latter > is more costly (?). But I guess it'd require the sort of specific code > you talked about before. Also, is distfiles/rubygem/ updated if one uses > CVSup to track the ports hierarchy? Wouldn't distfiles/rubygem/ become quite > large/heavy eventually? > The gem is not put into ${PORTSDIR}/distfiles/rubygem/ by the maintainer, it is downloaded by the ports infrastructure and put there when you do the `make install`. So it does not clutter the CVS repository. The maintainer just specifies from where to get the gem like done here: MASTER_SITES= http://rubyforge.org/frs/download.php/4258/ The common Makefile will then try to download http://rubyforge.org/frs/download.php/4258/{$PORTNAME}-{$PORTVERSION}.${ EXTRACT_SUFX} Which should be in most cases exaclty what you want (like rake-0.5.4.gem). Of course you can override these values in the port's Makefile. >> 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. > > IIRC the metadata includes a complete file list, but it's marshalled with YAML > and inside the "tar(tar + metadata.gz)" .gem structure. Maybe a Ruby script > could handle this ;) (I might try to write it if I find the time). The problem is that the file list can be in YAML and in pure Ruby. Further, some C-extensions do not have a complete file list for the generated code. So I picked the easier solution of having the maintainer specifying the file list. Generating the list out of the spec would be a very nice feature. >> 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. > > You're too modest :) It seems to me the system adds: > * atomic installs (although the system cannot yet be protected from > breakeage through direct invocation of gem) > * native dependencies (like needed typically by C extensions) > > These alone (especially the second IMHO) look very well from here :) > Thanks. Now the C-extensions for MySQL or PostgreSQL can actually depend on the databases in FreeBSD. This was why I wrote this extension in the first way. I wanted to install Typo through the ports system but it depends on the Rails-gems. You could not specify this dependency. Now applications that depend on rubygems can be installed (if the rubygem is present in the ports tree). Greets, Jonathan -- Jonathan Weiss http://blog.innerewut.de