diff options
author | Funda Wang <fwang@mageia.org> | 2012-09-12 08:10:29 +0000 |
---|---|---|
committer | Funda Wang <fwang@mageia.org> | 2012-09-12 08:10:29 +0000 |
commit | 1d8ae5030fb02e39aa2928d184c8302152ed89a1 (patch) | |
tree | 8ed6392b139e79a5a47bb1473c6d765defbd223f | |
parent | 1c314e786787359e8fc9fe7009cd5e6ebead036b (diff) | |
download | rpm-setup-1d8ae5030fb02e39aa2928d184c8302152ed89a1.tar rpm-setup-1d8ae5030fb02e39aa2928d184c8302152ed89a1.tar.gz rpm-setup-1d8ae5030fb02e39aa2928d184c8302152ed89a1.tar.bz2 rpm-setup-1d8ae5030fb02e39aa2928d184c8302152ed89a1.tar.xz rpm-setup-1d8ae5030fb02e39aa2928d184c8302152ed89a1.zip |
1.160: merge rubygems.rb from Mandriva, so that it works with ruby 1.9.x1.160
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rwxr-xr-x | rubygems.rb | 62 |
3 files changed, 51 insertions, 16 deletions
@@ -1,3 +1,6 @@ +Version 1.160 - 12 Sep 2012, by Funda wang +- merge rubygems.rb from Mandriva, so that it works with ruby 1.9.x + Version 1.159 - 10 Sep 2012, by Shlomi Fish - fix gem_helper.rb with ruby-1.9.x (see bug #7429). - patch written by Shlomi Fish with some help from the people on diff --git a/configure.ac b/configure.ac index 4d7db14..3aec58a 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ # $Id: configure.ac 271266 2010-11-04 10:43:28Z fwang $ AC_PREREQ(2.59) -AC_INIT(rpm-mageia-setup, 1.159, tv@mageia.org) +AC_INIT(rpm-mageia-setup, 1.160, tv@mageia.org) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(1.9 -Wno-portability no-dist-gzip dist-xz) AC_CONFIG_SRCDIR diff --git a/rubygems.rb b/rubygems.rb index 1a775bd..5368b26 100755 --- a/rubygems.rb +++ b/rubygems.rb @@ -3,40 +3,75 @@ # Copyright 2010 Per Øyvind Karlsen <peroyvind@mandriva.org> # This program is free software. It may be redistributed and/or modified under # the terms of the LGPL version 2.1 (or later). +# +# FIXME: Someone with actual ruby skills should really clean up and sanitize +# this! fugliness obvious... #++ require 'optparse' -require 'rubygems' +require 'rbconfig' provides = false requires = false opts = OptionParser.new("#{$0} <--provides|--requires>") opts.on("-P", "--provides", "Print provides") do |val| - provides = true + provides = true end opts.on("-R", "--requires", "Print requires") do |val| - requires= true + requires= true end rest = opts.permute(ARGV) if rest.size != 0 or (!provides and !requires) or (provides and requires) - $stderr.puts "Use either --provides OR --requires" - $stderr.puts opts - exit(1) + $stderr.puts "Use either --provides OR --requires" + $stderr.puts opts + exit(1) end -specpath = "%s/specifications/.*\.gemspec$" % Gem::dir +specpatt = "%s/specifications/.*\.gemspec$" % RbConfig::CONFIG["rubygemsdir"] + gems = [] -for gemspec in $stdin.readlines - if gemspec.match(specpath) - gems.push(gemspec.chomp) +ruby_versioned = false +abi_provide = false + +for path in $stdin.readlines + # way fugly, but we make the assumption that if the package has + # this file, the package is the current ruby version, and should + # therefore provide ruby(abi) = version + if provides and path.match(RbConfig::CONFIG["archdir"] + "/rbconfig.rb") + abi_provide = true + elsif path.match(specpatt) + ruby_versioned = true + gems.push(path.chomp) + # this is quite ugly and lame, but the assumption made is that if any files + # found in any of these directories specific to this ruby version, the + # package is dependent on this specific version. + # FIXME: only supports current ruby version + elsif not ruby_versioned + if path.match(RbConfig::CONFIG["rubylibdir"]) + ruby_versioned = true + elsif path.match(RbConfig::CONFIG["sitelibdir"]) + ruby_versioned = true + elsif path.match(RbConfig::CONFIG["vendorlibdir"]) + ruby_versioned = true + end + end +end + +if requires or abi_provide + abidep = "ruby(abi)" + if ruby_versioned + abidep += " = %s" % RbConfig::CONFIG["ruby_version"] end + print abidep + "\n" end + if gems.length > 0 + require 'rubygems' + if requires - require 'rbconfig' module Gem class Requirement @@ -61,9 +96,6 @@ if gems.length > 0 end end - # TODO: Should we add a strict dependency on ruby version here? - #print "ruby < %s%s\n" % [Config::CONFIG["ruby_version"][0..-2], Config::CONFIG["ruby_version"][-1..-1].to_i + 1] - print "ruby >= %s\n" % Config::CONFIG["ruby_version"] end for gem in gems @@ -74,7 +106,7 @@ if gems.length > 0 end if requires for d in spec.dependencies - print d.requirement.to_rpm(d.name) unless d.type != :runtime + print d.requirement.to_rpm(d.name)[0] unless d.type != :runtime end for d in spec.required_rubygems_version.to_rpm("rubygems") print d.gsub(/(rubygem\()|(\))/, "") |