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()
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')