mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
Merge pull request #12303 from NixOS/fix-mingw-2
More mingw build fixes
This commit is contained in:
commit
f12ef308f6
3 changed files with 18 additions and 18 deletions
|
@ -331,7 +331,7 @@ struct GitInputScheme : InputScheme
|
||||||
|
|
||||||
auto result = runProgram(RunOptions {
|
auto result = runProgram(RunOptions {
|
||||||
.program = "git",
|
.program = "git",
|
||||||
.args = {"-C", *repoPath, "--git-dir", repoInfo.gitDir, "check-ignore", "--quiet", std::string(path.rel())},
|
.args = {"-C", repoPath->string(), "--git-dir", repoInfo.gitDir, "check-ignore", "--quiet", std::string(path.rel())},
|
||||||
});
|
});
|
||||||
auto exitCode =
|
auto exitCode =
|
||||||
#ifndef WIN32 // TODO abstract over exit status handling on Windows
|
#ifndef WIN32 // TODO abstract over exit status handling on Windows
|
||||||
|
@ -344,7 +344,7 @@ struct GitInputScheme : InputScheme
|
||||||
if (exitCode != 0) {
|
if (exitCode != 0) {
|
||||||
// The path is not `.gitignore`d, we can add the file.
|
// The path is not `.gitignore`d, we can add the file.
|
||||||
runProgram("git", true,
|
runProgram("git", true,
|
||||||
{ "-C", *repoPath, "--git-dir", repoInfo.gitDir, "add", "--intent-to-add", "--", std::string(path.rel()) });
|
{ "-C", repoPath->string(), "--git-dir", repoInfo.gitDir, "add", "--intent-to-add", "--", std::string(path.rel()) });
|
||||||
|
|
||||||
|
|
||||||
if (commitMsg) {
|
if (commitMsg) {
|
||||||
|
@ -352,7 +352,7 @@ struct GitInputScheme : InputScheme
|
||||||
logger->pause();
|
logger->pause();
|
||||||
Finally restoreLogger([]() { logger->resume(); });
|
Finally restoreLogger([]() { logger->resume(); });
|
||||||
runProgram("git", true,
|
runProgram("git", true,
|
||||||
{ "-C", *repoPath, "--git-dir", repoInfo.gitDir, "commit", std::string(path.rel()), "-F", "-" },
|
{ "-C", repoPath->string(), "--git-dir", repoInfo.gitDir, "commit", std::string(path.rel()), "-F", "-" },
|
||||||
*commitMsg);
|
*commitMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -470,7 +470,7 @@ struct GitInputScheme : InputScheme
|
||||||
return repoInfo;
|
return repoInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t getLastModified(const RepoInfo & repoInfo, const std::string & repoDir, const Hash & rev) const
|
uint64_t getLastModified(const RepoInfo & repoInfo, const std::filesystem::path & repoDir, const Hash & rev) const
|
||||||
{
|
{
|
||||||
Cache::Key key{"gitLastModified", {{"rev", rev.gitRev()}}};
|
Cache::Key key{"gitLastModified", {{"rev", rev.gitRev()}}};
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ struct GitInputScheme : InputScheme
|
||||||
return lastModified;
|
return lastModified;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t getRevCount(const RepoInfo & repoInfo, const std::string & repoDir, const Hash & rev) const
|
uint64_t getRevCount(const RepoInfo & repoInfo, const std::filesystem::path & repoDir, const Hash & rev) const
|
||||||
{
|
{
|
||||||
Cache::Key key{"gitRevCount", {{"rev", rev.gitRev()}}};
|
Cache::Key key{"gitRevCount", {{"rev", rev.gitRev()}}};
|
||||||
|
|
||||||
|
@ -557,7 +557,7 @@ struct GitInputScheme : InputScheme
|
||||||
auto ref = originalRef ? *originalRef : getDefaultRef(repoInfo);
|
auto ref = originalRef ? *originalRef : getDefaultRef(repoInfo);
|
||||||
input.attrs.insert_or_assign("ref", ref);
|
input.attrs.insert_or_assign("ref", ref);
|
||||||
|
|
||||||
Path repoDir;
|
std::filesystem::path repoDir;
|
||||||
|
|
||||||
if (auto repoPath = repoInfo.getPath()) {
|
if (auto repoPath = repoInfo.getPath()) {
|
||||||
repoDir = *repoPath;
|
repoDir = *repoPath;
|
||||||
|
@ -565,22 +565,22 @@ struct GitInputScheme : InputScheme
|
||||||
input.attrs.insert_or_assign("rev", GitRepo::openRepo(repoDir)->resolveRef(ref).gitRev());
|
input.attrs.insert_or_assign("rev", GitRepo::openRepo(repoDir)->resolveRef(ref).gitRev());
|
||||||
} else {
|
} else {
|
||||||
auto repoUrl = std::get<ParsedURL>(repoInfo.location);
|
auto repoUrl = std::get<ParsedURL>(repoInfo.location);
|
||||||
Path cacheDir = getCachePath(repoUrl.to_string(), getShallowAttr(input));
|
std::filesystem::path cacheDir = getCachePath(repoUrl.to_string(), getShallowAttr(input));
|
||||||
repoDir = cacheDir;
|
repoDir = cacheDir;
|
||||||
repoInfo.gitDir = ".";
|
repoInfo.gitDir = ".";
|
||||||
|
|
||||||
createDirs(dirOf(cacheDir));
|
std::filesystem::create_directories(cacheDir.parent_path());
|
||||||
PathLocks cacheDirLock({cacheDir});
|
PathLocks cacheDirLock({cacheDir.string()});
|
||||||
|
|
||||||
auto repo = GitRepo::openRepo(cacheDir, true, true);
|
auto repo = GitRepo::openRepo(cacheDir, true, true);
|
||||||
|
|
||||||
// We need to set the origin so resolving submodule URLs works
|
// We need to set the origin so resolving submodule URLs works
|
||||||
repo->setRemote("origin", repoUrl.to_string());
|
repo->setRemote("origin", repoUrl.to_string());
|
||||||
|
|
||||||
Path localRefFile =
|
auto localRefFile =
|
||||||
ref.compare(0, 5, "refs/") == 0
|
ref.compare(0, 5, "refs/") == 0
|
||||||
? cacheDir + "/" + ref
|
? cacheDir / ref
|
||||||
: cacheDir + "/refs/heads/" + ref;
|
: cacheDir / "refs/heads" / ref;
|
||||||
|
|
||||||
bool doFetch;
|
bool doFetch;
|
||||||
time_t now = time(0);
|
time_t now = time(0);
|
||||||
|
@ -596,7 +596,7 @@ struct GitInputScheme : InputScheme
|
||||||
/* If the local ref is older than ‘tarball-ttl’ seconds, do a
|
/* If the local ref is older than ‘tarball-ttl’ seconds, do a
|
||||||
git fetch to update the local ref to the remote ref. */
|
git fetch to update the local ref to the remote ref. */
|
||||||
struct stat st;
|
struct stat st;
|
||||||
doFetch = stat(localRefFile.c_str(), &st) != 0 ||
|
doFetch = stat(localRefFile.string().c_str(), &st) != 0 ||
|
||||||
!isCacheFileWithinTtl(now, st);
|
!isCacheFileWithinTtl(now, st);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -616,7 +616,7 @@ struct GitInputScheme : InputScheme
|
||||||
|
|
||||||
repo->fetch(repoUrl.to_string(), fmt("%s:%s", fetchRef, fetchRef), getShallowAttr(input));
|
repo->fetch(repoUrl.to_string(), fmt("%s:%s", fetchRef, fetchRef), getShallowAttr(input));
|
||||||
} catch (Error & e) {
|
} catch (Error & e) {
|
||||||
if (!pathExists(localRefFile)) throw;
|
if (!std::filesystem::exists(localRefFile)) throw;
|
||||||
logError(e.info());
|
logError(e.info());
|
||||||
warn("could not update local clone of Git repository '%s'; continuing with the most recent version", repoInfo.locationToArg());
|
warn("could not update local clone of Git repository '%s'; continuing with the most recent version", repoInfo.locationToArg());
|
||||||
}
|
}
|
||||||
|
@ -850,7 +850,7 @@ struct GitInputScheme : InputScheme
|
||||||
for (auto & file : repoInfo.workdirInfo.dirtyFiles) {
|
for (auto & file : repoInfo.workdirInfo.dirtyFiles) {
|
||||||
writeString("modified:", hashSink);
|
writeString("modified:", hashSink);
|
||||||
writeString(file.abs(), hashSink);
|
writeString(file.abs(), hashSink);
|
||||||
dumpPath(*repoPath / file.rel(), hashSink);
|
dumpPath((*repoPath / file.rel()).string(), hashSink);
|
||||||
}
|
}
|
||||||
for (auto & file : repoInfo.workdirInfo.deletedFiles) {
|
for (auto & file : repoInfo.workdirInfo.deletedFiles) {
|
||||||
writeString("deleted:", hashSink);
|
writeString("deleted:", hashSink);
|
||||||
|
|
|
@ -783,7 +783,7 @@ LockedFlake lockFlake(
|
||||||
auto relPath = (topRef.subdir == "" ? "" : topRef.subdir + "/") + "flake.lock";
|
auto relPath = (topRef.subdir == "" ? "" : topRef.subdir + "/") + "flake.lock";
|
||||||
auto outputLockFilePath = *sourcePath / relPath;
|
auto outputLockFilePath = *sourcePath / relPath;
|
||||||
|
|
||||||
bool lockFileExists = pathExists(outputLockFilePath);
|
bool lockFileExists = fs::symlink_exists(outputLockFilePath);
|
||||||
|
|
||||||
auto s = chomp(diff);
|
auto s = chomp(diff);
|
||||||
if (lockFileExists) {
|
if (lockFileExists) {
|
||||||
|
|
|
@ -97,7 +97,7 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
|
||||||
|
|
||||||
// FIXME: don't call an external process.
|
// FIXME: don't call an external process.
|
||||||
runProgram(getNixBin("nix-env").string(), false,
|
runProgram(getNixBin("nix-env").string(), false,
|
||||||
{"--profile", profileDir, "-i", store->printStorePath(storePath), "--no-sandbox"});
|
{"--profile", profileDir.string(), "-i", store->printStorePath(storePath), "--no-sandbox"});
|
||||||
}
|
}
|
||||||
|
|
||||||
printInfo(ANSI_GREEN "upgrade to version %s done" ANSI_NORMAL, version);
|
printInfo(ANSI_GREEN "upgrade to version %s done" ANSI_NORMAL, version);
|
||||||
|
@ -120,7 +120,7 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
|
||||||
|
|
||||||
// Resolve profile to /nix/var/nix/profiles/<name> link.
|
// Resolve profile to /nix/var/nix/profiles/<name> link.
|
||||||
while (canonPath(profileDir.string()).find("/profiles/") == std::string::npos && std::filesystem::is_symlink(profileDir))
|
while (canonPath(profileDir.string()).find("/profiles/") == std::string::npos && std::filesystem::is_symlink(profileDir))
|
||||||
profileDir = readLink(profileDir);
|
profileDir = readLink(profileDir.string());
|
||||||
|
|
||||||
printInfo("found profile %s", profileDir);
|
printInfo("found profile %s", profileDir);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue