Commit Graph

19 Commits

Author SHA1 Message Date
Jan (janneke) Nieuwenhuizen fdef0d85ce
scripts: Typo in args-fold*.
* guix/scripts.scm (args-fold*): Add missing 'args' parameter so that
the all parameter names match their value.
2020-07-12 10:07:59 +02:00
Pierre Neidhardt 1d24cc6de6
scripts: Show disk-space warning when under the min of the thresholds.
Follow-up to 71c3c3df92 which got the logic
wrong.

* guix/scripts.scm (warn-about-disk-space): Compare AVAILABLE to the min of
RELATIVE-THRESHOLD-IN-BYTES and ABSOLUTE-THRESHOLD-IN-BYTES, not the max.
2020-03-06 08:32:01 +01:00
Ludovic Courtès 71c3c3df92
scripts: Adjust disk-space warning functionality.
This is a followup to fb7eec3a84.

* guix/scripts.scm (warn-about-disk-space): Do not multiply
ABSOLUTE-THRESHOLD-IN-BYTES by 2^30.  Compare AVAILABLE to the max of
RELATIVE-THRESHOLD-IN-BYTES and ABSOLUTE-THRESHOLD-IN-BYTES, not the
min.  Display AVAILABLE divided by 2^30.
2020-02-27 23:56:14 +01:00
Pierre Neidhardt fb7eec3a84
scripts: Emit GC hint if free space is lower than absolute and relative threshold.
* guix/scripts.scm (%disk-space-warning-absolute): New variable.
(warn-about-disk-space): Test against %disk-space-warning-absolute.
Fix error in display-hint due to extraneous 'profile' argument.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-02-26 22:05:56 +01:00
Ludovic Courtès 9c074f61ef
scripts: GC hint suggests 'guix gc -d 1m'.
* guix/scripts.scm (warn-about-disk-space): Suggest 'guix gc -d'.
2019-04-10 17:09:47 +02:00
Ludovic Courtès 9e5f2060ad
scripts: Skip 'guix pull' suggestion when running code from a checkout.
* guix/scripts.scm (warn-about-old-distro): Do not warn when
GUIX_UNINSTALLED is set.
2019-03-27 11:54:06 +01:00
Ludovic Courtès 55da450a1f
scripts: 'warn-about-old-distro' looks at the age of the running Guix.
This fixes a discrepancy that could be seen when running:

  sudo guix system …

where 'guix' would warn about the age of root's Guix, even though the
running Guix is the user's, not root's.

* guix/scripts.scm (warn-about-old-distro)[false-if-not-found]: Remove.
Obtain the profile date by calling 'current-profile-date' instead of
stat'ing "current-guix".
2019-03-17 22:55:01 +01:00
Ludovic Courtès 62a14bd26f
scripts: Suggest running 'guix gc' when we're short on disk space.
* guix/scripts.scm (%disk-space-warning): New variable.
(warn-about-disk-space): New procedure.
* guix/scripts/package.scm (build-and-use-profile): Use it.
* guix/scripts/system.scm (process-action): Likewise.
2018-10-23 01:04:39 +02:00
Ludovic Courtès 795d430d90
pull: Turn ~/.config/guix/current into a symlink to /var/guix/profiles.
This is more consistent with what 'guix package' does, more pleasant for
users (we no longer clobber ~/.config/guix), and more
cluster-friendly (since /var/guix/profiles is usually an NFS share
already.)

* guix/scripts/pull.scm (%current-profile, %user-profile-directory): New
variables.
(migrate-generations, ensure-default-profile): New procedures.
(guix-pull): Use %CURRENT-PROFILE by default.  Call
'ensure-default-profile'.
* doc/guix.texi (Invoking guix pull): Adjust 'guix package -p
~/.config/guix/current' example.
* guix/scripts.scm (warn-about-old-distro): Check %PROFILE-DIRECTORY
"/current-guix".
2018-10-11 18:29:11 +02:00
Ludovic Courtès 75e24d7b0e
pull: Install the new Guix in a profile.
* guix/scripts/pull.scm (%pull-version): New variable.
(build-from-source): Pass #:pull-version to BUILD.
(whole-package-for-legacy, derivation->manifest-entry): New procedure.
(build-and-install): Rewrite in terms of 'build-and-use-profile'.
* guix/scripts/system.scm (maybe-suggest-running-guix-pull)[latest]:
Switch to "/current".
* scripts/guix.in (augment-load-paths!): Remove use of
~/.config/guix/latest.
* build-aux/compile-as-derivation.scm: Replace "/guix/latest/" with
"/current/share/guile/site/X.Y"
* guix/scripts.scm (warn-about-old-distro)[age]: Check "/current"
instead of "/latest".
* doc/guix.texi (Invoking guix pull): Document it.
* doc/contributing.texi (Running Guix Before It Is Installed): Remove
footnote about abusing ~/.config/guix/latest.
2018-06-09 12:02:27 +02:00
Ludovic Courtès a1ff7e1d8d
scripts: Factorize option parsing sans 'GUIX_BUILD_OPTIONS'.
* guix/scripts.scm (parse-command-line): Add #:build-options? parameter
and honor it.
* guix/scripts/challenge.scm (guix-challenge): Use 'parse-command-line'
with #:build-options? #f instead of 'args-fold*'.
* guix/scripts/gc.scm (guix-gc): Likewise.
* guix/scripts/graph.scm (guix-graph): Likewise.
* guix/scripts/hash.scm (guix-hash): Likewise.
* guix/scripts/lint.scm (guix-lint): Likewise.
* guix/scripts/refresh.scm (guix-refresh): Likewise.
* guix/scripts/size.scm (guix-size): Likewise.
* guix/scripts/weather.scm (guix-weather): Likewise.
2017-10-28 09:45:53 +02:00
Ludovic Courtès e06ca952ed
scripts: Do not create the config directory.
This fixes runs of 'guix package' and 'guix system' tests in
environments where $HOME is read-only.

* guix/ui.scm (config-directory): Add #:ensure? parameter and honor it.
* guix/scripts.scm (warn-about-old-distro): Pass #:ensure? #f to
'config-directory'.
2017-05-13 00:03:46 +02:00
Ludovic Courtès bc0e6c9312
scripts: Fix singular/plural message mismatch.
* guix/scripts.scm (warn-about-old-distro): Swap singular and plural
forms in 'N_' call.
2017-05-10 23:38:04 +02:00
Ludovic Courtès 7fd952e052
scripts: Warn about old distro.
Fixes <http://bugs.gnu.org/25852>.
Suggested by Mark H Weaver <mhw@netris.org>.

* guix/scripts.scm (%distro-age-warning): New variable.
(warn-about-old-distro): New procedure.
* guix/scripts/package.scm (process-actions): Call
'warn-about-old-distro'.
* guix/scripts/system.scm (process-action): Likewise.
2017-05-10 22:09:08 +02:00
Ludovic Courtès 69daee23af
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance.  See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.

* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'.  Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 16:16:17 +02:00
Alex Kost a82a201a8d
emacs: Disable grafts when dry-run is enabled.
* emacs/guix-main.scm (process-package-actions): Set grafting according
to 'dry-run?'.
* guix/scripts.scm (build-package): Disable grafts when 'dry-run?' is #t.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2016-07-30 18:17:03 +03:00
Alex Kost ad8b83bda0 emacs: Add 'guix-devel-build-package-source'.
Suggested by Ludovic Courtès <ludo@gnu.org>.

* guix/scripts.scm (build-package-source): New procedure.
* emacs/guix-devel.el (guix-devel-build-package-source): New command.
  (guix-devel-keys-map): Add key binding for it.
* doc/emacs.texi (Emacs Development): Document it.
2015-10-12 10:59:31 +03:00
Alex Kost 430505eba3 scripts: Add 'build-package'.
* guix/scripts/system.scm (maybe-build): Move to ...
* guix/scripts.scm: ...here.
  (build-package): New procedure.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2015-09-22 22:05:10 +03:00
Alex Kost 88981dd3e2 Add (guix scripts).
* guix/ui.scm: Add missing copyright lines.
  (args-fold*, environment-build-options, %default-argument-handler,
  parse-command-line): Move to ...
* guix/scripts.scm: ...here.  New file.
* guix/scripts/archive.scm: Use it.
* guix/scripts/build.scm: Likewise.
* guix/scripts/download.scm: Likewise.
* guix/scripts/edit.scm: Likewise.
* guix/scripts/environment.scm: Likewise.
* guix/scripts/gc.scm: Likewise.
* guix/scripts/graph.scm: Likewise.
* guix/scripts/hash.scm: Likewise.
* guix/scripts/import/cpan.scm: Likewise.
* guix/scripts/import/cran.scm: Likewise.
* guix/scripts/import/elpa.scm: Likewise.
* guix/scripts/import/gem.scm: Likewise.
* guix/scripts/import/gnu.scm: Likewise.
* guix/scripts/import/hackage.scm: Likewise.
* guix/scripts/import/nix.scm: Likewise.
* guix/scripts/import/pypi.scm: Likewise.
* guix/scripts/lint.scm: Likewise.
* guix/scripts/package.scm: Likewise.
* guix/scripts/publish.scm: Likewise.
* guix/scripts/pull.scm: Likewise.
* guix/scripts/refresh.scm: Likewise.
* guix/scripts/size.scm: Likewise.
* guix/scripts/system.scm: Likewise.
* tests/ui.scm (with-environment-variable, "parse-command-line",
  "parse-command-line and --no options"): Move to ...
* tests/scripts.scm: ...here.  New file.
* Makefile.am (MODULES): Add guix/scripts.scm.
  (SCM_TESTS): Add tests/scripts.scm.
* po/guix/POTFILES.in: Add guix/scripts.scm.
2015-09-18 21:42:06 +03:00