+++ /dev/null
---- rpm-5.4.5/scripts/rubygems.rb.rb_newline~ 2012-02-29 17:25:34.815069060 +0100
-+++ rpm-5.4.5/scripts/rubygems.rb 2012-02-29 18:45:41.587464927 +0100
-@@ -61,10 +61,11 @@ for path in $stdin.readlines
- end
-
- if requires or abi_provide
-- print "ruby(abi)"
-+ abidep = "ruby(abi)"
- if ruby_versioned
-- print " = %s\n" % RbConfig::CONFIG["ruby_version"]
-+ abidep += " = %s" % RbConfig::CONFIG["ruby_version"]
- end
-+ print abidep + "\n"
- end
-
- if gems.length > 0
}
/* XXX: lacking better, more generic classifier... */
else if (!strncmp(fn, "/gstreamer", sizeof("/gstreamer")-1) &&
---- rpm-5.4.7/scripts/rubygems.rb.rubyabi_prov~ 2012-03-10 21:50:15.637085059 +0100
-+++ rpm-5.4.7/scripts/rubygems.rb 2012-03-10 21:50:23.928092180 +0100
-@@ -36,7 +36,12 @@ ruby_versioned = false
- abi_provide = false
-
- for path in $stdin.readlines
-- if path.match(specpatt)
-+ # 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
-@@ -46,12 +51,6 @@ for path in $stdin.readlines
- elsif not ruby_versioned
- if path.match(RbConfig::CONFIG["rubylibdir"])
- ruby_versioned = true
-- # even more 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["rubylibdir"] + "/Env.rb")
-- abi_provide = true
-- end
- elsif path.match(RbConfig::CONFIG["sitelibdir"])
- ruby_versioned = true
- elsif path.match(RbConfig::CONFIG["vendorlibdir"])
require 'rubygems'
spec = Gem::Specification.from_yaml(YAML.dump(header))
-diff -urN rpm-5.4.9/scripts/rubygems.rb rpm-5.4.9-patched/scripts/rubygems.rb
---- rpm-5.4.9/scripts/rubygems.rb 2011-04-01 18:30:28.000000000 +1100
-+++ rpm-5.4.9-patched/scripts/rubygems.rb 2012-08-30 18:09:09.771009037 +1100
-@@ -30,7 +30,7 @@
- exit(1)
- end
-
--specpatt = Config::CONFIG["rubylibdir"].sub(Config::CONFIG["ruby_version"], ".*/specifications/.*\.gemspec$")
-+specpatt = RbConfig::CONFIG["rubylibdir"].sub(RbConfig::CONFIG["ruby_version"], ".*/specifications/.*\.gemspec$")
- gems = []
- ruby_versioned = false
- abi_provide = false
-@@ -44,17 +44,17 @@
- # package is dependent on this specific version.
- # FIXME: only supports current ruby version
- elsif not ruby_versioned
-- if path.match(Config::CONFIG["rubylibdir"])
-+ if path.match(RbConfig::CONFIG["rubylibdir"])
- ruby_versioned = true
- # even more 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(Config::CONFIG["rubylibdir"] + "/Env.rb")
-+ if provides and path.match(RbConfig::CONFIG["rubylibdir"] + "/Env.rb")
- abi_provide = true
- end
-- elsif path.match(Config::CONFIG["sitelibdir"])
-+ elsif path.match(RbConfig::CONFIG["sitelibdir"])
- ruby_versioned = true
-- elsif path.match(Config::CONFIG["vendorlibdir"])
-+ elsif path.match(RbConfig::CONFIG["vendorlibdir"])
- ruby_versioned = true
- end
- end
-@@ -63,7 +63,7 @@
- if requires or abi_provide
- print "ruby(abi)"
- if ruby_versioned
-- print " = %s\n" % Config::CONFIG["ruby_version"]
-+ print " = %s\n" % RbConfig::CONFIG["ruby_version"]
- end
- end
-
-@@ -105,7 +105,7 @@
- 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\()|(\))/, "")
Source27: macros.lang
Source28: %{name}db_reset.c
Source29: dbupgrade.sh
+Source30: rubygems.rb
Patch0: %{name}-branch.patch
Patch1: %{name}-man_pl.patch
Patch2: %{name}-popt-aliases.patch
Patch65: %{name}-parseSpec-skip-empty-tags.patch
Patch66: %{name}-payload-use-hashed-inode.patch
Patch67: %{name}-repackage-dont-force-max-compression.patch
-Patch68: rubyprov-archdirs.patch
-Patch69: rubyprov-abi-versioned.patch
Patch70: python-%{name}sense-missingok.patch
Patch71: %{name}-changelog-encoding.patch
Patch72: %{name}-preserve-tag-type.patch
Patch1016: %{name}-5.4.9-update-rpmfc-when-removing-dependencies-on-self.patch
# status: idem
Patch1017: %{name}-5.4.9-rpmfc-extract-dependencies-for-all-files.patch
-# status: ready for merge
-Patch1018: %{name}-5.4.5-rubygems-add-missing-newline.patch
# status: probably okay to merge
Patch1019: %{name}-5.4.5-python-export-spec-macros.patch
# status: idem
%patch1015 -p1
%patch1016 -p1
%patch1017 -p1
-%patch1018 -p1
%patch1019 -p1
%patch1020 -p1
%patch1021 -p1
%patch1045 -p1
%patch1046 -p1
%patch1047 -p1
-%patch68 -p1
-%patch69 -p1
install %{SOURCE2} macros/pld.in
install %{SOURCE8} scripts/php.prov.in
install %{SOURCE9} scripts/php.req.in
install %{SOURCE11} scripts/perl.prov.in
+cp -p %{SOURCE30} scripts/rubygems.rb
%{__mv} -f scripts/perl.req{,.in}
--- /dev/null
+#!/usr/bin/env ruby
+#--
+# 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 'rbconfig'
+
+provides = false
+requires = false
+
+opts = OptionParser.new("#{$0} <--provides|--requires>")
+opts.on("-P", "--provides", "Print provides") do |val|
+ provides = true
+end
+opts.on("-R", "--requires", "Print requires") do |val|
+ 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)
+end
+
+specpatt = RbConfig::CONFIG["rubylibdir"].sub(RbConfig::CONFIG["ruby_version"], ".*/specifications/.*\.gemspec$")
+gems = []
+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
+ ruby_versioned = 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["archdir"])
+ ruby_versioned = true
+ elsif path.match(RbConfig::CONFIG["sitelibdir"])
+ ruby_versioned = true
+ elsif path.match(RbConfig::CONFIG["sitearchdir"])
+ ruby_versioned = true
+ elsif path.match(RbConfig::CONFIG["vendorlibdir"])
+ ruby_versioned = true
+ elsif path.match(RbConfig::CONFIG["vendorarchdir"])
+ 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
+
+ module Gem
+ class Requirement
+ def rpm_dependency_transform(name, version)
+ pessimistic = ""
+ if version == "> 0.0.0" or version == ">= 0"
+ version = ""
+ else
+ if version[0..1] == "~>"
+ pessimistic = "rubygem(%s) < %s\n" % [name, Gem::Version.create(version[3..-1]).bump]
+ version = version.gsub(/\~>/, '=>')
+ end
+ version = version.gsub(/^/, ' ')
+ end
+ version = "rubygem(%s)%s\n%s" % [name, version, pessimistic]
+ end
+
+ def to_rpm(name)
+ result = as_list
+ return result.map { |version| rpm_dependency_transform(name, version) }
+ end
+
+ end
+ end
+ end
+
+ for gem in gems
+ data = File.read(gem)
+ spec = eval(data)
+ if provides
+ print "rubygem(%s) = %s\n" % [spec.name, spec.version]
+ end
+ if requires
+ for d in spec.dependencies
+ 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\()|(\))/, "")
+ end
+ end
+ end
+end
+++ /dev/null
---- rpm-5.4.10/scripts/rubygems.rb~ 2013-04-26 00:58:58.622064212 +0300
-+++ rpm-5.4.10/scripts/rubygems.rb 2013-04-26 11:42:07.842839682 +0300
-@@ -39,8 +39,9 @@
- # 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
-+ ruby_versioned = true
- elsif path.match(specpatt)
- ruby_versioned = true
- gems.push(path.chomp)
+++ /dev/null
---- rpm-5.4.10/scripts/rubygems.rb~ 2013-04-26 00:28:59.955288629 +0300
-+++ rpm-5.4.10/scripts/rubygems.rb 2013-04-26 00:43:35.122569376 +0300
-@@ -51,10 +51,16 @@
- elsif not ruby_versioned
- if path.match(RbConfig::CONFIG["rubylibdir"])
- ruby_versioned = true
-+ elsif path.match(RbConfig::CONFIG["archdir"])
-+ ruby_versioned = true
- elsif path.match(RbConfig::CONFIG["sitelibdir"])
- ruby_versioned = true
-+ elsif path.match(RbConfig::CONFIG["sitearchdir"])
-+ ruby_versioned = true
- elsif path.match(RbConfig::CONFIG["vendorlibdir"])
- ruby_versioned = true
-+ elsif path.match(RbConfig::CONFIG["vendorarchdir"])
-+ ruby_versioned = true
- end
- end
- end