Skip to content

Commit 92629a8

Browse files
committed
app: more versatile initialization for path in config
in case a manifest file is contained into some sub directories, the command to init a workspace locally should be ``` west init -l sub1/sub2 --mf west.yml ``` but in that case, the west top dir is going to be into `sub1` which is an issue. one workaround is to use: ``` west init -l sub1 --mf sub2/west.yml ``` but in that case, the config is initialized incorrectly: `manifest.path` contains only `sub1` and `manifest.file` is `sub2/west.yml`. `manifest.path` should contain a path, even if `--mf` is a relative path. `manifest.file` should only contain the filename. this change allows any usage so that the workspace top dir is created next to `sub1` and the manifest repo can be located into nested directories Signed-off-by: Cyril Fougeray <[email protected]>
1 parent 361004d commit 92629a8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/west/app/project.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,13 @@ def do_add_parser(self, parser_adder):
204204
help='''manifest repository branch or tag name
205205
to check out first; cannot be combined with -l''')
206206
parser.add_argument('--mf', '--manifest-file', dest='manifest_file',
207-
help='manifest file name to use')
207+
help='manifest file name to use, relative to "directory"')
208208
parser.add_argument('-l', '--local', action='store_true',
209-
help='''use "directory" as an existing local
210-
manifest repository instead of cloning one from
211-
MANIFEST_URL; .west is created next to "directory"
212-
in this case, and manifest.path points at
213-
"directory"''')
209+
help='''use "directory" to create the workspace
210+
from a local manifest directory, instead of cloning
211+
one from MANIFEST_URL; .west is created next to
212+
"directory" in this case, and manifest.path points at
213+
the manifest file location.''')
214214
parser.add_argument('--rename-delay', type=int,
215215
help='''Number of seconds to wait before renaming
216216
some temporary directories. Some filesystems like NTFS
@@ -273,7 +273,7 @@ def local(self, args) -> Path:
273273
manifest_filename = args.manifest_file or 'west.yml'
274274
manifest_file = manifest_dir / manifest_filename
275275
topdir = manifest_dir.parent
276-
rel_manifest = manifest_dir.name
276+
rel_manifest = manifest_file.parent.relative_to(topdir)
277277
west_dir = topdir / WEST_DIR
278278

279279
if not manifest_file.is_file():
@@ -287,7 +287,7 @@ def local(self, args) -> Path:
287287
os.chdir(topdir)
288288
self.config = Configuration(topdir=topdir)
289289
self.config.set('manifest.path', os.fspath(rel_manifest))
290-
self.config.set('manifest.file', manifest_filename)
290+
self.config.set('manifest.file', manifest_file.name)
291291

292292
return topdir
293293

0 commit comments

Comments
 (0)