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

Can the output of brew bundle dump be sorted consistently? #1263

Closed
paddyroddy opened this issue Nov 13, 2023 · 3 comments
Closed

Can the output of brew bundle dump be sorted consistently? #1263

paddyroddy opened this issue Nov 13, 2023 · 3 comments
Labels

Comments

@paddyroddy
Copy link

I'm tracking my .Brewfile in git and I see occasionally packages move around. I'm not sure how things are sorted currently, but could it be done on package name?

I'm running the command

brew bundle dump --describe --force --file $HOME/.Brewfile
@MikeMcQuaid
Copy link
Member

I'm not sure how things are sorted currently

It's a topological sort. The ordering is important as otherwise you'll install dependencies in the not the order specified in the Brewfile.

but could it be done on package name?

It could but, due to the above, it should not be.

@MikeMcQuaid MikeMcQuaid closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2023
@paddyroddy
Copy link
Author

paddyroddy commented Nov 13, 2023

It's a topological sort. The ordering is important as otherwise you'll install dependencies in the not the order specified in the Brewfile.

Fair enough. Although, I think that as long as tap remains at the top then it's fine. FWIW I have done the following:

#!/usr/bin/env bash
BREW_FILE=$HOME/.Brewfile
BREW_TYPES=(
    tap
    brew
    cask
    mas
)
TMP_FILE=/tmp/.Brewfile_unsorted

# update homebrew list
brew bundle dump --force --file $TMP_FILE

# sort the final output
## clear current contents
> $BREW_FILE
for type in ${BREW_TYPES[@]}; do
    ## extract lines starting with "type" and sort them
    grep --dereference-recursive "^${type}" $TMP_FILE | sort >> $BREW_FILE
done
## remove temporary file
rm $TMP_FILE

@MikeMcQuaid
Copy link
Member

then it's fine

It's fine if you're happy for dependencies to be installed not when the Brewfile things they will be but before that and the error messages to not be clear about what package has failed to install.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants