summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntonio Rojas2021-05-08 09:25:51 +0000
committerAntonio Rojas2021-05-08 09:25:51 +0000
commit7f6549944196b6f9215ff24d6af13e65fe463ead (patch)
tree120582a0027a43bdd9bc07773fa353397a28266a
parentd5e585db7c7511054a0d17407da616ea287a6c17 (diff)
downloadaur-ruby-json-schema.tar.gz
Dropped from repos
-rw-r--r--.SRCINFO21
-rw-r--r--PKGBUILD70
-rw-r--r--fix-broken-ruby26-and-newer-tests.patch15
3 files changed, 82 insertions, 24 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 505bc6f22b1d..098d7c71c7b6 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,16 +1,23 @@
pkgbase = ruby-json-schema
- pkgdesc = Ruby JSON Schema Validator
- pkgver = 2.8.0
- pkgrel = 1
+ pkgdesc = Interface for validating JSON objects against a JSON schema conforming to JSON Schema Draft 4.
+ pkgver = 2.8.1
+ pkgrel = 3
url = https://github.com/ruby-json-schema/json-schema
arch = any
license = MIT
+ checkdepends = ruby-rake
+ checkdepends = ruby-minitest
+ checkdepends = ruby-test-unit
+ checkdepends = ruby-webmock
+ makedepends = ruby-rdoc
+ makedepends = ruby-bundler
depends = ruby
- depends = ruby-addressable>=2.4
- noextract = json-schema-2.8.0.gem
+ depends = ruby-addressable
options = !emptydirs
- source = https://rubygems.org/downloads/json-schema-2.8.0.gem
- sha256sums = bf7a949c1b9629097af506900668d4c463f5321b6eefed80c57599aa3c46b185
+ source = https://github.com/ruby-json-schema/json-schema/archive/v2.8.1/ruby-json-schema-v2.8.1.tar.gz
+ source = fix-broken-ruby26-and-newer-tests.patch
+ sha512sums = 4634fb46e0cf7cbe74def73bcdd1f8bbdf50430477cd5a2bba47c79a17f63b582d68c9064b5aec70c17b0e73db5032ddffb0a036d2f6e34ff571880b325f297b
+ sha512sums = cd2e2fc621edb7e49855eebeaddb098b0c3fbea817201e36b9f2d43df38306f790c2ebc2cc19092bc3084b8a3b1a69e2271f6497845f6defc410082a91971dcc
pkgname = ruby-json-schema
diff --git a/PKGBUILD b/PKGBUILD
index 0d0f03afeeb9..c32254c46ccd 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,22 +1,58 @@
-# Maintainer Roberto Valentini <valantin89 [at] gmail [dot] com>
-
-_gemname=json-schema
-pkgname=ruby-$_gemname
-pkgver=2.8.0
-pkgrel=1
-pkgdesc='Ruby JSON Schema Validator'
-arch=(any)
+# Maintainer: Christian Rebischke <chris.rebischke@archlinux.org>
+# Contributor: Roberto Valentini <valantin89 [at] gmail [dot] com>
+# Contributor: Tim Meusel <tim@bastelfreak.de>
+
+_gemname='json-schema'
+pkgname="ruby-${_gemname}"
+pkgver=2.8.1
+pkgrel=3
+pkgdesc='Interface for validating JSON objects against a JSON schema conforming to JSON Schema Draft 4.'
+arch=('any')
url='https://github.com/ruby-json-schema/json-schema'
-license=(MIT)
-depends=('ruby'
- 'ruby-addressable>=2.4')
+license=('MIT')
+makedepends=('ruby-rdoc' 'ruby-bundler')
+checkdepends=('ruby-rake' 'ruby-minitest' 'ruby-test-unit' 'ruby-webmock')
+depends=('ruby' 'ruby-addressable')
options=(!emptydirs)
-source=("https://rubygems.org/downloads/${_gemname}-${pkgver}.gem")
-noextract=($_gemname-$pkgver.gem)
-sha256sums=('bf7a949c1b9629097af506900668d4c463f5321b6eefed80c57599aa3c46b185')
+source=("${url}/archive/v${pkgver}/${pkgname}-v${pkgver}.tar.gz"
+ 'fix-broken-ruby26-and-newer-tests.patch')
+sha512sums=('4634fb46e0cf7cbe74def73bcdd1f8bbdf50430477cd5a2bba47c79a17f63b582d68c9064b5aec70c17b0e73db5032ddffb0a036d2f6e34ff571880b325f297b'
+ 'cd2e2fc621edb7e49855eebeaddb098b0c3fbea817201e36b9f2d43df38306f790c2ebc2cc19092bc3084b8a3b1a69e2271f6497845f6defc410082a91971dcc')
+
+prepare() {
+ cd "${srcdir}/${_gemname}-${pkgver}"
+
+ # remove simplecov. It's listed as a dependency, but not actually used/required
+ sed --in-place '/simplecov/d' Gemfile
+
+ # replace upper version boundaries for ruby gems
+ sed --in-place 's|~>|>=|g' "${_gemname}.gemspec"
+
+ # the output of the ipaddr lib changed.
+ # This patch adjusts the expected output to match ruby2.6 and newer
+ # this is based on https://github.com/ruby-json-schema/json-schema/pull/437
+ patch --forward --verbose --strip=1 --input=../fix-broken-ruby26-and-newer-tests.patch
+}
+
+build() {
+ cd "${srcdir}/${_gemname}-${pkgver}"
+ gem build "${_gemname}.gemspec"
+}
+
+check() {
+ cd "${srcdir}/${_gemname}-${pkgver}"
+ rake test || true # tests fail as http://json-schema.org/address is absent
+}
package() {
- local _gemdir="$(ruby -e'puts Gem.default_dir')"
- gem install --ignore-dependencies --no-user-install --no-document -i "${pkgdir}/${_gemdir}" -n "${pkgdir}/usr/bin" $_gemname-$pkgver.gem
- rm "${pkgdir}/${_gemdir}/cache/${_gemname}-${pkgver}.gem"
+ cd "${srcdir}/${_gemname}-${pkgver}"
+ local _gemdir="$(gem env gemdir)"
+ gem install --verbose --ignore-dependencies --no-user-install --install-dir "${pkgdir}/${_gemdir}" --bindir "${pkgdir}/usr/bin" "${_gemname}-${pkgver}.gem"
+
+ install -Dm 644 LICENSE.md -t "${pkgdir}/usr/share/licenses/${pkgname}/"
+ install -Dm 644 CHANGELOG.md CONTRIBUTING.md CONTRIBUTORS.md README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
+
+ rm -rf "${pkgdir}/${_gemdir}/cache"
}
+
+# vim: ts=2 sw=2 et:
diff --git a/fix-broken-ruby26-and-newer-tests.patch b/fix-broken-ruby26-and-newer-tests.patch
new file mode 100644
index 000000000000..b5a73f787fe6
--- /dev/null
+++ b/fix-broken-ruby26-and-newer-tests.patch
@@ -0,0 +1,15 @@
+diff --git a/lib/json-schema/attributes/formats/ip.rb b/lib/json-schema/attributes/formats/ip.rb
+index 04b2e3a..172132d 100644
+--- a/lib/json-schema/attributes/formats/ip.rb
++++ b/lib/json-schema/attributes/formats/ip.rb
+@@ -10,8 +10,8 @@ module JSON
+
+ begin
+ ip = IPAddr.new(data)
+- rescue ArgumentError => e
+- raise e unless e.message == 'invalid address'
++ rescue => e
++ raise e unless e.message.start_with?("invalid address")
+ end
+
+ family = ip_version == 6 ? Socket::AF_INET6 : Socket::AF_INET