summaryrefslogtreecommitdiff
path: root/dev-ruby/json
diff options
context:
space:
mode:
Diffstat (limited to 'dev-ruby/json')
-rw-r--r--dev-ruby/json/Manifest6
-rw-r--r--dev-ruby/json/files/json-1.8.6-heap-exposure.patch82
-rw-r--r--dev-ruby/json/json-1.8.6-r1.ebuild70
-rw-r--r--dev-ruby/json/json-2.1.0.ebuild73
-rw-r--r--dev-ruby/json/metadata.xml11
5 files changed, 242 insertions, 0 deletions
diff --git a/dev-ruby/json/Manifest b/dev-ruby/json/Manifest
new file mode 100644
index 000000000000..a055b8457959
--- /dev/null
+++ b/dev-ruby/json/Manifest
@@ -0,0 +1,6 @@
+AUX json-1.8.6-heap-exposure.patch 2937 BLAKE2B 204f4c5a16df8fa99ea46e7d29c4a7e8790da9c11ff1dddfeba47b73a3bbf3e06a9243a48fa1d95fc029d21a1031e689b16a91295a1601d4e62a4c18cee2bb3b SHA512 42545c069c8c36b120b63e74b8276b8a6b57237e6cd8ccdeb0e6e9b9acd4f9213e5a4fc35b2f804300e8d00a12546c51b9ef944bde60d679567544de796c87e1
+DIST json-1.8.6.gem 144384 BLAKE2B db9e407be4ac7e0cb2e09369637b88f70cdac7a659c600dc83a5390746dfd21b0a5243af62afaeeff013b5a4116a3b22c65a481cad89f1ca9be8904af87d0345 SHA512 8f393da080293965389df4a606e0604c500b4b267897b3c1b9007b7700dde8156f6598c25790e84fa20a7e03c7ae359a0b267c7b84e52dfe2a1ac83cf652ad9b
+DIST json-2.1.0.gem 140800 BLAKE2B 28bb5334358369351ec9f13f5fb609ce34eb429cfeffb8dfde70864541516a0c2abd00a640b4647f76dcef198f967456bae0a858a2f213e5a30272c1be1878c7 SHA512 bffbe462e952bca321d4325ecb9c5e9f61e51cad13758581ecfaa6a038bac4e30dc7db50bd897086a5592f6fc437d0e0909f91e279aaf4dd71cf127100c3550b
+EBUILD json-1.8.6-r1.ebuild 2117 BLAKE2B 73c347a1b355e862f58de9df53ff014569623c8eec076943a664444cb8fe537e6ebc0645429265730c3e8f649245cca967e8b0c488968a0054c537f8705d6490 SHA512 40709b7d045f68490cd78d9dd27a044c13ca4581a3286cffe3646013152b3a7968b1e3a5a3586413254e6660dc0beb4067f92443368d3400d043dbc1d72cd930
+EBUILD json-2.1.0.ebuild 2063 BLAKE2B a6858ead286219160db9a7f1ffb8ee078b3c2ab80bccbc4e79f8eb9e3d00e042813a3a99967b4ceaba58ba17bcef96fcb6f18014368b664656f7cca64b3a3c4d SHA512 02b679b5c90009dba80a4ee57ae1076ce8784c4b3a39ed5252555201f97522eed853c4756c6c06f8a8cdfd537b06d138f5bd06eaf56264fe65a599171fee5c02
+MISC metadata.xml 336 BLAKE2B e1094160e19b252f7b3233dbd2006c889c0a02aa4b04063caeb7ded80bb2f08a2c4bc31cfb7bdc17398b8d1b8c3fc9f3600eafad9920fe0355c807d3899f794f SHA512 8b4fa7ef9b753bbf1206b1f8a796d3f3b8e3f9ca07906a2e01dbcc8c69d4cb5e5cb26c395d0676b4dedd70fb910cf0abd3be83d3c94f0b90aee87ea6fda12877
diff --git a/dev-ruby/json/files/json-1.8.6-heap-exposure.patch b/dev-ruby/json/files/json-1.8.6-heap-exposure.patch
new file mode 100644
index 000000000000..d3da7a0f86f9
--- /dev/null
+++ b/dev-ruby/json/files/json-1.8.6-heap-exposure.patch
@@ -0,0 +1,82 @@
+diff --git ext/json/generator/generator.c ext/json/generator/generator.c
+index a135e28348..2cdca5685f 100644
+--- a/ext/json/ext/generator/generator.c
++++ b/ext/json/ext/generator/generator.c
+@@ -301,7 +301,7 @@ static char *fstrndup(const char *ptr, unsigned long len) {
+ char *result;
+ if (len <= 0) return NULL;
+ result = ALLOC_N(char, len);
+- memccpy(result, ptr, 0, len);
++ memcpy(result, ptr, len);
+ return result;
+ }
+
+@@ -1055,7 +1055,7 @@ static VALUE cState_indent_set(VALUE self, VALUE indent)
+ }
+ } else {
+ if (state->indent) ruby_xfree(state->indent);
+- state->indent = strdup(RSTRING_PTR(indent));
++ state->indent = fstrndup(RSTRING_PTR(indent), len);
+ state->indent_len = len;
+ }
+ return Qnil;
+@@ -1093,7 +1093,7 @@ static VALUE cState_space_set(VALUE self, VALUE space)
+ }
+ } else {
+ if (state->space) ruby_xfree(state->space);
+- state->space = strdup(RSTRING_PTR(space));
++ state->space = fstrndup(RSTRING_PTR(space), len);
+ state->space_len = len;
+ }
+ return Qnil;
+@@ -1129,7 +1129,7 @@ static VALUE cState_space_before_set(VALUE self, VALUE space_before)
+ }
+ } else {
+ if (state->space_before) ruby_xfree(state->space_before);
+- state->space_before = strdup(RSTRING_PTR(space_before));
++ state->space_before = fstrndup(RSTRING_PTR(space_before), len);
+ state->space_before_len = len;
+ }
+ return Qnil;
+@@ -1166,7 +1166,7 @@ static VALUE cState_object_nl_set(VALUE self, VALUE object_nl)
+ }
+ } else {
+ if (state->object_nl) ruby_xfree(state->object_nl);
+- state->object_nl = strdup(RSTRING_PTR(object_nl));
++ state->object_nl = fstrndup(RSTRING_PTR(object_nl), len);
+ state->object_nl_len = len;
+ }
+ return Qnil;
+@@ -1201,7 +1201,7 @@ static VALUE cState_array_nl_set(VALUE self, VALUE array_nl)
+ }
+ } else {
+ if (state->array_nl) ruby_xfree(state->array_nl);
+- state->array_nl = strdup(RSTRING_PTR(array_nl));
++ state->array_nl = fstrndup(RSTRING_PTR(array_nl), len);
+ state->array_nl_len = len;
+ }
+ return Qnil;
+diff --git ext/json/generator/generator.h ext/json/generator/generator.h
+index 298c0a4965..6bbf817b7d 100644
+--- a/ext/json/ext/generator/generator.h
++++ b/ext/json/ext/generator/generator.h
+@@ -1,7 +1,6 @@
+ #ifndef _GENERATOR_H_
+ #define _GENERATOR_H_
+
+-#include <string.h>
+ #include <math.h>
+ #include <ctype.h>
+
+diff --git ext/json/lib/json/version.rb ext/json/lib/json/version.rb
+index b5748334b9..cd7ddf8777 100644
+--- a/lib/json/version.rb
++++ b/lib/json/version.rb
+@@ -1,7 +1,7 @@
+ module JSON
+ # JSON version
+- VERSION = '1.8.6'
++ VERSION = '1.8.6.1'
+ VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
+ VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
+ VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
diff --git a/dev-ruby/json/json-1.8.6-r1.ebuild b/dev-ruby/json/json-1.8.6-r1.ebuild
new file mode 100644
index 000000000000..642bdbdac71d
--- /dev/null
+++ b/dev-ruby/json/json-1.8.6-r1.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+USE_RUBY="ruby22 ruby23 ruby24 ruby25"
+
+RUBY_FAKEGEM_RECIPE_DOC="rdoc"
+RUBY_FAKEGEM_EXTRADOC="CHANGES TODO README.md README-json-jruby.markdown"
+
+RUBY_FAKEGEM_GEMSPEC="json.gemspec"
+
+inherit multilib ruby-fakegem
+
+DESCRIPTION="A JSON implementation as a Ruby extension"
+HOMEPAGE="https://github.com/flori/json"
+LICENSE="|| ( Ruby GPL-2 )"
+
+KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+SLOT="0"
+IUSE=""
+
+RDEPEND="${RDEPEND}"
+DEPEND="${DEPEND}
+ dev-util/ragel"
+
+ruby_add_bdepend "dev-ruby/rake
+ doc? ( dev-ruby/rdoc )"
+
+PATCHES=( "${FILESDIR}/${P}-heap-exposure.patch" )
+
+all_ruby_prepare() {
+ # Avoid building the extension twice!
+ # And use rdoc instead of sdoc which we don't have packaged
+ # And don't call git to list files. We're using the pregenerated spec anyway.
+ sed -i \
+ -e 's| => :compile||' \
+ -e 's| => :clean||' \
+ -e 's|sdoc|rdoc|' \
+ -e 's|`git ls-files`|""|' \
+ Rakefile || die "rakefile fix failed"
+
+ # Remove hardcoded and broken -O setting.
+ sed -i -e '/^ \(if\|unless\)/,/^ end/ s:^:#:' \
+ -e '/^unless/,/^end/ s:^:#:' ext/json/ext/*/extconf.rb || die
+}
+
+each_ruby_compile() {
+ # Since 1.5.0 a Java extension is provided but it does not compile.
+ if [[ $(basename ${RUBY}) != "jruby" ]]; then
+ ${RUBY} -S rake compile || die "extension compile failed"
+ fi
+}
+
+each_ruby_test() {
+ JSON=pure \
+ ${RUBY} -Iext:lib -S testrb-2 tests/test_*.rb || die "pure ruby tests failed"
+
+ if [[ $(basename ${RUBY}) != "jruby" ]]; then
+ JSON=ext \
+ ${RUBY} -Iext:lib -S testrb-2 tests/test_*.rb || die "ext ruby tests failed"
+ fi
+}
+
+each_ruby_install() {
+ each_fakegem_install
+ if [[ $(basename ${RUBY}) != "jruby" ]]; then
+ ruby_fakegem_newins ext/json/ext/generator$(get_modname) lib/json/ext/generator$(get_modname)
+ ruby_fakegem_newins ext/json/ext/parser$(get_modname) lib/json/ext/parser$(get_modname)
+ fi
+}
diff --git a/dev-ruby/json/json-2.1.0.ebuild b/dev-ruby/json/json-2.1.0.ebuild
new file mode 100644
index 000000000000..4e6c977d3bac
--- /dev/null
+++ b/dev-ruby/json/json-2.1.0.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+USE_RUBY="ruby22 ruby23 ruby24 ruby25"
+
+RUBY_FAKEGEM_RECIPE_DOC="rdoc"
+RUBY_FAKEGEM_EXTRADOC="CHANGES.md README.md"
+RUBY_FAKEGEM_DOCDIR="doc"
+
+RUBY_FAKEGEM_GEMSPEC="json.gemspec"
+
+inherit multilib ruby-fakegem
+
+DESCRIPTION="A JSON implementation as a Ruby extension"
+HOMEPAGE="https://github.com/flori/json"
+LICENSE="Ruby"
+
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+SLOT="2"
+IUSE=""
+
+RDEPEND="${RDEPEND}"
+DEPEND="${DEPEND}
+ dev-util/ragel"
+
+ruby_add_bdepend "dev-ruby/rake
+ doc? ( dev-ruby/rdoc )"
+
+all_ruby_prepare() {
+ # Avoid building the extension twice!
+ # And use rdoc instead of sdoc which we don't have packaged
+ # And don't call git to list files. We're using the pregenerated spec anyway.
+ sed -i \
+ -e '/task :test/ s|:compile,||' \
+ -e 's| => :clean||' \
+ -e 's|sdoc|rdoc|' \
+ -e 's|`git ls-files`|""|' \
+ Rakefile || die "rakefile fix failed"
+
+ # Remove hardcoded and broken -O setting.
+ sed -i -e '/^ \(if\|unless\)/,/^ end/ s:^:#:' \
+ -e '/^unless/,/^end/ s:^:#:' ext/json/ext/*/extconf.rb || die
+
+ # Avoid setting gem since it will not be available yet when installing
+ sed -i -e '/gem/ s:^:#:' tests/test_helper.rb || die
+}
+
+each_ruby_configure() {
+ for ext in parser generator ; do
+ ${RUBY} -Cext/json/ext/${ext} extconf.rb || die
+ done
+}
+
+each_ruby_compile() {
+ for ext in parser generator ; do
+ emake V=1 -Cext/json/ext/${ext}
+ cp ext/json/ext/${ext}/${ext}$(get_modname) ext/json/ext/ || die
+ done
+}
+
+each_ruby_test() {
+ for t in pure ext ; do
+ JSON=${T} ${RUBY} -S rake do_test_${t} || die
+ done
+}
+
+each_ruby_install() {
+ each_fakegem_install
+
+ ruby_fakegem_newins ext/json/ext/generator$(get_modname) lib/json/ext/generator$(get_modname)
+ ruby_fakegem_newins ext/json/ext/parser$(get_modname) lib/json/ext/parser$(get_modname)
+}
diff --git a/dev-ruby/json/metadata.xml b/dev-ruby/json/metadata.xml
new file mode 100644
index 000000000000..892c8b0116a2
--- /dev/null
+++ b/dev-ruby/json/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>ruby@gentoo.org</email>
+ <name>Gentoo Ruby Project</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">flori/json</remote-id>
+ </upstream>
+</pkgmetadata>