<feed xmlns='http://www.w3.org/2005/Atom'>
<title>nixos/nixpkgs.git/pkgs/build-support/fetchpatch, branch master</title>
<subtitle>Nix Packages collection</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/'/>
<entry>
<title>fetchpatch2: use --full-index patches in tests</title>
<updated>2026-05-16T14:11:32+00:00</updated>
<author>
<name>networkException</name>
<email>git@nwex.de</email>
</author>
<published>2026-05-16T14:11:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=ed552f910152c635c94add4d5ca6a419080908bf'/>
<id>ed552f910152c635c94add4d5ca6a419080908bf</id>
<content type='text'>
This patch fixes fetchpatch2 tests collecting hash mismatches
over time due to commit hashes getting longer as repositories
grow by using --full-index patches where possible.

See #257446
See 32b51c33521a297b4a7d9015f49fdf52db18e467
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch fixes fetchpatch2 tests collecting hash mismatches
over time due to commit hashes getting longer as repositories
grow by using --full-index patches where possible.

See #257446
See 32b51c33521a297b4a7d9015f49fdf52db18e467
</pre>
</div>
</content>
</entry>
<entry>
<title>fetchpatch: add tests for hunks</title>
<updated>2025-10-13T06:23:57+00:00</updated>
<author>
<name>Morgan Jones</name>
<email>me@numin.it</email>
</author>
<published>2025-10-13T06:23:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=03ff9b06537b95477d8cfb9a2cff00c10809ab27'/>
<id>03ff9b06537b95477d8cfb9a2cff00c10809ab27</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fetchpatch: support `hunks` option</title>
<updated>2025-10-13T06:00:17+00:00</updated>
<author>
<name>Morgan Jones</name>
<email>me@numin.it</email>
</author>
<published>2025-10-09T07:50:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=77e773dbc6c45c0678d1c5c588a071a30add51bf'/>
<id>77e773dbc6c45c0678d1c5c588a071a30add51bf</id>
<content type='text'>
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 &lt;ylo@cs.hut.fi&gt;
  * Copyright (c) 1995 Tatu Ylonen &lt;ylo@cs.hut.fi&gt;, 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 = "...";
}
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;ylo@cs.hut.fi&gt;
  * Copyright (c) 1995 Tatu Ylonen &lt;ylo@cs.hut.fi&gt;, 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 = "...";
}
```
</pre>
</div>
</content>
</entry>
<entry>
<title>pkgs: remove optional builtins prefixes from prelude functions</title>
<updated>2025-10-04T17:02:37+00:00</updated>
<author>
<name>NAHO</name>
<email>90870942+trueNAHO@users.noreply.github.com</email>
</author>
<published>2025-09-30T06:49:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=c8d4dabc4357a22d1c249a9363998bdb00122544'/>
<id>c8d4dabc4357a22d1c249a9363998bdb00122544</id>
<content type='text'>
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/\&lt;builtins\.($(
          printf '%s\n' "${builtins[@]}" |
            paste --delimiter '|' --serial -
        ))\&gt;/\1/g
      "

    nix fmt
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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/\&lt;builtins\.($(
          printf '%s\n' "${builtins[@]}" |
            paste --delimiter '|' --serial -
        ))\&gt;/\1/g
      "

    nix fmt
</pre>
</div>
</content>
</entry>
<entry>
<title>treewide: run nixfmt 1.0.0</title>
<updated>2025-07-24T11:55:40+00:00</updated>
<author>
<name>Wolfgang Walther</name>
<email>walther@technowledgy.de</email>
</author>
<published>2025-07-22T13:19:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=5a0711127cd8b916c3d3128f473388c8c79df0da'/>
<id>5a0711127cd8b916c3d3128f473388c8c79df0da</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fetchpatch: add support for patches to files with apostrophes</title>
<updated>2025-05-23T21:32:28+00:00</updated>
<author>
<name>Jeremy Fleischman</name>
<email>jeremyfleischman@gmail.com</email>
</author>
<published>2025-05-23T21:15:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=1d32087125a9bb3e700b206ceb6eea28fdf07716'/>
<id>1d32087125a9bb3e700b206ceb6eea28fdf07716</id>
<content type='text'>
We're feeding a list of files from `lsdiff` to `filterdiff` via `xargs`.
That list is newline separated, and looks something like this:

```
$ lsdiff &lt;(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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We're feeding a list of files from `lsdiff` to `filterdiff` via `xargs`.
That list is newline separated, and looks something like this:

```
$ lsdiff &lt;(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.
</pre>
</div>
</content>
</entry>
<entry>
<title>treewide: format all inactive Nix files</title>
<updated>2024-12-10T19:26:33+00:00</updated>
<author>
<name>Silvan Mosberger</name>
<email>silvan.mosberger@tweag.io</email>
</author>
<published>2024-12-10T19:26:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=4f0dadbf38ee4cf4cc38cbc232b7708fddf965bc'/>
<id>4f0dadbf38ee4cf4cc38cbc232b7708fddf965bc</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>fetchpatch: add patchutils to nativeBuildInputs</title>
<updated>2024-07-01T15:09:00+00:00</updated>
<author>
<name>Ivan Trubach</name>
<email>mr.trubach@icloud.com</email>
</author>
<published>2024-07-01T14:01:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=6ed79156cef042b7dcfa206bafaa824d0a9ef638'/>
<id>6ed79156cef042b7dcfa206bafaa824d0a9ef638</id>
<content type='text'>
This change allows using programs from patchutils in postFetch.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This change allows using programs from patchutils in postFetch.
</pre>
</div>
</content>
</entry>
<entry>
<title>fetchpatch2: fix hash in tests</title>
<updated>2024-07-01T15:09:00+00:00</updated>
<author>
<name>Ivan Trubach</name>
<email>mr.trubach@icloud.com</email>
</author>
<published>2024-07-01T15:08:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=32b51c33521a297b4a7d9015f49fdf52db18e467'/>
<id>32b51c33521a297b4a7d9015f49fdf52db18e467</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fetchpatch: add decode test</title>
<updated>2023-03-11T21:39:29+00:00</updated>
<author>
<name>Artturin</name>
<email>Artturin@artturin.com</email>
</author>
<published>2021-10-25T10:45:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/nixos/nixpkgs.git/commit/?id=23e999fd9b98ba85a931bc8fe7f113fd235fb958'/>
<id>23e999fd9b98ba85a931bc8fe7f113fd235fb958</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
