Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
eab90dcb
Commit
eab90dcb
authored
11 years ago
by
Jack Nagel
Browse files
Options
Downloads
Patches
Plain Diff
Rewrite `brew reinstall`
Fixes Homebrew/homebrew#23928.
parent
d441d7b9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Library/Homebrew/cmd/install.rb
+4
-8
4 additions, 8 deletions
Library/Homebrew/cmd/install.rb
Library/Homebrew/cmd/reinstall.rb
+36
-32
36 additions, 32 deletions
Library/Homebrew/cmd/reinstall.rb
with
40 additions
and
40 deletions
Library/Homebrew/cmd/install.rb
+
4
−
8
View file @
eab90dcb
...
...
@@ -36,14 +36,9 @@ module Homebrew extend self
end
unless
ARGV
.
force?
perform_preinstall_checks
begin
ARGV
.
formulae
.
each
do
|
f
|
begin
install_formula
(
f
)
rescue
CannotInstallFormulaError
=>
e
ofail
e
.
message
end
end
ARGV
.
formulae
.
each
{
|
f
|
install_formula
(
f
)
}
rescue
FormulaUnavailableError
=>
e
ofail
e
.
message
require
'cmd/search'
...
...
@@ -124,6 +119,7 @@ module Homebrew extend self
# another formula. In that case, don't generate an error, just move on.
rescue
FormulaAlreadyInstalledError
=>
e
opoo
e
.
message
# Ignore CannotInstallFormulaError and let caller handle it.
rescue
CannotInstallFormulaError
=>
e
ofail
e
.
message
end
end
This diff is collapsed.
Click to expand it.
Library/Homebrew/cmd/reinstall.rb
+
36
−
32
View file @
eab90dcb
...
...
@@ -2,39 +2,43 @@ require 'cmd/install'
module
Homebrew
extend
self
def
reinstall
# At first save the named formulae and remove them from ARGV
named
=
ARGV
.
named
ARGV
.
delete_if
{
|
arg
|
named
.
include?
arg
}
clean_ARGV
=
ARGV
.
clone
# Add the used_options for each named formula separately so
# that the options apply to the right formula.
named
.
each
do
|
name
|
ARGV
.
replace
(
clean_ARGV
)
ARGV
<<
name
tab
=
Tab
.
for_name
(
name
)
tab
.
used_options
.
each
{
|
option
|
ARGV
<<
option
.
to_s
}
if
tab
.
built_as_bottle
and
not
tab
.
poured_from_bottle
ARGV
<<
'--build-bottle'
end
formula
=
Formulary
.
factory
(
name
)
begin
oh1
"Reinstalling
#{
name
}
#{
ARGV
.
options_only
*
' '
}
"
opt_link
=
formula
.
opt_prefix
if
opt_link
.
exist?
keg
=
Keg
.
new
(
opt_link
.
realpath
)
backup
keg
end
self
.
install_formula
formula
rescue
Exception
ignore_interrupts
{
restore_backup
(
keg
,
formula
)
}
raise
else
backup_path
(
keg
).
rmtree
if
backup_path
(
keg
).
exist?
end
ARGV
.
formulae
.
each
{
|
f
|
reinstall_formula
(
f
)
}
end
def
reinstall_formula
f
tab
=
Tab
.
for_formula
(
f
)
options
=
tab
.
used_options
|
f
.
build
.
used_options
notice
=
"Reinstalling
#{
f
.
name
}
"
notice
+=
" with
#{
options
*
", "
}
"
unless
options
.
empty?
oh1
notice
if
(
opt_link
=
f
.
opt_prefix
).
exist?
keg
=
Keg
.
new
(
opt_link
.
realpath
)
backup
keg
end
fi
=
FormulaInstaller
.
new
(
f
)
fi
.
options
=
options
fi
.
build_bottle
=
ARGV
.
build_bottle?
fi
.
build_bottle
||=
tab
.
built_as_bottle
&&
!
tab
.
poured_from_bottle
fi
.
build_from_source
=
ARGV
.
build_from_source?
fi
.
force_bottle
=
ARGV
.
force_bottle?
fi
.
verbose
=
ARGV
.
verbose?
fi
.
debug
=
ARGV
.
debug?
fi
.
prelude
fi
.
install
fi
.
caveats
fi
.
finish
rescue
FormulaInstallationAlreadyAttemptedError
# next
rescue
FormulaAlreadyInstalledError
=>
e
opoo
e
.
message
rescue
Exception
ignore_interrupts
{
restore_backup
(
keg
,
f
)
}
raise
else
backup_path
(
keg
).
rmtree
if
backup_path
(
keg
).
exist?
end
def
backup
keg
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment