diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-03-25 17:24:20 +0100 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-03-25 18:13:52 +0100 |
commit | d7c1296121b59b476ec6c519800ac31782a5f192 (patch) | |
tree | 5177fb5cc784df2bbfa3c232331202938e8c8278 | |
parent | fa4a6bacd13e4616d8b92ab6e296c5783eef52fa (diff) | |
download | aports-d7c1296121b59b476ec6c519800ac31782a5f192.tar.bz2 aports-d7c1296121b59b476ec6c519800ac31782a5f192.tar.xz |
testing/ruby-nokogiri: upgrade to 1.7.1 and refactor abuild
-rw-r--r-- | testing/ruby-nokogiri/APKBUILD | 97 |
1 files changed, 66 insertions, 31 deletions
diff --git a/testing/ruby-nokogiri/APKBUILD b/testing/ruby-nokogiri/APKBUILD index 4e64dedf80..54ff1bb8a2 100644 --- a/testing/ruby-nokogiri/APKBUILD +++ b/testing/ruby-nokogiri/APKBUILD @@ -1,46 +1,81 @@ # Contributor: Fabian Affolter <fabian@affolter-engineering.ch> # Maintainer: Jakub Jirutka <jakub@jirutka.cz> -_gemname=nokogiri -pkgname=ruby-$_gemname -pkgver=1.6.7.2 -pkgrel=1 +pkgname=ruby-nokogiri +_gemname=${pkgname#ruby-} +pkgver=1.7.1 +pkgrel=0 pkgdesc="An HTML, XML, SAX, and Reader parser" url="http://nokogiri.org/" arch="all" license="MIT" depends="ruby ruby-mini_portile2" -depends_dev="" makedepends="ruby-dev libxml2-dev libxslt-dev" -install="" -subpackages="" -source="http://gems.rubyforge.org/gems/$_gemname-$pkgver.gem" +checkdepends="ruby-minitest" +source="https://rubygems.org/downloads/$_gemname-$pkgver.gem" +builddir="$srcdir/$_gemname-$pkgver" +options="!check" # FIXME: some tests fails due to encoding issues + +unpack() { + default_unpack + + cd "$srcdir" + gem unpack $_gemname-$pkgver.gem +} + +prepare() { + default_prepare + + cd "$builddir" + + # Generate gemspec (there's no gemspec in the source). + gem specification -l --ruby "$srcdir"/$_gemname-$pkgver.gem \ + > "$builddir"/$_gemname.gemspec + + # Remove bundled external libraries etc. + sed -i \ + -e 's|, "ports/archives/[^"][^"]*"||g' \ + -e 's|, "ports/patches/[^"][^"]*"||g' \ + -e '\@mini_portile@d' \ + $_gemname.gemspec +} build() { - return 0 + cd "$builddir" + + gem build $_gemname.gemspec + gem install \ + --local \ + --install-dir dist \ + --ignore-dependencies \ + --no-document \ + --verbose \ + $_gemname-$pkgver.gem -- \ + --use-system-libraries +} + +check() { + cd "$builddir"/dist/gems/$_gemname-$pkgver + + # Note: This is copied from Fedora package. + export LANG=ja_JP.UTF-8 + ruby -I.:lib:test:ext \ + -e 'require "test/helper"' \ + -e 'Dir.glob("test/**/test_*.rb") {|f| require f }' } package() { - local _gemdir="$(ruby -rubygems -e'puts Gem.default_dir')" - local _geminstdir=$_gemdir/gems/$_gemname-$pkgver - mkdir -p "$pkgdir" || return 1 - - gem install --local --install-dir "$pkgdir"/$_gemdir \ - --ignore-dependencies --verbose --no-rdoc --no-ri \ - "$srcdir"/$_gemname-$pkgver.gem -- --use-system-libraries || \ - return 1 - rm -rf "$pkgdir"/$_gemdir/cache \ - "$pkgdir"/$_geminstdir/ext \ - "$pkgdir"/$_geminstdir/.require_paths - - cd "$pkgdir" - for i in usr/lib/ruby/gems/*/bin/*; do - if [ -e "$i" ]; then - mkdir -p "$pkgdir"/usr/bin - ln -s /$i "$pkgdir"/usr/bin/ - fi - done + local gemdir="$pkgdir/$(ruby -rubygems -e 'puts Gem.default_dir')" + + cd "$builddir"/dist + + mkdir -p "$gemdir" + cp -r bin extensions gems specifications "$gemdir"/ + + cd "$gemdir"/gems/$_gemname-$pkgver + + # Remove unnecessary files and rubbish... + rm -r ext/ patches/ suppressions/ tasks/ test/ \ + build_all test_all Rakefile .[a-z]* *.md *.rdoc *.txt *.yml || true } -md5sums="3e2169ebd67863a8a992289e2a887366 nokogiri-1.6.7.2.gem" -sha256sums="fb6afc0faec72b82eeccc84b5d11211aa6c4a81898a433b499ca7a60fcad4b87 nokogiri-1.6.7.2.gem" -sha512sums="27f72763f4f572b9a7042b48bd3a7a7516773eda128be603b8316e8ecaef42028f3d3a190947011cc6973fa4a43265a56f4b563bf28a8b2739b470cc19cee6cd nokogiri-1.6.7.2.gem" +sha512sums="86ae6d09d6daf0be2d6b46c4a5c8ebe6e9c00e7a4dfe86a2d1c7972726696a87d89e95fa390697a9cb3bae5f7d419c9a4f6d70b1a02c47ab0119bb14bc67efb3 nokogiri-1.7.1.gem" |