Merge pull request #11179 from obsidiansystems/misc-fix

Misc fixes
This commit is contained in:
Eelco Dolstra 2024-07-25 14:01:54 +02:00 committed by GitHub
commit 99c20d6624
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 2 deletions

View file

@ -264,7 +264,20 @@ connected:
auto inputs = readStrings<PathSet>(source);
auto wantedOutputs = readStrings<StringSet>(source);
AutoCloseFD uploadLock = openLockFile(currentLoad + "/" + escapeUri(storeUri.render()) + ".upload-lock", true);
AutoCloseFD uploadLock;
{
auto setUpdateLock = [&](auto && fileName){
uploadLock = openLockFile(currentLoad + "/" + escapeUri(fileName) + ".upload-lock", true);
};
try {
setUpdateLock(storeUri.render());
} catch (SysError & e) {
if (e.errNo != ENAMETOOLONG) throw;
// Try again hashing the store URL so we have a shorter path
auto h = hashString(HashAlgorithm::MD5, storeUri.render());
setUpdateLock(h.to_string(HashFormat::Base64, false));
}
}
{
Activity act(*logger, lvlTalkative, actUnknown, fmt("waiting for the upload lock to '%s'", storeUri.render()));

View file

@ -2,7 +2,11 @@
#include "eval-inline.hh"
#include <sstream>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-enum"
#include <toml.hpp>
#pragma GCC diagnostic pop
namespace nix {

View file

@ -10,6 +10,8 @@
#include "compression.hh"
#include "filetransfer.hh"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-enum"
#include <aws/core/Aws.h>
#include <aws/core/VersionConfig.h>
#include <aws/core/auth/AWSCredentialsProvider.h>
@ -25,6 +27,7 @@
#include <aws/s3/model/ListObjectsRequest.h>
#include <aws/s3/model/PutObjectRequest.h>
#include <aws/transfer/TransferManager.h>
#pragma GCC diagnostic pop
using namespace Aws::Transfer;

View file

@ -8,7 +8,7 @@
#include <optional>
#include <string>
namespace Aws { namespace Client { class ClientConfiguration; } }
namespace Aws { namespace Client { struct ClientConfiguration; } }
namespace Aws { namespace S3 { class S3Client; } }
namespace nix {