From 732c96f182386d1be00ebf47d332d8c81b878dcf Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 22 Nov 2019 11:33:29 +0100 Subject: daemon: GC displays how much it has collected. * nix/libstore/gc.cc (LocalStore::deletePathRecursive): Display the percentage reached relative to 'maxFreed', or the total amount of data deleted when 'maxFreed' is ULLONG_MAX. --- nix/libstore/gc.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'nix') diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc index fe152da015..7976ff7d76 100644 --- a/nix/libstore/gc.cc +++ b/nix/libstore/gc.cc @@ -11,6 +11,7 @@ #include #include #include +#include namespace nix { @@ -417,7 +418,15 @@ void LocalStore::deletePathRecursive(GCState & state, const Path & path) throw SysError(format("getting status of %1%") % path); } - printMsg(lvlInfo, format("deleting `%1%'") % path); + if (state.options.maxFreed != ULLONG_MAX) { + double fraction = state.results.bytesFreed + size + / state.options.maxFreed; + unsigned int percentage = (fraction > 1. ? 1. : fraction) * 100.; + printMsg(lvlInfo, format("[%1%%%] deleting '%2%'") % percentage % path); + } else { + size_t total = (state.results.bytesFreed + size) / (1024 * 1024); + printMsg(lvlInfo, format("[%1% MiB] deleting '%2%'") % total % path); + } state.results.paths.insert(path); -- cgit v1.2.3 From dc209d5a5ddba4320c9a4f893d6df4b70f3685a0 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 21 Nov 2019 15:14:33 +0100 Subject: guix build, daemon: Rename "--no-build-hook" to "--no-offload". This is a followup to bc69ea2d605810cc32e13ed03d5848b8dc358b61. * guix/scripts/build.scm (show-build-options-help): Rename "--no-build-hook" to "--no-offload". (%standard-build-options): Likewise, and warn when "--no-build-hook" is passed. * nix/nix-daemon/guix-daemon.cc (options): Add "--no-offload" and mark "--no-build-hook" as hidden. * guix/scripts/offload.scm: Adjust comment. * doc/guix.texi (Invoking guix-daemon, Common Build Options): Replace "--no-build-hook" with "--no-offload". * etc/completion/fish/guix.fish, etc/completion/zsh/_guix: Adjust accordingly. --- doc/guix.texi | 20 +++++++++----------- etc/completion/fish/guix.fish | 28 ++++++++++++++-------------- etc/completion/zsh/_guix | 8 ++++---- guix/scripts/build.scm | 8 ++++++-- guix/scripts/offload.scm | 2 +- nix/nix-daemon/guix-daemon.cc | 7 +++++-- 6 files changed, 39 insertions(+), 34 deletions(-) (limited to 'nix') diff --git a/doc/guix.texi b/doc/guix.texi index 7a004d2ee4..5756b6aa2c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -1368,13 +1368,11 @@ source URLs. When this option is omitted, This means that substitutes may be downloaded from @var{urls}, as long as they are signed by a trusted signature (@pxref{Substitutes}). -@cindex build hook -@item --no-build-hook -Do not use the @dfn{build hook}. - -The build hook is a helper program that the daemon can start and to -which it submits build requests. This mechanism is used to offload -builds to other machines (@pxref{Daemon Offload Setup}). +@cindex offloading +@item --no-offload +Do not use offload builds to other machines (@pxref{Daemon Offload +Setup}). That is, always build things locally instead of offloading +builds to remote machines. @item --cache-failures Cache build failures. By default, only successful builds are cached. @@ -8112,10 +8110,10 @@ stashing one of the build results with @code{guix archive --export} (@pxref{Invoking guix archive}), then rebuilding, and finally comparing the two results. -@item --no-build-hook -Do not attempt to offload builds @i{via} the ``build hook'' of the daemon -(@pxref{Daemon Offload Setup}). That is, always build things locally -instead of offloading builds to remote machines. +@item --no-offload +Do not use offload builds to other machines (@pxref{Daemon Offload +Setup}). That is, always build things locally instead of offloading +builds to remote machines. @item --max-silent-time=@var{seconds} When the build or substitution process remains silent for more than diff --git a/etc/completion/fish/guix.fish b/etc/completion/fish/guix.fish index 525d39679d..6582f3a186 100644 --- a/etc/completion/fish/guix.fish +++ b/etc/completion/fish/guix.fish @@ -133,7 +133,7 @@ complete -f -c guix -n '__fish_guix_using_command pull' -l url -d 'download the complete -f -c guix -n '__fish_guix_using_command pull' -l bootstrap -d 'use the bootstrap Guile to build the new Guix' #### system -set -l remotecommands reconfigure roll-back switch-generation list-generations build container vm vm-image disk-image init extension-graph shepherd-graph load-path keep-failed keep-going dry-run fallback no-substitutes substitutes-urls no-grafts no-build-hook max-silent-time timeout verbosity rounds cores max-jobs derivation on-error image-size no-grub share expose full-boot +set -l remotecommands reconfigure roll-back switch-generation list-generations build container vm vm-image disk-image init extension-graph shepherd-graph load-path keep-failed keep-going dry-run fallback no-substitutes substitutes-urls no-grafts no-offload max-silent-time timeout verbosity rounds cores max-jobs derivation on-error image-size no-grub share expose full-boot complete -f -c guix -n '__fish_guix_needs_command' -a system -d 'Build the operating system declared in FILE according to ACTION.' complete -f -c guix -n '__fish_guix_using_command system' -l reconfigure -d 'switch to a new operating system configuration' complete -f -c guix -n '__fish_guix_using_command system' -l roll-back -d 'switch to the previous operating system configuration' @@ -156,7 +156,7 @@ complete -f -c guix -n '__fish_guix_using_command system' -l fallback -d 'fall b complete -f -c guix -n '__fish_guix_using_command system' -l no-substitutes -d 'build instead of resorting to pre-built substitutes' complete -f -c guix -n '__fish_guix_using_command system' -a "--substitute-urls=" -d 'fetch substitute from URLS if they are authorized' complete -f -c guix -n '__fish_guix_using_command system' -l no-grafts -d 'do not graft packages' -complete -f -c guix -n '__fish_guix_using_command system' -l no-build-hook -d 'do not attempt to offload builds via the build hook' +complete -f -c guix -n '__fish_guix_using_command system' -l no-offload -d 'do not attempt to offload builds' complete -f -c guix -n '__fish_guix_using_command system' -a "--max-silent-time=" -d 'mark the build as failed after SECONDS of silence' complete -f -c guix -n '__fish_guix_using_command system' -a "--timeout=" -d 'mark the build as failed after SECONDS of activity' complete -f -c guix -n '__fish_guix_using_command system' -a "--verbosity=" -d 'use the given verbosity LEVEL' @@ -174,7 +174,7 @@ complete -f -c guix -n '__fish_guix_using_command system' -a "--expose=" -d 'for complete -f -c guix -n '__fish_guix_using_command system' -l full-boot -d 'for \'vm\', make a full boot sequence' #### build -set -l remotecommands expression file source sources system target derivations check repair root quiet log-file load-path keep-failed keep-going dry-run fallback no-substitutes substitute-urls no-grafts no-build-hook max-silent-time timeout verbosity rounds cores max-jobs with-source with-input with-graft +set -l remotecommands expression file source sources system target derivations check repair root quiet log-file load-path keep-failed keep-going dry-run fallback no-substitutes substitute-urls no-grafts no-offload max-silent-time timeout verbosity rounds cores max-jobs with-source with-input with-graft complete -f -c guix -n '__fish_guix_needs_command' -a build -d 'Build the given PACKAGE-OR-DERIVATION and return their output paths.' complete -f -c guix -n '__fish_guix_using_command build' -a "--expression=" -d 'build the package or derivation EXPR evaluates to' complete -f -c guix -n '__fish_guix_using_command build' -s f -d 'build the package or derivation that the code within FILE evaluates to' --exclusive --arguments "(ls -ap)" @@ -201,7 +201,7 @@ complete -f -c guix -n '__fish_guix_using_command build' -l fallback -d 'fall ba complete -f -c guix -n '__fish_guix_using_command build' -l no-substitutes -d 'build instead of resorting to pre-built substitutes' complete -f -c guix -n '__fish_guix_using_command build' -a "--substitute-urls=" -d 'fetch substitute from URLS if they are authorized' complete -f -c guix -n '__fish_guix_using_command build' -l no-grafts -d 'do not graft packages' -complete -f -c guix -n '__fish_guix_using_command build' -l no-build-hook -d 'do not attempt to offload builds via the build hook' +complete -f -c guix -n '__fish_guix_using_command build' -l no-offload -d 'do not attempt to offload builds' complete -f -c guix -n '__fish_guix_using_command build' -a "--max-silent-time=" -d 'mark the build as failed after SECONDS of silence' complete -f -c guix -n '__fish_guix_using_command build' -a "--timeout=" -d 'mark the build as failed after SECONDS of activity' complete -f -c guix -n '__fish_guix_using_command build' -a "--verbosity=" -d 'use the given verbosity LEVEL' @@ -215,7 +215,7 @@ complete -f -c guix -n '__fish_guix_using_command build' -a "--with-input=" -d ' complete -f -c guix -n '__fish_guix_using_command build' -a "--with-graft=" -d 'PACKAGE=REPLACEMENT .. graft REPLACEMENT on packages that refer to PACKAGE' #### package -set -l remotecommands install install-from-expression install-from-file remove upgrade manifest do-no-upgrade roll-back search-paths list-generations delete-generations switch-generation profile bootstrap verbose search list-installed list-available show load-path keep-failed keep-going dry-run fallback no.substitutes substitute-urls no-grafts no-build-hook max-silent-time timenout verbosity rounds cores max-jobs with-source with-input with-graft +set -l remotecommands install install-from-expression install-from-file remove upgrade manifest do-no-upgrade roll-back search-paths list-generations delete-generations switch-generation profile bootstrap verbose search list-installed list-available show load-path keep-failed keep-going dry-run fallback no.substitutes substitute-urls no-grafts no-offload max-silent-time timenout verbosity rounds cores max-jobs with-source with-input with-graft complete -f -c guix -n '__fish_guix_needs_command' -a package -d 'Install, remove, or upgrade packages in a single transaction.' complete -f -c guix -n '__fish_guix_using_command package' -s i -l install -d 'install PACKAGEs' complete -f -c guix -n '__fish_guix_using_command package' -s e -d 'install the package EXP evaluates to' @@ -252,7 +252,7 @@ complete -f -c guix -n '__fish_guix_using_command package' -l fallback -d 'fall complete -f -c guix -n '__fish_guix_using_command package' -l no-substitutes -d 'build instead of resorting to pre-built substitutes' complete -f -c guix -n '__fish_guix_using_command package' -a "--substitute-urls=" -d 'URLS fetch substitute from URLS if they are authorized' complete -f -c guix -n '__fish_guix_using_command package' -l no-grafts -d 'do not graft packages' -complete -f -c guix -n '__fish_guix_using_command package' -l no-build-hook -d 'do not attempt to offload builds via the build hook' +complete -f -c guix -n '__fish_guix_using_command package' -l no-offload -d 'do not attempt to offload builds' complete -f -c guix -n '__fish_guix_using_command package' -a "--max-silent-time=" -d 'SECONDS mark the build as failed after SECONDS of silence' complete -f -c guix -n '__fish_guix_using_command package' -a "--timeout=" -d 'SECONDS mark the build as failed after SECONDS of activity' complete -f -c guix -n '__fish_guix_using_command package' -a "--verbosity=" -d 'LEVEL use the given verbosity LEVEL' @@ -391,7 +391,7 @@ complete -f -c guix -n '__fish_guix_using_command gc' -l list-failures -d 'list complete -f -c guix -n '__fish_guix_using_command gc' -l clear-failures -d 'remove PATHS from the set of cached failures' #### environment -set -l remotecommands expression load ad-hoc pure search-paths system root container network share expose bootstrap load-path keep-failed keep-going dry-run fallback no-substitutes substitute-urls no-grafts no-build-hook max-silent-time timeout verbosity rounds cores max-jobs +set -l remotecommands expression load ad-hoc pure search-paths system root container network share expose bootstrap load-path keep-failed keep-going dry-run fallback no-substitutes substitute-urls no-grafts no-offload max-silent-time timeout verbosity rounds cores max-jobs complete -f -c guix -n '__fish_guix_needs_command' -a environment -d 'Build an environment that includes the dependencies of PACKAGE and execute COMMAND or an interactive shell in that environment.' complete -f -c guix -n '__fish_guix_using_command environment' -s e -d 'Create environment for the package that EXPR evaluates to' complete -f -c guix -n '__fish_guix_using_command environment' -a "--expression=" -d 'Create environment for the package that EXPR evaluates to' @@ -418,7 +418,7 @@ complete -f -c guix -n '__fish_guix_using_command environment' -l fallback -d 'f complete -f -c guix -n '__fish_guix_using_command environment' -l no-substitutes -d 'build instead of resorting to pre-built substitutes' complete -f -c guix -n '__fish_guix_using_command environment' -a "--substitute-urls=" -d 'fetch substitute from URLS if they are authorized' complete -f -c guix -n '__fish_guix_using_command environment' -l no-grafts -d 'do not graft packages' -complete -f -c guix -n '__fish_guix_using_command environment' -l no-build-hook -d 'do not attempt to offload builds via the build hook' +complete -f -c guix -n '__fish_guix_using_command environment' -l no-offload -d 'do not attempt to offload builds' complete -f -c guix -n '__fish_guix_using_command environment' -a "--max-silent-time=" -d 'mark the build as failed after SECONDS of silence' complete -f -c guix -n '__fish_guix_using_command environment' -a "--timeout=" -d 'mark the build as failed after SECONDS of activity' complete -f -c guix -n '__fish_guix_using_command environment' -a "--verbosity=" -d 'use the given verbosity LEVEL' @@ -432,7 +432,7 @@ complete -f -c guix -n '__fish_guix_using_command environment' -a "--max-jobs=" complete -f -c guix -n '__fish_guix_needs_command' -a edit -d 'Start $VISUAL or $EDITOR to edit the definitions of PACKAGE.' #### copy -set -l remotecommands to= from= load-path= keep-failed keep-going dry-run fallback no-substitutes substitute-urls= no-grafts no-build-hook max-silent-time= timeout= verbosity= rounds= cores= max-jobs= +set -l remotecommands to= from= load-path= keep-failed keep-going dry-run fallback no-substitutes substitute-urls= no-grafts no-offload max-silent-time= timeout= verbosity= rounds= cores= max-jobs= complete -f -c guix -n '__fish_guix_needs_command' -a copy -d 'Copy ITEMS to or from the specified host over SSH.' complete -f -c guix -n '__fish_guix_using_command copy' -a "--to=" -d 'send ITEMS to HOST' complete -f -c guix -n '__fish_guix_using_command copy' -a "--from=" -d 'receive ITEMS from HOST' @@ -445,7 +445,7 @@ complete -f -c guix -n '__fish_guix_using_command copy' -l fallback -d 'fall bac complete -f -c guix -n '__fish_guix_using_command copy' -l no-substitutes -d 'build instead of resorting to pre-built substitutes' complete -f -c guix -n '__fish_guix_using_command copy' -a "--substitute-urls=" -d 'fetch substitute from URLS if they are authorized' complete -f -c guix -n '__fish_guix_using_command copy' -l no-grafts -d 'do not graft packages' -complete -f -c guix -n '__fish_guix_using_command copy' -l no-build-hook -d 'do not attempt to offload builds via the build hook' +complete -f -c guix -n '__fish_guix_using_command copy' -l no-offload -d 'do not attempt to offload builds' complete -f -c guix -n '__fish_guix_using_command copy' -a "--max-silent-time=" -d 'mark the build as failed after SECONDS of silence' complete -f -c guix -n '__fish_guix_using_command copy' -a "--timeout=" -d 'mark the build as failed after SECONDS of activity' complete -f -c guix -n '__fish_guix_using_command copy' -a "--verbosity=" -d 'use the given verbosity LEVEL' @@ -467,7 +467,7 @@ complete -f -c guix -n '__fish_guix_using_command challenge' -a "--substitute-ur complete -f -c guix -n '__fish_guix_using_command challenge' -s v -l verbose -d 'show details about successful comparisons' #### archive -set -l remotecommands export format= recursive import missing extract= generate-key authorize expression= source system= target= load-path= keep-failed keep-going dry-run fallback no-substitutes substitute-urls= no-grafts no-build-hook max-silent-time= timeout= verbosity= rounds= cores= max-jobs= +set -l remotecommands export format= recursive import missing extract= generate-key authorize expression= source system= target= load-path= keep-failed keep-going dry-run fallback no-substitutes substitute-urls= no-grafts no-offload max-silent-time= timeout= verbosity= rounds= cores= max-jobs= complete -f -c guix -n '__fish_guix_needs_command' -a archive -d 'Export/import one or more packages from/to the store.' complete -f -c guix -n '__fish_guix_using_command archive' -l export -d 'export the specified files/packages to stdout' complete -f -c guix -n '__fish_guix_using_command archive' -a "--format=" -d 'export files/packages in the specified format FMT' @@ -489,7 +489,7 @@ complete -f -c guix -n '__fish_guix_using_command archive' -l fallback -d 'fall complete -f -c guix -n '__fish_guix_using_command archive' -l no-substitutes -d 'build instead of resorting to pre-built substitutes' complete -f -c guix -n '__fish_guix_using_command archive' -a "--substitute-urls=" -d 'fetch substitute from URLS if they are authorized' complete -f -c guix -n '__fish_guix_using_command archive' -l no-grafts -d 'do not graft packages' -complete -f -c guix -n '__fish_guix_using_command archive' -l no-build-hook -d 'do not attempt to offload builds via the build hook' +complete -f -c guix -n '__fish_guix_using_command archive' -l no-offload -d 'do not attempt to offload builds' complete -f -c guix -n '__fish_guix_using_command archive' -a "--max-silent-time=" -d 'mark the build as failed after SECONDS of silence' complete -f -c guix -n '__fish_guix_using_command archive' -a "--timeout=" -f -d 'mark the build as failed after SECONDS of activity' complete -f -c guix -n '__fish_guix_using_command archive' -a "--verbosity=" -d 'use the given verbosity LEVEL' @@ -498,7 +498,7 @@ complete -f -c guix -n '__fish_guix_using_command archive' -a "--cores=" -d 'all complete -f -c guix -n '__fish_guix_using_command archive' -a "--max-jobs=" -d 'allow at most N build jobs' #### pack -set -l remotecommands --load-path= --keep-failed --keep-going --dry-run --fallback --no-substitutes --substitute-urls= --no-grafts --no-build-hook --max-silent-time= --timeout= --verbosity= --rounds= --cores= --max-jobs= --with-source= --with-input= --with-graft= --format= --expression= --system= --target= --compression= --symlink= --localstatedir --help --version +set -l remotecommands --load-path= --keep-failed --keep-going --dry-run --fallback --no-substitutes --substitute-urls= --no-grafts --no-offload --max-silent-time= --timeout= --verbosity= --rounds= --cores= --max-jobs= --with-source= --with-input= --with-graft= --format= --expression= --system= --target= --compression= --symlink= --localstatedir --help --version complete -f -c guix -n '__fish_guix_needs_command' -a pack -d 'Create a bundle of PACKAGE.' complete -f -c guix -n '__fish_guix_using_command pack' -a "--load-path=" -d 'prepend DIR to the package module search path' complete -f -c guix -n '__fish_guix_using_command pack' -s L -d 'prepend DIR to the package module search path' @@ -512,7 +512,7 @@ complete -f -c guix -n '__fish_guix_using_command pack' -a "--fallback" -d 'fall complete -f -c guix -n '__fish_guix_using_command pack' -a "--no-substitutes" -d 'build instead of resorting to pre-built substitutes' complete -f -c guix -n '__fish_guix_using_command pack' -a "--substitute-urls=" -d 'fetch substitute from URLS if they are authorized' complete -f -c guix -n '__fish_guix_using_command pack' -a "--no-grafts" -d 'do not graft packages' -complete -f -c guix -n '__fish_guix_using_command pack' -a "--no-build-hook" -d 'do not attempt to offload builds via the build hook' +complete -f -c guix -n '__fish_guix_using_command pack' -a "--no-offload" -d 'do not attempt to offload builds via the build hook' complete -f -c guix -n '__fish_guix_using_command pack' -a "--max-silent-time=" -d 'mark the build as failed after SECONDS of silence' complete -f -c guix -n '__fish_guix_using_command pack' -a "--timeout=" -d 'mark the build as failed after SECONDS of activity' complete -f -c guix -n '__fish_guix_using_command pack' -a "--verbosity=" -d 'use the given verbosity LEVEL' diff --git a/etc/completion/zsh/_guix b/etc/completion/zsh/_guix index 3760bb629b..ae93b62b1d 100644 --- a/etc/completion/zsh/_guix +++ b/etc/completion/zsh/_guix @@ -87,7 +87,7 @@ _guix_list_installed_packages() '--no-substitutes[build instead of resorting to pre-built substitutes]' \ '--substitute-urls=[fetch substitute from URLS if they are authorized]:URLS:_urls' \ '--no-grafts[do not graft packages]' \ - '--no-build-hook[do not attempt to offload builds via the build hook]' \ + '--no-offload[do not attempt to offload builds]' \ '--max-silent-time=[mark the build as failed after SECONDS of silence]:SECONDS' \ '--timeout=[mark the build as failed after SECONDS of activity]:SECONDS' \ '--verbosity=[use the given verbosity LEVEL]:LEVEL' \ @@ -158,7 +158,7 @@ _guix_list_installed_packages() '--no-substitutes[build instead of resorting to pre-built substitutes]' \ '--substitute-urls=[fetch substitute from URLS if they are authorized]:URLS:_urls' \ '--no-grafts[do not graft packages]' \ - '--no-build-hook[do not attempt to offload builds via the build hook]' \ + '--no-offload[do not attempt to offload builds]' \ '--max-silent-time=[mark the build as failed after SECONDS of silence]:SECONDS' \ '--timeout=[mark the build as failed after SECONDS of activity]:SECONDS' \ '--verbosity=[use the given verbosity LEVEL]:LEVEL' \ @@ -282,7 +282,7 @@ _guix_list_installed_packages() '--no-substitutes[build instead of resorting to pre-built substitutes]' \ '--substitute-urls=[fetch substitute from URLS if they are authorized]:URLS:_urls' \ '--no-grafts[do not graft packages]' \ - '--no-build-hook[do not attempt to offload builds via the build hook]' \ + '--no-offload[do not attempt to offload builds]' \ '--max-silent-time=[mark the build as failed after SECONDS of silence]:SECONDS' \ '--timeout=[mark the build as failed after SECONDS of activity]:SECONDS' \ '--verbosity=[use the given verbosity LEVEL]:LEVEL' \ @@ -374,7 +374,7 @@ _guix_list_installed_packages() '--no-substitutes[build instead of resorting to pre-built substitutes]' \ '--substitute-urls=[fetch substitute from URLS if they are authorized]:URL:_urls' \ '--no-grafts[do not graft packages]' \ - '--no-build-hook[do not attempt to offload builds via the build hook]' \ + '--no-offload[do not attempt to offload builds]' \ '--max-silent-time=[mark the build as failed after SECONDS of silence]:SECONDS' \ '--timeout=[mark the build as failed after SECONDS of activity]:SECONDS' \ '--verbosity=[use the given verbosity LEVEL]:LEVEL' \ diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index ae78df9c5c..e72b89d2d4 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -504,7 +504,7 @@ (define (show-build-options-help) (display (G_ " --no-grafts do not graft packages")) (display (G_ " - --no-build-hook do not attempt to offload builds via the build hook")) + --no-offload do not attempt to offload builds")) (display (G_ " --max-silent-time=SECONDS mark the build as failed after SECONDS of silence")) @@ -610,8 +610,12 @@ (define %standard-build-options (alist-cons 'graft? #f (alist-delete 'graft? result eq?)) rest))) - (option '("no-build-hook") #f #f + (option '("no-offload" "no-build-hook") #f #f (lambda (opt name arg result . rest) + (when (string=? name "no-build-hook") + (warning (G_ "'--no-build-hook' is deprecated; \ +use '--no-offload' instead~%"))) + (apply values (alist-cons 'build-hook? #f (alist-delete 'build-hook? result)) diff --git a/guix/scripts/offload.scm b/guix/scripts/offload.scm index 1384f6b41d..18473684eb 100644 --- a/guix/scripts/offload.scm +++ b/guix/scripts/offload.scm @@ -60,7 +60,7 @@ (define-module (guix scripts offload) ;;; retrieving the build output(s) over SSH upon success. ;;; ;;; This command should not be used directly; instead, it is called on-demand -;;; by the daemon, unless it was started with '--no-build-hook' or a client +;;; by the daemon, unless it was started with '--no-offload' or a client ;;; inhibited build hooks. ;;; ;;; Code: diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc index 6f9c404c8d..cd949aca67 100644 --- a/nix/nix-daemon/guix-daemon.cc +++ b/nix/nix-daemon/guix-daemon.cc @@ -113,8 +113,11 @@ static const struct argp_option options[] = n_("do not use substitutes") }, { "substitute-urls", GUIX_OPT_SUBSTITUTE_URLS, n_("URLS"), 0, n_("use URLS as the default list of substitute providers") }, - { "no-build-hook", GUIX_OPT_NO_BUILD_HOOK, 0, 0, - n_("do not use the 'build hook'") }, + { "no-offload", GUIX_OPT_NO_BUILD_HOOK, 0, 0, + n_("do not attempt to offload builds") }, + { "no-build-hook", GUIX_OPT_NO_BUILD_HOOK, 0, + OPTION_HIDDEN, // deprecated + n_("do not attempt to offload builds") }, { "cache-failures", GUIX_OPT_CACHE_FAILURES, 0, 0, n_("cache build failures") }, { "rounds", GUIX_OPT_BUILD_ROUNDS, "N", 0, -- cgit v1.2.3 From 3a4d5ddd322c7daf0a8c83ca2c87c3fc38b19f0b Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian Date: Mon, 11 Nov 2019 19:14:16 -0800 Subject: daemon: boost::format: Fix typo "referred". MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * nix/boost/format/exceptions.hpp (too_few_args): Fix typo. (too_many_args): Fix typo. Signed-off-by: Ludovic Courtès --- nix/boost/format/exceptions.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nix') diff --git a/nix/boost/format/exceptions.hpp b/nix/boost/format/exceptions.hpp index 79e452449e..80da6d5718 100644 --- a/nix/boost/format/exceptions.hpp +++ b/nix/boost/format/exceptions.hpp @@ -59,7 +59,7 @@ public: virtual const char *what() const throw() { return "boost::too_few_args: " - "format-string refered to more arguments than were passed"; + "format-string referred to more arguments than were passed"; } }; @@ -70,7 +70,7 @@ public: virtual const char *what() const throw() { return "boost::too_many_args: " - "format-string refered to less arguments than were passed"; + "format-string referred to less arguments than were passed"; } }; -- cgit v1.2.3 From 7738a72186583afb3bb2e0a866c8aba130372400 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 26 Nov 2019 23:35:24 +0100 Subject: daemon: GC remove-unused-links phase uses 'statx' when available. * config-daemon.ac: Check for 'statx'. * nix/libstore/gc.cc (LocalStore::removeUnusedLinks) [HAVE_STATX]: Use 'statx' instead of 'lstat'. --- config-daemon.ac | 3 ++- nix/libstore/gc.cc | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'nix') diff --git a/config-daemon.ac b/config-daemon.ac index 848e1e58da..50ead355a8 100644 --- a/config-daemon.ac +++ b/config-daemon.ac @@ -91,8 +91,9 @@ if test "x$guix_build_daemon" = "xyes"; then dnl sched_setaffinity: to improve RPC locality. dnl statvfs: to detect disk-full conditions. dnl strsignal: for error reporting. + dnl statx: fine-grain 'stat' call, new in glibc 2.28. AC_CHECK_FUNCS([lutimes lchown posix_fallocate sched_setaffinity \ - statvfs nanosleep strsignal]) + statvfs nanosleep strsignal statx]) dnl Check whether the store optimiser can optimise symlinks. AC_MSG_CHECKING([whether it is possible to create a link to a symlink]) diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc index 7976ff7d76..29b75aa875 100644 --- a/nix/libstore/gc.cc +++ b/nix/libstore/gc.cc @@ -570,8 +570,17 @@ void LocalStore::removeUnusedLinks(const GCState & state) if (name == "." || name == "..") continue; Path path = linksDir + "/" + name; +#ifdef HAVE_STATX +# define st_size stx_size +# define st_nlink stx_nlink + struct statx st; + if (statx(AT_FDCWD, path.c_str(), + AT_SYMLINK_NOFOLLOW | AT_STATX_DONT_SYNC, + STATX_SIZE | STATX_NLINK, &st) == -1) +#else struct stat st; if (lstat(path.c_str(), &st) == -1) +#endif throw SysError(format("statting `%1%'") % path); if (st.st_nlink != 1) { @@ -586,6 +595,8 @@ void LocalStore::removeUnusedLinks(const GCState & state) throw SysError(format("deleting `%1%'") % path); state.results.bytesFreed += st.st_size; +#undef st_size +#undef st_nlink } struct stat st; -- cgit v1.2.3 From fbecb5cddb2d36cc1a29dac3751b017fa531383c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 26 Nov 2019 23:51:11 +0100 Subject: daemon: 'deletePath' uses 'statx' when available. * nix/libutil/util.cc (_deletePath) [HAVE_STATX]: Use 'statx'. --- nix/libutil/util.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'nix') diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc index 9a83876013..8093b4c8b4 100644 --- a/nix/libutil/util.cc +++ b/nix/libutil/util.cc @@ -306,7 +306,18 @@ static void _deletePath(const Path & path, unsigned long long & bytesFreed) printMsg(lvlVomit, format("%1%") % path); +#ifdef HAVE_STATX +# define st_mode stx_mode +# define st_size stx_size +# define st_nlink stx_nlink + struct statx st; + if (statx(AT_FDCWD, path.c_str(), + AT_SYMLINK_NOFOLLOW, + STATX_SIZE | STATX_NLINK | STATX_MODE, &st) == -1) + throw SysError(format("getting status of `%1%'") % path); +#else struct stat st = lstat(path); +#endif if (!S_ISDIR(st.st_mode) && st.st_nlink == 1) bytesFreed += st.st_size; @@ -321,6 +332,9 @@ static void _deletePath(const Path & path, unsigned long long & bytesFreed) for (auto & i : readDirectory(path)) _deletePath(path + "/" + i.name, bytesFreed); } +#undef st_mode +#undef st_size +#undef st_nlink if (remove(path.c_str()) == -1) throw SysError(format("cannot unlink `%1%'") % path); -- cgit v1.2.3 From b6b014bf42f68fcb71d37204328babb81e0e0855 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 29 Nov 2019 13:54:36 +0100 Subject: daemon: 'pathExists' uses 'statx' when available. * nix/libutil/util.cc (pathExists) [HAVE_STATX]: New code. --- nix/libutil/util.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'nix') diff --git a/nix/libutil/util.cc b/nix/libutil/util.cc index 8093b4c8b4..faba3789df 100644 --- a/nix/libutil/util.cc +++ b/nix/libutil/util.cc @@ -177,8 +177,13 @@ struct stat lstat(const Path & path) bool pathExists(const Path & path) { int res; +#ifdef HAVE_STATX + struct statx st; + res = statx(AT_FDCWD, path.c_str(), AT_SYMLINK_NOFOLLOW, 0, &st); +#else struct stat st; res = lstat(path.c_str(), &st); +#endif if (!res) return true; if (errno != ENOENT && errno != ENOTDIR) throw SysError(format("getting status of %1%") % path); -- cgit v1.2.3