1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-15 15:02:42 +01:00

Clean some header related things.

Revert most of "Hack together a fix for the public headers"

- The `libmain` change is kept, and one more libmain change is made.
  (Need to update Meson and Nix per the package alike).

- The S3 situation is fixed in a different way: the variable is public
  now, used in the header, and fixed accordingly.

- Fix TODO for `HAVE_EMBEDDED_SANDBOX_SHELL`

This reverts commit 2b51250534.
This commit is contained in:
John Ericson 2025-04-06 17:17:54 -04:00
parent 3fcdccb8ce
commit 3294b22a68
13 changed files with 32 additions and 48 deletions

View file

@ -9,7 +9,7 @@
#include "nix/util/signals.hh"
#include "store-config-private.hh"
#if ENABLE_S3
#if NIX_WITH_S3_SUPPORT
#include <aws/core/client/ClientConfiguration.h>
#endif
@ -756,7 +756,7 @@ struct curlFileTransfer : public FileTransfer
#endif
}
#if ENABLE_S3
#if NIX_WITH_S3_SUPPORT
std::tuple<std::string, std::string, Store::Params> parseS3Uri(std::string uri)
{
auto [path, params] = splitUriAndParams(uri);
@ -779,7 +779,7 @@ struct curlFileTransfer : public FileTransfer
if (hasPrefix(request.uri, "s3://")) {
// FIXME: do this on a worker thread
try {
#if ENABLE_S3
#if NIX_WITH_S3_SUPPORT
auto [bucketName, key, params] = parseS3Uri(request.uri);
std::string profile = getOr(params, "profile", "");

View file

@ -1,9 +1,13 @@
#pragma once
///@file
#include "nix/store/binary-cache-store.hh"
#include "nix/store/config.hh"
#include <atomic>
#if NIX_WITH_S3_SUPPORT
# include "nix/store/binary-cache-store.hh"
# include <atomic>
namespace nix {
@ -125,3 +129,5 @@ public:
};
}
#endif

View file

@ -1,7 +1,7 @@
#pragma once
///@file
#include "store-config-private.hh"
#if ENABLE_S3
#if NIX_WITH_S3_SUPPORT
#include "nix/util/ref.hh"

View file

@ -126,7 +126,8 @@ deps_private += sqlite
# AWS C++ SDK has bad pkg-config. See
# https://github.com/aws/aws-sdk-cpp/issues/2673 for details.
aws_s3 = dependency('aws-cpp-sdk-s3', required : false)
configdata_priv.set('ENABLE_S3', aws_s3.found().to_int())
# The S3 store definitions in the header will be hidden based on this variables.
configdata_pub.set('NIX_WITH_S3_SUPPORT', aws_s3.found().to_int())
if aws_s3.found()
aws_s3 = declare_dependency(
include_directories: include_directories(aws_s3.get_variable('includedir')),
@ -153,13 +154,13 @@ endforeach
busybox = find_program(get_option('sandbox-shell'), required : false)
# This one goes in config.h
# The path to busybox is passed as a -D flag when compiling this_library.
# This solution is inherited from the old make buildsystem
# TODO: do this differently?
configdata_priv.set('HAVE_EMBEDDED_SANDBOX_SHELL', get_option('embedded-sandbox-shell').to_int())
if get_option('embedded-sandbox-shell')
# This one goes in config.h
# The path to busybox is passed as a -D flag when compiling this_library.
# This solution is inherited from the old make buildsystem
# TODO: do this differently?
# TODO: at least define it unconditionally, so we get checking from -Wundef
configdata_priv.set('HAVE_EMBEDDED_SANDBOX_SHELL', 1)
hexdump = find_program('hexdump', native : true)
embedded_sandbox_shell_gen = custom_target(
'embedded-sandbox-shell.gen.hh',
@ -182,11 +183,6 @@ config_priv_h = configure_file(
output : 'store-config-private.hh',
)
config_pub_h = configure_file(
configuration : configdata_pub,
output : 'store-config.hh',
)
subdir('nix-meson-build-support/common')
sources = files(
@ -369,7 +365,7 @@ this_library = library(
install : true,
)
install_headers(headers + [ config_pub_h ], subdir : 'nix/store', preserve_path : true)
install_headers(headers, subdir : 'nix/store', preserve_path : true)
libraries_private = []

View file

@ -1,10 +1,10 @@
#include "store-config-private.hh"
#if ENABLE_S3
#include "nix/store/s3-binary-cache-store.hh"
#if NIX_WITH_S3_SUPPORT
#include <assert.h>
#include "nix/store/s3.hh"
#include "nix/store/s3-binary-cache-store.hh"
#include "nix/store/nar-info.hh"
#include "nix/store/nar-info-disk-cache.hh"
#include "nix/store/globals.hh"

View file

@ -2017,7 +2017,7 @@ void LocalDerivationGoal::runChild()
for (auto & i : pathsInChroot) {
if (i.second.source == "/proc") continue; // backwards compatibility
#ifdef HAVE_EMBEDDED_SANDBOX_SHELL
#if HAVE_EMBEDDED_SANDBOX_SHELL
if (i.second.source == "__embedded_sandbox_shell__") {
static unsigned char sh[] = {
#include "embedded-sandbox-shell.gen.hh"