From 2d27aeb5b0b9d3fa01d7d0c1d87c4f74ad182775 Mon Sep 17 00:00:00 2001 From: Zhang Qiang Date: Fri, 2 Nov 2012 21:21:41 +0800 Subject: [PATCH] pristine-tar import support and update dependency Change-Id: I830c4ff4ff6c95d8713584c098faf77c264f6536 --- debian/control | 3 ++- distfiles/gbs.spec | 1 + gitbuildsys/cmd_import.py | 2 ++ tests/test_import.py | 10 +++++----- tools/gbs | 5 +++++ 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/debian/control b/debian/control index 93f845b..de4b086 100644 --- a/debian/control +++ b/debian/control @@ -15,7 +15,8 @@ Depends: ${misc:Depends}, ${python:Depends}, sudo, osc (>= 0.136.0), git-buildpackage-rpm (>= 0.6.0git20120822-tizen20121025), - depanneur (>= 0.2) + depanneur (>= 0.2), + pristine-tar Description: The command line tools for Tizen package developers The command line tools for Tizen package developers will be used to do packaging related tasks. diff --git a/distfiles/gbs.spec b/distfiles/gbs.spec index 2e0a526..a956269 100644 --- a/distfiles/gbs.spec +++ b/distfiles/gbs.spec @@ -15,6 +15,7 @@ Requires: sudo Requires: osc >= 0.136.0 Requires: tizen-gbp-rpm >= 2012.10.25 Requires: depanneur >= 0.2 +Requires: pristine-tar BuildRequires: python-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build diff --git a/gitbuildsys/cmd_import.py b/gitbuildsys/cmd_import.py index 64e0396..64e3007 100644 --- a/gitbuildsys/cmd_import.py +++ b/gitbuildsys/cmd_import.py @@ -39,6 +39,8 @@ def main(args): params = ["argv[0] placeholder", "--packaging-dir=%s" % get_packaging_dir(args), "--upstream-branch=%s" % args.upstream_branch, path] + if not args.no_pristine_tar and os.path.exists("/usr/bin/pristine-tar"): + params.append("--pristine-tar") if path.endswith('.src.rpm') or path.endswith('.spec'): params.append("--no-patch-import") diff --git a/tests/test_import.py b/tests/test_import.py index 3fa70d9..87b2d4d 100644 --- a/tests/test_import.py +++ b/tests/test_import.py @@ -82,7 +82,7 @@ class TestImport(unittest.TestCase): """Test importing from source rpm.""" eq_(GBS(argv=["gbs", "import", srcrpm]), None) repo = GitRepository("./ail") - eq_(repo.get_local_branches(), ['master', 'upstream']) + eq_(repo.get_local_branches(), ['master', 'pristine-tar', 'upstream']) eq_(repo.get_tags(), ['upstream/0.2.29', 'vendor/0.2.29-2.3']) @with_data("bluez_unpacked") @@ -91,7 +91,7 @@ class TestImport(unittest.TestCase): eq_(GBS(argv=["gbs", "import", os.path.join(srcdir, 'bluez.spec')]), None) repo = GitRepository("./bluez") - eq_(repo.get_local_branches(), ['master', 'upstream']) + eq_(repo.get_local_branches(), ['master', 'pristine-tar', 'upstream']) eq_(repo.get_tags(), ['upstream/4.87', 'vendor/4.87-1']) #raise Exception(os.listdir('./bluez')) @@ -103,7 +103,7 @@ class TestImport(unittest.TestCase): repo = GitRepository.create("./repo_dir") os.chdir(repo.path) eq_(GBS(argv=["gbs", "import", srcrpm]), None) - eq_(repo.get_local_branches(), ['master', 'upstream']) + eq_(repo.get_local_branches(), ['master', 'pristine-tar', 'upstream']) eq_(repo.get_tags(), ['upstream/0.2.29', 'vendor/0.2.29-2.5']) #raise Exception(os.listdir('./bluez')) @@ -115,7 +115,7 @@ class TestImport(unittest.TestCase): "--author-email=test@otctools.jf.intel.com", srcrpm]), None) repo = GitRepository("./app-core") - eq_(repo.get_local_branches(), ['master', 'upstream']) + eq_(repo.get_local_branches(), ['master', 'pristine-tar', 'upstream']) eq_(repo.get_tags(), ['upstream/1.2', 'vendor/1.2-19.3']) @with_data("ail-0.2.29-2.3.src.rpm") @@ -124,7 +124,7 @@ class TestImport(unittest.TestCase): eq_(GBS(argv=["gbs", "import", "--upstream=upstream", srcrpm]), None) repo = GitRepository("./ail") - eq_(repo.get_local_branches(), ['master', 'upstream']) + eq_(repo.get_local_branches(), ['master', 'pristine-tar', 'upstream']) eq_(repo.get_tags(), ['upstream/0.2.29', 'vendor/0.2.29-2.3']) @raises(SystemExit) diff --git a/tools/gbs b/tools/gbs index 6816276..fb35e0e 100755 --- a/tools/gbs +++ b/tools/gbs @@ -56,6 +56,11 @@ def import_parser(parser): help='don\'t merge new upstream branch to master') parser.add_argument('--packaging-dir', help='directory containing packaging files') + parser.add_argument('--no-pristine-tar', action='store_true', + help='don\'t use pristine-tar to import source. ' + 'pristine-tar only support import *tar.{gz,bz2,xz} ' + 'sources, this option can be specified to import ' + 'other format sources') parser.set_defaults(alias="im") return parser -- 2.7.4