Compare commits

..

1 commit

Author SHA1 Message Date
Finn Behrens 9a6392c979 libmain: add progress bar with multiple status lines
Add the log-formats `multiline` and `multiline-with-logs` which offer
multiple current active building status lines.
2024-06-01 15:33:37 +02:00
15 changed files with 140 additions and 45 deletions

129
.gitignore vendored
View file

@ -1,5 +1,128 @@
Makefile.config
perl/Makefile.config
# /
/aclocal.m4
/autom4te.cache
/precompiled-headers.h.gch
/config.*
/configure
/stamp-h1
/svn-revision
/libtool
/config
# /doc/manual/
/doc/manual/*.1
/doc/manual/*.5
/doc/manual/*.8
/doc/manual/generated/*
/doc/manual/nix.json
/doc/manual/conf-file.json
/doc/manual/language.json
/doc/manual/xp-features.json
/doc/manual/src/command-ref/experimental-features-shortlist.md
/doc/manual/src/contributing/experimental-feature-descriptions.md
/doc/manual/src/release-notes/rl-next-generated.md
# /scripts/
/scripts/nix-profile.sh
/scripts/nix-profile-daemon.sh
/scripts/nix-profile.fish
/scripts/nix-profile-daemon.fish
# /src/libexpr/
/src/libexpr/lexer-tab.cc
/src/libexpr/lexer-tab.hh
/src/libexpr/parser-tab.cc
/src/libexpr/parser-tab.hh
/src/libexpr/parser-tab.output
/src/libexpr/nix.tbl
/src/libexpr/tests
/tests/unit/libexpr/libnixexpr-tests
# /src/libstore/
*.gen.*
/src/libstore/tests
/tests/unit/libstore/libnixstore-tests
# /src/libutil/
/src/libutil/tests
/tests/unit/libutil/libnixutil-tests
/src/nix/nix
/src/nix/doc
# /src/nix-env/
/src/nix-env/nix-env
# /src/nix-instantiate/
/src/nix-instantiate/nix-instantiate
# /src/nix-store/
/src/nix-store/nix-store
/src/nix-prefetch-url/nix-prefetch-url
/src/nix-collect-garbage/nix-collect-garbage
# /src/nix-channel/
/src/nix-channel/nix-channel
# /src/nix-build/
/src/nix-build/nix-build
/src/nix-copy-closure/nix-copy-closure
/src/error-demo/error-demo
/src/build-remote/build-remote
# /tests/functional/
/tests/functional/test-tmp
/tests/functional/common/vars-and-functions.sh
/tests/functional/result*
/tests/functional/restricted-innocent
/tests/functional/shell
/tests/functional/shell.drv
/tests/functional/config.nix
/tests/functional/ca/config.nix
/tests/functional/dyn-drv/config.nix
/tests/functional/repl-result-out
/tests/functional/debugger-test-out
/tests/functional/test-libstoreconsumer/test-libstoreconsumer
# /tests/functional/lang/
/tests/functional/lang/*.out
/tests/functional/lang/*.out.xml
/tests/functional/lang/*.err
/tests/functional/lang/*.ast
/perl/lib/Nix/Config.pm
/perl/lib/Nix/Store.cc
/misc/systemd/nix-daemon.service
/misc/systemd/nix-daemon.socket
/misc/systemd/nix-daemon.conf
/misc/upstart/nix-daemon.conf
/src/resolve-system-dependencies/resolve-system-dependencies
outputs/
*.a
*.o
*.o.tmp
*.so
*.dylib
*.dll
*.exe
*.dep
*~
*.pc
*.plist
# GNU Global
GPATH
GRTAGS
@ -9,11 +132,17 @@ GTAGS
# ccls
/.ccls-cache
# auto-generated compilation database
compile_commands.json
nix-rust/target
result
result-*
.vscode/
.direnv/
.envrc.local
# clangd and possibly more
.cache/

View file

@ -87,12 +87,11 @@ pre-commit-run {
"file"
"header"
];
# generated files; these will never actually be seen by this
# check, and are left here as documentation
excludes = [
''^src/pch/.*$''
# generated files; these will never actually be seen by this
# check, and are left here as documentation
''(parser|lexer)-tab\.hh$''
''\.gen\.hh$''
"(parser|lexer)-tab\\.hh$"
"\\.gen\\.hh$"
];
entry = lib.getExe pkgs.check-headers;
};

View file

@ -169,6 +169,7 @@ stdenv.mkDerivation (finalAttrs: {
./boehmgc-coroutine-sp-fallback.diff
./doc
./misc
./precompiled-headers.h
./src
./COPYING
]
@ -448,10 +449,7 @@ stdenv.mkDerivation (finalAttrs: {
shellHook = ''
# don't re-run the hook in (other) nested nix-shells
function lixShellHook() {
# n.b. how the heck does this become -env-env? well, `nix develop` does it:
# https://git.lix.systems/lix-project/lix/src/commit/7575db522e9008685c4009423398f6900a16bcce/src/nix/develop.cc#L240-L241
# this is, of course, absurd.
if [[ $name != lix-shell-env && $name != lix-shell-env-env ]]; then
if [[ $name != lix-shell-env ]]; then
return;
fi

View file

@ -3,7 +3,6 @@
#include <algorithm>
#include <set>
#include <memory>
#include <string_view>
#include <tuple>
#include <iomanip>
#if __APPLE__
@ -21,9 +20,9 @@
#include "local-store.hh"
#include "legacy.hh"
#include "experimental-features.hh"
#include "hash.hh"
using namespace nix;
using std::cin;
static void handleAlarm(int sig) {
}
@ -36,19 +35,9 @@ std::string escapeUri(std::string uri)
static std::string currentLoad;
static std::string makeLockFilename(const std::string & storeUri) {
// We include 48 bytes of escaped URI to give an idea of what the lock
// is on, then 16 bytes of hash to disambiguate.
// This avoids issues with the escaped URI being very long and causing
// path too long errors, while also avoiding any possibility of collision
// caused by simple truncation.
auto hash = hashString(HashType::htSHA256, storeUri).to_string(Base::Base32, false);
return escapeUri(storeUri).substr(0, 48) + "-" + hash.substr(0, 16);
}
static AutoCloseFD openSlotLock(const Machine & m, uint64_t slot)
{
return openLockFile(fmt("%s/%s-%d", currentLoad, makeLockFilename(m.storeUri), slot), true);
return openLockFile(fmt("%s/%s-%d", currentLoad, escapeUri(m.storeUri), slot), true);
}
static bool allSupportedLocally(Store & store, const std::set<std::string>& requiredFeatures) {
@ -274,9 +263,7 @@ connected:
auto inputs = readStrings<PathSet>(source);
auto wantedOutputs = readStrings<StringSet>(source);
auto lockFileName = currentLoad + "/" + makeLockFilename(storeUri) + ".upload-lock";
AutoCloseFD uploadLock = openLockFile(lockFileName, true);
AutoCloseFD uploadLock = openLockFile(currentLoad + "/" + escapeUri(storeUri) + ".upload-lock", true);
{
Activity act(*logger, lvlTalkative, actUnknown, fmt("waiting for the upload lock to '%s'", storeUri));

View file

@ -54,7 +54,6 @@ libcmd = library(
nlohmann_json,
lix_doc
],
cpp_pch : ['../pch/precompiled-headers.hh'],
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,

View file

@ -145,7 +145,6 @@ libexpr = library(
include_directories : [
'../libmain',
],
cpp_pch : ['../pch/precompiled-headers.hh'],
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,

View file

@ -322,7 +322,7 @@ struct GitLabInputScheme : GitArchiveInputScheme
readFile(
store->toRealPath(
downloadFile(store, url, "source", false, headers).storePath)));
if (json.is_array() && json.size() >= 1 && json[0]["id"] != nullptr) {
if (json.is_array() && json.size() == 1 && json[0]["id"] != nullptr) {
auto rev = Hash::parseAny(std::string(json[0]["id"]), htSHA1);
debug("HEAD revision for '%s' is %s", url, rev.gitRev());
return rev;

View file

@ -30,7 +30,6 @@ libfetchers = library(
liblixutil,
nlohmann_json,
],
cpp_pch : ['../pch/precompiled-headers.hh'],
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,

View file

@ -20,7 +20,6 @@ libmain = library(
liblixutil,
liblixstore,
],
cpp_pch : ['../pch/precompiled-headers.hh'],
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,

View file

@ -550,12 +550,7 @@ void LocalStore::openDB(State & state, bool create)
if (mode == "wal" ) {
/* persist the WAL files when the DB connection is closed.
* This allows for read-only connections without any write permissions
* on the state directory to succeed on a closed database. Setting the
* journal_size_limit to 2^40 bytes results in the WAL files getting
* truncated to 0 on exit and limits the on disk size of the WAL files
* to 2^40 bytes following a checkpoint */
if (sqlite3_exec(db, "pragma main.journal_size_limit = 1099511627776;", 0, 0, 0) != SQLITE_OK)
SQLiteError::throw_(db, "setting journal_size_limit");
* on the state directory to succeed on a closed database. */
int enable = 1;
if (sqlite3_file_control(db, NULL, SQLITE_FCNTL_PERSIST_WAL, &enable) != SQLITE_OK)
SQLiteError::throw_(db, "setting persistent WAL mode");

View file

@ -220,7 +220,6 @@ libstore = library(
nlohmann_json,
],
cpp_args : cpp_args,
cpp_pch : ['../pch/precompiled-headers.hh'],
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,

View file

@ -129,7 +129,6 @@ libutil = library(
openssl,
nlohmann_json,
],
cpp_pch : ['../pch/precompiled-headers.hh'],
implicit_include_directories : true,
install : true,
)

View file

@ -89,7 +89,6 @@ nix = executable(
boehm,
nlohmann_json,
],
cpp_pch : ['../pch/precompiled-headers.hh'],
install : true,
# FIXME(Qyriad): is this right?
install_rpath : libdir,

View file

@ -68,7 +68,6 @@ libutil_tester = executable(
liblixutil_test_support,
nlohmann_json,
],
cpp_pch : ['../../src/pch/precompiled-headers.hh'],
)
test(
@ -103,7 +102,6 @@ libstore_test_support = library(
include_directories : include_directories(
'libstore-support',
),
cpp_pch : ['../../src/pch/precompiled-headers.hh'],
)
liblixstore_test_support = declare_dependency(
include_directories : include_directories('libstore-support'),
@ -137,7 +135,6 @@ libstore_tester = executable(
gtest,
nlohmann_json,
],
cpp_pch : ['../../src/pch/precompiled-headers.hh'],
)
test(
@ -169,7 +166,6 @@ libexpr_test_support = library(
include_directories : include_directories(
'libexpr-support',
),
cpp_pch : ['../../src/pch/precompiled-headers.hh'],
)
liblixexpr_test_support = declare_dependency(
include_directories : include_directories('libexpr-support'),
@ -203,7 +199,6 @@ libexpr_tester = executable(
gtest,
nlohmann_json,
],
cpp_pch : ['../../src/pch/precompiled-headers.hh'],
)
test(
@ -230,7 +225,6 @@ libcmd_tester = executable(
gtest,
boost,
],
cpp_pch : ['../../src/pch/precompiled-headers.hh'],
)
test(