[rubygem-mechanize] Update to 2.6.0
Mamoru Tasaka
mtasaka at fedoraproject.org
Thu Oct 17 05:37:30 UTC 2013
commit 883c2350fff1f9cccd23776b6cff3e6f3ec2e962
Author: Mamoru TASAKA <mtasaka at fedoraproject.org>
Date: Thu Oct 17 14:36:12 2013 +0900
Update to 2.6.0
.gitignore | 1 +
...hanize-2.6.0-TestMechanizeXmlFile_test_at.patch | 39 ++++
...em-mechanize-2.6.0-disable-ntlm-http-test.patch | 18 ++
rubygem-mechanize-2.6.0-disable-ntlm-http.patch | 25 +++
rubygem-mechanize.spec | 189 +++++++-------------
sources | 2 +-
6 files changed, 150 insertions(+), 124 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 4a68602..41d8c75 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
mechanize-1.0.0.gem
/mechanize-1.0.1.beta.20110107104205.gem
+/mechanize-2.6.0.gem
diff --git a/rubygem-mechanize-2.6.0-TestMechanizeXmlFile_test_at.patch b/rubygem-mechanize-2.6.0-TestMechanizeXmlFile_test_at.patch
new file mode 100644
index 0000000..e246799
--- /dev/null
+++ b/rubygem-mechanize-2.6.0-TestMechanizeXmlFile_test_at.patch
@@ -0,0 +1,39 @@
+From 43f3b631484a2c0178e6699584471dedd598eca3 Mon Sep 17 00:00:00 2001
+From: Lee Jarvis <ljjarvis at gmail.com>
+Date: Mon, 6 May 2013 19:39:25 +0100
+Subject: [PATCH] Ensure we prefix xpath with // for searching entire document
+
+Tests prior to this commit passed because libxml2 was not so
+strict. Since upgrading to 2.9.0 this issue has been revealed.
+The former test should have been written with this in mind.
+
+Steps to reproduce (on OSX with Homebrew installed):
+
+ gem uninstall nokogiri
+ brew install libxml2
+ LDFLAGS="-L/usr/local/opt/libxml2/lib" \
+ CPPFLAGS="-I/usr/local/opt/libxml2/include" \
+ gem install nokogiri
+
+closes #308
+---
+ test/test_mechanize_xml_file.rb | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/test_mechanize_xml_file.rb b/test/test_mechanize_xml_file.rb
+index 58eb67c..bbe486c 100644
+--- a/test/test_mechanize_xml_file.rb
++++ b/test/test_mechanize_xml_file.rb
+@@ -23,7 +23,7 @@ def test_search
+ end
+
+ def test_at
+- assert_equal 'Perl', @xml.at('language[2]').text
++ assert_equal 'Perl', @xml.at('//language[2]').text
+ end
+
+ end
+\ No newline at end of file
+--
+1.8.4
+
diff --git a/rubygem-mechanize-2.6.0-disable-ntlm-http-test.patch b/rubygem-mechanize-2.6.0-disable-ntlm-http-test.patch
new file mode 100644
index 0000000..85fe0b1
--- /dev/null
+++ b/rubygem-mechanize-2.6.0-disable-ntlm-http-test.patch
@@ -0,0 +1,18 @@
+--- ./test/test_mechanize_http_agent.rb.nontlmtest 1970-01-01 09:00:00.000000000 +0900
++++ ./test/test_mechanize_http_agent.rb 2013-10-17 14:10:56.481951136 +0900
+@@ -790,6 +790,7 @@
+ e.message
+ end
+
++=begin
+ def test_response_authenticate_ntlm
+ @uri += '/ntlm'
+ @agent.add_auth @uri, 'user', 'password'
+@@ -801,6 +802,7 @@
+
+ assert_equal 'ok', page.body # lame test
+ end
++=end
+
+ def test_response_authenticate_unknown
+ @agent.add_auth @uri, 'user', 'password'
diff --git a/rubygem-mechanize-2.6.0-disable-ntlm-http.patch b/rubygem-mechanize-2.6.0-disable-ntlm-http.patch
new file mode 100644
index 0000000..563ab49
--- /dev/null
+++ b/rubygem-mechanize-2.6.0-disable-ntlm-http.patch
@@ -0,0 +1,25 @@
+--- ./lib/mechanize/http/agent.rb.nontlm 1970-01-01 09:00:00.000000000 +0900
++++ ./lib/mechanize/http/agent.rb 2013-10-17 14:07:07.107322560 +0900
+@@ -1,5 +1,5 @@
+ require 'tempfile'
+-require 'net/ntlm'
++#require 'net/ntlm'
+ require 'kconv'
+ require 'webrobots'
+
+@@ -738,6 +738,7 @@
+
+ existing_realms << realm
+ @digest_challenges[realm] = challenge
++=begin
+ elsif challenge = challenges.find { |c| c.scheme == 'NTLM' } then
+ existing_realms = @authenticate_methods[uri + '/'][:ntlm]
+
+@@ -762,6 +763,7 @@
+ type_1 = Net::NTLM::Message::Type1.new.encode64
+ headers['Authorization'] = "NTLM #{type_1}"
+ end
++=end
+ elsif challenge = challenges.find { |c| c.scheme == 'Basic' } then
+ realm = challenge.realm uri
+
diff --git a/rubygem-mechanize.spec b/rubygem-mechanize.spec
index 08ab1b4..0d307e0 100644
--- a/rubygem-mechanize.spec
+++ b/rubygem-mechanize.spec
@@ -1,47 +1,63 @@
# Initially Generated from mechanize-0.8.5.gem by gem2rpm -*- rpm-spec -*-
-%global majorver 1.0.1
-%global preminorver .beta.20110107104205
+%global majorver 2.6.0
+%undefine preminorver
%global rpmminorver .%(echo %preminorver | sed -e 's|^\\.\\.*||')
%global fullver %{majorver}%{?preminorver}
-%global fedorarel 5
+%global fedorarel 1
%global gem_name mechanize
-%global create_nongem 0
-
-%global gem_instdir %{gem_dir}/gems/%{gem_name}-%{version}%{preminorver}
+%global gem_instdir %{gem_dir}/gems/%{gem_name}-%{version}%{?preminorver}
Summary: A handy web browsing ruby object
Name: rubygem-%{gem_name}
Version: %{majorver}
-Release: %{?preminorver:0.}%{fedorarel}%{?preminorver:%{rpmminorver}}%{?dist}.1
+Release: %{?preminorver:0.}%{fedorarel}%{?preminorver:%{rpmminorver}}%{?dist}
Group: Development/Languages
-License: GPL+
+License: MIT
URL: http://mechanize.rubyforge.org/
-Source0: http://gems.rubyforge.org/gems/%{gem_name}-%{fullver}.gem
+Source0: https://rubygems.org/gems/%{gem_name}-%{fullver}.gem
+# Kill ntlm-http support
+# https://github.com/sparklemotion/mechanize/issues/282
+Patch0: rubygem-mechanize-2.6.0-disable-ntlm-http.patch
+Patch1: rubygem-mechanize-2.6.0-disable-ntlm-http-test.patch
+# https://github.com/sparklemotion/mechanize/issues/308
+# https://github.com/sparklemotion/mechanize/commit/43f3b631484a2c0178e6699584471dedd598eca3.patch
+Patch2: rubygem-mechanize-2.6.0-TestMechanizeXmlFile_test_at.patch
+
+# TODO
+# 2.7.2 needs additional dependency (http-cookie)
BuildRequires: ruby(release)
-BuildRequires: ruby-devel
-BuildRequires: rubygems-devel
+BuildRequires: ruby-devel
+BuildRequires: rubygems-devel
# For %%check
+BuildRequires: rubygem(domain_name)
+BuildRequires: rubygem(mime-types)
+BuildRequires: rubygem(net-http-digest_auth)
BuildRequires: rubygem(net-http-persistent)
-BuildRequires: rubygem(nokogiri) >= 1.2.1
+BuildRequires: rubygem(nokogiri)
+#BuildRequires: rubygem(ntlm-http)
+BuildRequires: rubygem(webrobots)
BuildRequires: rubygem(minitest)
Requires: ruby(release)
Requires: ruby(rubygems)
+Requires: rubygem(domain_name)
+Requires: rubygem(mime-types)
+Requires: rubygem(net-http-digest_auth)
Requires: rubygem(net-http-persistent)
-Requires: rubygem(nokogiri) >= 1.2.1
+#Requires: rubygem(ntlm-http)
+Requires: rubygem(nokogiri)
+Requires: rubygem(webrobots)
Provides: rubygem(%{gem_name}) = %{version}-%{release}
#Requires: rubygem(hoe)
# For non-gem support, net-http-persistent (which this package depends on)
# must also create non-gem package. Let's kill it (at least for F-15)
-%if ! %{create_nongem}
Obsoletes: ruby-%{gem_name} < 1.0.0-999
-%endif
BuildArch: noarch
@@ -62,118 +78,49 @@ Requires: ruby(rubygems)
%description doc
This package contains documentation for %{name}.
-%package -n ruby-%{gem_name}
-Summary: Non-Gem support package for %{gem_name}
-Group: Development/Languages
-Requires: %{name} = %{version}-%{release}
-Requires: ruby(nokogiri)
-Provides: ruby(%{gem_name}) = %{version}-%{release}
-
-%description -n ruby-%{gem_name}
-This package provides non-Gem support for %{gem_name}.
-
%prep
%setup -q -c -T
-%build
-%gem_install -n %{SOURCE0}
+TOPDIR=$(pwd)
+mkdir tmpunpackdir
+pushd tmpunpackdir
-# Allow net-http-persistent 2.x
-grep -rl net-http-persistent . | while read f
-do
- sed -i -e '\@net-http-persistent at s|~>|>=|' $f
-done
+gem unpack %{SOURCE0}
+cd %{gem_name}-%{version}
+# Permission
+find . -name \*.rb -print0 | xargs --null chmod 0644
-# Clean up
-find .%{gem_instdir} -name \*.html -print0 | \
- xargs -0 chmod 0644
-find . -name \*.gem | xargs chmod 0644
+# Patches
+%patch0 -p1 -b .ntlm
+%patch1 -p1 -b .ntlmtest
+%patch2 -p1 -b .test_at
-%install
-mkdir -p %{buildroot}%{gem_dir}
-cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir}
+gem specification -l --ruby %{SOURCE0} > %{gem_name}.gemspec
+# Kill ntlm-http dependency
+sed -i -e '\@ntlm-http at d' %{gem_name}.gemspec
+
+gem build %{gem_name}.gemspec
+mv %{gem_name}-%{version}.gem $TOPDIR
-# The following method is completely copied from rubygem-gettext
-# spec file
-#
-# Create symlinks
-##
-## Note that before switching to gem %%{ruby_vendorlibdir}/%%{gem_name}
-## already existed as a directory, so this cannot be replaced
-## by symlink (cpio fails)
-## Similarly, all directories under %%{ruby_vendorlibdir} cannot be
-## replaced by symlink
-#
-
-create_symlink_rec(){
-
-ORIGBASEDIR=$1
-TARGETBASEDIR=$2
-
-## First calculate relative path of ORIGBASEDIR
-## from TARGETBASEDIR
-TMPDIR=$TARGETBASEDIR
-BACKDIR=
-DOWNDIR=
-num=0
-nnum=0
-while true
-do
- num=$((num+1))
- TMPDIR=$(echo $TMPDIR | sed -e 's|/[^/][^/]*$||')
- DOWNDIR=$(echo $ORIGBASEDIR | sed -e "s|^$TMPDIR||")
- if [ x$DOWNDIR != x$ORIGBASEDIR ]
- then
- nnum=0
- while [ $nnum -lt $num ]
- do
- BACKDIR="../$BACKDIR"
- nnum=$((nnum+1))
- done
- break
- fi
-done
-
-RELBASEDIR=$( echo $BACKDIR/$DOWNDIR | sed -e 's|//*|/|g' )
-
-## Next actually create symlink
-pushd %{buildroot}/$ORIGBASEDIR
-find . -type f | while read f
-do
- DIRNAME=$(dirname $f)
- BACK2DIR=$(echo $DIRNAME | sed -e 's|/[^/][^/]*|/..|g')
- mkdir -p %{buildroot}${TARGETBASEDIR}/$DIRNAME
- LNNAME=$(echo $BACK2DIR/$RELBASEDIR/$f | \
- sed -e 's|^\./||' | sed -e 's|//|/|g' | \
- sed -e 's|/\./|/|' )
- ln -s -f $LNNAME %{buildroot}${TARGETBASEDIR}/$f
-done
popd
+rm -rf tmpunpackdir
-}
+%build
+mkdir -p .%{gem_dir}
+
+%gem_install
-%if %{create_nongem}
-create_symlink_rec %{gem_libdir} %{ruby_vendorlibdir}
-%endif
+%install
+mkdir -p %{buildroot}%{gem_dir}
+cp -a ./%{gem_dir}/* %{buildroot}%{gem_dir}
+# Clean up
+rm -f %{buildroot}%{gem_instdir}/{.autotest,.gemtest,.travis.yml}
%check
pushd ./%{gem_instdir}
-# Seems that Ruby 2.0.0 converts upper case HTTP to lowercase.
-sed -i '38 s/HTTP/http/' test/test_mech.rb
-
-# Some files are missing and due to it some tests fail, skil
-for TEST in \
- test_post_with_rails_3_encoding_hack \
- test_file_scheme_with_embedded_spaces \
- test_click2
-do
- grep -l "def $TEST" test/*.rb | \
- xargs sed -i.fail -e "/$TEST/a \ # Needed file does not exist\n return\n"
-done
-
testrb -Ilib test
popd
@@ -184,25 +131,21 @@ popd
%exclude %{gem_instdir}/Manifest.txt
%dir %{gem_instdir}
%{gem_libdir}/
-%{gem_dir}/cache/%{gem_name}-%{fullver}.gem
-%{gem_dir}/specifications/%{gem_name}-%{fullver}.gemspec
+%exclude %{gem_cache}
+%{gem_spec}
%files doc
%defattr(-,root,root,-)
%{gem_dir}/doc/%{gem_name}-%{fullver}/
-%{gem_instdir}/Rakefile
-%{gem_instdir}/Manifest.txt
+#%%{gem_instdir}/Rakefile
+#%%{gem_instdir}/Manifest.txt
%{gem_instdir}/examples/
-%{gem_instdir}/test/
-
-%if %{create_nongem}
-%files -n ruby-%{gem_name}
-%defattr(-,root,root,-)
-%{ruby_vendorlibdir}/%{gem_name}.rb
-%{ruby_vendorlibdir}/%{gem_name}/
-%endif
+%exclude %{gem_instdir}/test/
%changelog
+* Thu Oct 17 2013 Mamoru TASAKA <mtasaka at fedoraproject.org> - 2.6.0-1
+- Update to 2.6.0
+
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.0.1-0.5.beta.20110107104205.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
diff --git a/sources b/sources
index dc8889e..6159328 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-51aa137c71fe3b92e7791d9830efb8f5 mechanize-1.0.1.beta.20110107104205.gem
+91003bfd469b8b6522a371a78a1bcaf6 mechanize-2.6.0.gem
More information about the scm-commits
mailing list