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.
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.
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.
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.
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.
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.
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