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

feat(install): add --keepsrc to keep pkg/ and src/ directories #2272

Merged
merged 4 commits into from
Sep 18, 2023

Conversation

jdholtz
Copy link
Contributor

@jdholtz jdholtz commented Sep 7, 2023

Should fix #798.

Providing this flag during installation of AUR packages allows for keeping the src/ and pkg/ directories produced my makepkg. If the user wants to delete the directories, they can either select to cleanBuild in the cleanmenu or run the installation without the --nocleanbuild flag.

The one inconsistency I found when running Yay without the --nocleanbuild flag (and if pkg/ and src/ directories previously existed), since Yay runs pacman -U separately from makepkg, Yay will not clean the directories if the package is cached already whereas makepkg will. I don't think this is a big deal since Yay provides the cleanmenu, but we could discuss solutions to fix this inconsistency if you want.

I added tests in both places that make this check.

I opted not to add a --cleanbuild option that would override the option in the config file as I thought it would be confusing due to it being a makepkg flag. However, I can add it if desired. Also, I can change the name of the flag (paru uses --keepsrc but we could think of a different name to use as well).

Last, I exposed the CleanBuild attribute in the cmdBuilder as that is where I thought it was the easiest to access it. I'm not super familiar with Go so please let me know if it could be refactored to be put in a more logical place.

AUR packages

Providing this flag during installation of AUR packages allows for keeping
the src/ and pkg/ directories produced my makepkg. If the user wants to
delete the directories, they can either select to cleanBuild in the
cleanmenu or run the installation without the --nocleanbuild flag (yay
will only remove the directories if the package is rebuilt)
@jdholtz jdholtz requested a review from Jguer as a code owner September 7, 2023 16:57
This makes the description consistent with the descriptions in the
man page, --help, and zsh completion.
@sevmonster
Copy link

This is absolutely critical for building large packages like kernels, where a failed build step (for whatever reason) can really take a lot of time to get back to.

@Jguer
Copy link
Owner

Jguer commented Sep 15, 2023

Hey @jdholtz , I think we can merge this, let try and fix the CI.

I think keepsrc is a better flag name to expose to the user (and if paru already uses it, it's more familiar)

@jdholtz
Copy link
Contributor Author

jdholtz commented Sep 15, 2023

I think keepsrc is a better flag name to expose to the user (and if paru already uses it, it's more familiar)

Sounds good. Do you want me to go with keepsrc and nokeepsrc` to have both options then?

@Jguer
Copy link
Owner

Jguer commented Sep 15, 2023

I think keepsrc is enough.
(In the future we should look at allowing 'real' boolean flags for this ex: --keepsrc=false)

@Morganamilo
Copy link
Contributor

Would be good. Though =yes and =no I think is nicer.

This naming scheme is more familiar to users since it is the name of the
flag in Paru.
@jdholtz jdholtz changed the title feat(install): add --nocleanbuild to keep pkg/ and src/ directories feat(install): add --keepsrc to keep pkg/ and src/ directories Sep 15, 2023
@jdholtz
Copy link
Contributor Author

jdholtz commented Sep 15, 2023

(In the future we should look at allowing 'real' boolean flags for this ex: --keepsrc=false)

Yes, that would be nice. Many of the options prefixed with no can be removed and replaced with this format.

Though =yes and =no I think is nicer.

There could be multiple booleans used, like "yes", "true", and "y" for true and "no", "false", and "n" for false.

@Jguer
Copy link
Owner

Jguer commented Sep 18, 2023

merging :)

@jdholtz would you be interested in implementing this boolean flag system?

We'd just need to keep old toggles working for a while

@Jguer Jguer merged commit 04c76a4 into Jguer:next Sep 18, 2023
@Jguer
Copy link
Owner

Jguer commented Sep 18, 2023

sorry @jdholtz , ended forgetting to remove the coauthored line from the merge message, if it's important for you I'll revert and recommit with the proper author information

@jdholtz
Copy link
Contributor Author

jdholtz commented Sep 18, 2023

would you be interested in implementing this boolean flag system?

Yes, I can.

it's important for you I'll revert and recommit with the proper author information

No worries, you can keep it as is.

@jdholtz jdholtz deleted the nocleanbuild branch September 18, 2023 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Is it possible to keep the src directory?
4 participants