36 Commits

Author SHA1 Message Date
Mike McQuaid
4ab0a18c8f patch: improve nil strip message.
As reported https://github.com/Homebrew/brew/pull/4037#issuecomment-379591755.
2018-04-08 16:48:50 -07:00
ilovezfs
7c07ec5fc1 resource: allow patches to be applied 2018-01-22 01:10:14 -08:00
Shaun Jackman
e32299e652 patch: Use patch found in the PATH 2017-11-19 13:54:46 -08:00
Markus Reiter
9bee9ca575 Use “squiggly” heredocs. 2017-10-18 14:39:09 +02:00
Markus Reiter
175ca909ee Clean up code style and remove .rubocop_todo.yml. 2017-10-08 16:10:37 +02:00
Mike McQuaid
021cef4b2b Autocorrect Rubocop Style/SpecialGlobalVars. 2017-06-12 09:11:42 +01:00
Alyssa Ross
b01a9b0695 patch: clean up with Forwardable 2017-05-22 20:39:17 +01:00
Markus Reiter
58e36c7319 Fix Style/GuardClause. 2016-09-24 12:24:35 +02:00
Markus Reiter
52ff988530 Fix RuboCop CaseEquality. 2016-09-23 15:30:06 +02:00
Mike McQuaid
3982950e61 rubocop --auto-correct all hash-rocket usage. 2016-09-17 16:14:13 +01:00
Mike McQuaid
6693915399 rubocop --auto-correct all remaining files.
But remove some manual `.freeze`s on constants that shouldn't be
constants.
2016-09-17 16:14:13 +01:00
Misty De Meo
1ed7108052 Array#count alias didn't always exist
Fixes mistydemeo/tigerbrew#408.
2016-02-06 14:20:56 -08:00
ilovezfs
cc3d041c26 DSL method "apply" to specify patch files
The "apply" DSL method can be called from patch-do blocks to specify
the paths within an archive of the desired patch files, which will be
applied in the order in which they were supplied to the "apply" calls.
If "apply" isn't used, raise an error whenever the extracted directory
doesn't contain exactly one file.

The "apply" method can be called zero or more times within a patch-do
block with the following syntaxes supported:

    apply "single_apply"
    apply "multiple_apply_1", "multiple_apply_2"
    apply [array_of_apply]

If apply must be used, a single call using the second syntax above is
usually best practice. Each apply leaf should be the relative path to a
specific patch file in the extracted directory.

For example, if extracting this-v123-patches.tar.gz gives you

    this-123
    this-123/.DS_Store
    this-123/LICENSE.txt
    this-123/patches
    this-123/patches/A.diff
    this-123/patches/B.diff
    this-123/patches/C.diff
    this-123/README.txt

and you want to apply only B.diff and C.diff, then you need to use
"patches/B.diff" and "patches/C.diff" for the lowest-level apply leaves.

The code was provided by Xu Cheng. Any mistakes are mine.
2016-02-01 18:37:36 +00:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Jack Nagel
0f01e9ff43 Remove the direct url writer from Resource 2015-01-08 14:18:41 -05:00
Jack Nagel
d2d7516cc0 Allow debugging patching failures
Closes Homebrew/homebrew#33056.
2014-12-26 19:42:11 -05:00
Jack Nagel
5575fb843c Don't raise NotImplementedError 2014-12-23 01:04:44 -05:00
Jack Nagel
56dd575f96 Pass command and arg list into ErrorDuringExecution constructor 2014-09-18 20:32:50 -05:00
Jack Nagel
a55e196f5f Simplify internal representation of patches
- remove support for IO objects, since we no longer access ::DATA
   directly
 - since we don't need to support IO objects, use a separate class for
   string patches and stop wrapping strings in StringIO ojects
2014-07-29 16:22:06 -05:00
Jack Nagel
3f12ddbccd Decouple DATA patches from the executing script 2014-07-29 16:22:06 -05:00
Jack Nagel
8df8f437f0 Make Patch a module since it only has singleton methods 2014-07-28 16:23:42 -05:00
Jack Nagel
90f69372ce Remove inheritance patch classes 2014-07-28 16:23:42 -05:00
Jack Nagel
126d2133ab Fix method signature 2014-07-10 12:42:54 -05:00
Jack Nagel
2b9cfe9fa5 Legacy patches are never StringIOs 2014-07-10 12:42:54 -05:00
Jack Nagel
fbefa76ce2 Always use class.name to build inspect strings 2014-07-01 18:39:15 -05:00
Jack Nagel
e0c1f5aef6 Remove redundant method
This already happens in the superclass.
2014-03-18 14:46:43 -05:00
Jack Nagel
7af46a5ed0 Always use CurlDownloadStrategy for legacy patches
Fixes Homebrew/homebrew#27671.
2014-03-18 14:24:32 -05:00
Jack Nagel
c84c8b1d0e Set patch name on initialization 2014-03-15 22:40:14 -05:00
Jack Nagel
251bd707a2 Remove use of Forwardable from ExternalPatch 2014-03-14 16:16:53 -05:00
Jack Nagel
72e0d9806b Ensure patch cache path is unique even when checksum is missing 2014-03-14 12:38:06 -05:00
Jack Nagel
c91c2c10d8 Add inspect methods to patch classes 2014-03-13 21:35:41 -05:00
Jack Nagel
a5a78ce3c6 Drop version from cached patch filenames 2014-03-13 21:35:41 -05:00
Jack Nagel
4f051abc3e Teach audit about new patches implementation 2014-03-13 21:35:41 -05:00
Jack Nagel
86cdd812a2 Teach fetch to download patches 2014-03-13 21:35:41 -05:00
Jack Nagel
665b14c4a4 Enable new patch implementation with compatibility layer 2014-03-13 21:35:41 -05:00
Jack Nagel
bc6e4a1894 New patch implementation and DSL
This commit introduces a new patch implementation that supports
checksums and caching.

Patches are declared in blocks:

  patch do
    url ...
    sha1 ...
  end

A strip level of -p1 is assumed. It can be overridden using a symbol
argument:

  patch :p0 do
    url ...
    sha1 ...
  end

Patches can be declared in stable, devel, and head blocks. This form is
preferred over using conditionals.

  stable do
    # ...

    patch do
      url ...
      sha1 ...
    end
  end

Embedded (__END__) patches are declared like so:

  patch :DATA
  patch :p0, :DATA

Patches can also be embedded by passing a string. This makes it possible
to provide multiple embedded patches while making only some of them
conditional.

  patch :p0, "..."
2014-03-13 21:35:41 -05:00