RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
Server: rpm5.org Name: Per Øyvind Karlsen
Root: /v/rpm/cvs Email: pkarl...@rpm5.org
Module: rpm Date: 01-Apr-2011 09:31:18
Branch: rpm-5_3 Handle: 2011040107311701
Modified files: (Branch: rpm-5_3)
rpm CHANGES
rpm/scripts rubygems.rb
Log:
rubygems.rb: add/provide ruby(abi) dependencies for non-gems. (not my
proudest work.. ;)
Summary:
RevisionChanges Path
1.3296.2.193+1 -0 rpm/CHANGES
1.4.2.3 +45 -12 rpm/scripts/rubygems.rb
patch -p0 '@@ .'
Index: rpm/CHANGES
$ cvs diff -u -r1.3296.2.192 -r1.3296.2.193 CHANGES
--- rpm/CHANGES 1 Apr 2011 05:22:44 - 1.3296.2.192
+++ rpm/CHANGES 1 Apr 2011 07:31:18 - 1.3296.2.193
@@ -1,4 +1,5 @@
5.3.9 - 5.3.10
+- proyvind: rubygems.rb: add/provide ruby(abi) dependencies for non-gems.
- proyvind: rpmfc: add classifiers for gstreamer plugins dep generator.
- proyvind: use pythoneggs.py for python deps generated by internal
generator.
- proyvind: rpmfc: enable ruby file classifier internal dep generator.
@@ .
patch -p0 '@@ .'
Index: rpm/scripts/rubygems.rb
$ cvs diff -u -r1.4.2.2 -r1.4.2.3 rubygems.rb
--- rpm/scripts/rubygems.rb 13 Mar 2011 20:17:26 - 1.4.2.2
+++ rpm/scripts/rubygems.rb 1 Apr 2011 07:31:17 - 1.4.2.3
@@ -3,40 +3,74 @@
# Copyright 2010 Per Ãyvind Karlsen peroyv...@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 = Config::CONFIG[rubylibdir].sub(Config::CONFIG[ruby_version],
.*/specifications/.*\.gemspec$)
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
+ if 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(Config::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)
+ abi_provide = true
+ end
+elsif path.match(Config::CONFIG[sitelibdir])
+ ruby_versioned = true
+elsif path.match(Config::CONFIG[vendorlibdir])
+ ruby_versioned = true
+end
+ end
+end
+
+if requires or abi_provide
+ print ruby(abi)
+ if ruby_versioned
+print = %s\n % Config::CONFIG[ruby_version]
end
end
+
if gems.length 0
+ require 'rubygems'
+
if requires
-require 'rbconfig'
module Gem
class Requirement
@@ -61,7 +95,6 @@
end
end
-print ruby(abi) = %s\n % Config::CONFIG[ruby_version]
end
for gem in gems
@@ .
__
RPM Package Managerhttp://rpm5.org
CVS Sources Repositoryrpm-cvs@rpm5.org