From 518e56814dab601524cd76292428e6935c742db8 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Apr 18 2016 07:24:38 +0000 Subject: Remove remote-calling unit tests Changelog: - Remove remote-calling unit tests - repository: decode() linkname - repository: SYMTYPE is constant in module tarfile, not in any class --- diff --git a/0001-Remove-remote-calling-unit-tests.patch b/0001-Remove-remote-calling-unit-tests.patch deleted file mode 100644 index dca0be6..0000000 --- a/0001-Remove-remote-calling-unit-tests.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 509cb3b15b6f32a7e9dd1a5f96fbd2ba9b0d86d6 Mon Sep 17 00:00:00 2001 -From: Mathieu Bridon -Date: Wed, 21 Jan 2015 09:33:46 +0100 -Subject: [PATCH] Remove remote-calling unit tests - -These can only fail when building in Koji, as the builder can't access -the Internet. ---- - test/test_credentials.py | 21 --------------------- - test/test_repository.py | 7 ------- - 2 files changed, 28 deletions(-) - -diff --git a/test/test_credentials.py b/test/test_credentials.py -index 92482d9..36263c0 100644 ---- a/test/test_credentials.py -+++ b/test/test_credentials.py -@@ -81,26 +81,5 @@ class CredentialCallback(utils.RepoTestCase): - - self.assertRaises(Exception, lambda: remote.fetch(callbacks=MyCallbacks())) - -- def test_bad_cred_type(self): -- class MyCallbacks(pygit2.RemoteCallbacks): -- @staticmethod -- def credentials(url, username, allowed): -- self.assertTrue(allowed & GIT_CREDTYPE_USERPASS_PLAINTEXT) -- return Keypair("git", "foo.pub", "foo", "sekkrit") -- -- url = "https://github.com/github/github" -- remote = self.repo.create_remote("github", url) -- self.assertRaises(TypeError, lambda: remote.fetch(callbacks=MyCallbacks())) -- --class CallableCredentialTest(utils.RepoTestCase): -- -- def test_user_pass(self): -- credentials = UserPass("libgit2", "libgit2") -- callbacks = pygit2.RemoteCallbacks(credentials=credentials) -- -- url = "https://bitbucket.org/libgit2/testgitrepository.git" -- remote = self.repo.create_remote("bb", url) -- remote.fetch(callbacks=callbacks) -- - if __name__ == '__main__': - unittest.main() -diff --git a/test/test_repository.py b/test/test_repository.py -index 8558340..e127cc4 100644 ---- a/test/test_repository.py -+++ b/test/test_repository.py -@@ -513,13 +513,6 @@ class CloneRepositoryTest(utils.NoRepoTestCase): - self.assertTrue('refs/remotes/custom_remote/master' in repo.listall_references()) - self.assertIsNotNone(repo.remotes["custom_remote"]) - -- def test_clone_with_credentials(self): -- repo = clone_repository( -- "https://bitbucket.org/libgit2/testgitrepository.git", -- self._temp_dir, callbacks=pygit2.RemoteCallbacks(credentials=pygit2.UserPass("libgit2", "libgit2"))) -- -- self.assertFalse(repo.is_empty) -- - def test_clone_with_checkout_branch(self): - # create a test case which isolates the remote - test_repo = clone_repository('./test/data/testrepo.git', --- -2.7.1 - diff --git a/0001-repository-SYMTYPE-is-constant-in-module-tarfile-not.patch b/0001-repository-SYMTYPE-is-constant-in-module-tarfile-not.patch new file mode 100644 index 0000000..0c30297 --- /dev/null +++ b/0001-repository-SYMTYPE-is-constant-in-module-tarfile-not.patch @@ -0,0 +1,26 @@ +From a922ced80d635f2aef73bf7a647672b8df7a7914 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Fri, 15 Apr 2016 14:07:33 +0200 +Subject: [PATCH] repository: SYMTYPE is constant in module tarfile, not in any + class + +Reference: https://github.com/libgit2/pygit2/issues/618 +Signed-off-by: Igor Gnatenko +(cherry picked from commit 270dad8cd39b0f1dbb34256b389eb1bb458779de) +--- + pygit2/repository.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pygit2/repository.py b/pygit2/repository.py +index e9bbdc6..88cc888 100644 +--- a/pygit2/repository.py ++++ b/pygit2/repository.py +@@ -799,7 +799,7 @@ class Repository(_Repository): + info.mtime = timestamp + info.uname = info.gname = 'root' # just because git does this + if entry.mode == GIT_FILEMODE_LINK: +- info.type = archive.SYMTYPE ++ info.type = tarfile.SYMTYPE + info.linkname = content + info.mode = 0o777 # symlinks get placeholder + info.size = 0 diff --git a/0002-repository-decode-linkname.patch b/0002-repository-decode-linkname.patch new file mode 100644 index 0000000..e889353 --- /dev/null +++ b/0002-repository-decode-linkname.patch @@ -0,0 +1,26 @@ +From 7d296f33e67f53783856c045a7f21a9df75dd91e Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Fri, 15 Apr 2016 14:13:47 +0200 +Subject: [PATCH] repository: decode() linkname + +Reference: https://github.com/libgit2/pygit2/issues/620 +Signed-off-by: Igor Gnatenko +(cherry picked from commit fd9a39a91b11964b8b88fdb4caf51ffdc559a6fa) +--- + pygit2/repository.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/pygit2/repository.py b/pygit2/repository.py +index 88cc888..4cf1a80 100644 +--- a/pygit2/repository.py ++++ b/pygit2/repository.py +@@ -800,7 +800,8 @@ class Repository(_Repository): + info.uname = info.gname = 'root' # just because git does this + if entry.mode == GIT_FILEMODE_LINK: + info.type = tarfile.SYMTYPE +- info.linkname = content ++ info.type = archive.SYMTYPE ++ info.linkname = content.decode("utf-8") + info.mode = 0o777 # symlinks get placeholder + info.size = 0 + archive.addfile(info) diff --git a/0003-Remove-remote-calling-unit-tests.patch b/0003-Remove-remote-calling-unit-tests.patch new file mode 100644 index 0000000..0d6f463 --- /dev/null +++ b/0003-Remove-remote-calling-unit-tests.patch @@ -0,0 +1,61 @@ +From 4859d36a47f74e10d2d92283f4ba6f0b35f162cd Mon Sep 17 00:00:00 2001 +From: Mathieu Bridon +Date: Wed, 21 Jan 2015 09:33:46 +0100 +Subject: [PATCH] Remove remote-calling unit tests + +These can only fail when building in Koji, as the builder can't access +the Internet. +--- + test/test_credentials.py | 21 --------------------- + test/test_repository.py | 7 ------- + 2 files changed, 28 deletions(-) + +diff --git a/test/test_credentials.py b/test/test_credentials.py +index 92482d9..36263c0 100644 +--- a/test/test_credentials.py ++++ b/test/test_credentials.py +@@ -81,26 +81,5 @@ class CredentialCallback(utils.RepoTestCase): + + self.assertRaises(Exception, lambda: remote.fetch(callbacks=MyCallbacks())) + +- def test_bad_cred_type(self): +- class MyCallbacks(pygit2.RemoteCallbacks): +- @staticmethod +- def credentials(url, username, allowed): +- self.assertTrue(allowed & GIT_CREDTYPE_USERPASS_PLAINTEXT) +- return Keypair("git", "foo.pub", "foo", "sekkrit") +- +- url = "https://github.com/github/github" +- remote = self.repo.create_remote("github", url) +- self.assertRaises(TypeError, lambda: remote.fetch(callbacks=MyCallbacks())) +- +-class CallableCredentialTest(utils.RepoTestCase): +- +- def test_user_pass(self): +- credentials = UserPass("libgit2", "libgit2") +- callbacks = pygit2.RemoteCallbacks(credentials=credentials) +- +- url = "https://bitbucket.org/libgit2/testgitrepository.git" +- remote = self.repo.create_remote("bb", url) +- remote.fetch(callbacks=callbacks) +- + if __name__ == '__main__': + unittest.main() +diff --git a/test/test_repository.py b/test/test_repository.py +index 5590ea2..a2f16ca 100644 +--- a/test/test_repository.py ++++ b/test/test_repository.py +@@ -527,13 +527,6 @@ class CloneRepositoryTest(utils.NoRepoTestCase): + self.assertTrue('refs/remotes/custom_remote/master' in repo.listall_references()) + self.assertIsNotNone(repo.remotes["custom_remote"]) + +- def test_clone_with_credentials(self): +- repo = clone_repository( +- "https://bitbucket.org/libgit2/testgitrepository.git", +- self._temp_dir, callbacks=pygit2.RemoteCallbacks(credentials=pygit2.UserPass("libgit2", "libgit2"))) +- +- self.assertFalse(repo.is_empty) +- + def test_clone_with_checkout_branch(self): + # create a test case which isolates the remote + test_repo = clone_repository('./test/data/testrepo.git', diff --git a/python-pygit2.spec b/python-pygit2.spec index 372debc..e213538 100644 --- a/python-pygit2.spec +++ b/python-pygit2.spec @@ -2,16 +2,19 @@ Name: python-%{pkgname} Version: 0.24.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Python bindings for libgit2 +License: GPLv2 with linking exception URL: http://www.pygit2.org Source0: http://pypi.python.org/packages/source/p/%{pkgname}/%{pkgname}-%{version}.tar.gz -License: GPLv2 with linking exception + +Patch0001: 0001-repository-SYMTYPE-is-constant-in-module-tarfile-not.patch +Patch0002: 0002-repository-decode-linkname.patch +Patch0003: 0003-Remove-remote-calling-unit-tests.patch + BuildRequires: libgit2-devel BuildRequires: openssl-devel -Patch1: 0001-Remove-remote-calling-unit-tests.patch - %description pygit2 is a set of Python bindings to the libgit2 library, which implements the core of Git. @@ -96,6 +99,11 @@ find %{buildroot} -name '*.so' -exec chmod 755 {} ';' %doc docs/_build/html/* %changelog +* Mon Apr 18 2016 Igor Gnatenko 0.24.0-3 +- Remove remote-calling unit tests +- repository: decode() linkname +- repository: SYMTYPE is constant in module tarfile, not in any class + * Thu Apr 14 2016 Igor Gnatenko - 0.24.0-2 - Add python[23]-six to BR/Rs