Commit Graph

15 Commits

Author SHA1 Message Date
Sandro
e56cb489a1 fetchtorrent: fix single-file torrents (#497402) 2026-08-21 20:10:51 +00:00
Eman Resu
9137068a86 build-support/fetchtorrent: remove assertMsg usage 2026-05-26 14:14:54 -04:00
Steven Allen
a59ff0d123 fetchtorrent: actually emit flatten warnings
Previously, they were let-bound to a `warnings` variable, but never used.
2026-05-05 13:17:48 -07:00
Steven Allen
2e3d501f48 fetchtorrent: handle single-file downloads
Previously, we'd attempt to flatten all downloads with:

    mv -v $downloadedDir/*/* $out

However, this doesn't work when we download a single file to
`$downloadedDir/some-file-name`.

This patch handles this case as follows:

1. If no files were downloaded, we exit with an error.

2. If a single directory was downloaded, we flatten it.

3. If a single file was downloaded we move it to $out.

4. If multiple files/directories were downloaded directly to
`$downloadedDir`, we move all these files into $out directly. I haven't
encountered this last case, but it doesn't add any complexity to support
it.
2026-05-05 13:17:48 -07:00
Steven Allen
48e7602398 fetchtorrent: use a random name for downloadedDirectory
Generate a random name for `downloadDirectory` in case the torrent
contains a directory called `downloadDirectory`. This is unlikely to
happen in practice, but we might as well play it safe.
2026-05-05 13:17:47 -07:00
Dyego Aurélio
28096cc5e3 treewide: apply nixfmt 1.2.0 2026-01-22 18:37:56 -03:00
Emily
f8b2fc54c8 fetchtorrent: use Transmission 4
I don’t know why setting `--config-dir` breaks the finish script
with Transmission 4, but I don’t really feel like spending more
time investigating than I already did. It does still respect the
passed settings, since we were passing the default location anyway.
2025-10-28 18:14:05 +00:00
Adam Dinwoodie
588622a0e3 fetchtorrent: add flatten argument for rqbit
Currently, the output from fetchtorrent will be different depending on
whether the default "transmission" backend or the "rqbit" backend is
used, because "rqbit" changed its behaviour in v6.0.0 to create
subdirectories.

Restore the old behaviour for the rqbit backend of flattening the
directory structure, but add a "flatten" argument to allow users to
explicitly request the behaviour without this change.

Because fetchtorrent produces fixed-output derivations, it's possible
that people won't notice the changes in behaviour here, so add a warning
that the behaviour might be unexpected (in either direction!) if the
flatten argument isn't specified for the rqbit backend, and -- to avoid
needing to support it indefinitely -- a warning that `flatten = false`
will be deprecated in future.

Update the fetchtorrent tests to check all the relevant combinations,
and to mark all tests as now working.

Update the release notes to advertise this breaking change.

Fixes #432001.
2025-08-09 20:22:29 +01:00
Adam Dinwoodie
613a98461f fetchtorrent: check JSON config usage correctly
The arguments to `fetchtorrent` are supposed to throw an error if the
user attempts to specify JSON configuration when they're not using the
transmission backend, however a logic error means the error will never
be thrown.

Move the test to somewhere where the behaviour will actually be checked.
2025-08-09 19:24:34 +01:00
Adam Dinwoodie
f632635221 fetchtorrent: run hooks when using rqbit
The postFetch and postUnpack hooks ought to be run in fetchtorrent
regardless of the backend in use.  Ensure that's the case, rather than
only running them if the transmission backend is being used.
2025-08-09 19:24:34 +01:00
Wolfgang Walther
5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Silvan Mosberger
4f0dadbf38 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 a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
Doron Behar
7645dde059 transmission_3: rename from transmission 2024-06-21 12:33:37 +03:00
Peder Bergebakken Sundt
9a16042cc3 fetchtorrent: add meta support 2023-12-02 02:04:40 +01:00
Eirik Wittersø
2fd6af1929 fetchFromBittorrent: Rename to fetchtorrent 2023-10-28 11:32:10 +01:00