mirror of
https://github.com/NixOS/nix.git
synced 2025-11-21 01:39:36 +01:00
Relegate toRealPath to LocalFSStore
Fix #14480 This method is not well-defined for arbitrary stores, which do not have a notion of a "real path" -- it is only well-defined for local file systems stores, which do have exactly that notion, and so it is moved to that sub-interface instead. Some call-sites had to be fixed up for this, but in all cases the changes are positive. Using `getFSSourceAccessor` allows for more other stores to work properly. `nix-channel` was straight-up wrong in the case of redirected local stores. And the building logic with remote building and a non-local store is also fixed, properly gating some deletions on store type. Co-authored-by: Robert Hensing <robert@roberthensing.nl>
This commit is contained in:
parent
948c89b367
commit
099af7578f
12 changed files with 63 additions and 55 deletions
|
|
@ -58,7 +58,7 @@ struct ChrootDerivationBuilder : virtual DerivationBuilderImpl
|
|||
environment using bind-mounts. We put it in the Nix store
|
||||
so that the build outputs can be moved efficiently from the
|
||||
chroot to their final location. */
|
||||
auto chrootParentDir = store.Store::toRealPath(drvPath) + ".chroot";
|
||||
auto chrootParentDir = store.toRealPath(drvPath) + ".chroot";
|
||||
deletePath(chrootParentDir);
|
||||
|
||||
/* Clean up the chroot directory automatically. */
|
||||
|
|
@ -171,7 +171,7 @@ struct ChrootDerivationBuilder : virtual DerivationBuilderImpl
|
|||
continue;
|
||||
if (buildMode != bmCheck && status.known->isValid())
|
||||
continue;
|
||||
auto p = store.Store::toRealPath(status.known->path);
|
||||
auto p = store.toRealPath(status.known->path);
|
||||
if (pathExists(chrootRootDir + p))
|
||||
std::filesystem::rename((chrootRootDir + p), p);
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ struct ChrootDerivationBuilder : virtual DerivationBuilderImpl
|
|||
|
||||
debug("materialising '%s' in the sandbox", store.printStorePath(path));
|
||||
|
||||
Path source = store.Store::toRealPath(path);
|
||||
Path source = store.toRealPath(path);
|
||||
Path target = chrootRootDir + store.printStorePath(path);
|
||||
|
||||
if (pathExists(target)) {
|
||||
|
|
|
|||
|
|
@ -1887,7 +1887,7 @@ void DerivationBuilderImpl::cleanupBuild(bool force)
|
|||
if (force) {
|
||||
/* Delete unused redirected outputs (when doing hash rewriting). */
|
||||
for (auto & i : redirectedOutputs)
|
||||
deletePath(store.Store::toRealPath(i.second));
|
||||
deletePath(store.toRealPath(i.second));
|
||||
}
|
||||
|
||||
if (topTmpDir != "") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue