aboutsummaryrefslogtreecommitdiffstats
path: root/gem_helper.rb
diff options
context:
space:
mode:
authorShlomi Fish <shlomif@mageia.org>2012-09-10 18:46:21 +0000
committerShlomi Fish <shlomif@mageia.org>2012-09-10 18:46:21 +0000
commit1c314e786787359e8fc9fe7009cd5e6ebead036b (patch)
treea7a7f031ac9bcf04c0b2a4bd1e5641f5a7a2daeb /gem_helper.rb
parent62cde8e3f1282f217b17877fa1cbc68a98a0d627 (diff)
downloadrpm-setup-1c314e786787359e8fc9fe7009cd5e6ebead036b.tar
rpm-setup-1c314e786787359e8fc9fe7009cd5e6ebead036b.tar.gz
rpm-setup-1c314e786787359e8fc9fe7009cd5e6ebead036b.tar.bz2
rpm-setup-1c314e786787359e8fc9fe7009cd5e6ebead036b.tar.xz
rpm-setup-1c314e786787359e8fc9fe7009cd5e6ebead036b.zip
Version 1.159 - fix gem_helper.rb with ruby-1.9.x.1.159
Patch by Shlomi Fish with some help from #ruby-lang.
Diffstat (limited to 'gem_helper.rb')
-rwxr-xr-xgem_helper.rb30
1 files changed, 14 insertions, 16 deletions
diff --git a/gem_helper.rb b/gem_helper.rb
index 6661575..86dfced 100755
--- a/gem_helper.rb
+++ b/gem_helper.rb
@@ -57,10 +57,8 @@ if ARGV[0] == "build" or ARGV[0] == "install"
argv.delete_at(0)
end
- file_data = Zlib::GzipReader.open("metadata.gz")
- header = YAML::load(file_data)
- file_data.close()
- body = header.instance_variable_get :@ivars
+ file_data = Zlib::GzipReader.open("metadata.gz") { |gz| gz.read() }
+ header = YAML.load(file_data)
require 'rubygems'
spec = Gem::Specification.from_yaml(YAML.dump(header))
@@ -79,7 +77,7 @@ if ARGV[0] == "build" or ARGV[0] == "install"
end
end
- if body['extensions'].size > 0
+ if header.extensions.size > 0
require 'rubygems/ext'
module Gem::Ext
class Builder
@@ -121,22 +119,22 @@ if ARGV[0] == "build" or ARGV[0] == "install"
unless dry_run
Gem::Installer.new(spec).build_extensions
else
- for ext in body['extensions']
+ for ext in header.extensions
files.push(ext[0..ext.rindex("/")-1]+".so")
end
end
- body['extensions'].clear()
+ header.extensions.clear()
end
if ARGV[0] == "build"
- body['test_files'].clear()
+ header.test_files.clear()
# We don't want ext/ in require_paths, it will only contain content for
# building extensions which needs to be installed in sitearchdir anyways..
idx = 0
- for i in 0..body['require_paths'].size()-1
- if body['require_paths'][idx].match("^ext(/|$)")
- body['require_paths'].delete_at(idx)
+ for i in 0..header.require_paths.size()-1
+ if header.require_paths[idx].match("^ext(/|$)")
+ header.require_paths.delete_at(idx)
else
idx += 1
end
@@ -144,19 +142,19 @@ if ARGV[0] == "build" or ARGV[0] == "install"
# We'll get rid of all the files we don't really need to install
idx = 0
- for i in 0..body['files'].size()-1
- if filter and body['files'][idx].match(filter)
+ for i in 0..header.files.size()-1
+ if filter and header.files[idx].match(filter)
match = true
else
match = false
- for path in body['require_paths']
- if body['files'][idx].match("^%s/" % path)
+ for path in header.require_paths
+ if header.files[idx].match("^%s/" % path)
match = true
end
end
end
if !match
- body['files'].delete_at(idx)
+ header.files.delete_at(idx)
else
idx += 1
end