From de1ec5a63444f90fea58bef4d6da10ca85830fcc Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 18 Jul 2024 03:15:26 -0400 Subject: [PATCH] A bunch of small fixes --- src/build-remote/build-remote.cc | 2 +- src/libcmd/command.cc | 2 +- src/libexpr/primops/fetchClosure.cc | 2 +- src/libstore-c/nix_api_store.cc | 2 +- src/libstore/build/drv-output-substitution-goal.cc | 1 + src/libstore/profiles.hh | 2 +- src/libstore/remote-store.hh | 7 ++++--- src/libstore/store-reference.cc | 2 ++ src/libutil/config-abstract.hh | 2 +- src/nix-build/nix-build.cc | 2 +- src/nix-channel/nix-channel.cc | 1 - src/nix-collect-garbage/nix-collect-garbage.cc | 2 +- src/nix-copy-closure/nix-copy-closure.cc | 2 +- src/nix-env/nix-env.cc | 2 +- src/nix-instantiate/nix-instantiate.cc | 2 +- src/nix-store/nix-store.cc | 1 + src/nix/flake.cc | 2 +- src/nix/log.cc | 2 +- src/nix/main.cc | 3 ++- src/nix/make-content-addressed.cc | 2 +- src/nix/prefetch.cc | 2 +- src/nix/repl.cc | 1 + src/nix/sigs.cc | 2 +- src/nix/unix/daemon.cc | 3 ++- src/nix/verify.cc | 2 +- tests/unit/libstore/local-overlay-store.cc | 8 ++------ tests/unit/libstore/local-store.cc | 14 ++------------ tests/unit/libstore/ssh-store.cc | 8 ++------ tests/unit/libstore/uds-remote-store.cc | 8 ++------ 29 files changed, 38 insertions(+), 53 deletions(-) diff --git a/src/build-remote/build-remote.cc b/src/build-remote/build-remote.cc index a0a404e575a..1824e20024e 100644 --- a/src/build-remote/build-remote.cc +++ b/src/build-remote/build-remote.cc @@ -16,7 +16,7 @@ #include "globals.hh" #include "serialise.hh" #include "build-result.hh" -#include "store-api.hh" +#include "store-open.hh" #include "strings.hh" #include "derivations.hh" #include "local-store.hh" diff --git a/src/libcmd/command.cc b/src/libcmd/command.cc index 67fef190920..349fb37d704 100644 --- a/src/libcmd/command.cc +++ b/src/libcmd/command.cc @@ -2,7 +2,7 @@ #include "command.hh" #include "markdown.hh" -#include "store-api.hh" +#include "store-open.hh" #include "local-fs-store.hh" #include "derivations.hh" #include "nixexpr.hh" diff --git a/src/libexpr/primops/fetchClosure.cc b/src/libexpr/primops/fetchClosure.cc index fc5bb31454f..7f59cac2f70 100644 --- a/src/libexpr/primops/fetchClosure.cc +++ b/src/libexpr/primops/fetchClosure.cc @@ -1,5 +1,5 @@ #include "primops.hh" -#include "store-api.hh" +#include "store-open.hh" #include "realisation.hh" #include "make-content-addressed.hh" #include "url.hh" diff --git a/src/libstore-c/nix_api_store.cc b/src/libstore-c/nix_api_store.cc index ba4a6e6e5eb..4961937cf12 100644 --- a/src/libstore-c/nix_api_store.cc +++ b/src/libstore-c/nix_api_store.cc @@ -43,7 +43,7 @@ Store * nix_store_open(nix_c_context * context, const char * uri, const char *** if (!params) return new Store{nix::openStore(uri_str)}; - nix::Store::Params params_map; + nix::StoreReference::Params params_map; for (size_t i = 0; params[i] != nullptr; i++) { params_map[params[i][0]] = params[i][1]; } diff --git a/src/libstore/build/drv-output-substitution-goal.cc b/src/libstore/build/drv-output-substitution-goal.cc index 02284d93c1a..4488efdcb59 100644 --- a/src/libstore/build/drv-output-substitution-goal.cc +++ b/src/libstore/build/drv-output-substitution-goal.cc @@ -3,6 +3,7 @@ #include "worker.hh" #include "substitution-goal.hh" #include "callback.hh" +#include "store-open.hh" namespace nix { diff --git a/src/libstore/profiles.hh b/src/libstore/profiles.hh index b10a72330b4..63aa9972c9b 100644 --- a/src/libstore/profiles.hh +++ b/src/libstore/profiles.hh @@ -84,7 +84,7 @@ typedef std::list Generations; */ std::pair> findGenerations(Path profile); -class LocalFSStore; +struct LocalFSStore; /** * Create a new generation of the given profile diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh index 4e18962683d..f19aa0fc57b 100644 --- a/src/libstore/remote-store.hh +++ b/src/libstore/remote-store.hh @@ -35,14 +35,15 @@ struct RemoteStoreConfig : virtual StoreConfig * \todo RemoteStore is a misnomer - should be something like * DaemonStore. */ -class RemoteStore : public virtual RemoteStoreConfig, +struct RemoteStore : + public virtual RemoteStoreConfig, public virtual Store, public virtual GcStore, public virtual LogStore { -public: + using Config = RemoteStoreConfig; - RemoteStore(const Params & params); + RemoteStore(const Config & config); /* Implementations of abstract store API methods. */ diff --git a/src/libstore/store-reference.cc b/src/libstore/store-reference.cc index b4968dfadbd..5e5d30fc117 100644 --- a/src/libstore/store-reference.cc +++ b/src/libstore/store-reference.cc @@ -1,5 +1,7 @@ #include +#include + #include "error.hh" #include "url.hh" #include "store-reference.hh" diff --git a/src/libutil/config-abstract.hh b/src/libutil/config-abstract.hh index 7d546b33332..10c98f0a73f 100644 --- a/src/libutil/config-abstract.hh +++ b/src/libutil/config-abstract.hh @@ -23,7 +23,7 @@ struct JustValue }; template -auto && operator <<(auto && str, const JustValue & opt) +auto && operator<<(auto && str, const JustValue & opt) { return str << opt.get(); } diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc index 0ce987d8a5c..9e5dfd1a04c 100644 --- a/src/nix-build/nix-build.cc +++ b/src/nix-build/nix-build.cc @@ -11,7 +11,7 @@ #include "current-process.hh" #include "parsed-derivations.hh" -#include "store-api.hh" +#include "store-open.hh" #include "local-fs-store.hh" #include "globals.hh" #include "realisation.hh" diff --git a/src/nix-channel/nix-channel.cc b/src/nix-channel/nix-channel.cc index d8d0d518b78..028a7f36f24 100644 --- a/src/nix-channel/nix-channel.cc +++ b/src/nix-channel/nix-channel.cc @@ -2,7 +2,6 @@ #include "shared.hh" #include "globals.hh" #include "filetransfer.hh" -#include "store-api.hh" #include "store-open.hh" #include "legacy.hh" #include "eval-settings.hh" // for defexpr diff --git a/src/nix-collect-garbage/nix-collect-garbage.cc b/src/nix-collect-garbage/nix-collect-garbage.cc index 91209c97898..9830b1058a3 100644 --- a/src/nix-collect-garbage/nix-collect-garbage.cc +++ b/src/nix-collect-garbage/nix-collect-garbage.cc @@ -1,6 +1,6 @@ #include "file-system.hh" #include "signals.hh" -#include "store-api.hh" +#include "store-open.hh" #include "store-cast.hh" #include "gc-store.hh" #include "profiles.hh" diff --git a/src/nix-copy-closure/nix-copy-closure.cc b/src/nix-copy-closure/nix-copy-closure.cc index b64af758fcb..d910adcf876 100644 --- a/src/nix-copy-closure/nix-copy-closure.cc +++ b/src/nix-copy-closure/nix-copy-closure.cc @@ -1,6 +1,6 @@ #include "shared.hh" #include "realisation.hh" -#include "store-api.hh" +#include "store-open.hh" #include "legacy.hh" using namespace nix; diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 5e170c99d37..056e9025800 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -9,7 +9,7 @@ #include "profiles.hh" #include "path-with-outputs.hh" #include "shared.hh" -#include "store-api.hh" +#include "store-open.hh" #include "local-fs-store.hh" #include "user-env.hh" #include "value-to-json.hh" diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc index c4854951124..5474ed0b7cb 100644 --- a/src/nix-instantiate/nix-instantiate.cc +++ b/src/nix-instantiate/nix-instantiate.cc @@ -8,7 +8,7 @@ #include "signals.hh" #include "value-to-xml.hh" #include "value-to-json.hh" -#include "store-api.hh" +#include "store-open.hh" #include "local-fs-store.hh" #include "common-eval-args.hh" #include "legacy.hh" diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index f073074e851..40d20b37690 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -2,6 +2,7 @@ #include "derivations.hh" #include "dotgraph.hh" #include "globals.hh" +#include "store-open.hh" #include "store-cast.hh" #include "local-fs-store.hh" #include "log-store.hh" diff --git a/src/nix/flake.cc b/src/nix/flake.cc index 3f9f8f99b06..26e553bde07 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -8,7 +8,7 @@ #include "flake/flake.hh" #include "get-drvs.hh" #include "signals.hh" -#include "store-api.hh" +#include "store-open.hh" #include "derivations.hh" #include "outputs-spec.hh" #include "attr-path.hh" diff --git a/src/nix/log.cc b/src/nix/log.cc index 7f590c708f6..efa4a584ccc 100644 --- a/src/nix/log.cc +++ b/src/nix/log.cc @@ -1,7 +1,7 @@ #include "command.hh" #include "common-args.hh" #include "shared.hh" -#include "store-api.hh" +#include "store-open.hh" #include "log-store.hh" #include "progress-bar.hh" diff --git a/src/nix/main.cc b/src/nix/main.cc index 00ad6fe2c97..0d839425afb 100644 --- a/src/nix/main.cc +++ b/src/nix/main.cc @@ -8,7 +8,8 @@ #include "globals.hh" #include "legacy.hh" #include "shared.hh" -#include "store-api.hh" +#include "store-open.hh" +#include "store-registration.hh" #include "filetransfer.hh" #include "finally.hh" #include "loggers.hh" diff --git a/src/nix/make-content-addressed.cc b/src/nix/make-content-addressed.cc index d9c988a9f5d..0c3efd7f499 100644 --- a/src/nix/make-content-addressed.cc +++ b/src/nix/make-content-addressed.cc @@ -1,5 +1,5 @@ #include "command.hh" -#include "store-api.hh" +#include "store-open.hh" #include "make-content-addressed.hh" #include "common-args.hh" diff --git a/src/nix/prefetch.cc b/src/nix/prefetch.cc index db7d9e4efe6..fa087430f86 100644 --- a/src/nix/prefetch.cc +++ b/src/nix/prefetch.cc @@ -1,7 +1,7 @@ #include "command.hh" #include "common-args.hh" #include "shared.hh" -#include "store-api.hh" +#include "store-open.hh" #include "filetransfer.hh" #include "finally.hh" #include "progress-bar.hh" diff --git a/src/nix/repl.cc b/src/nix/repl.cc index a2f3e033e72..8f74149042d 100644 --- a/src/nix/repl.cc +++ b/src/nix/repl.cc @@ -1,6 +1,7 @@ #include "eval.hh" #include "eval-settings.hh" #include "globals.hh" +#include "store-open.hh" #include "command.hh" #include "installable-value.hh" #include "repl.hh" diff --git a/src/nix/sigs.cc b/src/nix/sigs.cc index 1e277cbbee7..5a8693ab6c4 100644 --- a/src/nix/sigs.cc +++ b/src/nix/sigs.cc @@ -1,7 +1,7 @@ #include "signals.hh" #include "command.hh" #include "shared.hh" -#include "store-api.hh" +#include "store-open.hh" #include "thread-pool.hh" #include "progress-bar.hh" diff --git a/src/nix/unix/daemon.cc b/src/nix/unix/daemon.cc index 4a7997b1fb0..8b618c19e2b 100644 --- a/src/nix/unix/daemon.cc +++ b/src/nix/unix/daemon.cc @@ -7,6 +7,7 @@ #include "local-store.hh" #include "remote-store.hh" #include "remote-store-connection.hh" +#include "store-open.hh" #include "serialise.hh" #include "archive.hh" #include "globals.hh" @@ -239,7 +240,7 @@ static PeerInfo getPeerInfo(int remote) */ static ref openUncachedStore() { - Store::Params params; // FIXME: get params from somewhere + StoreReference::Params params; // FIXME: get params from somewhere // Disable caching since the client already does that. params["path-info-cache-size"] = "0"; return openStore(settings.storeUri, params); diff --git a/src/nix/verify.cc b/src/nix/verify.cc index 124a05bed2c..3e2253fdf04 100644 --- a/src/nix/verify.cc +++ b/src/nix/verify.cc @@ -1,6 +1,6 @@ #include "command.hh" #include "shared.hh" -#include "store-api.hh" +#include "store-open.hh" #include "thread-pool.hh" #include "signals.hh" #include "keys.hh" diff --git a/tests/unit/libstore/local-overlay-store.cc b/tests/unit/libstore/local-overlay-store.cc index b34ca92375e..4fe7e607f47 100644 --- a/tests/unit/libstore/local-overlay-store.cc +++ b/tests/unit/libstore/local-overlay-store.cc @@ -1,9 +1,6 @@ -// FIXME: Odd failures for templates that are causing the PR to break -// for now with discussion with @Ericson2314 to comment out. -#if 0 -# include +#include -# include "local-overlay-store.hh" +#include "local-overlay-store.hh" namespace nix { @@ -31,4 +28,3 @@ TEST(LocalOverlayStore, constructConfig_rootPath) } } // namespace nix -#endif diff --git a/tests/unit/libstore/local-store.cc b/tests/unit/libstore/local-store.cc index abc3ea7963f..e22f54bd45d 100644 --- a/tests/unit/libstore/local-store.cc +++ b/tests/unit/libstore/local-store.cc @@ -1,15 +1,6 @@ -// FIXME: Odd failures for templates that are causing the PR to break -// for now with discussion with @Ericson2314 to comment out. -#if 0 -# include +#include -# include "local-store.hh" - -// Needed for template specialisations. This is not good! When we -// overhaul how store configs work, this should be fixed. -# include "args.hh" -# include "config-impl.hh" -# include "abstract-setting-to-json.hh" +#include "local-store.hh" namespace nix { @@ -37,4 +28,3 @@ TEST(LocalStore, constructConfig_rootPath) } } // namespace nix -#endif diff --git a/tests/unit/libstore/ssh-store.cc b/tests/unit/libstore/ssh-store.cc index b853a5f1fb9..a1fcef6b863 100644 --- a/tests/unit/libstore/ssh-store.cc +++ b/tests/unit/libstore/ssh-store.cc @@ -1,9 +1,6 @@ -// FIXME: Odd failures for templates that are causing the PR to break -// for now with discussion with @Ericson2314 to comment out. -#if 0 -# include +#include -# include "ssh-store.hh" +#include "ssh-store.hh" namespace nix { @@ -52,4 +49,3 @@ TEST(MountedSSHStore, constructConfig) } } -#endif diff --git a/tests/unit/libstore/uds-remote-store.cc b/tests/unit/libstore/uds-remote-store.cc index 5ccb208714f..4bd3bc18f5f 100644 --- a/tests/unit/libstore/uds-remote-store.cc +++ b/tests/unit/libstore/uds-remote-store.cc @@ -1,9 +1,6 @@ -// FIXME: Odd failures for templates that are causing the PR to break -// for now with discussion with @Ericson2314 to comment out. -#if 0 -# include +#include -# include "uds-remote-store.hh" +#include "uds-remote-store.hh" namespace nix { @@ -20,4 +17,3 @@ TEST(UDSRemoteStore, constructConfigWrongScheme) } } // namespace nix -#endif