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

Brew log output no longer accepts format arguments #6028

Closed
espoelstra opened this issue Apr 17, 2019 · 1 comment
Closed

Brew log output no longer accepts format arguments #6028

espoelstra opened this issue Apr 17, 2019 · 1 comment
Labels
outdated PR was locked due to age

Comments

@espoelstra
Copy link

  • [ x ] are reporting a bug others will be able to reproduce and not asking a question. If you're not sure or want to ask a question do so on our Discourse: https://discourse.brew.sh
  • [ x ] ran a brew command and reproduced the problem with multiple formulae? If it's a problem with a single, official formula (not cask) please file this issue at Homebrew/homebrew-core: https://github.com/Homebrew/homebrew-core/issues/new/choose. If it's a brew cask problem please file this issue at https://github.com/Homebrew/homebrew-cask/issues/new/choose. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.
  • [ x ] ran brew update and can still reproduce the problem?
  • [ x ] ran brew doctor, fixed all issues and can still reproduce the problem?
  • [ x ] ran brew config and brew doctor and included their output with your issue?

What you were trying to do (and why)

Trying to look up previous versions of Bash formula to install Bash 4 instead of Bash 5. This SO answer has the syntax I was trying to use. https://stackoverflow.com/a/53766019/3794873

What happened (include command output)

When attempting to use a git log formatting argument that used to work on brew log, it stated that the arguments were invalid.

Command output
brew log --format=format:%H\ %s -F --grep=4.4.23 bash
Usage: brew log [options] formula

Show the git log for the given formula.

-p, -u, --patch                  Also output patch from commit.
    --stat                       Also output diffstat from commit.
    --oneline                    Output only one line per commit.
-1, --max-count=1                Output only one commit.
-h, --help                       Show this message.

Error: invalid option: --format=format:%H %s

What you expected to happen

Expected brew log to pass the command to git log as it used to for advanced search capabilities.

Step-by-step reproduction instructions (by running brew commands)

brew log --format=format:%H\ %s -F --grep=4.4.23 bash

Goal would be to use this filtered output to install a specific previous version without having to create a custom tap first.

BREW_VERSION_SHA=$(brew log --format=format:%H\ %s -F --grep=4.4.23 bash | head -1 | awk '{print $2}')
BREW_FORMULA_NAME=bash
brew info $BREW_FORMULA_NAME \
| sed -n \
    -e '/^From: /s///' \
    -e 's/github.com/raw.githubusercontent.com/' \
    -e 's%blob/%%' \
    -e "s/master/$BREW_VERSION_SHA/p" \
| xargs brew install

Alternative method of achieving the same goal appears to be:

brew tap-new username/repo-name
# extract with a version seems to run a grep under the hood
brew extract --version='4.4.23' bash username/repo-name
brew install bash@4.4.23
# Note this "fails" when trying to grab a bottle for the package and seems to have some odd doubling of the version in that output, but this isn't fatal.
@MikeMcQuaid
Copy link
Member

Goal would be to use this filtered output to install a specific previous version

Sorry, this is not a use-case we wish to support. brew extract is the supported flow for this.

For brew log specifically: you could use git -C $(brew --repo homebrew/core) log --format ....

@lock lock bot added the outdated PR was locked due to age label May 18, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests

2 participants