diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-11-19 17:19:20 +0200 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-11-21 10:33:36 +0200 |
commit | da5daecccc31697ff9338024cb55a2bf25bb9aab (patch) | |
tree | 2b0e85d5d2f72a8fb57a574497157f767a232dd5 | |
parent | 4d6fbbbe2a87cc0943ff231d7b2ff8d74f468c92 (diff) | |
download | git-buildpackage-da5daecccc31697ff9338024cb55a2bf25bb9aab.tar.gz git-buildpackage-da5daecccc31697ff9338024cb55a2bf25bb9aab.tar.bz2 git-buildpackage-da5daecccc31697ff9338024cb55a2bf25bb9aab.zip |
buildpackage-rpm: look for remote upstream branches
Consider remote branches, too, while looking for the upstream branch
when trying to guess if a package is native or not.
Change-Id: I3dbbb49816d1d294d81209ea5ab5870e053fd66a
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rwxr-xr-x | gbp/scripts/buildpackage_rpm.py | 12 | ||||
-rw-r--r-- | tests/component/rpm/test_buildpackage_rpm.py | 8 |
2 files changed, 18 insertions, 2 deletions
diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py index dcfa3ace..4b24723a 100755 --- a/gbp/scripts/buildpackage_rpm.py +++ b/gbp/scripts/buildpackage_rpm.py @@ -288,7 +288,17 @@ def export_patches(repo, spec, export_treeish, options): def is_native(repo, options): """Determine whether a package is native or non-native""" if options.native.is_auto(): - return not repo.has_branch(options.upstream_branch) + if repo.has_branch(options.upstream_branch): + return False + # Check remotes, too + for remote_branch in repo.get_remote_branches(): + remote, branch = remote_branch.split('/', 1) + if branch == options.upstream_branch: + gbp.log.debug("Found upstream branch '%s' from remote '%s'" % + (remote, branch)) + return False + return True + return options.native.is_on() diff --git a/tests/component/rpm/test_buildpackage_rpm.py b/tests/component/rpm/test_buildpackage_rpm.py index 3060f84b..88a66fc0 100644 --- a/tests/component/rpm/test_buildpackage_rpm.py +++ b/tests/component/rpm/test_buildpackage_rpm.py @@ -139,10 +139,16 @@ class TestGbpRpm(RpmRepoTestBase): def test_non_native_build(self): """Basic test of non-native pkg""" - self.init_test_repo('gbp-test') + repo = self.init_test_repo('gbp-test') eq_(mock_gbp([]), 0) self.check_rpms('../rpmbuild/RPMS/*') + # Test nativity guessing from remote branches by creating a dummy + # remote branch + repo.update_ref('refs/remotes/fooremote/foobranch', + 'srcdata/gbp-test/upstream') + eq_(mock_gbp(['--git-upstream-branch=foobranch']), 0) + def test_option_native(self): """Test the --git-native option""" self.init_test_repo('gbp-test2') |