summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Graaff <graaff@gentoo.org>2012-08-19 07:45:02 +0000
committerHans de Graaff <graaff@gentoo.org>2012-08-19 07:45:02 +0000
commitcb8fc184d736c55b16ddcd17c29f3eee748c62a6 (patch)
treec721e2279699e45bb80646b700d8f2c1e06cfd65 /eclass/ruby-fakegem.eclass
parentVersion bump. (diff)
downloadgentoo-2-cb8fc184d736c55b16ddcd17c29f3eee748c62a6.tar.gz
gentoo-2-cb8fc184d736c55b16ddcd17c29f3eee748c62a6.tar.bz2
gentoo-2-cb8fc184d736c55b16ddcd17c29f3eee748c62a6.zip
Make sure to use UTF-8 encoding when reading YAML files with ruby19. Patch and bug report by Shunsuke Shimizu in bug 431276.
Diffstat (limited to 'eclass/ruby-fakegem.eclass')
-rw-r--r--eclass/ruby-fakegem.eclass15
1 files changed, 11 insertions, 4 deletions
diff --git a/eclass/ruby-fakegem.eclass b/eclass/ruby-fakegem.eclass
index aedfe04915fd..229acaa6bd4a 100644
--- a/eclass/ruby-fakegem.eclass
+++ b/eclass/ruby-fakegem.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.36 2012/08/15 15:06:09 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ruby-fakegem.eclass,v 1.37 2012/08/19 07:45:02 graaff Exp $
# @ECLASS: ruby-fakegem.eclass
# @MAINTAINER:
@@ -245,7 +245,14 @@ ruby_fakegem_gemspec_gemspec() {
# the metadata distributed by the gem itself. This is similar to how
# rubygems creates an installation from a .gem file.
ruby_fakegem_metadata_gemspec() {
- ${RUBY} -r yaml -e "puts Gem::Specification.from_yaml(File::open('$1').read).to_ruby" > $2
+ case ${RUBY} in
+ *ruby19)
+ ${RUBY} -r yaml -e "puts Gem::Specification.from_yaml(File::open('$1', :encoding => 'UTF-8').read).to_ruby" > $2
+ ;;
+ *)
+ ${RUBY} -r yaml -e "puts Gem::Specification.from_yaml(File::open('$1').read).to_ruby" > $2
+ ;;
+ esac
}
# @FUNCTION: ruby_fakegem_genspec
@@ -273,7 +280,7 @@ ruby_fakegem_genspec() {
# so better taking this into consideration.
local quoted_description=${DESCRIPTION//\"/\\\"}
cat - > $1 <<EOF
-# generated by ruby-fakegem.eclass $Revision: 1.36 $
+# generated by ruby-fakegem.eclass $Revision: 1.37 $
Gem::Specification.new do |s|
s.name = "${RUBY_FAKEGEM_NAME}"
s.version = "${RUBY_FAKEGEM_VERSION}"
@@ -323,7 +330,7 @@ ruby_fakegem_binwrapper() {
#!${rubycmd}
# This is a simplified version of the RubyGems wrapper
#
-# Generated by ruby-fakegem.eclass $Revision: 1.36 $
+# Generated by ruby-fakegem.eclass $Revision: 1.37 $
require 'rubygems'