Skip to content
Snippets Groups Projects
Commit a01eb03f authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

Support to push just one package in mpcdf_push

parent b2be213d
No related branches found
No related tags found
No related merge requests found
......@@ -53,32 +53,36 @@ def do_mpcdf_push(self, subcmd, opts, *args):
print("Setting attribute", attribute)
mpcdf_common.set_attribute(api_url, (to_project,), attr)
for package in from_packages:
if package not in to_packages:
filelist = osc.core.meta_get_filelist(api_url, from_project, package)
for orig_package in from_packages:
if orig_package not in to_packages:
filelist = osc.core.meta_get_filelist(api_url, from_project, orig_package)
if "_link" in filelist:
print("Not branching package {0}, is a link".format(package))
print("Not branching package {0}, is a link".format(orig_package))
else:
print("Branching package {0}".format(package))
print("Branching package {0}".format(orig_package))
exists, targetprj, targetpkg, srcprj, srcpkg = \
osc.core.branch_pkg(api_url, from_project, package, target_project=to_project, nodevelproject=True)
osc.core.branch_pkg(api_url, from_project, orig_package, target_project=to_project, nodevelproject=True)
else:
print("Not branching package {0}, already present in target".format(package))
print("Not branching package {0}, already present in target".format(orig_package))
for attribute in package_attributes:
try:
attr = mpcdf_common.get_attribute(api_url, from_project, package, attribute)
attr = mpcdf_common.get_attribute(api_url, from_project, orig_package, attribute)
except Exception:
continue
mpcdf_common.set_attribute(api_url, (to_project, package), attr)
mpcdf_common.set_attribute(api_url, (to_project, orig_package), attr)
# Check if distribution is already set in to_project
to_prj_meta = mpcdf_common.project_meta(api_url, to_project)
sys_repo = to_prj_meta.find('./repository[@name="System"]')
if sys_repo is None:
distribution = mpcdf_common.project_meta(api_url, from_project).find('./repository[@name="System"]/path[@project="distributions"]').get("repository")
else:
distribution = sys_repo.find('./path[@project="distributions"]').get("repository")
if package is None:
# Check if distribution is already set in to_project
to_prj_meta = mpcdf_common.project_meta(api_url, to_project)
sys_repo = to_prj_meta.find('./repository[@name="System"]')
if sys_repo is None:
distribution = mpcdf_common.project_meta(api_url, from_project).find('./repository[@name="System"]/path[@project="distributions"]').get("repository")
else:
distribution = sys_repo.find('./path[@project="distributions"]').get("repository")
print("Creating repository configuration")
mpcdf_common.mpcdf_setup_repos(api_url, to_project, distribution, packages=[package] if package else None)
print("Creating repository configuration")
mpcdf_common.mpcdf_setup_repos(api_url, to_project, distribution)
else:
if not mpcdf_common.mpcdf_enable_repositories(api_url, to_project, package):
print("ATTENTION: Not changing unmanaged package {0}".format(package))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment