linkage: enable cache by default.

This has not been causing any issues in CI or for `master` users so
let's now enable it by default for everyone.
This commit is contained in:
Mike McQuaid 2018-06-29 19:57:39 +01:00
parent 0d33aba0b7
commit 6f5c8b8509
6 changed files with 15 additions and 49 deletions

View File

@ -287,11 +287,6 @@ then
HOMEBREW_BASH_COMMAND="$HOMEBREW_LIBRARY/Homebrew/dev-cmd/$HOMEBREW_COMMAND.sh"
fi
if [[ -n "$HOMEBREW_DEVELOPER" || -n "$HOMEBREW_DEV_CMD_RUN" ]]
then
export HOMEBREW_LINKAGE_CACHE="1"
fi
check-run-command-as-root() {
[[ "$(id -u)" = 0 ]] || return

View File

@ -1,4 +1,4 @@
#: * `linkage` [`--test`] [`--reverse`] [`--cached`] <formula>:
#: * `linkage` [`--test`] [`--reverse`] <formula>:
#: Checks the library links of an installed formula.
#:
#: Only works on installed formulae. An error is raised if it is run on
@ -9,9 +9,6 @@
#:
#: If `--reverse` is passed, print the dylib followed by the binaries
#: which link to it for each library the keg references.
#:
#: If `--cached` is passed, print the cached linkage values stored in
#: HOMEBREW_CACHE, set from a previous `brew linkage` run
require "cache_store"
require "linkage_checker"
@ -24,7 +21,6 @@ module Homebrew
Homebrew::CLI::Parser.parse do
switch "--test"
switch "--reverse"
switch "--cached"
switch :verbose
switch :debug
end
@ -33,8 +29,7 @@ module Homebrew
ARGV.kegs.each do |keg|
ohai "Checking #{keg.name} linkage" if ARGV.kegs.size > 1
use_cache = args.cached? || ENV["HOMEBREW_LINKAGE_CACHE"]
result = LinkageChecker.new(keg, use_cache: use_cache, cache_db: db)
result = LinkageChecker.new(keg, cache_db: db)
if args.test?
result.display_test_output

View File

@ -5,12 +5,10 @@ require "linkage_cache_store"
class LinkageChecker
attr_reader :undeclared_deps
def initialize(keg, formula = nil, cache_db:,
use_cache: !ENV["HOMEBREW_LINKAGE_CACHE"].nil?,
rebuild_cache: false)
def initialize(keg, formula = nil, cache_db:, rebuild_cache: false)
@keg = keg
@formula = formula || resolve_formula(keg)
@store = LinkageCacheStore.new(keg.to_s, cache_db) if use_cache
@store = LinkageCacheStore.new(keg.to_s, cache_db)
@system_dylibs = Set.new
@broken_dylibs = Set.new

View File

@ -4,32 +4,16 @@ describe "brew linkage", :integration_test do
(HOMEBREW_CELLAR/"testball/0.0.1/foo").mkpath
end
context "no cache" do
it "works when no arguments are provided" do
expect { brew "linkage" }
.to be_a_success
.and not_to_output.to_stdout
.and not_to_output.to_stderr
end
it "works when one argument is provided" do
expect { brew "linkage", "testball" }
.to be_a_success
.and not_to_output.to_stderr
end
it "works when no arguments are provided" do
expect { brew "linkage" }
.to be_a_success
.and not_to_output.to_stdout
.and not_to_output.to_stderr
end
context "cache" do
it "works when no arguments are provided" do
expect { brew "linkage", "--cached" }
.to be_a_success
.and not_to_output.to_stderr
end
it "works when one argument is provided" do
expect { brew "linkage", "--cached", "testball" }
.to be_a_success
.and not_to_output.to_stderr
end
it "works when one argument is provided" do
expect { brew "linkage", "testball" }
.to be_a_success
.and not_to_output.to_stderr
end
end

View File

@ -779,7 +779,7 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
If `--pry` is passed or HOMEBREW_PRY is set, pry will be
used instead of irb.
* `linkage` [`--test`] [`--reverse`] [`--cached`] `formula`:
* `linkage` [`--test`] [`--reverse`] `formula`:
Checks the library links of an installed formula.
Only works on installed formulae. An error is raised if it is run on
@ -791,9 +791,6 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
If `--reverse` is passed, print the dylib followed by the binaries
which link to it for each library the keg references.
If `--cached` is passed, print the cached linkage values stored in
HOMEBREW_CACHE, set from a previous `brew linkage` run
* `man` [`--fail-if-changed`]:
Generate Homebrew's manpages.

View File

@ -795,7 +795,7 @@ Enter the interactive Homebrew Ruby shell\.
If \fB\-\-examples\fR is passed, several examples will be shown\. If \fB\-\-pry\fR is passed or HOMEBREW_PRY is set, pry will be used instead of irb\.
.
.TP
\fBlinkage\fR [\fB\-\-test\fR] [\fB\-\-reverse\fR] [\fB\-\-cached\fR] \fIformula\fR
\fBlinkage\fR [\fB\-\-test\fR] [\fB\-\-reverse\fR] \fIformula\fR
Checks the library links of an installed formula\.
.
.IP
@ -807,9 +807,6 @@ If \fB\-\-test\fR is passed, only display missing libraries and exit with a non\
.IP
If \fB\-\-reverse\fR is passed, print the dylib followed by the binaries which link to it for each library the keg references\.
.
.IP
If \fB\-\-cached\fR is passed, print the cached linkage values stored in HOMEBREW_CACHE, set from a previous \fBbrew linkage\fR run
.
.TP
\fBman\fR [\fB\-\-fail\-if\-changed\fR]
Generate Homebrew\'s manpages\.