-
Notifications
You must be signed in to change notification settings - Fork 74
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
Add scripts to help identify bottled / unbottled formulae #2610
Conversation
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
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.
None of my comments are binding, but I did a shellnerd review.
@@ -0,0 +1,43 @@ | |||
#!/usr/bin/env bash |
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.
If this script has to be run on macOS it may make sense to write it not to use bash, given that the version of Bash available without homebrew is heinously out-of-date. (or it's been removed, I can't remember)
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.
I'm open to that; do you recommend zsh
?
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.
switched to /bin/sh
in d3e7b1d
|
||
FORMULA=${1} | ||
|
||
if [[ $# -ne 1 ]]; then |
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.
if [[ $# -ne 1 ]]; then | |
if [ $# -ne 1 ]; then |
This can use test
/ []
instead of the bash conditional expression `[[]]``.
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.
switched to []
in d45f9e6
exit 1 | ||
fi | ||
|
||
for f in $(brew deps ${FORMULA} --full-name | grep osrf/simulation) |
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 osrf/simulation
always at the beginning or end of the full name? You could either use grep -F
to do a literal search for this, although it would match gosrf/simulationz
as well. Or use an anchored expression such as ^osrf/simulation
for matching the start of the line.
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.
tightened up as ^osrf/simulation/
in d45f9e6
# but has different output for formulae that are "ready to bottle" or | ||
# that have "unbottled deps". So just echo the name of any formula for which | ||
# `brew unbottled` doesn't print "already bottled" | ||
brew unbottled $f | grep "already bottled" > /dev/null \ |
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.
GNU grep has a -q
/--quiet
flag but I can't recall if it also exists in FreeBSD grep.
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.
good call; using --quiet
in d45f9e6
brew unbottled $f | grep "already bottled" > /dev/null \ | ||
|| echo $f |
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.
Possibly worth phrasing this as a conditional statement since it's already split across multiple lines.
brew unbottled $f | grep "already bottled" > /dev/null \ | |
|| echo $f | |
if brew unbottled $f | grep "already bottled" > /dev/null; then | |
echo $f | |
fi |
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.
switched to if
statement in d45f9e6
* Improve regex by starting with ^, ending with / * [ ] instead of [[ ]] * Use grep --quiet instead of > /dev/null * Use if block instead of multi-line command with || Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
7c7573f
to
1a07ebf
Compare
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
1a07ebf
to
5194681
Compare
Useful for removing broken bottles Signed-off-by: Steve Peters <scpeters@openrobotics.org>
I added another script and updated the pull request description |
thanks for the reviews; I'm going to merge these scripts since I've been using them successfully for quite a few bottle-related pull requests |
I'm working on a GitHub actions workflows to automate removing broken bottles and rebuilding missing bottles, and I'm starting with two scripts:
unbottled_dependencies.sh
prints the unbottled dependencies needed by a given formula (useful for rebuilding bottles)bottled_dependents.sh
prints the bottled dependents that use a given formula (useful for removing broken bottles)unbottled_dependencies.sh examples
Gazebo Ionic not yet bottled, so it has lots of unbottled dependencies:
but several other collections have some bottles missing:
bottled_dependents.sh examples
When a new protobuf version lands in homebrew-core, we have to remove bottles for all dependents that use
gz-msgs*
: