[packages/rpm] rubygems.rb: ruby-2.0 compatible packaging fixes (missing version in noarch packages)

glen glen at pld-linux.org
Sun Jun 1 21:14:57 CEST 2014


commit 73eb048b2f020161bf036d5096c3e7d9b74c62f5
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sun Jun 1 22:14:24 2014 +0300

    rubygems.rb: ruby-2.0 compatible packaging fixes (missing version in noarch packages)

 rpm.spec    |  2 +-
 rubygems.rb | 12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/rpm.spec b/rpm.spec
index b8a7b67..a0a7463 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -50,7 +50,7 @@ Summary(ru.UTF-8):	Менеджер пакетов от RPM
 Summary(uk.UTF-8):	Менеджер пакетів від RPM
 Name:		rpm
 Version:	5.4.14
-Release:	3
+Release:	4
 License:	LGPL v2.1
 Group:		Base
 # http://rpm5.org/files/rpm/rpm-5.4/rpm-5.4.14-0.20131024.src.rpm
diff --git a/rubygems.rb b/rubygems.rb
index f048488..62dc71e 100755
--- a/rubygems.rb
+++ b/rubygems.rb
@@ -30,10 +30,14 @@ if rest.size != 0 or (!provides and !requires) or (provides and requires)
   exit(1)
 end
 
-specpatt = RbConfig::CONFIG["rubylibdir"].sub(RbConfig::CONFIG["ruby_version"], ".*/specifications/.*\.gemspec$")
+require 'rubygems'
+gem_dir = Gem.respond_to?(:default_dirs) ? Gem.default_dirs[:system][:gem_dir] : Gem.path.first
+specpatt = "#{gem_dir}/specifications/.*\.gemspec$"
 gems = []
 ruby_versioned = false
 abi_provide = false
+# as ruby_version may be empty, take version from basename of archdir
+ruby_version = RbConfig::CONFIG["ruby_version"].empty? ? File.basename(RbConfig::CONFIG["archdir"]) : RbConfig::CONFIG["ruby_version"]
 
 for path in $stdin.readlines
   # way fugly, but we make the assumption that if the package has
@@ -55,11 +59,11 @@ for path in $stdin.readlines
     elsif path.match(RbConfig::CONFIG["archdir"])
       ruby_versioned = true
     elsif path.match(RbConfig::CONFIG["sitelibdir"])
-      ruby_versioned = true
+      ruby_versioned = !RbConfig::CONFIG["ruby_version"].empty?
     elsif path.match(RbConfig::CONFIG["sitearchdir"])
       ruby_versioned = true
     elsif path.match(RbConfig::CONFIG["vendorlibdir"])
-      ruby_versioned = true
+      ruby_versioned = !RbConfig::CONFIG["ruby_version"].empty?
     elsif path.match(RbConfig::CONFIG["vendorarchdir"])
       ruby_versioned = true
     end
@@ -69,7 +73,7 @@ end
 if requires or abi_provide
   abidep = "ruby(abi)"
   if ruby_versioned
-    abidep += " = %s" % RbConfig::CONFIG["ruby_version"]
+    abidep += " = %s" % ruby_version
   end
   print abidep + "\n"
 end
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm.git/commitdiff/73eb048b2f020161bf036d5096c3e7d9b74c62f5



More information about the pld-cvs-commit mailing list