diff options
author | jlam <jlam@pkgsrc.org> | 2008-03-31 15:40:43 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2008-03-31 15:40:43 +0000 |
commit | 725605277ed4901abc85c46e350581e6304804bb (patch) | |
tree | 878a9fa1c255b45bef9e83646524282b9d46dad4 | |
parent | ab526dcd814f4d88d333d043f4444b0fce973421 (diff) | |
download | pkgsrc-725605277ed4901abc85c46e350581e6304804bb.tar.gz |
Update rubygems to 1.1.0. Changes from version 1.0.1 include:
+ Port patches to allow gems to be installed into an "installion root"
from 1.0.1nb2.
+ Rename the --build-root option to --install-root, which more accurately
reflects the purpose of the option.
+ Update rubygem.mk to work with rubygems-1.1.0.
+ Require 1.1.0 as the minimum rubygems version for the build.
+ Remove GEM_FORMAT and special code to extract the gemspec file
from a gem archive -- `gem spec' can now do it correctly by itself.
+ Rename various *buildroot* targets to *install-root* to match the
name of the `gem' option.
* RubyGems now uses persistent connections on index updates and only
updates from a latest index by default, cutting candidate gems for
updates to roughly 1/4 (at present). Index updates are much faster
now.
* `gem list -r` may only show the latest version of a gem, add --all to
see all gems.
* `gem spec` now extracts specifications from .gem files.
* `gem query --installed` to aid automation of checking for gems.
This update has been tested with the 3 packages in pkgsrc that install
using the ``gem'' command:
devel/rubyforge
misc/ruby-gem_plugin
www/mongrel
This update has also been tested with the 129 packages in my local
tree that install using the ``gem'' command.
-rw-r--r-- | misc/rubygems/Makefile | 11 | ||||
-rw-r--r-- | misc/rubygems/PLIST | 15 | ||||
-rw-r--r-- | misc/rubygems/distinfo | 21 | ||||
-rw-r--r-- | misc/rubygems/patches/patch-aa | 10 | ||||
-rw-r--r-- | misc/rubygems/patches/patch-ab | 61 | ||||
-rw-r--r-- | misc/rubygems/patches/patch-ac | 18 | ||||
-rw-r--r-- | misc/rubygems/patches/patch-ad | 54 | ||||
-rw-r--r-- | misc/rubygems/patches/patch-ae | 52 | ||||
-rw-r--r-- | misc/rubygems/patches/patch-af | 16 | ||||
-rw-r--r-- | misc/rubygems/patches/patch-ag | 29 | ||||
-rw-r--r-- | misc/rubygems/patches/patch-ah | 19 | ||||
-rw-r--r-- | misc/rubygems/rubygem.mk | 75 |
12 files changed, 227 insertions, 154 deletions
diff --git a/misc/rubygems/Makefile b/misc/rubygems/Makefile index fc4fc898a7f..77fa867b6f5 100644 --- a/misc/rubygems/Makefile +++ b/misc/rubygems/Makefile @@ -1,9 +1,8 @@ -# $NetBSD: Makefile,v 1.18 2008/03/18 03:47:07 jlam Exp $ +# $NetBSD: Makefile,v 1.19 2008/03/31 15:40:43 jlam Exp $ -DISTNAME= rubygems-1.0.1 -PKGREVISION= 2 +DISTNAME= rubygems-1.1.0 CATEGORIES= misc ruby -MASTER_SITES= http://rubyforge.org/frs/download.php/29548/ +MASTER_SITES= http://rubyforge.org/frs/download.php/34638/ EXTRACT_SUFX= .tgz MAINTAINER= minskim@NetBSD.org @@ -48,9 +47,9 @@ GENERATE_PLIST+= \ INSTALL_ENV+= GEM_HOME=${DESTDIR}${GEM_HOME} INSTALL_TARGET= install -INSTALL_TARGET+= --format-executable +INSTALL_TARGET+= --no-format-executable # "bin/gem", not "bin/gem18" .if ${_USE_DESTDIR} != "no" -INSTALL_TARGET+= --buildroot=${DESTDIR:Q} +INSTALL_TARGET+= --install-root=${DESTDIR:Q} .endif # rubygem's setup.rb is not the typical setup.rb -- manually run the diff --git a/misc/rubygems/PLIST b/misc/rubygems/PLIST index 0ce2ef48006..9b9721ae03d 100644 --- a/misc/rubygems/PLIST +++ b/misc/rubygems/PLIST @@ -1,6 +1,5 @@ -@comment $NetBSD: PLIST,v 1.7 2008/03/13 18:46:20 jlam Exp $ +@comment $NetBSD: PLIST,v 1.8 2008/03/31 15:40:43 jlam Exp $ bin/gem -bin/update_rubygems ${RUBY_SITELIBDIR}/rbconfig/datadir.rb ${RUBY_SITELIBDIR}/rubygems.rb ${RUBY_SITELIBDIR}/rubygems/builder.rb @@ -50,12 +49,12 @@ ${RUBY_SITELIBDIR}/rubygems/ext/configure_builder.rb ${RUBY_SITELIBDIR}/rubygems/ext/ext_conf_builder.rb ${RUBY_SITELIBDIR}/rubygems/ext/rake_builder.rb ${RUBY_SITELIBDIR}/rubygems/format.rb -${RUBY_SITELIBDIR}/rubygems/gem_open_uri.rb ${RUBY_SITELIBDIR}/rubygems/gem_openssl.rb ${RUBY_SITELIBDIR}/rubygems/gem_path_searcher.rb ${RUBY_SITELIBDIR}/rubygems/gem_runner.rb ${RUBY_SITELIBDIR}/rubygems/indexer.rb ${RUBY_SITELIBDIR}/rubygems/indexer/abstract_index_builder.rb +${RUBY_SITELIBDIR}/rubygems/indexer/latest_index_builder.rb ${RUBY_SITELIBDIR}/rubygems/indexer/marshal_index_builder.rb ${RUBY_SITELIBDIR}/rubygems/indexer/master_index_builder.rb ${RUBY_SITELIBDIR}/rubygems/indexer/quick_index_builder.rb @@ -63,8 +62,14 @@ ${RUBY_SITELIBDIR}/rubygems/install_update_options.rb ${RUBY_SITELIBDIR}/rubygems/installer.rb ${RUBY_SITELIBDIR}/rubygems/local_remote_options.rb ${RUBY_SITELIBDIR}/rubygems/old_format.rb -${RUBY_SITELIBDIR}/rubygems/open-uri.rb ${RUBY_SITELIBDIR}/rubygems/package.rb +${RUBY_SITELIBDIR}/rubygems/package/f_sync_dir.rb +${RUBY_SITELIBDIR}/rubygems/package/tar_header.rb +${RUBY_SITELIBDIR}/rubygems/package/tar_input.rb +${RUBY_SITELIBDIR}/rubygems/package/tar_output.rb +${RUBY_SITELIBDIR}/rubygems/package/tar_reader.rb +${RUBY_SITELIBDIR}/rubygems/package/tar_reader/entry.rb +${RUBY_SITELIBDIR}/rubygems/package/tar_writer.rb ${RUBY_SITELIBDIR}/rubygems/platform.rb ${RUBY_SITELIBDIR}/rubygems/remote_fetcher.rb ${RUBY_SITELIBDIR}/rubygems/require_paths_builder.rb @@ -83,6 +88,8 @@ ${RUBY_SITELIBDIR}/rubygems/validator.rb ${RUBY_SITELIBDIR}/rubygems/version.rb ${RUBY_SITELIBDIR}/rubygems/version_option.rb ${RUBY_SITELIBDIR}/ubygems.rb +@dirrm ${RUBY_SITELIBDIR}/rubygems/package/tar_reader +@dirrm ${RUBY_SITELIBDIR}/rubygems/package @dirrm ${RUBY_SITELIBDIR}/rubygems/indexer @dirrm ${RUBY_SITELIBDIR}/rubygems/ext @dirrm ${RUBY_SITELIBDIR}/rubygems/digest diff --git a/misc/rubygems/distinfo b/misc/rubygems/distinfo index 0b5cace4af2..e8e0a816b3d 100644 --- a/misc/rubygems/distinfo +++ b/misc/rubygems/distinfo @@ -1,10 +1,13 @@ -$NetBSD: distinfo,v 1.14 2008/03/12 15:07:47 jlam Exp $ +$NetBSD: distinfo,v 1.15 2008/03/31 15:40:43 jlam Exp $ -SHA1 (rubygems-1.0.1.tgz) = 232750fa59917ea9baf03797fdb10a22d29ebad9 -RMD160 (rubygems-1.0.1.tgz) = b75fdf2aa252f84972495502b4b91f9e6d4c7e7c -Size (rubygems-1.0.1.tgz) = 246165 bytes -SHA1 (patch-aa) = 10cd33875708ec59e0a2c4a7f644de999860e810 -SHA1 (patch-ab) = bb20e3613e59ccc5b83c18e865eb5d7fc043c45c -SHA1 (patch-ac) = 28f9792eda2a8e9c9fd80f0de551c5228c623432 -SHA1 (patch-ad) = 46718895573a6d6e82a1df6eb38aa93a22aeaa87 -SHA1 (patch-ae) = e33e4ffa7fba3e73f62cc234d0aebe38f7cb242d +SHA1 (rubygems-1.1.0.tgz) = 2379e510267ed1c979987a618c9f139e58266d28 +RMD160 (rubygems-1.1.0.tgz) = 934b6ee3dfcd68b4ac93616ce40c4921d3f2e766 +Size (rubygems-1.1.0.tgz) = 426191 bytes +SHA1 (patch-aa) = 43d31663301d537f4fb25df61f499e59efefc60c +SHA1 (patch-ab) = 7713e164288dd8010867808085acba8e55b50845 +SHA1 (patch-ac) = e007358881509523f2c2821ced208f5bd9b5a232 +SHA1 (patch-ad) = b7e9a459ccb0305591db97ab7214ddc5befa24f0 +SHA1 (patch-ae) = 033fc1465fd689a5c814f7a58843945bc2fe020f +SHA1 (patch-af) = c18ecbbf52cdd68543cd1e11742045f0295dc337 +SHA1 (patch-ag) = 699d5830c20f0f026b074e5ef4546853df022136 +SHA1 (patch-ah) = da89120c46f4f5dda46861af06bce7e6e8595c4f diff --git a/misc/rubygems/patches/patch-aa b/misc/rubygems/patches/patch-aa index 79bfdc96c34..d7cc6bc8164 100644 --- a/misc/rubygems/patches/patch-aa +++ b/misc/rubygems/patches/patch-aa @@ -1,14 +1,12 @@ -$NetBSD: patch-aa,v 1.3 2008/03/08 00:43:55 jlam Exp $ +$NetBSD: patch-aa,v 1.4 2008/03/31 15:40:43 jlam Exp $ -Patch by Marcus Rueckert for staged installation of gems. - ---- lib/rubygems/commands/install_command.rb.orig 2007-12-12 19:43:02.000000000 -0500 +--- lib/rubygems/commands/install_command.rb.orig 2008-03-28 17:29:50.000000000 -0400 +++ lib/rubygems/commands/install_command.rb @@ -60,6 +60,7 @@ class Gem::Commands::InstallCommand < Ge :format_executable => options[:format_executable], :ignore_dependencies => options[:ignore_dependencies], :install_dir => options[:install_dir], -+ :build_root => options[:build_root], ++ :install_root => options[:install_root], :security_policy => options[:security_policy], :wrappers => options[:wrappers], - } + :bin_dir => options[:bin_dir] diff --git a/misc/rubygems/patches/patch-ab b/misc/rubygems/patches/patch-ab index 8c2da3deecd..dacd0d14678 100644 --- a/misc/rubygems/patches/patch-ab +++ b/misc/rubygems/patches/patch-ab @@ -1,41 +1,52 @@ -$NetBSD: patch-ab,v 1.5 2008/03/12 15:07:47 jlam Exp $ +$NetBSD: patch-ab,v 1.6 2008/03/31 15:40:43 jlam Exp $ -Patch by Marcus Rueckert for staged installation of gems. -Additional changes by Johnny C. Lam to download remote gems -into the cache directory in @build_root if specified. - ---- lib/rubygems/dependency_installer.rb.orig 2007-12-17 22:45:04.000000000 -0500 +--- lib/rubygems/dependency_installer.rb.orig 2008-03-20 21:00:57.000000000 -0400 +++ lib/rubygems/dependency_installer.rb -@@ -44,6 +44,7 @@ class Gem::DependencyInstaller +@@ -33,6 +33,7 @@ class Gem::DependencyInstaller + # :format_executable:: See Gem::Installer#initialize. + # :ignore_dependencies: Don't install any dependencies. + # :install_dir: See Gem::Installer#install. ++ # :install_root: See Gem::Installer#install. + # :security_policy: See Gem::Installer::new and Gem::Security. + # :wrappers: See Gem::Installer::new + def initialize(options = {}) +@@ -43,6 +44,7 @@ class Gem::DependencyInstaller @format_executable = options[:format_executable] @ignore_dependencies = options[:ignore_dependencies] @install_dir = options[:install_dir] || Gem.dir -+ @build_root = options[:build_root] ++ @install_root = options[:install_root] @security_policy = options[:security_policy] @wrappers = options[:wrappers] + @bin_dir = options[:bin_dir] +@@ -177,7 +179,12 @@ class Gem::DependencyInstaller + + gather_dependencies -@@ -121,9 +122,14 @@ class Gem::DependencyInstaller - # always replaced. - def download(spec, source_uri) - gem_file_name = "#{spec.full_name}.gem" -- local_gem_path = File.join @install_dir, 'cache', gem_file_name -+ installdir = @install_dir -+ unless @build_root.nil? or @build_root == "" -+ installdir = File.join(@build_root, @install_dir) +- spec_dir = File.join @install_dir, 'specifications' ++ install_dir = @install_dir ++ unless @install_root.nil? or @install_root == "" ++ install_dir = File.join(@install_root, @install_dir) + end + -+ local_gem_path = File.join installdir, 'cache', gem_file_name ++ spec_dir = File.join install_dir, 'specifications' + source_index = Gem::SourceIndex.from_gems_in spec_dir -- Gem.ensure_gem_subdirectories @install_dir -+ Gem.ensure_gem_subdirectories installdir + @gems_to_install.each do |spec| +@@ -189,7 +196,8 @@ class Gem::DependencyInstaller + say "Installing gem #{spec.full_name}" if Gem.configuration.really_verbose - source_uri = URI.parse source_uri unless URI::Generic === source_uri - scheme = source_uri.scheme -@@ -230,6 +236,7 @@ class Gem::DependencyInstaller + _, source_uri = @specs_and_sources.assoc spec +- local_gem_path = Gem::RemoteFetcher.fetcher.download spec, source_uri ++ local_gem_path = Gem::RemoteFetcher.fetcher.download spec, source_uri, ++ install_dir + + inst = Gem::Installer.new local_gem_path, + :env_shebang => @env_shebang, +@@ -197,6 +205,7 @@ class Gem::DependencyInstaller :format_executable => @format_executable, :ignore_dependencies => @ignore_dependencies, :install_dir => @install_dir, -+ :build_root => @build_root, ++ :install_root => @install_root, :security_policy => @security_policy, - :wrappers => @wrappers - + :wrappers => @wrappers, + :bin_dir => @bin_dir diff --git a/misc/rubygems/patches/patch-ac b/misc/rubygems/patches/patch-ac index d7a995f2573..f594f0b52ff 100644 --- a/misc/rubygems/patches/patch-ac +++ b/misc/rubygems/patches/patch-ac @@ -1,18 +1,14 @@ -$NetBSD: patch-ac,v 1.1 2008/03/08 00:43:55 jlam Exp $ +$NetBSD: patch-ac,v 1.2 2008/03/31 15:40:43 jlam Exp $ -Patch by Marcus Rueckert for staged installation of gems. - ---- lib/rubygems/install_update_options.rb.orig 2007-12-12 18:36:15.000000000 -0500 +--- lib/rubygems/install_update_options.rb.orig 2008-02-20 14:27:40.000000000 -0500 +++ lib/rubygems/install_update_options.rb -@@ -25,6 +25,13 @@ module Gem::InstallUpdateOptions - options[:install_dir] = File.expand_path(value) +@@ -31,6 +31,11 @@ module Gem::InstallUpdateOptions + options[:bin_dir] = File.expand_path(value) end -+ add_option(:"Install", '-B', '--build-root DIR', -+ 'Temporary installation root. Useful for', -+ 'building packages. Do not use when installing', -+ 'remote gems.') do |value, options| -+ options[:build_root] = File.expand_path(value) ++ add_option(:"Install", '-B', '--install-root DIR', ++ 'Root directory for gem files on install') do |value, options| ++ options[:install_root] = File.expand_path(value) + end + add_option(:"Install/Update", '-d', '--[no-]rdoc', diff --git a/misc/rubygems/patches/patch-ad b/misc/rubygems/patches/patch-ad index 4d9ebf27a36..bd0595fbb24 100644 --- a/misc/rubygems/patches/patch-ad +++ b/misc/rubygems/patches/patch-ad @@ -1,30 +1,54 @@ -$NetBSD: patch-ad,v 1.1 2008/03/08 00:43:55 jlam Exp $ +$NetBSD: patch-ad,v 1.2 2008/03/31 15:40:43 jlam Exp $ -Patch by Marcus Rueckert for staged installation of gems. - ---- lib/rubygems/installer.rb.orig 2007-12-20 19:43:06.000000000 -0500 +--- lib/rubygems/installer.rb.orig 2008-03-28 21:10:33.000000000 -0400 +++ lib/rubygems/installer.rb -@@ -73,6 +73,14 @@ class Gem::Installer +@@ -51,6 +51,9 @@ class Gem::Installer + # for a signed-gems-only policy. + # :ignore_dependencies:: Don't raise if a dependency is missing. + # :install_dir:: The directory to install the gem into. ++ # :install_root:: The directory to use as a buildroot for "destdir"-style ++ # installation. All paths during installation are relative ++ # to the buildroot. + # :format_executable:: Format the executable the same as the ruby executable. + # If your ruby is ruby18, foo_exec will be installed as + # foo_exec18. +@@ -62,6 +65,7 @@ class Gem::Installer + options = { + :force => false, + :install_dir => Gem.dir, ++ :install_root => nil, + :exec_format => false, + :env_shebang => false, + :bin_dir => nil +@@ -70,12 +74,17 @@ class Gem::Installer + @env_shebang = options[:env_shebang] + @force = options[:force] + gem_home = options[:install_dir] +- @gem_home = Pathname.new(gem_home).expand_path ++ @gem_home = File.expand_path gem_home + @ignore_dependencies = options[:ignore_dependencies] @format_executable = options[:format_executable] @security_policy = options[:security_policy] @wrappers = options[:wrappers] -+ @build_root = options[:build_root] -+ @bin_dir = Gem.bindir @gem_home -+ unless @build_root.nil? or @build_root == "" -+ @build_root = Pathname.new(@build_root).expand_path -+ @gem_home = File.join(@build_root, @gem_home) -+ @bin_dir = File.join(@build_root, @bin_dir) + @bin_dir = options[:bin_dir] ++ install_root = options[:install_root] ++ unless install_root.nil? or install_root == "" ++ @install_root = File.expand_path install_root ++ @gem_home = File.join(@install_root, @gem_home) + end -+ begin @format = Gem::Format.from_file_by_path @gem, @security_policy -@@ -224,7 +232,7 @@ class Gem::Installer +@@ -227,7 +236,11 @@ class Gem::Installer # If the user has asked for the gem to be installed in a directory that is # the system gem directory, then use the system bin directory, else create # (or use) a new bin dir under the gem_home. -- bindir = Gem.bindir @gem_home -+ bindir = @bin_dir +- bindir = @bin_dir ? @bin_dir : (Gem.bindir @gem_home) ++ bindir = @bin_dir ? @bin_dir : (Gem.bindir @gem_home, @install_root) ++ ++ unless @install_root.nil? or @install_root == "" ++ bindir = File.join(@install_root, bindir) ++ end Dir.mkdir bindir unless File.exist? bindir raise Gem::FilePermissionError.new(bindir) unless File.writable? bindir diff --git a/misc/rubygems/patches/patch-ae b/misc/rubygems/patches/patch-ae index 51888010719..a40b0e4cc6a 100644 --- a/misc/rubygems/patches/patch-ae +++ b/misc/rubygems/patches/patch-ae @@ -1,44 +1,42 @@ -$NetBSD: patch-ae,v 1.1 2008/03/08 00:43:55 jlam Exp $ +$NetBSD: patch-ae,v 1.2 2008/03/31 15:40:43 jlam Exp $ -Patch by Marcus Rueckert for staged installation of gems. - ---- setup.rb.orig 2007-12-20 20:15:55.000000000 -0500 +--- setup.rb.orig 2008-03-27 19:09:24.000000000 -0400 +++ setup.rb -@@ -24,6 +24,9 @@ if ARGV.include? '--help' then - puts " --prefix=DIR Prefix path for installing RubyGems" - puts " Will not affect gem repository" +@@ -34,6 +34,9 @@ if ARGV.include? '--help' or ARGV.includ + puts " --prefix=DIR Prefix path for installing RubyGems" + puts " Will not affect gem repository location" puts -+ puts " --buildroot=DIR Staging directory for installing RubyGems (for packagers)" -+ puts " Will not affect gem repository" ++ puts " --install-root=DIR Root directory for installing RubyGems" ++ puts " Will not affect gem repository" + puts - puts " --format-executable Make the gem command's prefix and suffix match ruby's" - puts " If ruby is installed as ruby19, gem will be gem19" + puts " --no-format-executable Force installation as `gem`" puts -@@ -74,11 +77,30 @@ else + puts " --no-rdoc Don't build RDoc for RubyGems" +@@ -83,11 +86,30 @@ else lib_dir = File.join prefix, 'lib' bin_dir = File.join prefix, 'bin' +end + -+unless ARGV.grep(/^--buildroot/).empty? then -+ buildroot = nil -+ -+ buildroot_arg = ARGV.grep(/^--buildroot=/).first -+ if buildroot_arg =~ /^--buildroot=(.*)/ then -+ buildroot = $1 -+ else -+ path_index = ARGV.index '--buildroot' -+ buildroot = ARGV[path_index + 1] -+ end -+ -+ buildroot = File.expand_path buildroot ++unless ARGV.grep(/^--install-root/).empty? then ++ install_root = nil - mkdir_p lib_dir - mkdir_p bin_dir -+ raise "invalid --buildroot #{buildroot.inspect}" if buildroot.nil? ++ install_root_arg = ARGV.grep(/^--install-root=/).first ++ if install_root_arg =~ /^--install-root=(.*)/ then ++ install_root = $1 ++ else ++ path_index = ARGV.index '--install-root' ++ install_root = ARGV[path_index + 1] ++ end ++ ++ install_root = File.expand_path install_root ++ ++ raise "invalid --install-root #{install_root.inspect}" if install_root.nil? + -+ bin_dir = File.join(buildroot, bin_dir) -+ lib_dir = File.join(buildroot, lib_dir) ++ bin_dir = File.join(install_root, bin_dir) ++ lib_dir = File.join(install_root, lib_dir) end +mkdir_p lib_dir diff --git a/misc/rubygems/patches/patch-af b/misc/rubygems/patches/patch-af new file mode 100644 index 00000000000..cca1568446e --- /dev/null +++ b/misc/rubygems/patches/patch-af @@ -0,0 +1,16 @@ +$NetBSD: patch-af,v 1.1 2008/03/31 15:40:43 jlam Exp $ + +--- lib/rubygems/commands/uninstall_command.rb.orig 2008-02-23 21:26:47.000000000 -0500 ++++ lib/rubygems/commands/uninstall_command.rb +@@ -40,6 +40,11 @@ module Gem + options[:bin_dir] = File.expand_path(value) + end + ++ add_option('-B', '--install-root DIR', ++ 'Root directory for gem files') do |value, options| ++ options[:install_root] = File.expand_path(value) ++ end ++ + add_version_option + add_platform_option + end diff --git a/misc/rubygems/patches/patch-ag b/misc/rubygems/patches/patch-ag new file mode 100644 index 00000000000..c8f9983efd1 --- /dev/null +++ b/misc/rubygems/patches/patch-ag @@ -0,0 +1,29 @@ +$NetBSD: patch-ag,v 1.1 2008/03/31 15:40:43 jlam Exp $ + +--- lib/rubygems/uninstaller.rb.orig 2008-02-23 22:05:54.000000000 -0500 ++++ lib/rubygems/uninstaller.rb +@@ -31,6 +31,11 @@ class Gem::Uninstaller + @force_all = options[:all] + @force_ignore = options[:ignore] + @bin_dir = options[:bin_dir] ++ install_root = options[:install_root] ++ unless install_root.nil? or install_root == "" ++ @install_root = File.expand_path install_root ++ @gem_home = File.join(@install_root, @gem_home) ++ end + end + + ## +@@ -74,7 +79,11 @@ class Gem::Uninstaller + return if gemspec.nil? + + if gemspec.executables.size > 0 then +- bindir = @bin_dir ? @bin_dir : (Gem.bindir @gem_home) ++ bindir = @bin_dir ? @bin_dir : (Gem.bindir @gem_home, @install_root) ++ ++ unless @install_root.nil? or @install_root == "" ++ bindir = File.join(@install_root, bindir) ++ end + + list = Gem.source_index.search(gemspec.name).delete_if { |spec| + spec.version == gemspec.version diff --git a/misc/rubygems/patches/patch-ah b/misc/rubygems/patches/patch-ah new file mode 100644 index 00000000000..afd1ce67fe2 --- /dev/null +++ b/misc/rubygems/patches/patch-ah @@ -0,0 +1,19 @@ +$NetBSD: patch-ah,v 1.1 2008/03/31 15:40:43 jlam Exp $ + +--- lib/rubygems.rb.orig 2008-03-28 21:05:55.000000000 -0400 ++++ lib/rubygems.rb +@@ -213,7 +213,13 @@ module Gem + ## + # The path where gem executables are to be installed. + +- def self.bindir(install_dir=Gem.dir) ++ def self.bindir(install_dir=Gem.dir, install_root=nil) ++ unless install_root.nil? ++ install_root_path = Pathname.new install_root ++ install_dir_path = Pathname.new install_dir ++ install_dir_path = install_dir_path.relative_path_from install_root_path ++ install_dir = install_dir_path.expand_path File::SEPARATOR ++ end + return File.join(install_dir, 'bin') unless + install_dir.to_s == Gem.default_dir + Gem.default_bindir diff --git a/misc/rubygems/rubygem.mk b/misc/rubygems/rubygem.mk index 4bc2fc3d9f6..6b2c5b49af4 100644 --- a/misc/rubygems/rubygem.mk +++ b/misc/rubygems/rubygem.mk @@ -1,4 +1,4 @@ -# $NetBSD: rubygem.mk,v 1.34 2008/03/27 05:34:31 jlam Exp $ +# $NetBSD: rubygem.mk,v 1.35 2008/03/31 15:40:43 jlam Exp $ # # This Makefile fragment is intended to be included by packages that build # and install Ruby gems. @@ -19,21 +19,14 @@ # # GEM_CLEANBUILD # A list of shell globs representing files to remove from the -# gem installed in the buildroot. The file is removed if the -# path matches the glob and is not in ${WRKSRC}. The default -# is "ext/*" +# gem installed in the installation root. The file is removed +# if the path matches the glob and is not in ${WRKSRC}. The +# default is "ext/*" # # Example: # # GEM_CLEANBUILD= *.o *.${RUBY_DLEXT} mkmf.log # -# GEM_FORMAT -# The file format of the downloaded gem. Some older gems are only -# available in the outdated ``packed'', shar-like format. -# -# Possible: packed, tar -# Default: tar -# # GEM_NAME # The name of the gem to install. The default value is ${DISTNAME}. # @@ -75,18 +68,15 @@ PKG_DESTDIR_SUPPORT?= user-destdir # Default to using rake to build the local gem from the unpacked files. GEM_BUILD?= rake -# Default to assuming a "tar" gem archive format. -GEM_FORMAT?= tar - # Build and run-time dependencies. # -# We need rubygems>=1.0.1nb1 to actually build the package, but the +# We need rubygems>=1.1.0 to actually build the package, but the # resulting installed gem can run with older versions of rubygems. # # If we're using rake to build the local gem, then include it as a # build tool. # -BUILD_DEPENDS+= rubygems>=1.0.1nb1:../../misc/rubygems +BUILD_DEPENDS+= rubygems>=1.1.0:../../misc/rubygems DEPENDS+= rubygems>=1.0.1:../../misc/rubygems .if ${GEM_BUILD} == "rake" BUILD_DEPENDS+= rake>=0.8.1:../../devel/rake @@ -157,31 +147,14 @@ PRINT_PLIST_AWK+= /^(@dirrm )?${GEM_HOME:S|${PREFIX}/||:S|/|\\/|g}/ \ ### GEM_SPECFILE?= ${WRKDIR}/${DISTNAME}.gemspec -# This awk script prints the gemspec file embedded in a "packed" gem -# archive to standard output. -# -_GEMSPEC_EXTRACT_AWK= \ - 'BEGIN { do_print = 0 } \ - /^--- .*Gem::Specification/ { do_print = 1; print; next } \ - /^---/ { print; exit 0 } \ - { if (do_print) print }' - .PHONY: gem-extract post-extract: gem-extract .if !target(gem-extract) gem-extract: . for _gem_ in ${DISTFILES:M*.gem} ${RUN} cd ${WRKDIR} && ${RUBYGEM} unpack ${_DISTDIR:Q}/${_gem_:Q} -. if ${GEM_FORMAT} == "tar" - ${RUN} cd ${WRKDIR} && \ - ${EXTRACTOR} -f tar ${_DISTDIR:Q}/${_gem_:Q} metadata.gz && \ - ${EXTRACTOR} metadata.gz && \ - rm metadata.gz && mv metadata ${_gem_}spec -. endif -. if ${GEM_FORMAT} == "packed" - ${RUN} cd ${WRKDIR} && awk ${_GEMSPEC_EXTRACT_AWK} \ - ${_DISTDIR:Q}/${_gem_:Q} > ${_gem_}spec -. endif + ${RUN} cd ${WRKDIR} && ${RUBYGEM} spec ${_DISTDIR:Q}/${_gem_:Q} \ + > ${_gem_}spec . endfor .endif @@ -191,7 +164,7 @@ gem-extract: ### The gem-build target builds a new local gem from the extracted gem's ### contents. The new gem as created as ${WRKSRC}/${GEM_NAME}.gem. ### The local gem is then installed into a special build root under -### ${WRKDIR} (${_RUBYGEM_BUILDROOT}), possibly compiling any extensions. +### ${WRKDIR} (${_RUBYGEM_INSTALL_ROOT}), possibly compiling any extensions. ### GEM_CLEANBUILD?= ext/* .if !empty(GEM_CLEANBUILD:M/*) || !empty(GEM_CLEANBUILD:M*../*) @@ -199,8 +172,8 @@ PKG_FAIL_REASON= "GEM_CLEANBUILD must be relative to "${GEM_LIBDIR:Q}"." .endif _GEM_BUILD_TARGETS= _gem-${GEM_BUILD}-build -_GEM_BUILD_TARGETS+= _gem-build-buildroot -_GEM_BUILD_TARGETS+= _gem-build-buildroot-check +_GEM_BUILD_TARGETS+= _gem-build-install-root +_GEM_BUILD_TARGETS+= _gem-build-install-root-check .if !empty(GEM_CLEANBUILD) _GEM_BUILD_TARGETS+= _gem-build-cleanbuild .endif @@ -230,32 +203,32 @@ _gem-rake-build: exit 0; \ done -_RUBYGEM_BUILDROOT= ${WRKDIR}/.inst +_RUBYGEM_INSTALL_ROOT= ${WRKDIR}/.inst _RUBYGEM_OPTIONS= --no-update-sources # don't cache the gem index _RUBYGEM_OPTIONS+= --install-dir ${GEM_HOME} -_RUBYGEM_OPTIONS+= --build-root ${_RUBYGEM_BUILDROOT} +_RUBYGEM_OPTIONS+= --install-root ${_RUBYGEM_INSTALL_ROOT} _RUBYGEM_OPTIONS+= --local ${WRKSRC}/${GEM_NAME}.gem _RUBYGEM_OPTIONS+= -- --build-args ${CONFIGURE_ARGS} -.PHONY: _gem-build-buildroot -_gem-build-buildroot: - @${STEP_MSG} "Installing gem into buildroot" +.PHONY: _gem-build-install-root +_gem-build-install-root: + @${STEP_MSG} "Installing gem into installation root" ${RUN} ${SETENV} ${MAKE_ENV} ${RUBYGEM} install ${_RUBYGEM_OPTIONS} # The ``gem'' command doesn't exit with a non-zero result even if the # install of the gem failed, so we do the check and return the proper exit # code ourselves. # -.PHONY: _gem-build-buildroot-check -_gem-build-buildroot-check: - ${RUN} test -f ${_RUBYGEM_BUILDROOT}${GEM_CACHEDIR}/${GEM_NAME}.gem || \ - ${FAIL_MSG} "Installing ${GEM_NAME}.gem into buildroot failed." +.PHONY: _gem-build-install-root-check +_gem-build-install-root-check: + ${RUN} test -f ${_RUBYGEM_INSTALL_ROOT}${GEM_CACHEDIR}/${GEM_NAME}.gem || \ + ${FAIL_MSG} "Installing ${GEM_NAME}.gem into installation root failed." .if !empty(GEM_CLEANBUILD) .PHONY: _gem-build-cleanbuild _gem-build-cleanbuild: @${STEP_MSG} "Cleaning intermediate gem build files" - ${RUN} cd ${_RUBYGEM_BUILDROOT}${GEM_LIBDIR} && \ + ${RUN} cd ${_RUBYGEM_INSTALL_ROOT}${GEM_LIBDIR} && \ find . -print | sort -r | \ while read file; do \ case $$file in \ @@ -276,13 +249,13 @@ _gem-build-cleanbuild: ### ### gem-install ### -### The gem-install target installs the gem in ${_RUBY_BUILDROOT} into +### The gem-install target installs the gem in ${_RUBY_INSTALL_ROOT} into ### the actual gem repository. ### GENERATE_PLIST+= ${RUBYGEM_GENERATE_PLIST} RUBYGEM_GENERATE_PLIST= \ ${ECHO} "@comment The following lines are automatically generated." && \ - ( cd ${_RUBYGEM_BUILDROOT}${PREFIX} && \ + ( cd ${_RUBYGEM_INSTALL_ROOT}${PREFIX} && \ ${FIND} ${GEM_DOCDIR:S|${PREFIX}/||} \! -type d -print | \ ${SORT} && \ ${FIND} ${GEM_DOCDIR:S|${PREFIX}/||} -type d -print | \ @@ -291,5 +264,5 @@ RUBYGEM_GENERATE_PLIST= \ .PHONY: gem-install do-install: gem-install gem-install: - ${RUN} cd ${_RUBYGEM_BUILDROOT}${PREFIX} && \ + ${RUN} cd ${_RUBYGEM_INSTALL_ROOT}${PREFIX} && \ pax -rwpe . ${DESTDIR}${PREFIX} |