-
Notifications
You must be signed in to change notification settings - Fork 730
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[util/vendor_hw.py] add only_subdir support #594
Conversation
We already have Can you
|
That is exactly the road I started down (I started adding an include_only_from_upstream following the design of exclude_from_upstream), but also wanted to trim the prefix of the path name, so I started adding the ability to do that too, then realized that the path prefix trimming would imply include_only_from_upstream for everything down that path prefix, and was working out how to do that, then realized that with that working I wouldn't need the include_only_from_upstream anymore. But in any case, I don't need all that for the mpsse stuff. This much simpler only_subdir will do. (And note that the upstream repo we want to fetch these four files from have over 8 thousand files we don't want, and those 8000+ files are scattered among over a hundred top level directories in that repo. So trying to use exclude_from_upstream would be an ongoing maintenance headache. And we'd still want to trim the path prefix.) An include_only_from_upstream might be useful in some other case, but wouldn't help us here, and we would still want the path prefix trimming, and the only_subdir functionality I've implemented here seems to be the simplest way there. I do welcome a better idea, but I don't think an include{_only,}_from_upstream sort of thing is what we need here (for mpsse), at least not as I imagined it and started implementing it yesterday. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation @tjshep, sounds reasonable.
The implementation LGTM with a couple nits, but please
- Update the documentation in
doc/rm/vendor_hw_tool.md
to inform users about this new feature. - Update the commit message to explain a bit of your motivation (e.g. what you wrote in a previous comment here).
I'd encourage you to include a short "why did I do this change" paragraph in the commit message and pull request description right from the start, as it makes reviewing much easier, and helps in the future to understand why changes were done.
util/vendor_hw.py
Outdated
if 'only_subdir' in desc['upstream']: | ||
upstream_only_subdir = desc['upstream']['only_subdir'] | ||
clone_subdir = clone_dir / upstream_only_subdir | ||
if not os.path.isdir(clone_subdir): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clone_subdir.is_dir()
(clone_subdir is a Path object)
672c86c
to
13e58c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with the nits in the documentation addressed. Thanks!
doc/rm/vendor_hw_tool.md
Outdated
|
||
In the example vendor description file below, the mpsse directory is populated from | ||
the chromiumos platform2 repository, extracting just the few files in the | ||
trunks/ftdi subdirectory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write one sentence per line in Markdown (https://bubble.servers.lowrisc.org/doc/rm/markdown_usage_style.html).
doc/rm/vendor_hw_tool.md
Outdated
@@ -77,6 +77,32 @@ Optional parts can be removed if they are not used. | |||
} | |||
``` | |||
|
|||
If only the contents of a single subdirectory (including its children) of an | |||
upstream repository is to be copied in, the optional `only_subdir` key of can be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is -> are
doc/rm/vendor_hw_tool.md
Outdated
@@ -77,6 +77,32 @@ Optional parts can be removed if they are not used. | |||
} | |||
``` | |||
|
|||
If only the contents of a single subdirectory (including its children) of an | |||
upstream repository is to be copied in, the optional `only_subdir` key of can be | |||
used in the upstream section to specify the subdirectory to be copied in. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upstream -> upstream
13e58c6
to
4b3b8fe
Compare
…tion. With an 'only_subdir' key in an upstream section, a single subtree of an upstream repository can be specified for copying in. This will enable use of this tool to extract a small piece of a large upstream repository without having to keep the path of directories down to that piece and without having to maintain a large list of excludes.
4b3b8fe
to
d18ec40
Compare
This closes lowRISC#594. Signed-off-by: Andreas Kurth <adk@lowrisc.org>
We would like to use the vendor_hw.py script to pull sw/host/vendor/mpsse/*.[ch] out of where they came from which is subdirectory in chromiumos/platform2 repo.
sw/host/vendor/mpsse.vendor.hjson would contain: