Commit Graph

11 Commits

Author SHA1 Message Date
Pieter De Gendt d36e887b5e tests: Add test cases for invalid west projects manifests
Add tests for cases where projects are inside the .west directory.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-10-21 13:39:14 +02:00
Pieter De Gendt 775dce9cc6 tests: Add manifest test for submodules
Add a testcase to parse a manifest and validate the as_dict output.
Add an invalid manifest file for missing required submodule properties.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-09-24 10:55:24 -07:00
Martí Bolívar 4db42bbbc5 tests: fix invalid_duplicate_name.yaml
Commit 3f81eb4195
("manifest: project names must be unique") fixed an issue where
projects with duplicate names were previously permitted, but the test
case file that was meant to catch regressions was incorrectly left
empty. Fix it.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2022-03-25 14:02:32 -07:00
Michael Zimmermann 5451c3ae71 manifest: deny using `/` and `\` as project names
- names are not supposed to be paths
- it may be a mis-use of `repo-path`'s default value
- it would make using the name for log files harder

More info: https://github.com/zephyrproject-rtos/west/pull/515

Signed-off-by: Michael Zimmermann <sigmaepsilon92@gmail.com>
2021-07-29 07:41:02 -07:00
Martí Bolívar 984aec8ecd manifest: allow missing projects list
It's annoying to have to specify projects lists in some cases
when all you're trying to do is exercise something else.

Though the number of situations where a manifest with no projects is
useful may be limited, they nonetheless exist, so make it possible.

This is a backwards incompatible change, so bump the schema version.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-03-10 12:56:35 +01:00
Martí Bolívar 4209bacf39 manifest: rework workspace escape checks
Let's use a lexical check instead of escapes_directory(). This
continues to let some users who are symlinking outside the workspace
to keep doing that, even though we don't officially support it in
west.

Also throw in a check for an absolute project path, which should never
happen and is similarly a sign of an attempt to escape the workspace.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-09-24 06:46:27 -07:00
Marti Bolivar 060bd29c45 manifest: correct several design and implementation issues
The west.manifest module is not in great shape:

- Though it's possible to create a manifest from data, this still
  looks for a topdir and a manifest.path configuration option on
  disk. This is wrong and contrary to the goal that we can parse
  manifest data independently of the file system.

  You can see that this doesn't really make sense in the hacks that
  the west init implementation needs to make things work, and the fact
  that all the tests which operate on data only have to patch
  west_topdir(), etc.

- The Project definition repeatedly finds the west topdir. Even
  when this is necessary, it should only be done once, and the value
  cached and passed around.

- The ManifestProject abstraction makes several bizarre semantic
  decisions, some of which never made sense, some of which are
  just stale leftovers from when it was SpecialProject.

- The manifest_path() helper mutates the global configuration object

Add some new kwargs to the Manifest factories and constructor, which
allow the user to avoid using west_topdir() or west.configuration when
they do not want to, and propagate the new information down into
Project and ManifestProject.

This allows users to parse manifest files and data without forcing
them to be inside an actual installation (and/or to parse other
manifest files than the one currently pointed to by manifest.path), at
the cost of not having abspath or posixpath attributes in some cases.

Fix up Project by taking a new topdir kwarg and saving it in a slot.

Fix up ManifestProject so that it generally makes more sense. This now
enforces an existing requirement in the documentation that no project
can be named "manifest", as that's reserved for the manifest
repository. Fix some other thinkos as well by deprecating the revision
and url kwargs, which are SpecialProject leftovers, and taking the
path as an argument as-is, even though that means it can be None now.

I've tried to preserve backwards compatibility whenever possible,
especially in situations where the user just wants to parse the
manifest in the current west installation based on file system
searches and configuration options.

The additional kwargs to Project and ManifestProject are breaking
changes for any code which was using this module for something else,
but the lack of sense that those made before probably meant such
code didn't do anything useful, so that's okay.

This also breaks compatibility with "west list zephyr" when run
outside of the top level directory -- you need to say "west list
manifest" or give the complete relative path to zephyr now.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-08-30 17:32:57 -06:00
Marti Bolivar bfc6786636 manifest: allow 'repo-path' to specify the path within a remote
Users have provided negative feedback about some specifics related to
the new restriction that project names must be unique.

In particular, there is a use case for fetching the same project (the
LittleVGL graphics library) into two separate paths with two separate
revisions (to allow Kconfig to select between two major versions).

Since project names must now be unique, this would require the use of
the `url` attribute instead of `remote` (since the URL is of course
the same for both "projects", "remote.url-base + name" cannot be used
without violating name uniqueness).

To make it possible to keep using remotes, add a new optional
'repo-path' attribute to each project. If given, then 'remote.url-base
+ repo-path' forms the fetch URL.

Like remote itself, 'repo-path' cannot be combined with 'url'.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-07-26 11:33:01 +02:00
Marti Bolivar 3f81eb4195 manifest: project names must be unique
It is always possible to satisfy this constraint now that project URLs
may be specified explicitly.

(This restriction will be necessary to make manifest imports work
sensibly -- we should have done this before...).

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-05-20 11:06:53 +02:00
Marti Bolivar 5415292aa4 tests: add test cases for explicit project URLs
Make sure to update comments for existing tests with modified semantics.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-05-20 11:06:53 +02:00
Marti Bolivar e19e7e61b5 tests: flatten the hierarchy
There's no good reason to have these tests in subdirectories. Flatten
them out. Keep the directory of invalid manifests separate to keep the
directory listing clean, though.

Signed-off-by: Marti Bolivar <marti.bolivar@nordicsemi.no>
2019-05-20 11:06:53 +02:00