Commit Graph

23 Commits

Author SHA1 Message Date
Robert Hensing
c071530ca5 testers.invalidateFetcherByDrvHash: Move from top-level 2022-05-05 12:08:50 +02:00
Naïm Favier
bf7d13dc4f
fetchpatch: add relative
Allows restricting patches to a specific subdirectory, à la
`git diff --relative=subdir`.

This cannot be done (cleanly) currently because the `includes` logic
happens *after* `stripLen` is applied, so we can't match on `subdir/*`.

This change adds a `relative` argument that makes this possible by
filtering files before doing any processing, and setting `stripLen` and
`extraPrefix` accordingly.
2022-03-25 01:00:36 +01:00
Robert Hensing
80672b6b87 fetchpatch: Fix typos 2022-03-15 19:11:10 +01:00
DavHau
ac728c1e96 fetchpatch: Clean up
Co-Authored-By: Ivar Scholten <ivar.scholten@protonmail.com>
2022-02-02 12:15:47 +01:00
DavHau
dfcc51def7 fetchpatch: allow empty hash
Previously, when sha256 either wasn't defined or set to an empty string
fetchpatch would error out as follows:

'''
warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
...
/nix/store/agwlk2bcfvz2ggrsbvwd7696qj55frbi-stdenv-linux/setup: line 96: /build/: Is a directory
sed: couldn't flush stdout: Broken pipe
'''

This patch makes it show fetchurl's error message instead:

'''
warning: found empty hash, assuming 'sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
...
error: hash mismatch in fixed-output derivation:
         specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
            got:    sha256-NWGWoyEgT/ztCwbhNgGPvG+nqX4bxtFnD+wds6fklbs=
'''

This is very convenient for TOFU.

Co-Authored-By: Ivar Scholten <ivar.scholten@protonmail.com>
2022-02-02 12:15:47 +01:00
Artturi
44403b728b
patchutils: add 0.4.2 variant + remove meta.executable + enable tests + fix inter-dependencies by wrapping (#141567) 2021-10-25 13:13:22 +03:00
Jan Tojnar
01e352ac44
fetchpatch: Allow using base64-encoded hash
Nix now returns base64-encoded SRI hashes on hash mismatch. Usually,
people copy the returned hashes in TOFU fashion but since base64-encoded
strings can contain slashes, they often broke our use of them for temporary file name.

Escaping them should prevent the failures.
2020-03-02 23:57:40 +01:00
Vladimír Čunát
e07c5ec107
fetchpatch: explain why we use 0.3.3 2019-05-12 15:16:45 +02:00
Bob van der Linden
9555fd73f3
fetchpatch: explicitly use patchutils 0.3.3 2019-04-13 23:20:33 +02:00
volth
caf2cae44b fetchpatch: patchutils -> buildPackages.patchutils 2018-08-21 17:21:25 -04:00
Timo Kaufmann
3058513941 fetchpatch: add option to revert a patch 2018-07-16 22:46:54 +02:00
Timo Kaufmann
8f9b985e60 fetchpatch: fail on empty patch
Since this is probably never the desired case and has led to actual
issues, see the comments at:

af1313e915

This might also happen when pulling a patch from GitHub or a similar web
interface without explicitly selecting the "raw" format.
2018-07-15 14:14:21 +02:00
Timo Kaufmann
1ddab0efb1 fetchpatch: escape excludes and includes
Excludes and includes are implemented by passing the parameters to the
respective flags of `filterdiff`. Those were passed unescaped until now.
Since those flags expect patterns (similar to shell globs), something
like `/some/path/*` might be used to exclude or include all files in
some path. Without escaping the shell would expand the `*`, leading to
unexpected behaviour.
2018-07-15 09:58:47 +02:00
John Ericson
aa6adfc324 fetchpatch: Add includes to compliment excludes, and require that both not be non-empty.
This commit was originally introduced as part of #41420 and then
reverted with the rest of that PR. However there was no reason to revert
his particular commit.
2018-07-15 09:56:41 +02:00
Peter Simons
6e07a3a19a
Revert "haskell generic-builder: Use strictDeps always" 2018-07-04 13:18:21 +02:00
John Ericson
57bb96d659 fetchpatch: Add includes to compliment excludes, and require that both not be non-empty. 2018-07-02 15:51:13 -04:00
John Ericson
9bd437d4b4 fetchpatch: Add support for an arbitrary extra prefix
We still ensure the old and new ones start, respectfully, with `a/` and
`b/`. Use with `stripLen` to ensure tha the old `a/` and `/b` are gone
if a new prefix is added.
2018-01-18 12:19:49 -05:00
Dan Peebles
dd8a42a224 fetchpatch: allow callers to specify postFetch sensibly
Before this fix, it seemed to be trying to merge our postFetch with the
patch normalization logic, but accidentally clobbering the whole thing
with the passed-in value.
2017-10-03 12:48:30 -04:00
Robin Gloster
100107a3cd fetchpatch: add excludes parameter 2017-07-26 13:32:59 +02:00
Franz Pletz
7e8b3adb04 fetchpatch: add addPrefixes argument
Sometimes patches start without a leading prefix. We default to strip
one prefix or path component from patches (-p1) in the patchPhase in
stdenv.

As all patches should therefore be in this format, fetchpatch should
have an option to normalize patch paths. This commit introduces a new
argument to fetchpatch called addPrefixes that adds one patch prefix to
the old and new paths in a patch before putting it into the store.
2016-07-29 12:03:08 +02:00
aszlig
d2df553da1
fetchpatch: Allow to pass a postFetch attribute.
Comes in handy if we want to make additional modificiations to the
output file. While I wasn't sure whether to invoke the passed postFetch
directly before the patch or afterwards, I thought it would be better
afterwards because "postFetch of fetchpatch" at least to my intuition
would sound that after whatever "fetchpatch" does - it comes afterwards.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2015-06-23 03:35:30 +02:00
Joel Taylor
8bfa1a2efc Patches for a lot of packages for GHC 7.10 2015-02-22 17:33:10 -08:00
Vladimír Čunát
137eae0b55 Merge #2630: add and use fetchpatch
fetchpatch is fetchurl that determinizes the patch.
Some parts of generated patches change from time to time, e.g. see #1983 and
http://comments.gmane.org/gmane.linux.distributions.nixos/12815
Using fetchpatch should prevent the hash from changing.

Conflicts (auto-solved):
	pkgs/development/libraries/haskell/gitit/default.nix
2014-05-17 07:31:03 +02:00