diff --git a/.gitignore b/.gitignore index fd579e8..a9607b9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /vcstools-0.1.31-b40a0da.tar.gz /vcstools-0.1.32-7effcc5.tar.gz /vcstools-0.1.35-a6a0ee4.tar.gz +/vcstools-0.1.36-299bf21.tar.gz diff --git a/python-vcstools-0.1.36-test-fixes.patch b/python-vcstools-0.1.36-test-fixes.patch new file mode 100644 index 0000000..ebfcd2d --- /dev/null +++ b/python-vcstools-0.1.36-test-fixes.patch @@ -0,0 +1,70 @@ +From 562de2be781eda9a1ef7c2cee36ba71296836070 Mon Sep 17 00:00:00 2001 +From: Scott K Logan +Date: Sun, 14 Dec 2014 04:21:27 -0800 +Subject: [PATCH] Fix test for git >= 1.8.2 + +The behavior of --depth changed in 1.8.2. Previously, when --depth=n was specified, +the most recent n + 1 commits were present in the clone. In 1.8.2 and newer, the most +recent n commits are. + +See https://raw.githubusercontent.com/gitster/git/master/Documentation/RelNotes/1.8.2.txt +--- + test/test_git.py | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/test/test_git.py b/test/test_git.py +index b250f8f..7921627 100644 +--- a/test/test_git.py ++++ b/test/test_git.py +@@ -43,6 +43,7 @@ + import threading + import time + ++from distutils.version import LooseVersion + from vcstools import GitClient + from vcstools.vcs_base import VcsError + +@@ -236,9 +237,13 @@ def test_checkout_shallow(self): + self.assertEqual(client.get_branch(), "master") + self.assertEqual(client.get_branch_parent(), "master") + po = subprocess.Popen("git log --pretty=format:%H", shell=True, cwd=self.local_path, stdout=subprocess.PIPE) +- log = po.stdout.read().decode('UTF-8').splitlines() +- # shallow only contains last 2 commits +- self.assertEqual(2, len(log), log) ++ log = po.stdout.read().decode('UTF-8').strip().splitlines() ++ if LooseVersion(client.gitversion) >= LooseVersion('1.8.2'): ++ # shallow only contains last commit ++ self.assertEqual(1, len(log), log) ++ else: ++ # shallow only contains last 2 commits ++ self.assertEqual(2, len(log), log) + + def test_checkout_specific_version_and_update(self): + url = self.remote_path +From c3176b498266bbb06553f67896e342c2ce62ea73 Mon Sep 17 00:00:00 2001 +From: Scott K Logan +Date: Sun, 14 Dec 2014 04:23:40 -0800 +Subject: [PATCH] Fix race condition in testing + +If the git timeout test is run on a machine which can run many threads, +the TCP server finishes the call to `handle` and resets the connection +before the timeout has occurred, and the test fails. +--- + test/test_git.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/test/test_git.py b/test/test_git.py +index 7921627..d577278 100644 +--- a/test/test_git.py ++++ b/test/test_git.py +@@ -774,7 +774,9 @@ class GitTimeoutTest(unittest.TestCase): + + class MuteHandler(BaseRequestHandler): + def handle(self): +- self.request.recv(1024) ++ data = True ++ while data: ++ data = self.request.recv(1024) + + @classmethod + def setUpClass(self): diff --git a/python-vcstools.spec b/python-vcstools.spec index 17da772..9b17cb8 100644 --- a/python-vcstools.spec +++ b/python-vcstools.spec @@ -1,32 +1,50 @@ -%global commit a6a0ee4c9201e8bd9b7a7e28efb2c826cda7a1b2 +%global commit 299bf21181dfee6e20d710d9af83c20cba584d27 %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global realname vcstools + +%if 0%{?fedora} > 12 %global with_python3 1 +%else +%{!?__python2: %global __python2 /usr/bin/python2} +%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} +%{!?python2_version: %global python2_version %(%{__python2} -c "from sys import stdout, version; stdout.write(version[:3])")} +%endif Name: python-%{realname} -Version: 0.1.35 -Release: 3%{?dist} +Version: 0.1.36 +Release: 1%{?dist} Summary: Version Control System tools for Python License: BSD URL: http://www.ros.org/wiki/vcstools Source0: https://github.com/%{realname}/%{realname}/archive/%{commit}/%{realname}-%{version}-%{shortcommit}.tar.gz +# Fix some broken tests (submitted upstream) +Patch0: %{name}-0.1.36-test-fixes.patch + BuildArch: noarch +BuildRequires: bzr +BuildRequires: git +BuildRequires: mercurial +BuildRequires: python-coverage BuildRequires: python-dateutil BuildRequires: python-devel +BuildRequires: python-mock +BuildRequires: python-nose +%if 0%{?rhel} && 0%{?rhel} <= 6 +BuildRequires: python-sphinx10 +%else BuildRequires: python-sphinx -BuildRequires: PyYAML - -%if 0%{?with_python3} -BuildRequires: python3-dateutil -BuildRequires: python3-devel -BuildRequires: python3-setuptools -BuildRequires: python3-PyYAML %endif +BuildRequires: PyYAML +BuildRequires: subversion +Requires: bzr +Requires: git +Requires: mercurial Requires: python-dateutil Requires: PyYAML +Requires: subversion %description The vcstools module provides a Python API for interacting with different @@ -38,8 +56,22 @@ Its main use is to support the rosinstall tool. %if 0%{?with_python3} %package -n python3-%{realname} Summary: Version Control System tools for Python + +BuildRequires: python3-coverage +BuildRequires: python3-dateutil +BuildRequires: python3-devel +BuildRequires: python3-mock +BuildRequires: python3-nose +BuildRequires: python3-setuptools +BuildRequires: python3-sphinx +BuildRequires: python3-PyYAML + +Requires: bzr +Requires: git +Requires: mercurial Requires: python3-dateutil Requires: python3-PyYAML +Requires: subversion %description -n python3-%{realname} The vcstools module provides a Python API for interacting with different @@ -47,10 +79,11 @@ version control systems (VCS/SCMs). The VcsClient class provides an API for seamless interacting with Git, Mercurial (Hg), Bzr and SVN. The focus of the API is manipulating on-disk checkouts of source-controlled trees. Its main use is to support the rosinstall tool. -%endif +%endif # with_python3 %prep %setup -qn %{realname}-%{commit} +%patch0 -p1 sed -i 's/haiku/default/' doc/conf.py sed -i 's/:special-members://' doc/vcstools.rst @@ -58,51 +91,90 @@ sed -i 's/:special-members://' doc/vcstools.rst rm -rf %{py3dir} cp -a . %{py3dir} find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' -%endif +%endif # with_python3 + find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|' %build -CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build +%{__python2} setup.py build +%if 0%{?rhel} && 0%{?rhel} <= 6 +make -C doc html man SPHINXBUILD=sphinx-1.0-build +%else +make -C doc html man +%endif +rm -f doc/_build/html/.buildinfo + %if 0%{?with_python3} pushd %{py3dir} -CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build +%{__python3} setup.py build +make -C doc html man SPHINXBUILD=sphinx-build-%{python3_version} +rm -f doc/_build/html/.buildinfo popd %endif # with_python3 -pushd doc -make html -make man -popd - %install +%{__python2} setup.py install --root %{buildroot} +mkdir -p %{buildroot}%{_mandir}/man1 +chmod -x doc/_build/man/%{realname}.1 +install -p -m 0644 doc/_build/man/%{realname}.1 %{buildroot}%{_mandir}/man1/ + %if 0%{?with_python3} pushd %{py3dir} -%{__python3} setup.py install --skip-build --root $RPM_BUILD_ROOT +%{__python3} setup.py install --skip-build --root %{buildroot} rm -rf %{buildroot}%{python3_sitelib}/setuptools/tests +mkdir -p %{buildroot}%{_mandir}/man1 +chmod -x doc/_build/man/%{realname}.1 +install -p -m 0644 doc/_build/man/%{realname}.1 %{buildroot}%{_mandir}/man1/python3-%{realname}.1 popd %endif # with_python3 -%{__python} setup.py install --root $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1 -chmod -x doc/_build/man/vcstools.1 -install -p -m 0644 doc/_build/man/vcstools.1 $RPM_BUILD_ROOT%{_mandir}/man1/ -rm -rf doc/_build/html/.buildinfo +%check +export GIT_AUTHOR_EMAIL="foo@example.com" +export GIT_AUTHOR_NAME="Foo Bar" +export GIT_COMMITTER_EMAIL="foo@example.com" +export GIT_COMMITTER_NAME="Foo Bar" +export HGUSER="Foo Bar " +export LANG=en_US.UTF-8 + +# Exclude 5 tests which access remote data +# Exclude a test with a bad unicode conversion on python2.6 machines (filed upstream) +%if "%{python2_version}" == "2.6" +nosetests --with-coverage --cover-package %{realname} -w test \ + -e "^(test_url_matches_with_shortcut|test_checkout|test_checkout_dir_exists|test_checkout_version|test_get_url_by_reading|test_shell_command_verbose)$" +%else +nosetests --with-coverage --cover-package %{realname} -w test \ + -e "^(test_url_matches_with_shortcut|test_checkout|test_checkout_dir_exists|test_checkout_version|test_get_url_by_reading)$" +%endif + +%if 0%{?with_python3} +pushd %{py3dir} +nosetests-%{python3_version} --with-coverage --cover-package %{realname} -w test \ + -e "^(test_url_matches_with_shortcut|test_checkout|test_checkout_dir_exists|test_checkout_version|test_get_url_by_reading)$" +popd +%endif # with_python3 %files %doc doc/_build/html LICENSE -%{python_sitelib}/%{realname} -%{python_sitelib}/%{realname}-*.egg-info -%{_mandir}/man1/*.gz +%{python2_sitelib}/%{realname} +%{python2_sitelib}/%{realname}-%{version}-py?.?.egg-info +%{_mandir}/man1/%{realname}.1.gz %if 0%{?with_python3} %files -n python3-%{realname} %doc doc/_build/html LICENSE %{python3_sitelib}/%{realname} -%{python3_sitelib}/%{realname}-*.egg-info -%{_mandir}/man1/*.gz -%endif +%{python3_sitelib}/%{realname}-%{version}-py?.?.egg-info +%{_mandir}/man1/python3-%{realname}.1.gz +%endif # with_python3 %changelog +* Sun Dec 14 2014 Scott K Logan - 0.1.36-1 +- Update to release 0.1.36 +- Update to python packaging guidelines +- Add check section +- Add patch for test fixes +- Add bzr, git, mercurial and subversion to Requires + * Sun Jun 08 2014 Fedora Release Engineering - 0.1.35-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild diff --git a/sources b/sources index 25dc85b..6cec6b9 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -700c7fda12ef9608f191f92e97d2fcd5 vcstools-0.1.35-a6a0ee4.tar.gz +03dab58a8c8a5b112bd981d7194e0cb7 vcstools-0.1.36-299bf21.tar.gz