Invoke mkbranch and setup_git_package with ns/pkgname as package name

This commit is contained in:
Pierre-Yves Chibon 2015-12-11 13:43:52 +01:00
parent 382d837d7a
commit 705d5df833

View file

@ -117,7 +117,7 @@ def _invoke(program, args, cwd=None):
return stdout.strip() return stdout.strip()
def _create_branch(pkgname, branch, existing_branches): def _create_branch(ns, pkgname, branch, existing_branches):
'''Create a specific branch for a package. '''Create a specific branch for a package.
:arg pkgname: Name of the package to branch :arg pkgname: Name of the package to branch
@ -128,7 +128,7 @@ def _create_branch(pkgname, branch, existing_branches):
branch = branch.replace('*', '').strip() branch = branch.replace('*', '').strip()
if branch == 'master': if branch == 'master':
print 'ERROR: Proudly refusing to create master branch. Invalid repo?' print 'ERROR: Proudly refusing to create master branch. Invalid repo?'
print 'INFO: Please check %s repo' % pkgname print 'INFO: Please check %s repo' % os.path.join(ns, pkgname)
return return
if branch in existing_branches: if branch in existing_branches:
@ -137,9 +137,11 @@ def _create_branch(pkgname, branch, existing_branches):
try: try:
if VERBOSE: if VERBOSE:
print 'Creating branch: %s for package: %s' % (branch, pkgname) print 'Creating branch: %s for package: %s' % (
branch, os.path.join(ns, pkgname))
if not TEST_ONLY: if not TEST_ONLY:
_invoke(MKBRANCH, [branch, pkgname]) _invoke(MKBRANCH, [branch, os.path.join(ns, pkgname)])
fedmsg.publish( fedmsg.publish(
topic='branch', topic='branch',
modname='git', modname='git',
@ -147,6 +149,7 @@ def _create_branch(pkgname, branch, existing_branches):
agent='pkgdb', agent='pkgdb',
name=pkgname, name=pkgname,
branch=branch, branch=branch,
namespace=ns,
), ),
) )
except ProcessError, e: except ProcessError, e:
@ -213,7 +216,7 @@ def branch_package(ns, pkgname, requested_branches, existing_branches):
exists = os.path.exists(os.path.join(GIT_FOLDER, ns, '%s.git' % pkgname)) exists = os.path.exists(os.path.join(GIT_FOLDER, ns, '%s.git' % pkgname))
if not exists or 'master' not in existing_branches: if not exists or 'master' not in existing_branches:
if not TEST_ONLY: if not TEST_ONLY:
_invoke(SETUP_PACKAGE, [pkgname]) _invoke(SETUP_PACKAGE, [os.path.join(ns, pkgname)])
# SETUP_PACKAGE creates master # SETUP_PACKAGE creates master
if 'master' in requested_branches: if 'master' in requested_branches:
requested_branches.remove('master') requested_branches.remove('master')
@ -224,13 +227,14 @@ def branch_package(ns, pkgname, requested_branches, existing_branches):
agent='pkgdb', agent='pkgdb',
name=pkgname, name=pkgname,
branch='master', branch='master',
namespace=ns,
), ),
) )
# Create all the required branches for the package # Create all the required branches for the package
# Use the translated branch name until pkgdb falls inline # Use the translated branch name until pkgdb falls inline
for branch in requested_branches: for branch in requested_branches:
_create_branch(pkgname, branch, existing_branches) _create_branch(ns, pkgname, branch, existing_branches)
def main(): def main():