Skip to content
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

scripts: west_commands: patch: Add gh-fetch subcommand #83538

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pdgendt
Copy link
Collaborator

@pdgendt pdgendt commented Jan 3, 2025

Add a gh-fetch subcommand to the west patch extension to download a patch file from Github and generate the patch meta data.

The patch info is appended to the patches.yml file.

@pdgendt pdgendt requested a review from cfriedt January 3, 2025 15:33
@cfriedt
Copy link
Member

cfriedt commented Jan 3, 2025

Cool 😎

@pdgendt pdgendt force-pushed the west-patch-gh-fetch branch from af5c571 to cfd7e13 Compare January 7, 2025 21:11
@pdgendt
Copy link
Collaborator Author

pdgendt commented Jan 7, 2025

I'm thinking the gh-fetch subcommand should create the patches file and directory if they don't exist yet.

@cfriedt WDYT?

@cfriedt
Copy link
Member

cfriedt commented Jan 7, 2025

@pdgendt - yeah that makes sense. And possibly append to the file as well.

@pdgendt pdgendt force-pushed the west-patch-gh-fetch branch from cfd7e13 to 341733f Compare January 8, 2025 09:30
@pdgendt pdgendt marked this pull request as ready for review January 8, 2025 09:31
@zephyrbot zephyrbot added the area: West West utility label Jan 8, 2025
scripts/west_commands/patch.py Outdated Show resolved Hide resolved
scripts/west_commands/patch.py Outdated Show resolved Hide resolved
@pdgendt pdgendt force-pushed the west-patch-gh-fetch branch from 341733f to d4144f1 Compare January 8, 2025 12:59
@faxe1008
Copy link
Collaborator

faxe1008 commented Jan 8, 2025

Tangential to this command: perhaps one that goes through all patches and alerts you if a patch was merged upstream. :^)

@pdgendt
Copy link
Collaborator Author

pdgendt commented Jan 8, 2025

Tangential to this command: perhaps one that goes through all patches and alerts you if a patch was merged upstream. :^)

Not sure if the west patch needs to become another Swiss army knife, having the gh-fetch was to reduce the amount of work to create a patch from a PR which could get tedious.

@pdgendt pdgendt force-pushed the west-patch-gh-fetch branch from d4144f1 to 0eebe67 Compare January 8, 2025 15:04
@cfriedt
Copy link
Member

cfriedt commented Jan 8, 2025

@faxe1008 - I could see something like west patch prune.

Effectively, all it would do is check the merge-pr URL to see if a patch was merged, and delete the patch from yaml if it was.

@faxe1008
Copy link
Collaborator

faxe1008 commented Jan 8, 2025

@faxe1008 - I could see something like west patch prune.

Effectively, all it would do is check the merge-pr URL to see if a patch was merged, and delete the patch from yaml if it was.

Yeah that would be lovely, altough this means that ideally the patch is only pruned if the west manifest of the project points to a commit that includes the commit of the merged PR. Or alternatively after pruning it gives you the "next" revision that includes all pruned patches. But I guess for the first case applying the patches will fail anyways 🤷

Add a gh-fetch subcommand to the west patch extension to download a patch
file from Github and generate the patch meta data.

The patch info is appended to the patches.yml file.

Signed-off-by: Pieter De Gendt <[email protected]>
@pdgendt pdgendt force-pushed the west-patch-gh-fetch branch from 0eebe67 to 4c717be Compare January 10, 2025 09:09
@zephyrbot zephyrbot requested a review from mbolivar January 10, 2025 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: West West utility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants