mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
manifest_file must be an absolute path
Correctly pass the full path of the manifest file for the submanifest. The manifest-name in the <submanifest/> element was being passed in as given, which caused it to not be found since the current directory never set. (b/226333721: fails when manifest-name is given.) Also verify that the manifest_file passed to XmlManifest() is an absolute path. Bug: https://b.corp.google.com/issues/226333721 Change-Id: I23461078233e34562bc2eafeb732cfe8bd38ddc1 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/333861 Tested-by: LaMont Jones <lamontjones@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
parent
244c9a71a6
commit
5d3291d818
@ -237,8 +237,13 @@ class _XmlSubmanifest:
|
|||||||
if self.remote and not self.project:
|
if self.remote and not self.project:
|
||||||
raise ManifestParseError(
|
raise ManifestParseError(
|
||||||
f'Submanifest {name}: must specify project when remote is given.')
|
f'Submanifest {name}: must specify project when remote is given.')
|
||||||
|
# Construct the absolute path to the manifest file using the parent's
|
||||||
|
# method, so that we can correctly create our repo_client.
|
||||||
|
manifestFile = parent.SubmanifestInfoDir(
|
||||||
|
os.path.join(parent.path_prefix, self.relpath),
|
||||||
|
os.path.join('manifests', manifestName or 'default.xml'))
|
||||||
rc = self.repo_client = RepoClient(
|
rc = self.repo_client = RepoClient(
|
||||||
parent.repodir, manifestName, parent_groups=','.join(groups) or '',
|
parent.repodir, manifestFile, parent_groups=','.join(groups) or '',
|
||||||
submanifest_path=self.relpath, outer_client=outer_client)
|
submanifest_path=self.relpath, outer_client=outer_client)
|
||||||
|
|
||||||
self.present = os.path.exists(os.path.join(self.repo_client.subdir,
|
self.present = os.path.exists(os.path.join(self.repo_client.subdir,
|
||||||
@ -337,6 +342,8 @@ class XmlManifest(object):
|
|||||||
self.repodir = os.path.abspath(repodir)
|
self.repodir = os.path.abspath(repodir)
|
||||||
self._CheckLocalPath(submanifest_path)
|
self._CheckLocalPath(submanifest_path)
|
||||||
self.topdir = os.path.join(os.path.dirname(self.repodir), submanifest_path)
|
self.topdir = os.path.join(os.path.dirname(self.repodir), submanifest_path)
|
||||||
|
if manifest_file != os.path.abspath(manifest_file):
|
||||||
|
raise ManifestParseError('manifest_file must be abspath')
|
||||||
self.manifestFile = manifest_file
|
self.manifestFile = manifest_file
|
||||||
self.local_manifests = local_manifests
|
self.local_manifests = local_manifests
|
||||||
self._load_local_manifests = True
|
self._load_local_manifests = True
|
||||||
|
Loading…
Reference in New Issue
Block a user