Optional dependencies are not tracked #10708

Closed
nicolasdespres opened this Issue Mar 5, 2012 · 5 comments

Comments

Projects
None yet
3 participants
Contributor

nicolasdespres commented Mar 5, 2012

Hi,

Some formula have optional dependency like this depends_on 'qt' if qt?. They are not reported by brew info. Here an example with poppler:

$ brew install --with-qt4 poppler
[...successful installation...]
$ brew info poppler
poppler 0.18.4
http://poppler.freedesktop.org
Depends on: pkg-config
/usr/local/Cellar/poppler/0.18.4 (458 files, 22M)
  Installed with: --with-qt4
http://github.com/mxcl/homebrew/commits/master/Library/Formula/poppler.rb

The installa options are tracked in the install receipt. I guess that's why brew info is able to list them. Maybe we can do something to fix this. I have tried:

$ brew info --with-qt4 poppler
poppler 0.18.4
http://poppler.freedesktop.org
Depends on: pkg-config, qt
/usr/local/Cellar/poppler/0.18.4 (458 files, 22M)
  Installed with: --with-qt4
http://github.com/mxcl/homebrew/commits/master/Library/Formula/poppler.rb

and in this case it works. So, I will try to find a way to teach brew info to automatically add the install options listed in the receipt after it has loaded the formula.

What do you think?

Regards,
-Nico

Contributor

adamv commented Mar 5, 2012

See: mxcl#10050

Contributor

jacknagel commented Mar 5, 2012

Work is being done to fix these things:

mxcl#10555
mxcl#10050

We read from the install receipt to show the "Installed with: ..." line, but reading from the install receipt isn't really the right approach for the

Depends on: ...

line. It should list any deps that the formula can use, not those that were used to install it. In the future we will hopefully be able to say:

Dependencies: ...
Optional dependencies: ...

instead.

Contributor

nicolasdespres commented Mar 9, 2012

An ugly hack to work around this issue:

def get_formula(name)
  # Get the formula.
  f = Formula.factory(name)
  t = Tab.for_formula f
  # Inject the options in ARGV.
  opts = t.used_options
  ARGV.concat(opts)
  # Remove required formula.
  klass_name = Formula.class_s(name)
  Object.send(:remove_const, klass_name)
  # Reload the formula
  load f.path
  klass = Object.const_get(klass_name)
  f = klass.new(name)
  # Remove the options from ARGV.
  ARGV.delete_if{|x| opts.include? x }
  f
end
Contributor

nicolasdespres commented Apr 20, 2012

Just to mention that brew uses is also impacted by this issue:

$ brew uses --installed qt
$ brew uses --installed --with-qt4 qt
poppler
Contributor

adamv commented Aug 9, 2012

Should be addressed by the work in #13923.

adamv closed this Aug 9, 2012

xu-cheng locked and limited conversation to collaborators Feb 16, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.