You are not logged in.

#1 2004-12-10 11:40:26

kumo
Member
From: VARESE - Italy
Registered: 2004-04-02
Posts: 49
Website

[new] rubygems

Okay, finally I think I have been able to package up rubygems. Please try it out and tell me what you think.

The PKGBUILD file:

pkgname=rubygems
pkgver=0.8.1
pkgrel=1
pkgdesc="A package management framework for the Ruby programming language"
url="http://rubygems.rubyforge.org/wiki/wiki.pl?RubyGems"
depends=('ruby')
makedepends=()
source=(http://rubyforge.org/frs/download.php/1399/rubygems-$pkgver.tgz rubygems.patch)
install=rubygems.install
md5sums=('6276d268b420c0d61796cdbf6d28dae4' 'c754f8fe34f1521ba38e485e23b0e2bc')

build() {
  cd $startdir/src/rubygems-$pkgver
  patch -p1 -i ../rubygems.patch
  ruby install.rb

  install -D -m644 ../install_gem.rb $startdir/pkg/tmp/rubygems-pkg/install_gem.rb
  install -D -m644 packages/sources/sources.gemspec $startdir/pkg/tmp/rubygems-pkg/packages
  install -D -m644 packages/sources/lib/sources.rb $startdir/pkg/tmp/rubygems-pkg/packages/
sources/lib/sources.rb
}

The rubygems.install file:

# arg 1:  the new package version
post_install() {
  cd /tmp/rubygems-pkg
  /usr/bin/env ruby -w install_gem.rb
  rm -rf /tmp/rubygems-pkg
}

post_upgrade() {
  cd /tmp/rubygems-pkg
  /usr/bin/env ruby -w install_gem.rb
  rm -rf /tmp/rubygems-pkg
}
   
op=$1
shift
$op $*

The rubygems.patch file:

--- rubygems-0.8.1/install.rb   2004-09-12 09:24:57.000000000 +0200
+++ rubygems-modified/install.rb        2004-11-29 11:07:47.000000000 +0100
@@ -5,15 +5,20 @@
 
 include Config
 
+# for archlinux makepkg
+$archpackagedir = "../../pkg"
+
 $srcdir = CONFIG["srcdir"]
 $version = CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
 $libdir = File.join(CONFIG["libdir"], "ruby", $version)
+$libdir = File.join($archpackagedir, $libdir); #archlinux
 $archdir = File.join($libdir, CONFIG["arch"])
 $site_libdir = $:.find {|x| x =~ /site_ruby$/}
 if !$site_libdir
   $site_libdir = File.join($libdir, "site_ruby")
 elsif $site_libdir !~ Regexp.new(Regexp.quote($version))
   $site_libdir = File.join($site_libdir, $version)
+  $site_libdir = File.join($archpackagedir, $site_libdir);
 end
 
 def remove_stubs
@@ -108,6 +113,8 @@
   ## Install the 'bin' files.
 
   bindir = CONFIG['bindir']
+  packagebindir = File.join($archpackagedir, bindir) # archlinux
+  File::makedirs(packagebindir) # archlinux
   ruby_install_name = CONFIG['ruby_install_name']
   is_windows_platform = CONFIG["arch"] =~ /dos|win32/i
   Find.find('bin') do |f|
@@ -117,7 +124,7 @@
     next if f =~ /.rb$/
     next if File.basename(f) =~ /^./
     source = f
-    target = File.join(bindir, File.basename(f))
+    target = File.join(packagebindir, File.basename(f)) # archlinux
     File.open(target, "w", 0755) do |script|
       sourcelines = File.read(source)
       sourcelines.gsub!(/#!/usr/bin/env ruby/, "#!#{bindir}/#{ruby_install_name}")
@@ -136,13 +143,14 @@
 
   ## Install the 'sources' package bundled with RubyGems.
 
-  Dir.chdir("packages/sources")
-    load("sources.gemspec")
-    spec = Gem.sources_spec
-    Gem::manage_gems
-    gem_file = Gem::Builder.new(spec).build
-    Gem::Installer.new(gem_file).install(true, Gem.dir, false)
-  Dir.chdir("../..")
+  # archlinux commented out
+  #Dir.chdir("packages/sources")
+  #  load("sources.gemspec")
+  #  spec = Gem.sources_spec
+  #  Gem::manage_gems
+  #  gem_file = Gem::Builder.new(spec).build
+  #  Gem::Installer.new(gem_file).install(true, Gem.dir, false)
+  #Dir.chdir("../..")
 end
 
 install_rb

The install_gem.rb file:

#!/usr/bin/ruby
# Install the 'sources' package bundled with RubyGems.

Dir.chdir("packages/sources")
  load("sources.gemspec")
  spec = Gem.sources_spec
  Gem::manage_gems
  gem_file = Gem::Builder.new(spec).build
  Gem::Installer.new(gem_file).install(true, Gem.dir, false)
Dir.chdir("../..")

Offline

#2 2004-12-10 11:42:46

kumo
Member
From: VARESE - Italy
Registered: 2004-04-02
Posts: 49
Website

Re: [new] rubygems

Hmm, there is a problem though with the version of Ruby that ArchLinux has and it is not possible to list or install remote gems. Either you must download the gem and install it locally or install the latest stable version of ruby...

Offline

Board footer

Powered by FluxBB