keg: further tweak directory constants.
- ensure that `HOMEBREW_CELLAR` is always created on `install`. - remove the need for a special `PRUNEABLE_DIRECTORIES` variable - reuse values from existing variables and get `uniq`s.
This commit is contained in:
parent
d4f8335f0a
commit
9a698d2130
@ -26,7 +26,7 @@ before_install:
|
|||||||
sudo chown -R "$USER" "$HOMEBREW_REPOSITORY";
|
sudo chown -R "$USER" "$HOMEBREW_REPOSITORY";
|
||||||
else
|
else
|
||||||
LINUX="1";
|
LINUX="1";
|
||||||
export PATH="$PWD/bin:$PATH";
|
export PATH="$PWD/bin:/usr/bin:/bin";
|
||||||
fi
|
fi
|
||||||
# umask 022 fixes Linux `brew tests` failures;
|
# umask 022 fixes Linux `brew tests` failures;
|
||||||
- if [ "$LINUX" ]; then
|
- if [ "$LINUX" ]; then
|
||||||
|
|||||||
@ -293,7 +293,6 @@ module Homebrew
|
|||||||
def rm_ds_store(dirs = nil)
|
def rm_ds_store(dirs = nil)
|
||||||
dirs ||= begin
|
dirs ||= begin
|
||||||
Keg::MUST_EXIST_DIRECTORIES + [
|
Keg::MUST_EXIST_DIRECTORIES + [
|
||||||
HOMEBREW_CELLAR,
|
|
||||||
HOMEBREW_PREFIX/"Caskroom",
|
HOMEBREW_PREFIX/"Caskroom",
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|||||||
@ -15,7 +15,7 @@ module Homebrew
|
|||||||
|
|
||||||
dirs = []
|
dirs = []
|
||||||
|
|
||||||
Keg::PRUNEABLE_DIRECTORIES.each do |dir|
|
Keg::MUST_EXIST_SUBDIRECTORIES.each do |dir|
|
||||||
next unless dir.directory?
|
next unless dir.directory?
|
||||||
|
|
||||||
dir.find do |path|
|
dir.find do |path|
|
||||||
@ -32,8 +32,7 @@ module Homebrew
|
|||||||
path.unlink
|
path.unlink
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elsif path.directory? && !Keg::PRUNEABLE_DIRECTORIES.include?(path) &&
|
elsif path.directory? && !Keg::MUST_EXIST_SUBDIRECTORIES.include?(path)
|
||||||
!Keg::MUST_BE_WRITABLE_DIRECTORIES.include?(path)
|
|
||||||
dirs << path
|
dirs << path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -276,7 +276,7 @@ module Homebrew
|
|||||||
def check_for_broken_symlinks
|
def check_for_broken_symlinks
|
||||||
broken_symlinks = []
|
broken_symlinks = []
|
||||||
|
|
||||||
Keg::PRUNEABLE_DIRECTORIES.each do |d|
|
Keg::MUST_EXIST_SUBDIRECTORIES.each do |d|
|
||||||
next unless d.directory?
|
next unless d.directory?
|
||||||
|
|
||||||
d.find do |path|
|
d.find do |path|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def attempt_directory_creation
|
def attempt_directory_creation
|
||||||
Keg::MUST_BE_WRITABLE_DIRECTORIES.each do |dir|
|
Keg::MUST_EXIST_DIRECTORIES.each do |dir|
|
||||||
begin
|
begin
|
||||||
FileUtils.mkdir_p(dir) unless dir.exist?
|
FileUtils.mkdir_p(dir) unless dir.exist?
|
||||||
rescue
|
rescue
|
||||||
|
|||||||
@ -70,27 +70,27 @@ class Keg
|
|||||||
].freeze
|
].freeze
|
||||||
# TODO: remove when brew-test-bot no longer uses this
|
# TODO: remove when brew-test-bot no longer uses this
|
||||||
TOP_LEVEL_DIRECTORIES = KEG_LINK_DIRECTORIES
|
TOP_LEVEL_DIRECTORIES = KEG_LINK_DIRECTORIES
|
||||||
PRUNEABLE_DIRECTORIES = (
|
MUST_EXIST_SUBDIRECTORIES = (
|
||||||
KEG_LINK_DIRECTORIES - %w[var] + %w[var/homebrew/linked]
|
KEG_LINK_DIRECTORIES - %w[var] + %w[
|
||||||
).map { |dir| HOMEBREW_PREFIX/dir }
|
opt
|
||||||
|
var/homebrew/linked
|
||||||
|
]
|
||||||
|
).map { |dir| HOMEBREW_PREFIX/dir }.uniq.sort.freeze
|
||||||
|
|
||||||
# Keep relatively in sync with
|
# Keep relatively in sync with
|
||||||
# https://github.com/Homebrew/install/blob/master/install
|
# https://github.com/Homebrew/install/blob/master/install
|
||||||
MUST_EXIST_DIRECTORIES = (
|
MUST_EXIST_DIRECTORIES = MUST_EXIST_SUBDIRECTORIES + [
|
||||||
(KEG_LINK_DIRECTORIES + %w[
|
HOMEBREW_CELLAR,
|
||||||
opt
|
].uniq.sort.freeze
|
||||||
]).map { |dir| HOMEBREW_PREFIX/dir }
|
|
||||||
).freeze
|
|
||||||
MUST_BE_WRITABLE_DIRECTORIES = (
|
MUST_BE_WRITABLE_DIRECTORIES = (
|
||||||
(KEG_LINK_DIRECTORIES + %w[
|
%w[
|
||||||
opt
|
|
||||||
etc/bash_completion.d lib/pkgconfig
|
etc/bash_completion.d lib/pkgconfig
|
||||||
share/aclocal share/doc share/info share/locale share/man
|
share/aclocal share/doc share/info share/locale share/man
|
||||||
share/man/man1 share/man/man2 share/man/man3 share/man/man4
|
share/man/man1 share/man/man2 share/man/man3 share/man/man4
|
||||||
share/man/man5 share/man/man6 share/man/man7 share/man/man8
|
share/man/man5 share/man/man6 share/man/man7 share/man/man8
|
||||||
share/zsh share/zsh/site-functions
|
share/zsh share/zsh/site-functions
|
||||||
var/log
|
var/log
|
||||||
]).map { |dir| HOMEBREW_PREFIX/dir } + [
|
].map { |dir| HOMEBREW_PREFIX/dir } + MUST_EXIST_SUBDIRECTORIES + [
|
||||||
HOMEBREW_CACHE,
|
HOMEBREW_CACHE,
|
||||||
HOMEBREW_CELLAR,
|
HOMEBREW_CELLAR,
|
||||||
HOMEBREW_LOCKS,
|
HOMEBREW_LOCKS,
|
||||||
@ -98,7 +98,7 @@ class Keg
|
|||||||
HOMEBREW_REPOSITORY,
|
HOMEBREW_REPOSITORY,
|
||||||
Language::Python.homebrew_site_packages,
|
Language::Python.homebrew_site_packages,
|
||||||
]
|
]
|
||||||
).freeze
|
).uniq.sort.freeze
|
||||||
|
|
||||||
# These paths relative to the keg's share directory should always be real
|
# These paths relative to the keg's share directory should always be real
|
||||||
# directories in the prefix, never symlinks.
|
# directories in the prefix, never symlinks.
|
||||||
|
|||||||
@ -142,9 +142,10 @@ RSpec.configure do |config|
|
|||||||
|
|
||||||
FileUtils.rm_rf [
|
FileUtils.rm_rf [
|
||||||
TEST_DIRECTORIES.map(&:children),
|
TEST_DIRECTORIES.map(&:children),
|
||||||
*Keg::MUST_EXIST_DIRECTORIES,
|
*Keg::MUST_EXIST_SUBDIRECTORIES,
|
||||||
HOMEBREW_LINKED_KEGS,
|
HOMEBREW_LINKED_KEGS,
|
||||||
HOMEBREW_PINNED_KEGS,
|
HOMEBREW_PINNED_KEGS,
|
||||||
|
HOMEBREW_PREFIX/"var",
|
||||||
HOMEBREW_PREFIX/"Caskroom",
|
HOMEBREW_PREFIX/"Caskroom",
|
||||||
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-cask",
|
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-cask",
|
||||||
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-bar",
|
HOMEBREW_LIBRARY/"Taps/homebrew/homebrew-bar",
|
||||||
|
|||||||
@ -4,10 +4,10 @@ jobs:
|
|||||||
vmImage: xcode9-macos10.13
|
vmImage: xcode9-macos10.13
|
||||||
steps:
|
steps:
|
||||||
- bash: |
|
- bash: |
|
||||||
HOMEBREW_REPOSITORY="$(brew --repo)";
|
HOMEBREW_REPOSITORY="$(brew --repo)"
|
||||||
mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library";
|
mv "$HOMEBREW_REPOSITORY/Library/Taps" "$PWD/Library"
|
||||||
sudo rm -rf "$HOMEBREW_REPOSITORY";
|
sudo rm -rf "$HOMEBREW_REPOSITORY"
|
||||||
sudo ln -s "$PWD" "$HOMEBREW_REPOSITORY";
|
sudo ln -s "$PWD" "$HOMEBREW_REPOSITORY"
|
||||||
brew update-reset Library/Taps/homebrew/homebrew-core
|
brew update-reset Library/Taps/homebrew/homebrew-core
|
||||||
brew test-bot --coverage
|
brew test-bot --coverage
|
||||||
displayName: Run brew test-bot
|
displayName: Run brew test-bot
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user