summaryrefslogtreecommitdiffstats
path: root/main/ruby
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-10-11 12:27:00 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-10-15 14:22:18 +0000
commit45607bc1477202e1308cc8dcb038fe9fc67885b7 (patch)
tree98c367eea618a06e27f7d9b75b7135f3782b4614 /main/ruby
parentcc7048c5491d54872412bd3fc07d8497f64077b1 (diff)
downloadaports-45607bc1477202e1308cc8dcb038fe9fc67885b7.tar.bz2
aports-45607bc1477202e1308cc8dcb038fe9fc67885b7.tar.xz
main/ruby: upgrade to 1.9.3_p194
Diffstat (limited to 'main/ruby')
-rw-r--r--main/ruby/APKBUILD130
-rw-r--r--main/ruby/ruby-1.9.3-always-use-i386.patch11
-rw-r--r--main/ruby/ruby-1.9.3-backport-from-trunk-rev37068.patch103
3 files changed, 233 insertions, 11 deletions
diff --git a/main/ruby/APKBUILD b/main/ruby/APKBUILD
index c86605d7e..df0c454b7 100644
--- a/main/ruby/APKBUILD
+++ b/main/ruby/APKBUILD
@@ -1,18 +1,31 @@
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
-# Maintainer: Carlo Landmeter <clandmeter@gmail.com>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=ruby
-pkgver=1.8.7_p358
+pkgver=1.9.3_p194
_pkgver=${pkgver/_/-}
-pkgrel=1
+pkgrel=0
+
+_abi=1.9.1
+
pkgdesc="An object-oriented language for quick and easy programming"
url="http://www.ruby-lang.org/en/"
arch="all"
license="Ruby"
depends=""
makedepends="zlib-dev openssl-dev libiconv-dev gdbm-dev db-dev readline-dev
- valgrind-dev"
-subpackages="$pkgname-doc $pkgname-dev"
-source="ftp://ftp.ruby-lang.org/pub/ruby/${pkgver%.*}/${pkgname}-${_pkgver}.tar.bz2"
+ libffi-dev coreutils
+ autoconf"
+subpackages="$pkgname-doc $pkgname-dev $pkgname-irb $pkgname-gems \
+ $pkgname-rdoc $pkgname-rake $pkgname-bigdecimal
+ $pkgname-io-console:io_console $pkgname-json $pkgname-minitest
+ $pkgname-libs
+ "
+patches="
+ ruby-1.9.3-always-use-i386.patch
+ ruby-1.9.3-backport-from-trunk-rev37068.patch
+ "
+source="ftp://ftp.ruby-lang.org/pub/ruby/${pkgver%.*}/${pkgname}-${_pkgver}.tar.bz2
+ $patches"
options="!fhs"
#
@@ -20,8 +33,16 @@ options="!fhs"
#
_builddir="$srcdir/$pkgname-${_pkgver}"
+_gemdir="/usr/lib/ruby/gems/$_abi"
+_rubydir="/usr/lib/ruby/$_abi"
+
prepare() {
cd "$_builddir"
+ for i in $patches; do
+ msg $i
+ patch -p1 -i "$srcdir"/$i || return 1
+ done
+ autoconf
}
build() {
@@ -34,7 +55,7 @@ build() {
# turn off distcc/ccache
# http://bugs.alpinelinux.org/issues/show/1
- export CC=gcc
+# export CC=gcc
# ruby saves path to install. we want use $PATH
export INSTALL=install
@@ -46,10 +67,9 @@ build() {
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--with-sitedir='/usr/local/lib/site_ruby' \
- --with-search-path='/usr/lib/site_ruby/$(ruby_ver)/i686-linux' \
+ --with-search-path='/usr/lib/site_ruby/$(ruby_ver)/i386-linux' \
--enable-pthread \
- --disable-rpath \
- --disable-versioned-paths \
+ --disable-rpath \
--enable-shared \
--with-mantype=man \
|| return 1
@@ -72,4 +92,92 @@ package() {
"${pkgdir}/usr/share/licenses/${pkgname}"/COPYING || return 1
}
-md5sums="de35f00997f4ccee3e22dff0f2d01b8a ruby-1.8.7-p358.tar.bz2"
+_mv() {
+ local i
+ for i in "$@"; do
+ mkdir -p "$subpkgdir"/${i%/*}
+ mv "$pkgdir"/${i} "$subpkgdir"/${i%/*}/ || return 1
+ done
+}
+
+_mvgem() {
+ cd "$pkgdir"
+ for i in $_rubydir/${1}.rb \
+ $_rubydir/${1} \
+ $_rubydir/i386-linux-uclibc/${1} \
+ $_gemdir/gems/${1}-* \
+ $_gemdir/specifications/${1}-* ; do
+ [ -e "$pkgdir"/$i ] || continue
+ _mv "$i"
+ done
+}
+
+gems() {
+ pkgdesc="The Ruby standard for packaging ruby libraries"
+ replaces="rubygems"
+ depends="ruby"
+ _mv usr/bin/gem \
+ $_rubydir/rubygems \
+ || return 1
+}
+
+rake() {
+ pkgdesc="Ruby based make-like utility"
+ depends="ruby"
+ _mvgem rake || return 1
+ _mv usr/bin/rake
+}
+
+irb() {
+ pkgdesc="The Interactive Ruby"
+ replaces="ruby"
+ depends="ruby"
+ cd "$pkgdir"
+ _mv usr/bin/irb \
+ usr/lib/ruby/$_abi/irb*
+}
+
+rdoc() {
+ pkgdesc="Ruby documentation tool"
+ depends="ruby"
+ _mvgem rdoc || return 1
+ _mv usr/bin/ri \
+ usr/bin/rdoc
+}
+
+bigdecimal() {
+ pkgdesc="Ruby arbitrary-precision floating point decimal arithmetic"
+ depends="ruby"
+ _mvgem bigdecimal
+}
+
+io_console() {
+ pkgdesc="Ruby simple console IO library"
+ depends="ruby"
+ _mvgem io-console
+ _mv $_rubydir/io \
+ $_rubydir/i386-linux-uclibc/io/console.so
+}
+
+json() {
+ pkgdesc="Ruby JSON library"
+ depends="ruby"
+ _mvgem json
+}
+
+minitest() {
+ pkgdesc="Ruby suite of testing facilities"
+ depends="ruby"
+ _mvgem minitest
+}
+
+libs() {
+ pkgdesc="Libraries necessary to run Ruby"
+ depends="ruby"
+ mkdir -p "$subpkgdir"/usr
+ mv "$pkgdir"/usr/lib "$subpkgdir"/usr/
+}
+
+md5sums="2278eff4cfed3cbc0653bc73085caa34 ruby-1.9.3-p194.tar.bz2
+8395693c99415532780605af203a102b ruby-1.9.3-always-use-i386.patch
+b586536d4d196b142fd0968dac192617 ruby-1.9.3-backport-from-trunk-rev37068.patch"
diff --git a/main/ruby/ruby-1.9.3-always-use-i386.patch b/main/ruby/ruby-1.9.3-always-use-i386.patch
new file mode 100644
index 000000000..f5a8c3de3
--- /dev/null
+++ b/main/ruby/ruby-1.9.3-always-use-i386.patch
@@ -0,0 +1,11 @@
+--- a/configure.in.orig 2011-10-18 08:56:21.587594685 +0200
++++ b/configure.in 2011-10-18 08:56:59.751593321 +0200
+@@ -2935,6 +2935,8 @@
+ configure_args=$ac_configure_args
+ AC_SUBST(configure_args)dnl
+
++target_cpu=`echo $target_cpu | sed s/i.86/i386/`
++
+ if test "${universal_binary-no}" = yes ; then
+ arch="universal-${target_os}"
+ AC_CACHE_CHECK(whether __ARCHITECTURE__ is available, rb_cv_architecture_available,
diff --git a/main/ruby/ruby-1.9.3-backport-from-trunk-rev37068.patch b/main/ruby/ruby-1.9.3-backport-from-trunk-rev37068.patch
new file mode 100644
index 000000000..ed94e738f
--- /dev/null
+++ b/main/ruby/ruby-1.9.3-backport-from-trunk-rev37068.patch
@@ -0,0 +1,103 @@
+Patch from trunk for CVE-2012-4464, CVE-2012-4466
+Part for test/ruby/test_exception.rb was adjusted for ruby 1.9.3
+
+Mamoru Tasaka <mtasaka@fedoraproject.org>
+
+------------------------------------------------------------------------
+r37068 | shugo | 2012-10-03 02:25:10 +0900 (Wed, 03 Oct 2012) | 2 lines
+
+* error.c (exc_to_s, name_err_to_s, name_err_mesg_to_str): do not
+ taint messages.
+------------------------------------------------------------------------
+Index: error.c
+===================================================================
+--- ./error.c (revision 37067)
++++ ./error.c (revision 37068)
+@@ -635,7 +635,6 @@
+
+ if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
+ r = rb_String(mesg);
+- OBJ_INFECT(r, exc);
+ return r;
+ }
+
+@@ -996,11 +995,7 @@
+
+ if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
+ StringValue(str);
+- if (str != mesg) {
+- rb_iv_set(exc, "mesg", mesg = str);
+- }
+- OBJ_INFECT(mesg, exc);
+- return mesg;
++ return str;
+ }
+
+ /*
+@@ -1131,7 +1126,6 @@
+ args[2] = d;
+ mesg = rb_f_sprintf(NAME_ERR_MESG_COUNT, args);
+ }
+- OBJ_INFECT(mesg, obj);
+ return mesg;
+ }
+
+Index: test/ruby/test_exception.rb
+===================================================================
+--- ./test/ruby/test_exception.rb (revision 37067)
++++ ./test/ruby/test_exception.rb (modified)
+@@ -333,4 +333,54 @@
+ load(t.path)
+ end
+ end
++
++ def test_to_s_taintness_propagation
++ for exc in [Exception, NameError]
++ m = "abcdefg"
++ e = exc.new(m)
++ e.taint
++ s = e.to_s
++ assert_equal(false, m.tainted?,
++ "#{exc}#to_s should not propagate taintness")
++ assert_equal(false, s.tainted?,
++ "#{exc}#to_s should not propagate taintness")
++ end
++
++ o = Object.new
++ def o.to_str
++ "foo"
++ end
++ o.taint
++ e = NameError.new(o)
++ s = e.to_s
++ assert_equal(false, s.tainted?)
++ end
++
++ def test_exception_to_s_should_not_propagate_untrustedness
++ favorite_lang = "Ruby"
++
++ for exc in [Exception, NameError]
++ assert_raise(SecurityError) do
++ lambda {
++ $SAFE = 4
++ exc.new(favorite_lang).to_s
++ favorite_lang.replace("Python")
++ }.call
++ end
++ end
++
++ assert_raise(SecurityError) do
++ lambda {
++ $SAFE = 4
++ o = Object.new
++ o.singleton_class.send(:define_method, :to_str) {
++ favorite_lang
++ }
++ NameError.new(o).to_s
++ favorite_lang.replace("Python")
++ }.call
++ end
++
++ assert_equal("Ruby", favorite_lang)
++ end
+ end