45 Commits

Author SHA1 Message Date
Mike McQuaid
6f5c8b8509 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.
2018-06-29 19:57:39 +01:00
Mike McQuaid
05568420c0 linkage_checker: fix cache invalidation.
Rather than using the name of the keg for the key use the full path.
This provides several advantages:

- there's no need to invalidate the cache on a `brew upgrade` or
  `brew switch`
- it's easier to figure out what cache entries can be removed and this
  can be done whenever a keg is removed by `brew uninstall` or
  `brew cleanup`.

Also, ensure that an `install` (or `reinstall`, `upgrade`) always
results in the cache being rebuilt for that keg (in case different
options were used).
2018-06-06 13:30:45 +01:00
Gautham Goli
1caa0c0219 linkage: Fix brew linkage --reverse 2018-06-02 20:58:34 +05:30
Mike McQuaid
1a2c2f2e1b linkage_cache: cache input data and not results.
Cache all the non-weak dynamic library links for a keg rather than the
result of running `brew linkage`. This means that we correctly handle
changes to e.g. what non-keg files are present on disk.
2018-06-01 14:05:16 +01:00
Mike McQuaid
63aacd71d3 linkage_checker: fix bad instance variable usage. 2018-05-24 14:53:03 +01:00
Andrew R. McBurney
ddb7f06e9f Fixed rubocop offenses from brew style. 2018-05-22 12:54:54 -04:00
Mike McQuaid
44f5d3ec79 Refactor cache store code. 2018-05-22 14:46:14 +01:00
Andrew R. McBurney
010207b982 Changed cache usage behavior.
1. Running `brew linkage some_package` does not set the cache.
2. Running `brew linkage --cached some_package` when `DatabaseCache.empty?` returns `true` should build the cache.
3. Running `brew linkage --cached some_package` when `DatabaseCache.empty?` returns `false` should use the cache.
2018-05-21 17:36:30 -04:00
Andrew R. McBurney
d3120c0206 Use cache if HOMEBREW_LINKAGE_CACHE exists in formula_cellar_checks and formula. Make functions private in LinkageChecker. 2018-05-06 15:55:33 -04:00
Mike McQuaid
555e2a2fc8 Merge remote-tracking branch 'origin/master' into cache-optimization 2018-05-02 09:46:58 +01:00
Mike McQuaid
8f3ddf968f linkage_checker: correctly handle multiple taps.
Fix upgrades of formulae with the same name in multiple taps.

As reported in:
https://github.com/Homebrew/brew/pull/3789#issuecomment-384890624
2018-04-28 17:24:48 +01:00
AndrewMcBurney
a756af3b32 Fixed style issue offenses from brew style. 2018-04-25 10:27:03 -04:00
AndrewMcBurney
27e5d1aee5 Merge remote-tracking branch 'origin/master' into cache-optimization 2018-04-25 10:04:36 -04:00
Mike McQuaid
8035afcc36 linkage_checker: fix generic pathname calls. 2018-04-25 12:08:33 +01:00
Mike McQuaid
3454d6a961 runtime_deps: improve documentation and consistency. 2018-04-25 11:44:29 +01:00
Mike McQuaid
598bbd4c72
Merge branch 'master' into undeclared_runtime_dependencies 2018-04-25 10:41:43 +01:00
Mike McQuaid
c167614797 linkage_checker: handle missing formulae. 2018-04-25 10:26:02 +01:00
AndrewMcBurney
916247b920 Merge remote-tracking branch 'origin/master' into cache-optimization 2018-04-24 16:49:51 -04:00
Mike McQuaid
4a03145c1c linkage: fix --test exit code.
Ensure that a non-zero exit code is set both for missing random dylibs
and random missing dependencies.

Additionally, while we are here, drastically trim down the public
interface for this class to the bare minimum and allow getting the
output from `display_test_output` as a variable.

Fixes issue mentioned by @ilovezfs in:
https://github.com/Homebrew/brew/pull/3940#issuecomment-383794520
2018-04-24 09:52:51 +01:00
AndrewMcBurney
d5795d816a Added broken_deps to LinkageStore. 2018-04-09 14:01:42 -04:00
AndrewMcBurney
dcdd16237c Merge remote-tracking branch 'origin/master' into cache-optimization 2018-04-09 13:49:58 -04:00
Mike McQuaid
de82d3a945
Merge pull request #3940 from maxim-belkin/fix-undeclared
linkage_checker: fix detection of broken dependencies and missing libraries
2018-04-08 16:13:28 -07:00
Maxim Belkin
3484db71d0 fix missing_deps 2018-04-07 15:35:27 -05:00
Maxim Belkin
e15430c2cb fix if statement 2018-04-07 14:46:31 -05:00
Mike McQuaid
9fca172d03 Fix HOMEBREW_RUBY_WARNINGS="-w"
Fix various circular requirements, method redefinitions, etc.
2018-04-07 20:28:56 +01:00
Maxim Belkin
e4a1b16180 Being explicit about sorting keys first 2018-04-07 13:33:10 -05:00
Maxim Belkin
71fef1493d Use flat_map and other shortcuts 2018-04-07 13:28:15 -05:00
Maxim Belkin
d6e0b7d2bf use new syntax 2018-03-30 20:56:36 -05:00
Maxim Belkin
55620a736a
distinguish between broken_dylibs and broken_deps 2018-03-30 15:55:14 -05:00
Alyssa Ross
6bbc56c3a9
Merge branch 'master' into undeclared_runtime_dependencies 2018-03-30 12:39:13 +01:00
Mike McQuaid
42a39b16bf formula: use runtime_dependencies from tab.
Don't do so in `linkage_checker` or `tab` which to avoid recursive loops
and want the actual values specified in the formula itself.
2018-03-27 14:52:47 +01:00
Maxim Belkin
09eab0cc76
unrolling one-liner into two do/end blocks 2018-03-21 13:10:23 -05:00
Maxim Belkin
0513d9de5c
display_items: handle nil keys 2018-03-20 12:30:14 -05:00
Maxim Belkin
81042c63fb
dylib_to_dep: use Regexp 2018-03-20 10:06:52 -05:00
Maxim Belkin
1501354ee7 Fix brew style error and warning 2018-03-18 19:03:31 -05:00
Maxim Belkin
9642485e73 Missing libraries now report corresponding missing formulae 2018-03-18 18:52:12 -05:00
Maxim Belkin
8634f19107 linkage: consider missing links to Cellar 2018-03-18 17:40:52 -05:00
Maxim Belkin
2a6a2b2fa0 Fixes for linkage_checker
1. In "display_test_output": when printing dependencies without
linkage, use "Dependencies with no linkage" string instead of "Possible
unnecessary dependencies" for consistency with "display_normal_output"

2. In "check_dylibs": keep track of and skip repetitive checking of
those dylibs that have been previously checked. This is applicable when
different executables/libraries are linked against the same libraries.

3. In "check_undeclared_deps": when there are missing libraries,
corresponding dependencies should be excluded from the list of
dependencies with no linkage.
2018-03-17 00:49:04 -05:00
AndrewMcBurney
bc76a8afcb Changed default behavior of brew linkage command to build cache instead of using cached output. Cached output may be printed with --cached flag. 2018-03-14 16:36:56 -04:00
Alyssa Ross
6cd195723f
Merge branch 'master' into undeclared_runtime_dependencies 2018-03-12 09:22:39 +00:00
Alyssa Ross
0a2f0ab456
Fix formula/linkage_checker infinite recursion 2018-03-12 09:20:24 +00:00
AndrewMcBurney
8bd38d08cb Move linkage_cache_store.rb to ~/Library/Homebrew. 2018-03-06 12:07:57 -05:00
AndrewMcBurney
831fcfa5dd Merge remote-tracking branch 'origin/master' into cache-optimization 2018-03-06 11:46:23 -05:00
Shaun Jackman
4af8950f8b check_undeclared_deps: Fix for taps
undeclared_deps reported all dependencies in taps as undeclared.
2018-03-05 09:51:27 -08:00
Shaun Jackman
97932c1abf Move linkage_checker from os/mac to generic 2018-02-28 11:18:27 -08:00