Bug 144568 - devel/ruby-gems: Ruby 1.9.1 has rubygems version 1.3.1 built in, but some gems require a newer version. 1.3.5 is available by the ports, but needs the following changes.
Summary: devel/ruby-gems: Ruby 1.9.1 has rubygems version 1.3.1 built in, but some gem...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Philip M. Gollucci
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-09 01:30 UTC by Aaron Gifford
Modified: 2010-09-01 03:23 UTC (History)
0 users

See Also:


Attachments
file.diff (1.28 KB, patch)
2010-03-09 01:30 UTC, Aaron Gifford
no flags Details | Diff
file.diff (637 bytes, patch)
2010-03-09 01:30 UTC, Aaron Gifford
no flags Details | Diff
ruby-gems.diff (2.42 KB, patch)
2010-08-31 14:21 UTC, Jyun-Yan You
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Gifford 2010-03-09 01:30:00 UTC
When using Ruby 1.9.1, rubygems version 1.3.1 comes built-in.  However, some gems want the newer version.  There are two ways to achieve this:

1) Do 'gem update --system' and have rubygems do the update

PROBLEM: This will break installed gems and mess up the gem environment requiring manual patching of the file /usr/local/lib/ruby/site_ruby/1.9/rubygems/defaults.rb to correct the gem environment paths.

The other alternative is:

2) Use the devel/ruby-gems port.

PROBLEM: The port is disabled when using Ruby 1.9.  This is a BUG and should be fixed/removed, since 1.3.5 is the latest rubygems port version and 1.3.1 (older) is the built-in version.  Users will WANT to install the port to get a FreeBSD-compatible update of the gem system.

SOLUTION to PROBLEM #2:

Apply this patch (or one that accomplishes something similar) to the port Makefile, and add a new patch file that fixes the gem environment.

Fix: PATCH TO MAKEFILE:

Also available online at:
  http://www.aarongifford.com/ruby-gems-makefile-patch.txt

PATCH TO GEM ENVIRONMENT SO THE PATH IS FREEBSD COMPATIBLE:

Belongs in:
  /usr/ports/devel/ruby-gemsfiles/patch-lib__rubygems__defaults.rb

Also available online at:
  http://www.aarongifford.com/ruby-gems-patch-lib__rubygems__defaults.rb.txt
How-To-Repeat: See above.  See patches below for fix.
Comment 1 Aaron Gifford 2010-03-09 01:53:11 UTC
There's a typo in my Makefile patch.  And also I missed patching
pkg-plist. Finally, a new version 1.3.6, of rubygems is out.  I
patched distinfo with the MD5/SHA256/size info and Makefile version
and it appears to have installed seamlessly under 1.9.1 with my
patches.

The only other issue is probably with the package file list, because
when I uninstall the port, I do notice this:

pkg_delete: file
'/usr/local/lib/ruby/site_ruby/1.9/rubygems/digest/digest_adapter.rb'
doesn't exist
pkg_delete: file
'/usr/local/lib/ruby/site_ruby/1.9/rubygems/digest/md5.rb' doesn't
exist
pkg_delete: file
'/usr/local/lib/ruby/site_ruby/1.9/rubygems/digest/sha1.rb' doesn't
exist
pkg_delete: file
'/usr/local/lib/ruby/site_ruby/1.9/rubygems/digest/sha2.rb' doesn't
exist
pkg_delete: file '/usr/local/lib/ruby/site_ruby/1.9/rubygems/timer.rb'
doesn't exist
pkg_delete: file '/usr/local/lib/ruby/site_ruby/1.9/rubygems/digest'
doesn't exist
pkg_delete: unable to completely remove directory
'/usr/local/lib/ruby/site_ruby/1.9/rubygems/digest'
pkg_delete: unable to completely remove directory
'/usr/local/lib/ruby/site_ruby/1.9/rubygems/commands'
pkg_delete: unable to completely remove directory
'/usr/local/lib/ruby/site_ruby/1.9/rubygems'


I'm not familiar enough with FreeBSD port pkg-plist structure to
appropriately and compatibly conditionally omit those files that 1.9
doesn't use/install.  I am guessing wildly that this issue appears
because these files are included with 1.9 but perhaps not with 1.8?

Aaron out.

UPDATED PATCHES for 1.3.6 devel/ruby-gems under Ruby 1.9.1 on FreeBSD:


Makefile/pkg-plist/distinfo patch:
Online at:
  http://www.aarongifford.com/ruby-gems-makefile-patch.txt

--- Makefile.orig	2010-03-08 17:49:32.247247288 -0700
+++ Makefile	2010-03-08 18:37:18.555302097 -0700
@@ -6,7 +6,7 @@
 #

 PORTNAME=	gems
-PORTVERSION=	1.3.5
+PORTVERSION=	1.3.6
 CATEGORIES=	devel ruby
 MASTER_SITES=	RF
 MASTER_SITE_SUBDIR=	ruby${PORTNAME}
@@ -43,9 +43,8 @@

 .include <bsd.port.pre.mk>

-.if ${RUBY_VER} == 1.9
-IGNORE=	already included in this ruby distribution
-.endif
+RUBY_SVER=      ${RUBY_VER:S/.//g}
+PLIST_SUB+=     RUBY_SVER="${RUBY_SVER}"

 do-install:
 	cd ${WRKSRC}; ${RUBY} ${RUBY_SETUP} ${RUBY_SETUP_OPTIONS}
@@ -53,7 +52,7 @@
 post-install:
 	@${MKDIR} ${PREFIX}/${GEMS_DOC_BASE_DIR}/
 	@${TOUCH} ${PREFIX}/${GEMS_DOC_BASE_DIR}/.keep_this
-	@${LN} -sf ${PREFIX}/bin/gem18 ${PREFIX}/bin/gem
+	@${LN} -sf ${PREFIX}/bin/gem${RUBY_SVER} ${PREFIX}/bin/gem

 .if !defined(NOPORTDOCS)
 	@${FIND} -ds ${PREFIX}/lib/ruby/gems/${RUBY_VER}/doc/${DISTNAME} \
@@ -69,8 +68,8 @@
 # This target is only meant to be used by the port maintainer.
 x-generate-plist:
 	${ECHO} bin/gem > pkg-plist.new
-	${ECHO} bin/gem18 >> pkg-plist.new
-	${ECHO} bin/update_rubygems18 >> pkg-plist.new
+	${ECHO} bin/gem${RUBYS_VER} >> pkg-plist.new
+	${ECHO} bin/update_rubygems${RUBY_SVER} >> pkg-plist.new
 	${ECHO} ${GEMS_VER_DIR_P}/cache/sources-0.0.2.gem >> pkg-plist.new
 	${FIND} ${PREFIX}/${GEMS_VER_DIR}/gems/sources-0.0.2 -type f |
${SORT} | ${SED} -e 's,${PREFIX}/${GEMS_VER_DIR},${GEMS_VER_DIR_P},'
>> pkg-plist.new
 	${ECHO} ${GEMS_VER_DIR_P}/specifications/sources-0.0.2.gemspec >>
pkg-plist.new
--- distinfo.orig	2010-03-08 18:37:49.285715931 -0700
+++ distinfo	2010-03-08 18:37:56.593576220 -0700
@@ -1,7 +1,3 @@
-MD5 (ruby/rubygems-1.3.5.tgz) = 6e317335898e73beab15623cdd5f8cff
-SHA256 (ruby/rubygems-1.3.5.tgz) =
c0928cc1ae54dedfb5f57ad3829882c1f90e42bc17bf50491aa6f93a937546ac
-SIZE (ruby/rubygems-1.3.5.tgz) = 278469
-
 MD5 (ruby/rubygems-1.3.6.tgz) = 789ca8e9ad1d4d3fe5f0534fcc038a0d
 SHA256 (ruby/rubygems-1.3.6.tgz) =
5c6e6ca672b68acccb8f898670f1661307dea8668fc7f71bb421cab51208d7b0
 SIZE (ruby/rubygems-1.3.6.tgz) = 285167
--- pkg-plist.orig	2010-03-08 18:27:10.306935999 -0700
+++ pkg-plist	2010-03-08 18:37:29.782088283 -0700
@@ -1,7 +1,7 @@
 @comment $FreeBSD: ports/devel/ruby-gems/pkg-plist,v 1.20 2009/08/05
03:01:51 pgollucci Exp $
 bin/gem
-bin/gem18
-bin/update_rubygems18
+bin/gem%%RUBY_SVER%%
+bin/update_rubygems%%RUBY_SVER%%
 lib/ruby/gems/%%RUBY_VER%%/cache/sources-0.0.2.gem
 lib/ruby/gems/%%RUBY_VER%%/gems/sources-0.0.2/lib/sources.rb
 lib/ruby/gems/%%RUBY_VER%%/specifications/sources-0.0.2.gemspec





The other patch remains the same, available online at:

http://www.aarongifford.com/ruby-gems-patch-lib__rubygems__defaults.rb.txt
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2010-03-09 02:42:33 UTC
Responsible Changed
From-To: freebsd-ports-bugs->pgollucci

Take a guess that this applies to devel/ruby-gems.
Comment 3 Aaron Gifford 2010-03-10 01:47:38 UTC
Okay, that patch has a few typos...   i.e. RUBYS_VAR (wrong) instead
of RUBY_SVAR

Is defining another make variable like RUBY_SVAR the best way to make
sure that installed elements named after the installed version of Ruby
are correctly named?  i.e. gem18 or gem19 depending on whether
RUBY_VER is 1.8 or 1.9? Other suggestions?

Hoping Ruby 1.9.1 can be a first class citizen under FreeBSD soon,
Aaron out.
Comment 4 pgollucci 2010-04-27 21:41:07 UTC
Can you please provide a complete diff against the current 
devel/ruby-gems port [now 1.3.6]
as an attachment (see send-pr -a, port submit, or the upload feature of 
the gnats webpage).

If not, just link to the *complete* diff as one file on your site.


-- 
------------------------------------------------------------------------
Philip M. Gollucci (pgollucci@ridecharge.com)
p: 703.549.2050x206, did: 703.579.6947
Senior System Admin - RideCharge, Inc.  http://ridecharge.com
1024D/DB9B8C1C B90B FBC3 A3A1 C71A 8E70  3F8C 75B8 8FFB DB9B 8C1C

Work like you don't need the money,
love like you'll never get hurt,
and dance like nobody's watching.
Comment 5 Philip M. Gollucci freebsd_committer freebsd_triage 2010-04-27 23:34:10 UTC
State Changed
From-To: open->feedback

waiting on feedback
Comment 6 Philip M. Gollucci freebsd_committer freebsd_triage 2010-04-29 19:26:16 UTC
Responsible Changed
From-To: pgollucci->ruby

over to ruby@
Comment 7 Jyun-Yan You 2010-08-31 14:21:07 UTC
I make a new diff for current devel/ruby-gems (1.3.7). 
Comment 8 Philip M. Gollucci freebsd_committer freebsd_triage 2010-08-31 19:49:18 UTC
Responsible Changed
From-To: ruby->pgollucci

I will take it
Comment 9 Philip M. Gollucci freebsd_committer freebsd_triage 2010-08-31 19:49:38 UTC
State Changed
From-To: feedback->open

reopen
Comment 10 Philip M. Gollucci freebsd_committer freebsd_triage 2010-09-01 03:23:47 UTC
State Changed
From-To: open->closed

required update for rails 3.0.0 to work with rub 1.9.x included in that