summaryrefslogtreecommitdiff
path: root/pkgs/build-support/fetchpatch (follow)
Commit message (Expand)AuthorAgeFilesLines
* fetchpatch: add tests for hunksMorgan Jones2025-10-121-5/+21
* fetchpatch: support `hunks` option•••We can pick individual hunks or ranges of hunks with filterdiff, so expose that in fetchpatch. This was originally useful for openssh, since the first hunks always look like this (that is, only differing in the date): ``` @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.616 2025/08/29 03:50:38 djm Exp $ */ +/* $OpenBSD: ssh.c,v 1.617 2025/09/04 00:29:09 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland ``` The usage looks something like this to skip the first hunk in the patch. Numbers work too, if you'd like to only pick out specific hunks. ``` fetchpatch { name = "my-patch"; url = "..."; hunks = [ "2-" ]; hash = "..."; } ``` Morgan Jones2025-10-121-0/+6
* pkgs: remove optional builtins prefixes from prelude functions•••Remove optional builtins prefixes from prelude functions by running: builtins=( abort baseNameOf break derivation derivationStrict dirOf false fetchGit fetchMercurial fetchTarball fetchTree fromTOML import isNull map null placeholder removeAttrs scopedImport throw toString true ) fd \ --type file \ . \ pkgs \ --exec-batch sed --in-place --regexp-extended " s/\<builtins\.($( printf '%s\n' "${builtins[@]}" | paste --delimiter '|' --serial - ))\>/\1/g " nix fmt NAHO2025-10-041-3/+3
* treewide: run nixfmt 1.0.0Wolfgang Walther2025-07-241-57/+56
* fetchpatch: add support for patches to files with apostrophes•••We're feeding a list of files from `lsdiff` to `filterdiff` via `xargs`. That list is newline separated, and looks something like this: ``` $ lsdiff <(curl -s https://github.com/jfly/annoying-filenames/commit/1e86a219f5fc9c4137b409bc9c38036f3922724b.patch) a/README.md b/files/The Answer to the Ultimate Question of Life, The Universe, and Everything.txt ``` However, if the list contains files with apostrophes in it, xargs freaks out: ``` $ echo "there's an apostrophe here" | xargs -I{} python -c "import sys; print(sys.argv)" {} xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option ``` The fix is simple, just explicitly specify a delimiter: ``` $ echo "there's an apostrophe here" | xargs -I{} --delimiter='\n' python -c "import sys; print(sys.argv)" {} ['-c', "there's an apostrophe here"] ``` I added 2 tests here: - `nix-build -A pkgs.tests.fetchpatch.fileWithApostrophe` fails without the code change. - `nix-build -A pkgs.tests.fetchpatch.fileWithSpace` passes both before and after this change, but I wanted to add it to prove that I didn't break anything. Jeremy Fleischman2025-05-232-1/+19
* treewide: format all inactive Nix files•••After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \ --argstr baseRev b32a0943687d2a5094a6d92f25a4b6e16a76b5b7 result/bin/apply-formatting $NIXPKGS_PATH Silvan Mosberger2024-12-102-81/+123
* fetchpatch: add patchutils to nativeBuildInputs•••This change allows using programs from patchutils in postFetch. Ivan Trubach2024-07-011-5/+7
* fetchpatch2: fix hash in testsIvan Trubach2024-07-011-1/+1
* fetchpatch: add decode testArtturin2023-03-111-0/+7
* fetchpatch: add "decode" argument for gerrit•••(and gitiles) This allows fetching a patch from servers that return them base64-encoded, like this: fetchpatch { name = "gcc.patch"; url = "https://chromium.googlesource.com/aosp/platform/external/libchrome/+/f37ae3b1a873d74182a2ac31d96742ead9c1f523^!?format=TEXT"; decode = "base64 -d"; sha256 = "11j1bqz2p8xrfzgfrylgdvmqs45489c4ckl7l0ra1dpfgbqy94a8"; } Alyssa Ross2023-03-111-1/+14
* treewide: use optionalStringFelix Buehler2023-02-131-1/+1
* fetchpatch2: init•••allows us to use the new features of patchutils without having to reset all fetchpatch hashes in nixpkgs https://github.com/NixOS/nixpkgs/issues/32084 Artturin2022-07-202-8/+9
* testers.invalidateFetcherByDrvHash: Move from top-levelRobert Hensing2022-05-051-4/+4
* 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. Naïm Favier2022-03-252-15/+46
* fetchpatch: Fix typosRobert Hensing2022-03-151-2/+2
* fetchpatch: Clean up•••Co-Authored-By: Ivar Scholten <ivar.scholten@protonmail.com> DavHau2022-02-021-2/+13
* 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> DavHau2022-02-021-5/+1
* patchutils: add 0.4.2 variant + remove meta.executable + enable tests + fix i...Artturi2021-10-251-0/+8
* 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. Jan Tojnar2020-03-021-1/+5
* fetchpatch: explain why we use 0.3.3Vladimír Čunát2019-05-121-0/+1
* fetchpatch: explicitly use patchutils 0.3.3Bob van der Linden2019-04-131-4/+7
* fetchpatch: patchutils -> buildPackages.patchutilsvolth2018-08-211-5/+5
* fetchpatch: add option to revert a patchTimo Kaufmann2018-07-161-4/+7
* fetchpatch: fail on empty patch•••Since this is probably never the desired case and has led to actual issues, see the comments at: https://github.com/NixOS/nixpkgs/commit/af1313e91552e42a4419b396b3026319c60fc17f This might also happen when pulling a patch from GitHub or a similar web interface without explicitly selecting the "raw" format. Timo Kaufmann2018-07-151-0/+18
* 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. Timo Kaufmann2018-07-151-2/+2
* fetchpatch: Add includes to compliment excludes, and require that both not be...•••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. John Ericson2018-07-151-2/+4
* Revert "haskell generic-builder: Use strictDeps always"Peter Simons2018-07-041-4/+2
* fetchpatch: Add includes to compliment excludes, and require that both not be...John Ericson2018-07-021-2/+4
* 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. John Ericson2018-01-181-5/+5
* 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.Dan Peebles2017-10-031-1/+1
* fetchpatch: add excludes parameterRobin Gloster2017-07-261-3/+6
* 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. Franz Pletz2016-07-291-3/+7
* 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> aszlig2015-06-231-0/+1
* Patches for a lot of packages for GHC 7.10Joel Taylor2015-02-221-1/+1
* 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 Vladimír Čunát2014-05-171-0/+22