86 Commits

Author SHA1 Message Date
Markus Reiter
5cd8b609f7
Merge pull request #8350 from reitermarkus/doc-version
Refactor and document `Version`.
2020-08-26 09:09:18 +02:00
Markus Reiter
c53f362476 Refactor and document Version. 2020-08-26 03:17:39 +02:00
Markus Reiter
7e7e4c179b Document Resource. 2020-08-26 03:13:59 +02:00
Mike McQuaid
3a91c37e66
Fix RuboCop checks. 2020-08-19 17:12:32 +01:00
Markus Reiter
490e503b1b Replace Homebrew.args with Context. 2020-08-06 16:13:14 +02:00
Markus Reiter
bace9ecc34 Pass verbose? to Formula#verify_download_integrity. 2020-08-06 16:13:14 +02:00
Michka Popoff
1f8ebf5d20 resource: allow on_os blocks 2020-06-10 19:29:04 +02:00
Bo Anderson
2ba0bc809e resource: fix incorrect argument error for empty/non-existent target 2020-05-31 20:35:48 +01:00
Mike McQuaid
8e2718c74e
resource: tweak fetch_patches logic. 2020-05-14 09:20:58 +01:00
Jonathan Chang
2ffb87cb03 resource: fix patching when patch already fetched
This inappropriately modified the shared `patches` variable, meaning an
already fetched patch would be removed and therefore not be applied when
the resource was staged.
2020-05-14 17:09:52 +10:00
Mike McQuaid
a7475a2946
Split out prepare_patches and fetch_patches methods.
The new `fetch_patches` method wasn't exclusively fetching so shouldn't
have been skipped when it was.

Fixes #7558.
2020-05-13 11:49:17 +01:00
Mike McQuaid
6ed1ccd8e8
Fetch (all) resources when building from source
Also:
- when `brew test` or `brew postinstall` is run allow `Resource#stage`
  to fetch the resource.
- make `Formula#fetch` and `Resource#fetch` fetch external patches too.

Follow-up from #7549 and #7546.
2020-05-12 12:37:54 +01:00
Bo Anderson
58cecf38cf resource: restore fetch in stage
Fixes #7546.
2020-05-12 03:24:28 +01:00
Michelle Nguyen
2264c08cee
Fetch formula resources before unlinking during upgrade.
Fixes #6374.
2020-05-11 09:37:56 +01:00
Bo Anderson
43d6caf0e3 patch: add support for changing directory 2020-03-09 19:51:10 +00:00
Gautham Goli
acde828a45 ARGV: Replace ARGV.verbose? with Homebrew.args.verbose? 2020-02-02 14:00:04 +01:00
EricFromCanada
b817796562 Grammar fixes for status messages 2019-12-02 11:38:06 -05:00
Mike McQuaid
3cfb028e7f
Resource#fetch: verify downloads by default.
This API is used internally correctly and externally mostly correctly
but #6230 reveals the external usage is fairly confusing and a bit
unsafe by default. Preserve the existing API while verifying the
checksum by default and providing an opt-out. Using the existing, safe
method will result in a double verification of the checksum which is
harmless. A Homebrew/homebrew-core PR will follow shortly to address
those cases.

Fixes #6230
2019-06-15 17:22:45 +01:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
EricFromCanada
fa6404e0f5 grammar fixes 2019-04-13 21:29:32 -04:00
Mike McQuaid
d64429a736
rubocop: enable Style/IfUnlessModifier. 2019-02-21 12:55:49 +00:00
Kevin Abel
8fddd87472
Resource, CurlDownloadStrategy: Deduplicate the curl HEAD requests
Fixes #5357

* Eliminates getting a new strategy instance via Resource methods
* only call resolve_url_basename_time once and store the time result as
an instance variable for reuse
2018-12-16 13:56:58 -06:00
EricFromCanada
20167e5f1b Adjust comments to tidy API docs output. 2018-10-18 21:42:43 -04:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Markus Reiter
7c496f7a7e Explicitly pass specs to download strategy. 2018-08-02 10:33:14 +02:00
Markus Reiter
e367e7eea8 Explicitly pass url and mirrors to download strategy. 2018-08-02 10:09:35 +02:00
Markus Reiter
9ffc7dd465 Use Resource#downloader for BottleLoader. 2018-08-01 05:40:15 +02:00
Markus Reiter
3d27b2aa8d Explicitly pass version to download strategy. 2018-08-01 05:40:15 +02:00
Mike McQuaid
256dfc1af9 Move methods from FileUtils to Formula
These don't need to live on FileUtils and don't really make sense there
either.
2018-07-14 18:13:23 +01:00
Mike McQuaid
abf3043125 formula: move mktemp.
This should be an instance rather than a class method.
2018-07-14 15:41:16 +01:00
Mike McQuaid
0a76c9f02e mktemp: move to Formula and compat.
Move this method away from FileUtils as it doesn't need to be on that
class.
2018-07-13 14:42:49 +01:00
Markus Reiter
5e3bc85527 Remove unnecessary Pathname check. 2018-07-05 11:54:32 +02:00
Mike McQuaid
c101a82c5b
Revert "Fix SVN downloads of versioned formula by munging directory names" 2018-06-26 07:10:36 +01:00
Andrew Janke
b72c4e3248 Fix SVN downloads of versioned formula by munging directory names 2018-06-25 03:21:36 -04:00
ilovezfs
7c07ec5fc1 resource: allow patches to be applied 2018-01-22 01:10:14 -08:00
Markus Reiter
3b4ee58c49 Refactor using Forwardable and DelegateClass. 2017-06-28 09:25:31 +02:00
Misty De Meo
4e3d23ad14 Resource: set version to nil if version is null
Is this the right fix? This fixes version cascading from the parent.
2016-11-10 15:09:36 -08:00
Vlad Shablinsky
8a968a0b60
resource: detect HEAD versions 2016-07-16 20:39:13 +08:00
ilovezfs
21ca138edf Resource.unpack: install invisible files and dirs
Since patches sometimes change .gitignore and .travis.yml, it's
desirable to install them along with everything else if a resource needs
patching. Also, for resources that are git respositories, this allows
install to interact with git objects other than the commit specifically
checked out. More generally, this may help to avoid subtle issues by
preserving the fidelity of resources in cases where invisible dot files
play a functional role.

Closes #329.

Signed-off-by: ilovezfs <ilovezfs@icloud.com>
2016-06-07 12:16:43 -07:00
Andrew Janke
258a764f67 stage: fix block signature back-compatibility under Ruby 1.8.7
The new stage() signature introduced by #66 breaks back-compatibility
under Ruby 1.8.7. This fixes it by switching back to a one-argument
block signature and using a new class to wrap both the Resource and
Mktemp info for the staging context, in a signature-back-compatible
way.

Addresses homebrew/homebrew-core#529.

Closes #135.

Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-04-22 21:49:00 -04:00
Andrew Janke
acc9a7ca85 brew test, install, update-test: add --keep-tmp option
Also enables sandbox for --interactive and --debug use of install
and test, using automatic retention.

Closes #66.

Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-04-18 12:23:08 -04: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
Xu Cheng
6c8c56a689 build: store source modified time in tabfile 2016-01-15 16:26:04 +08:00
Xu Cheng
b121e5fd7b more core file style updated by rubocop 2015-08-06 17:23:56 +08: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
Dominyk Tiller
12861686b8 checksums: switch to sha256 for bottles and new formulae
Closes Homebrew/homebrew#37164.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-03-05 14:45:39 +00:00
Jack Nagel
7a49c143e4 Use attr_accessor for checksum 2015-01-12 00:37:24 -05:00
Jack Nagel
0f01e9ff43 Remove the direct url writer from Resource 2015-01-08 14:18:41 -05:00
Jack Nagel
b459f953c4 Stop caching the downloader on the resource instance 2015-01-06 00:25:04 -05:00
Jack Nagel
62c0a391b4 Don't attempt to detect version if URL is not set 2014-12-31 10:38:04 -05:00