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

Limit brewfile to items you install and not dependencies #41

Closed
derimagia opened this issue Jun 25, 2016 · 6 comments
Closed

Limit brewfile to items you install and not dependencies #41

derimagia opened this issue Jun 25, 2016 · 6 comments

Comments

@derimagia
Copy link
Contributor

I'm interested in converting my package list to be more similar to "brew leaves" (Run the external brew command using brew leaves, see https://github.com/Homebrew/brew/blob/cb711a2d39a9c76d40f43b4fe13564eba3424ea8/Library/Homebrew/cmd/leaves.rb). Since the dependencies will be installed by homebrew, I don't have the need to store these in my package list.

First thing I'm curious about is were there ever any plans for this or any reasons why it isn't done this way?

@rcmdnk
Copy link
Owner

rcmdnk commented Jun 26, 2016

I have sometimes thought to make a list with such dependencies but that makes a list complex.
On the other hand, this idea to list up only leaves seems useful.

I implemented --leaves option in v3.12.5, which lists up only brew leaves packages.

If you want to do it always, you can set

export HOMEBREW_BREWFILE_LEAVES=1

in your .bashrc/.zshrc, then brew-file will be done with --leaves option always.

Note:

There is a difficulty on clean.
For now, at clean, brew-file checks dependencies of listed packages,
and do not uninstall if they are in the list of dependencies.

If a package, which has some packages depending on, is uninstalled,
these packages are remained, but not in Brewfile.
Then, they will be uninstalled at clean.

But there could be some packages on which some packages depend,
but the package itself is used by itself, for example: go.

I don't have better idea for now, therefore we should be careful to use leave option,
especially to use clean command.

@derimagia
Copy link
Contributor Author

Thanks for this! I'll try messing around with it. What I wished to work towards was being able to only have a list of the important programs and not dependencies of items that you never installed yourself. Sadly leaves isn't the best solution for the reasons you mentioned as well as the concept itself will hide programs you installed if you installed a program that depended on it.

Example is if you install renameutils, it will hide coreutils.. and I have a feeling that it'll also hide all the flags you may have had on it as well... Keeping track of items you actually install vs installed because of dependencies seems like something homebrew should have in the program's install receipt but I don't see sadly. Anyway I think this can be closed, thanks!

@rcmdnk
Copy link
Owner

rcmdnk commented Jun 27, 2016

There is a possibility to have an option such HOMEBREW_BREWFILE_KEEP=go,coreutils, which will no be removed by cleanup (or listed up always if it is installed), even if they are under dependencies.

The concept of Brew-file is that users don't need to prepare for Brewfile by themselves,
so I hesitate to add such an option.
But maybe it is useful especially now we have leaves option.

@derimagia
Copy link
Contributor Author

Another option for that may be to have the possibility of having multiple brewfiles, where it would only write to 1 but have the option of reading multiple of them. I can see that being useful outside of this one context. But I agree managing them yourself isn't really the spirit of the plugin so I don't see many people using it

@rcmdnk
Copy link
Owner

rcmdnk commented Jun 27, 2016

I added HOMEBREW_BREWFILE_TOP_PACKAGES option in brew-file.
It can be set by an argument of --top_packages
Usage is like:
export HOMEBREW_BREWFILE_TOP_PACKAGES=go,coreutils

',' separated list.

If the package is in this list, it will be in Brewfile even if leaves option is used and it is under dependencies.

Not sure how the option is useful or not,
but people can control if they want.

@derimagia
Copy link
Contributor Author

Awesome! And thanks for looking at this stuff so quickly

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

No branches or pull requests

2 participants