mirror of
https://github.com/NixOS/nix.git
synced 2025-11-15 06:52:43 +01:00
libstore: Fix makeCopyPathMessage after config getUri refactor
This commit is contained in:
parent
cf7084a67c
commit
e6f3a193d8
1 changed files with 28 additions and 12 deletions
|
|
@ -785,12 +785,24 @@ const Store::Stats & Store::getStats()
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string makeCopyPathMessage(std::string_view srcUri, std::string_view dstUri, std::string_view storePath)
|
static std::string
|
||||||
|
makeCopyPathMessage(const StoreReference & src, const StoreReference & dst, std::string_view storePath)
|
||||||
{
|
{
|
||||||
return srcUri == "local" || srcUri == "daemon" ? fmt("copying path '%s' to '%s'", storePath, dstUri)
|
auto isShorthand = [](const StoreReference & ref) {
|
||||||
: dstUri == "local" || dstUri == "daemon"
|
if (const auto * specified = std::get_if<StoreReference::Specified>(&ref.variant)) {
|
||||||
? fmt("copying path '%s' from '%s'", storePath, srcUri)
|
const auto & scheme = specified->scheme;
|
||||||
: fmt("copying path '%s' from '%s' to '%s'", storePath, srcUri, dstUri);
|
return (scheme == "local" || scheme == "unix") && specified->authority.empty() && ref.params.empty();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isShorthand(src))
|
||||||
|
return fmt("copying path '%s' to '%s'", storePath, dst.render());
|
||||||
|
|
||||||
|
if (isShorthand(dst))
|
||||||
|
return fmt("copying path '%s' from '%s'", storePath, src.render());
|
||||||
|
|
||||||
|
return fmt("copying path '%s' from '%s' to '%s'", storePath, src.render(), dst.render());
|
||||||
}
|
}
|
||||||
|
|
||||||
void copyStorePath(
|
void copyStorePath(
|
||||||
|
|
@ -801,11 +813,15 @@ void copyStorePath(
|
||||||
if (!repair && dstStore.isValidPath(storePath))
|
if (!repair && dstStore.isValidPath(storePath))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto srcUri = srcStore.config.getUri();
|
auto srcRef = srcStore.config.getReference();
|
||||||
auto dstUri = dstStore.config.getUri();
|
auto dstRef = dstStore.config.getReference();
|
||||||
auto storePathS = srcStore.printStorePath(storePath);
|
auto storePathS = srcStore.printStorePath(storePath);
|
||||||
Activity act(
|
Activity act(
|
||||||
*logger, lvlInfo, actCopyPath, makeCopyPathMessage(srcUri, dstUri, storePathS), {storePathS, srcUri, dstUri});
|
*logger,
|
||||||
|
lvlInfo,
|
||||||
|
actCopyPath,
|
||||||
|
makeCopyPathMessage(srcRef, dstRef, storePathS),
|
||||||
|
{storePathS, srcRef.render(), dstRef.render()});
|
||||||
PushActivity pact(act.id);
|
PushActivity pact(act.id);
|
||||||
|
|
||||||
auto info = srcStore.queryPathInfo(storePath);
|
auto info = srcStore.queryPathInfo(storePath);
|
||||||
|
|
@ -957,15 +973,15 @@ std::map<StorePath, StorePath> copyPaths(
|
||||||
// We can reasonably assume that the copy will happen whenever we
|
// We can reasonably assume that the copy will happen whenever we
|
||||||
// read the path, so log something about that at that point
|
// read the path, so log something about that at that point
|
||||||
uint64_t total = 0;
|
uint64_t total = 0;
|
||||||
auto srcUri = srcStore.config.getUri();
|
auto srcRef = srcStore.config.getReference();
|
||||||
auto dstUri = dstStore.config.getUri();
|
auto dstRef = dstStore.config.getReference();
|
||||||
auto storePathS = srcStore.printStorePath(missingPath);
|
auto storePathS = srcStore.printStorePath(missingPath);
|
||||||
Activity act(
|
Activity act(
|
||||||
*logger,
|
*logger,
|
||||||
lvlInfo,
|
lvlInfo,
|
||||||
actCopyPath,
|
actCopyPath,
|
||||||
makeCopyPathMessage(srcUri, dstUri, storePathS),
|
makeCopyPathMessage(srcRef, dstRef, storePathS),
|
||||||
{storePathS, srcUri, dstUri});
|
{storePathS, srcRef.render(), dstRef.render()});
|
||||||
PushActivity pact(act.id);
|
PushActivity pact(act.id);
|
||||||
|
|
||||||
LambdaSink progressSink([&](std::string_view data) {
|
LambdaSink progressSink([&](std::string_view data) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue