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
7c500208
Commit
7c500208
authored
13 years ago
by
Adam Vandenberg
Browse files
Options
Downloads
Patches
Plain Diff
Use Patches
parent
f6052e8c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Library/Homebrew/formula.rb
+9
-57
9 additions, 57 deletions
Library/Homebrew/formula.rb
with
9 additions
and
57 deletions
Library/Homebrew/formula.rb
+
9
−
57
View file @
7c500208
...
...
@@ -4,7 +4,7 @@ require 'formula_support'
require
'hardware'
require
'bottles'
require
'extend/fileutils'
require
'patches'
# Derive and define at least @url, see Library/Formula for examples
class
Formula
...
...
@@ -521,71 +521,23 @@ private
end
def
patch
# Only call `patches` once.
# If there is code in `patches`, which is not recommended, we only
# want to run that code once.
the_patches
=
patches
return
if
the_patches
.
nil?
if
not
the_patches
.
kind_of?
Hash
# We assume -p1
patch_defns
=
{
:p1
=>
the_patches
}
else
patch_defns
=
the_patches
end
patch_list
=
[]
n
=
0
patch_defns
.
each
do
|
arg
,
urls
|
# DATA.each does each line, which doesn't work so great
urls
=
[
urls
]
unless
urls
.
kind_of?
Array
urls
.
each
do
|
url
|
p
=
{
:filename
=>
'%03d-homebrew.diff'
%
n
+=
1
,
:compression
=>
false
}
if
defined?
DATA
and
url
==
DATA
pn
=
Pathname
.
new
p
[
:filename
]
pn
.
write
(
DATA
.
read
.
to_s
.
gsub
(
"HOMEBREW_PREFIX"
,
HOMEBREW_PREFIX
))
elsif
url
=~
%r[^
\w
+
\:
//]
out_fn
=
p
[
:filename
]
case
url
when
/\.gz$/
p
[
:compression
]
=
:gzip
out_fn
+=
'.gz'
when
/\.bz2$/
p
[
:compression
]
=
:bzip2
out_fn
+=
'.bz2'
end
p
[
:curl_args
]
=
[
url
,
'-o'
,
out_fn
]
else
# it's a file on the local filesystem
p
[
:filename
]
=
url
end
p
[
:args
]
=
[
"-
#{
arg
}
"
,
'-i'
,
p
[
:filename
]]
patch_list
<<
p
end
end
patch_list
=
Patches
.
new
(
patches
)
return
if
patch_list
.
empty?
external_patches
=
patch_list
.
collect
{
|
p
|
p
[
:curl_args
]}.
select
{
|
p
|
p
}.
flatten
unless
external_patches
.
empty?
unless
patch_list
.
external_curl_args
.
empty?
ohai
"Downloading patches"
# downloading all at once is much more efficient, especially for FTP
curl
(
*
external_
patche
s
)
curl
(
*
patch_list
.
external_
curl_arg
s
)
end
ohai
"Patching"
patch_list
.
each
do
|
p
|
case
p
[
:
compression
]
when
:gzip
then
safe_system
"/usr/bin/gunzip"
,
p
[
:
filename
]
+
'.gz'
when
:bzip2
then
safe_system
"/usr/bin/bunzip2"
,
p
[
:filename
]
+
'.bz2'
case
p
.
compression
when
:gzip
then
safe_system
"/usr/bin/gunzip"
,
p
.
download_
filename
when
:bzip2
then
safe_system
"/usr/bin/bunzip2"
,
p
.
download_filename
end
# -f means it doesn't prompt the user if there are errors, if just
# exits with non-zero status
safe_system
'/usr/bin/patch'
,
'-f'
,
*
(
p
[
:args
])
# -f means don't prompt the user if there are errors; just exit with non-zero status
safe_system
'/usr/bin/patch'
,
'-f'
,
*
(
p
.
patch_args
)
end
end
...
...
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