The deprecated delete_config function supports passing a list
of ConfigFile enumerations. Update argument typing accordingly.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Make deprecated calls explicit during testing or remove them if
unnecessary.
Change the update_config and delete_config helper methods to use a
Configuration class instead of the global deprecated config functions.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
In October 2024, a problem reported in #558 showed that some Windows
systems can be configured to allow directory and file creations but not
renames. Test this _before_ git cloning to "fail fast" and remove git
from the very confusing picture.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This will be useful as both a diagnostic tool and as a workaround; see
October 2024 comments in west issue #558 for examples and details.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Print a stack trace when debugging with -vvv or more. This is MUCH
faster than `git grep error_message` and it's even more useful when the
same error message is used in multiple places! Example: die_already() in
project.py
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
It's not allowed to have projects inside the .west directory,
add a check when parsing the manifest.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Use the literal constant WEST_DIR instead of using the same string
value scattered around the project.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Omitting the artifact name changes the behavior, it will download all
artifacts and create subdirectories for each.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Fixes new `west diff --manifest` option added by commit
0d5ee4eb08 ("app: project: Allow to diff against manifest revision")
Do not pass `project.revision` to `git diff` because `project.revision`
is unresolved user input and does not always resolve to a commit. For
instance, `project.revision` can be the name of a remote branch like
`v3.7-branch` that does not exist locally; then `git diff` fails. Or
even worse: there could be a local branch of the same name which points
to a totally different commit.
This bug was found when discussing issue #747, see 7th comment there for
a longer description of what `manifest-rev` is and how it works.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Our release process documentation recommends getting passing tox
results on as many popular linux distributions as time allows. Doing
this by hand is cumbersome, redundant, and error prone.
Add a directory with a helper script that automates the entire process
using docker compose and document its use in MAINTAINERS.rst.
Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This makes it trivial to inspect, line by line, what got covered.
That is useful when evaluating coverage for a new feature.
Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
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>
It seems natural to recommend "debug" flags when telling the user to
"debug".
More specifically, this makes a big difference in situations like the
one reported in #671
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Starting with PEP 621, `pyproject.toml` is the standard way of
specifying project metadata.
Also switch to using the version from `pyproject.toml` instead of having
a west.version python module. Adjust documentation for the same.
Update MAINTAINERS.rst to use build for dist building.
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Fixes 2020 commit a53ec10cf2 ("west diff: only print output for
projects with nonempty diffs")
Fixes#731
At least with git version 2.46.0, --exit-code is 0 when there has been a
merge conflict! git bug or feature? Either way this causes west diff to
wrongly assume there is no diff in that repo.
Two other issues:
1. if returncode is higher than 1 (= a git diff failure) AND -v is used,
then failed.append(project) is never run.
2. stderr is never, ever printed
Try for instance `west diff --fubar` and `west -v --fubar` (which are
possible since commit 73aee32278). One fails and the other does
not. Neither prints any useful error.
The verbosity level should never have any side-effect.
To fix:
- Assume there is a diff when --exit-code is zero AND stdout is not
empty. Treat this the same as --exit-code=1
- Always `failed.append(project)` when --exit-code > 1
- Print stderr when there is a diff or in verbose mode.
This drops one `elif` which also simplifies the logic.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Stop using `shlex.split()` in conftest.py as a way to prepare test
commands for subprocess.run() because it does not always work. When we
have quoting issues, just avoid them entirely by passing the test
command as a list.
Replace shlex.split() with a simple str.split() for convenience in
simple cases. This simple split() will immediately fail when trying to
use quote which is working exactly as intended.
This also makes the cmd() interface more similar to subprocess.run() and
its many friends, which is good thing.
This is similar to commit 41007648d9 ("Project.git(list/str): reduce
reliance on shlex.split()") but applied to tests/
Before commit 624880e8ff, shlex.split() was used unconditionally in
conftest.py. As expected, this eventually broke on Windows: shlex is
not compatible across all operating systems and shells.
https://docs.python.org/3/library/subprocess.html#security-considerations
> If the shell is invoked explicitly, via shell=True, it is the
> application’s responsibility to ensure that all whitespace and
> metacharacters are quoted appropriately to avoid shell injection
> vulnerabilities. On _some_ platforms, it is possible to use shlex.quote()
> for this escaping.
(Emphasis mine)
Then commit 624880e8ff made the "interesting" decision to stop using
shlex.split()... only on Windows. This was discussed in
https://github.com/zephyrproject-rtos/west/pull/266#discussion_r284670076
So after this commit, parsing of test commands was delegated to the
shell but... only on Windows! This worked for a long time but eventually
broke testing white spaces for the new `west alias` #716. Rather than
making that Windows-specific hack even more complex with a special case,
finally do the right thing and ask more complex test commands to use a
list. Now we can drop shlex.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Commit d842371089 ("app: handle unexpected command name better")
intentionally created a big error handling difference between extensions
and built-in commands. As an unfortunate side effect, it lost the
relevant "manifest import failure" error messages for _extension_
commands. This is especially ironic when the extension command is
missing because the import failed, see example in #726.
Error handling is generally very hard to test comprehensively and even
more so in this complex "bootstrap" area. Rather than trying to refactor
it once again, tweak the existing error messages to gently steer the
user away from (potentially missing) extensions and towards built-in
commands that provide a simpler and better error handling out of the
box: they still show relevant, manifest error messages! Always have.
Also recommand the -vv option which conveniently includes git error
messages like "dubious ownership" since previous commit
23db6e1f3c ("app: re-work logging yet again") from the same giant PR
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
* Add environment variables when running forall for each project.
* Add a "cwd" argument to execute the command in different directory
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Add an argument to the west diff command that allows to set the
manifest revision as the merge-base.
Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
Fixes issue reported in PR #710 where most places are hardcoded to
'utf-8' while this one is (Windows) locale-dependent. In the future, we
may want to make this more flexible but the most urgent fix is
consistency: with this commit, manifest decoding should be hardcoded to
'utf-8' everywhere.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
No functional change: just a lot less duplication & hardcoding.
This can help testing and supporting other encodings. It does not hurt
in any case.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Cosmetic fix, no functional change. A little less duplication and
hardcoding.
listdir_at() had an optional "encoding" parameter but it was never used
before now, always defaulting to 'utf-8'.
Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Long overdue; both where still at @v1!
Found by chance in
https://github.com/zephyrproject-rtos/west/actions/runs/9275086435/job/25518959121?pr=711
where all macos-latest configs failed like this:
```
Run actions/setup-python@v1
Error: Version 3.8 with arch x64 not found
Available versions:
(empty)
```
Signed-off-by: Marc Herbert <marc.herbert@intel.com>