Skip to content
Snippets Groups Projects
Commit 0799b781 authored by Tim Jaacks's avatar Tim Jaacks
Browse files

integrate_into_manifest: fix support for manifest projects with prefixed namespace

Previous solution did not work because lxml does not support XPath 2.0 syntax.
parent 52b5d851
No related branches found
No related tags found
1 merge request!22integrate_into_manifest: fix support for manifest projects with prefixed namespace
Pipeline #8107 passed with stage
in 27 seconds
......@@ -54,17 +54,17 @@ def integrate_into_manifest(
except FileNotFoundError:
sys.exit("ERROR: file '%s' not found in manifest repo" % manifest_file)
# Find project references in manifest
# We're using XPath's substring function here to test if the name attribute
# ends on the project name. This adds suport for sub-projects as well
# (e.g."mygroup/myproject", when only "myproject" is given).
project_nodes = manifest.findall(
"project[substring(@name, string-length(@name)-string-length('%s')+1)='%s']"
% (project.path, project.path)
)
if not project_nodes:
# Find project reference in manifest
# We are using str.endswith() for this in order to support sub-projects as well
# (e.g."mygroup/myproject", when only "myproject" is given)
project_node = None
project_nodes = manifest.findall("project")
for node in project_nodes:
name = node.get("name")
if name is not None and name.endswith(project.path):
project_node = node
if project_node is None:
sys.exit("ERROR: project '%s' not found in manifest" % project.path)
project_node = project_nodes[0]
# Get current project revision from manifest
old_revision = project_node.get("revision")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment