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

Custom formula options can't be parsed #7397

Closed
3 tasks done
d12frosted opened this issue Apr 20, 2020 · 1 comment · Fixed by #7402
Closed
3 tasks done

Custom formula options can't be parsed #7397

d12frosted opened this issue Apr 20, 2020 · 1 comment · Fixed by #7402
Labels
outdated PR was locked due to age

Comments

@d12frosted
Copy link

Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

  • ran brew update and can still reproduce the problem?
  • ran brew doctor, fixed all issues and can still reproduce the problem?
  • ran brew config and brew doctor and included their output with your issue?

What you were trying to do (and why)

I was trying to install a custom formula with custom options. Actually, I found this issue on a formula with decent amount of options, but it can be reproduced with much smaller formula (basically, took it from the cookbook).

class Foo < Formula
  desc ""
  homepage ""
  url "https://example.com/foo-0.1.tar.gz"
  sha256 "85cc828a96735bdafcf29eb6291ca91bac846579bcef7308536e0c875d6c81d7"

  # depends_on "cmake" => :build

  option "with-ham", "Description of the option"
  option "without-spam", "Another description"

  def install
    # ENV.deparallelize
    system "./configure", "--disable-debug",
                          "--disable-dependency-tracking",
                          "--disable-silent-rules",
                          "--prefix=#{prefix}"
    # system "cmake", ".", *std_cmake_args
    system "make", "install"
  end

  test do
    system "false"
  end
end

What happened (include command output)

$ brew install Foo.rb --with-ham
Command output
Updating Homebrew...
==> Auto-updated Homebrew!
Updated Homebrew from 3b78b1aa9 to ef3b14814.
No changes to formulae.

Usage: brew install [options] formula

Install formula. Additional options specific to formula may be appended to
the command.

Unless HOMEBREW_NO_INSTALL_CLEANUP is set, brew cleanup will then be run for
the installed formulae or, every 30 days, for all formulae.

-d, --debug                      If brewing fails, open an interactive
                                 debugging session with access to IRB or a
                                 shell inside the temporary build directory.
    --env                        If std is passed, use the standard build
                                 environment instead of superenv. If super
                                 is passed, use superenv even if the formula
                                 specifies the standard build environment.
    --ignore-dependencies        An unsupported Homebrew development flag to
                                 skip installing any dependencies of any
                                 kind. If the dependencies are not already
                                 present, the formula will have issues. If
                                 you're not developing Homebrew, consider
                                 adjusting your PATH rather than using this
                                 flag.
    --only-dependencies          Install the dependencies with specified
                                 options but do not install the formula
                                 itself.
    --cc                         Attempt to compile using the specified
                                 compiler, which should be the name of the
                                 compiler's executable, e.g. gcc-7 for GCC
                                 7. In order to use LLVM's clang, specify
                                 llvm_clang. To use the Apple-provided
                                 clang, specify clang. This option will
                                 only accept compilers that are provided by
                                 Homebrew or bundled with macOS. Please do
                                 not file issues if you encounter errors
                                 while using this option.
-s, --build-from-source          Compile formula from source even if a
                                 bottle is provided. Dependencies will still
                                 be installed from bottles if they are
                                 available.
    --force-bottle               Install from a bottle if it exists for the
                                 current or newest version of macOS, even if
                                 it would not normally be used for
                                 installation.
    --include-test               Install testing dependencies required to
                                 run brew test formula.
    --devel                      If formula defines it, install the
                                 development version.
    --HEAD                       If formula defines it, install the HEAD
                                 version, aka. master, trunk, unstable.
    --fetch-HEAD                 Fetch the upstream repository to detect if
                                 the HEAD installation of the formula is
                                 outdated. Otherwise, the repository's HEAD
                                 will only be checked for updates when a new
                                 stable or development version has been
                                 released.
    --keep-tmp                   Retain the temporary files created during
                                 installation.
    --build-bottle               Prepare the formula for eventual bottling
                                 during installation, skipping any
                                 post-install steps.
    --bottle-arch                Optimise bottles for the specified
                                 architecture rather than the oldest
                                 architecture supported by the version of
                                 macOS the bottles are built on.
-f, --force                      Install without checking for previously
                                 installed keg-only or non-migrated
                                 versions.
-v, --verbose                    Print the verification and postinstall
                                 steps.
    --display-times              Print install times for each formula at the
                                 end of the run.
-i, --interactive                Download and patch formula, then open a
                                 shell. This allows the user to run
                                 ./configure --help and otherwise
                                 determine how to turn the software package
                                 into a Homebrew package.
-g, --git                        Create a Git repository, useful for
                                 creating patches to the software.
-h, --help                       Show this message.

Error: invalid option: --with-ham

What you expected to happen

Custom option to be parsed.

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

  1. save provided formula somewhere
  2. brew install Foo.rb --with-ham
  3. Notice the error.

Interestingly, if I disable the homebrew autoupdate and revert #7333, then everything works.

  1. set -x HOMEBREW_NO_AUTO_UPDATE false (I am using fish, hence the syntax)
  2. cd /usr/local/Homebrew/
  3. git revert 8d868b739
  4. cd back to formula location
  5. brew install Foo.rb --with-ham - option is parsed, it just says that URL is invalid, which is expected.

Output of brew config and brew doctor commands

$ brew config
HOMEBREW_VERSION: 2.2.13-84-gef3b148
ORIGIN: https://github.com/Homebrew/brew
HEAD: ef3b148147717e0f317d6e51f9b56e50558e6d5f
Last commit: 15 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 0a27529d1d443cec9237ccce19168aac9d6de8e1
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.LWJk7M9QjH/org.macosforge.xquartz:0
HOMEBREW_EDITOR: emacsclient
HOMEBREW_MAKE_JOBS: 8
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
Clang: 11.0 build 1103
Git: 2.26.1 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
Java: 13.0.1, 1.8.0_192
macOS: 10.15.4-x86_64
CLT: N/A
Xcode: 11.4.1
XQuartz: 2.7.11 => /opt/X11

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Putting non-prefixed coreutils in your path can cause gmp builds to fail.

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  docker
  emacs
  gnupg
@d12frosted
Copy link
Author

Confirm that it is fixed. Thank you very much!

@lock lock bot added the outdated PR was locked due to age label May 20, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
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

Successfully merging a pull request may close this issue.

1 participant