From 1c314e786787359e8fc9fe7009cd5e6ebead036b Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Mon, 10 Sep 2012 18:46:21 +0000 Subject: Version 1.159 - fix gem_helper.rb with ruby-1.9.x. Patch by Shlomi Fish with some help from #ruby-lang. --- NEWS | 5 +++++ configure.ac | 2 +- gem_helper.rb | 30 ++++++++++++++---------------- 3 files changed, 20 insertions(+), 17 deletions(-) diff --git a/NEWS b/NEWS index c2650ec..9eef9d3 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +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 + Freenode's #ruby-lang. + Version 1.158 - 8 Sep 2012, by Funda Wang - find-provides, find-requires: only enable rubygems when /usr/bin/ruby is found diff --git a/configure.ac b/configure.ac index 696b870..4d7db14 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.158, tv@mageia.org) +AC_INIT(rpm-mageia-setup, 1.159, tv@mageia.org) AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(1.9 -Wno-portability no-dist-gzip dist-xz) AC_CONFIG_SRCDIR 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 -- cgit v1.2.1