From 5c4fd77097e2cecfd4780e099af7954f86779fe1 Mon Sep 17 00:00:00 2001 From: Thiago Jung Bauermann Date: Wed, 15 Sep 2021 20:36:38 -0300 Subject: etc: Add systemd files for running ‘guix gc’ periodically MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * etc/guix-gc.service.in: New file. * etc/guix-gc.timer: Likewise. * .gitignore: Ignore generated ‘guix-gc.service’. * nix/local.mk (nodist_systemdservice_DATA): Add ‘guix-gc.service’ and ‘guix-gc.timer’. (EXTRA_DIST): Add ‘guix-gc.service.in’ and ‘guix-gc.timer’. * doc/guix.texi (Binary Installation): Mention the new systemd files. Signed-off-by: Mathieu Othacehe --- etc/guix-gc.service.in | 20 ++++++++++++++++++++ etc/guix-gc.timer | 15 +++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 etc/guix-gc.service.in create mode 100644 etc/guix-gc.timer (limited to 'etc') diff --git a/etc/guix-gc.service.in b/etc/guix-gc.service.in new file mode 100644 index 0000000000..2f1ca6584b --- /dev/null +++ b/etc/guix-gc.service.in @@ -0,0 +1,20 @@ +# This is a "service unit file" for the systemd init system to perform a +# one-shot 'guix gc' operation. It is meant to be triggered by a timer. +# Drop it in /etc/systemd/system or similar together with 'guix-gc.timer' +# to set it up. + +[Unit] +Description=Discard unused Guix store items + +[Service] +Type=oneshot +# Customize the 'guix gc' arguments to fit your needs. +ExecStart=@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix gc -d 1m -F 10G +PrivateDevices=yes +PrivateNetwork=yes +PrivateUsers=no +ProtectKernelTunables=yes +ProtectKernelModules=yes +ProtectControlGroups=yes +MemoryDenyWriteExecute=yes +SystemCallFilter=@default @file-system @basic-io @system-service diff --git a/etc/guix-gc.timer b/etc/guix-gc.timer new file mode 100644 index 0000000000..192132fbda --- /dev/null +++ b/etc/guix-gc.timer @@ -0,0 +1,15 @@ +# This is a "timer unit file" for the systemd init system to trigger +# 'guix-gc.service' periodically. Drop it in /etc/systemd/system or similar +# together with 'guix-gc.service' to set it up. + +[Unit] +Description=Discard unused Guix store items + +[Timer] +OnCalendar=weekly +AccuracySec=1h +Persistent=true +RandomizedDelaySec=6000 + +[Install] +WantedBy=timers.target -- cgit v1.2.3 From 3d15a19874f63dfc15eb6625558f279ccbc71d5d Mon Sep 17 00:00:00 2001 From: Xinglu Chen Date: Wed, 8 Sep 2021 15:45:39 +0200 Subject: etc: committer: Amend previous commit if a copyright line was added. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, the script would raise an error if a copyright line was added to a file in gnu/packages/. With this change, it will amend the previous commit whenever a copyright line is added, and add the copyright line to the commit. * etc/committer.scm.in (add-copyright-line): New procedure. (main): Check if a copyright line was added and call ‘add-copyright-line’ if necessary. Signed-off-by: Ludovic Courtès --- etc/committer.scm.in | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'etc') diff --git a/etc/committer.scm.in b/etc/committer.scm.in index e81ce16611..1ad83e37d7 100755 --- a/etc/committer.scm.in +++ b/etc/committer.scm.in @@ -5,6 +5,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2020, 2021 Ricardo Wurmus ;;; Copyright © 2021 Sarah Morgensen +;;; Copyright © 2021 Xinglu Chen ;;; ;;; This file is part of GNU Guix. ;;; @@ -288,6 +289,15 @@ (define (changelog-has-location? changelog) (break-string-with-newlines message/f 72) (break-string-with-newlines changelog/f 72)))) +(define (add-copyright-line line) + "Add the copyright line on LINE to the previous commit." + (let ((author (match:substring + (string-match "^\\+;;; Copyright ©[^[:alpha:]]+(.*)$" line) + 1))) + (format + (current-output-port) "Amend and add copyright line for ~a~%" author) + (system* "git" "commit" "--amend" "--no-edit"))) + (define (group-hunks-by-sexp hunks) "Return a list of pairs associating all hunks with the S-expression they are modifying." @@ -370,15 +380,23 @@ (define* (change-commit-message* file-name old new #:rest rest) (error "Cannot apply"))) (usleep %delay)) hunks) - (change-commit-message* (hunk-file-name (first hunks)) - old new) - (let ((port (open-pipe* OPEN_WRITE "git" "commit" "-F" "-"))) + (define copyright-line + (any (lambda (line) (and=> (string-prefix? "+;;; Copyright ©" line) + (const line))) + (hunk-diff-lines (first hunks)))) + (cond + (copyright-line + (add-copyright-line copyright-line)) + (else + (let ((port (open-pipe* OPEN_WRITE "git" "commit" "-F" "-"))) + (change-commit-message* (hunk-file-name (first hunks)) + old new) (change-commit-message* (hunk-file-name (first hunks)) old new port) (usleep %delay) (unless (eqv? 0 (status:exit-val (close-pipe port))) - (error "Cannot commit"))))) + (error "Cannot commit"))))))) ;; XXX: we recompute the hunks here because previous ;; insertions lead to offsets. (new+old+hunks (diff-info))))))) -- cgit v1.2.3 From 9102512748b5a44cc4214288159fd45dabe076be Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 21 Sep 2021 15:15:35 +0200 Subject: news: Add entry for "guix graph -M". * etc/news.scm: Add entry. --- etc/news.scm | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'etc') diff --git a/etc/news.scm b/etc/news.scm index 88d23d71ed..7404632b6e 100644 --- a/etc/news.scm +++ b/etc/news.scm @@ -23,6 +23,37 @@ (channel-news (version 0) + (entry (commit "5b32ad4f6f555d305659cee825879df075b06331") + (title + (en "New @option{--max-depth} option for @command{guix graph}") + (fr "Nouvelle option @option{--max-depth} pour @command{guix graph}")) + (body + (en "The @command{guix graph} command has a new @option{--max-depth} +(or @option{-M}) option, which allows you to restrict a graph to the given +depth---very useful when visualizing large graphs. For example, the command +below displays, using the @code{xdot} package, the dependency graph of +LibreOffice, including only nodes that are at most at distance 2 of +LibreOffice itself: + +@example +guix graph -M 2 libreoffice | xdot - +@end example + +See @command{info \"(guix) Invoking guix graph\"} for more information.") + (fr "La commande @command{guix graph} dispose d'une nouvelle option +@option{--max-depth} (ou @option{-M}) pour restreindre la profondeur d'un +graphe---très utile pour visualiser des gros graphes. Par exemple, la +commande ci-dessous affiche, en utilisant @code{xdot}, le graphe de dépendance +de LibreOffice en n'incluant que les nœuds qui sont au plus à distance 2 de +LibreOffice soi-même : + +@example +guix graph -M 2 libreoffice | xdot - +@end example + +Voir @command{info \"(guix.fr) Invoquer guix graph\"} pour plus +d'informations."))) + (entry (commit "82daab42811a2e3c7684ebdf12af75ff0fa67b99") (title (en "New @samp{deb} format for the @command{guix pack} command") -- cgit v1.2.3 From 09289d0d2ba4610b18dd32c9e6984f62ee547951 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 22 Sep 2021 12:00:15 +0200 Subject: news: Add entry for Git clone fallback to SWH. Suggested by zimoun. * etc/news.scm: Add entry. --- etc/news.scm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'etc') diff --git a/etc/news.scm b/etc/news.scm index 7404632b6e..a4f04e1282 100644 --- a/etc/news.scm +++ b/etc/news.scm @@ -54,6 +54,30 @@ Voir @command{info \"(guix.fr) Invoquer guix graph\"} pour plus d'informations."))) + (entry (commit "05f44c2d858a1e7b13c90362c35fa86bdc4d5a24") + (title + (en "Channel clones fall back to Software Heritage") + (fr "Les clones de canaux peuvent recourir à Software Heritage")) + (body + (en "When @command{guix time-machine} or @command{guix pull} fetches +a channel pinned to a specific commit, it now automatically falls back to +cloning it from the Software Heritage archive if the original URL is +unreachable. This contributes to long-term reproducibility. See +@command{info \"(guix) Replicating Guix\"}. + +Automatic fallback also works for other Git clones made on your behalf, such +as when using @option{--with-commit} and related package transformation +options.") + (fr "Quand la commande @command{guix time-machine} ou @command{guix +pull} récupère un canal fixé à une révision spécifique, elle est maintenant +capable de le cloner depuis l'archive Software Heritage si l'URL initiale +n'est plus disponible. Cela contribue à la reproductibilité à long terme. +Voir @command{info \"(guix.fr) Répliquer Guix\"}. + +Ce recours à Software Heritage fonctionne aussi pour les autres clones Git que +Guix peut faire, comme lorsqu'on utilise @option{--with-commit} et les options +de transformation de paquet similaires."))) + (entry (commit "82daab42811a2e3c7684ebdf12af75ff0fa67b99") (title (en "New @samp{deb} format for the @command{guix pack} command") -- cgit v1.2.3 From 84db46783be6debbd60e08d3184217e22bb7fd3b Mon Sep 17 00:00:00 2001 From: Florian Pelz Date: Thu, 23 Sep 2021 07:52:38 +0200 Subject: news: Add 'de' translation. * etc/news.scm: Add German translation of fallback to SWH entry. --- etc/news.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'etc') diff --git a/etc/news.scm b/etc/news.scm index a4f04e1282..6a81bfd69d 100644 --- a/etc/news.scm +++ b/etc/news.scm @@ -57,6 +57,7 @@ (entry (commit "05f44c2d858a1e7b13c90362c35fa86bdc4d5a24") (title (en "Channel clones fall back to Software Heritage") + (de "Zum Klonen von Kanälen wird notfalls auf Software Heritage zurückgegriffen") (fr "Les clones de canaux peuvent recourir à Software Heritage")) (body (en "When @command{guix time-machine} or @command{guix pull} fetches @@ -68,6 +69,17 @@ Automatic fallback also works for other Git clones made on your behalf, such as when using @option{--with-commit} and related package transformation options.") + (de "Wenn bei @command{guix time-machine} oder @command{guix +pull} ein bestimmter Commit eines Kanals bezogen werden soll, wird +jetzt für den Fall, dass die ursprüngliche URL unerreichbar ist, +automatisch vom Software-Heritage-Archiv geklont. Das trägt zur +langfristigen Reproduzierbarkeit bei. Siehe @command{info \"(guix.de) +Guix nachbilden\"}. + +Der automatische Rückgriff auf Software Heritage findet auch +Verwendung bei anderen Arten von Git-Klon, die Guix durchführt, z.B.@: +wenn Sie @option{--with-commit} und ähnliche Paketumwandlungsoptionen +einsetzen.") (fr "Quand la commande @command{guix time-machine} ou @command{guix pull} récupère un canal fixé à une révision spécifique, elle est maintenant capable de le cloner depuis l'archive Software Heritage si l'URL initiale -- cgit v1.2.3 From d96582f810ce41f06f657018c9d15bdef67c881e Mon Sep 17 00:00:00 2001 From: Florian Pelz Date: Thu, 23 Sep 2021 07:55:28 +0200 Subject: news: Add 'de' translation. * etc/news.scm: Add German translation of 'guix graph -M' entry. --- etc/news.scm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'etc') diff --git a/etc/news.scm b/etc/news.scm index 6a81bfd69d..63d832a610 100644 --- a/etc/news.scm +++ b/etc/news.scm @@ -26,6 +26,7 @@ (entry (commit "5b32ad4f6f555d305659cee825879df075b06331") (title (en "New @option{--max-depth} option for @command{guix graph}") + (de "Neue Option @option{--max-depth} für @command{guix graph}") (fr "Nouvelle option @option{--max-depth} pour @command{guix graph}")) (body (en "The @command{guix graph} command has a new @option{--max-depth} @@ -40,6 +41,20 @@ @end example See @command{info \"(guix) Invoking guix graph\"} for more information.") + (de "Der Befehl @command{guix graph} verfügt über eine neue +Befehlszeilenoption @option{--max-depth} (oder @option{-M}), mit der +Sie einen Graphen auf die angegebene Tiefe einschränken. Das ist vor +allem bei großen Graphen nützlich; zum Beispiel zeigt der folgende +Befehl, unter Verwendung des Pakets @code{xdot}, den +Abhängigkeitsgraphen von LibreOffice unter Ausschluss der Knoten, die +eine Distanz größer als 2 von LibreOffice selbst haben: + +@example +guix graph -M 2 libreoffice | xdot - +@end example + +Führen Sie @code{info \"(guix.de) Aufruf von guix graph\"} aus, um mehr zu +erfahren.") (fr "La commande @command{guix graph} dispose d'une nouvelle option @option{--max-depth} (ou @option{-M}) pour restreindre la profondeur d'un graphe---très utile pour visualiser des gros graphes. Par exemple, la -- cgit v1.2.3 From a2b937984a502f7129f3b84f631be92dde689022 Mon Sep 17 00:00:00 2001 From: Andrew Tropin Date: Fri, 24 Sep 2021 10:06:48 +0300 Subject: news: Add entry about Guix Home. * etc/news.scm: Add entry. Signed-off-by: Oleg Pykhalov --- etc/news.scm | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'etc') diff --git a/etc/news.scm b/etc/news.scm index 88d23d71ed..dcf07480ed 100644 --- a/etc/news.scm +++ b/etc/news.scm @@ -15,6 +15,7 @@ ;; Copyright © 2021 Chris Marusich ;; Copyright © 2021 Maxime Devos ;; Copyright © 2021 Xinglu Chen +;; Copyright © 2021 Andrew Tropin ;; ;; Copying and distribution of this file, with or without modification, are ;; permitted in any medium without royalty provided the copyright notice and @@ -22,6 +23,35 @@ (channel-news (version 0) +(entry (commit "a2324d8b56eabf8117bca220a507cc791edffd2e") + (title + (en "Guix Home is a part of GNU Guix") + (ru "Guix Home теперь поставляется в составе GNU Guix")) + (body + (en "Guix Home splitted out from rde project and now is a part of +Guix proper. The new @command{guix home} with its actions allows users to +manage their packages and configurations (aka. dotfiles) in a declarative way, +similar to how many people manage their system with @command{guix system}. + +Take a look at available actions and arguments: +@example +guix home --help +@end example + +See @command{info \"(guix) Home Configuration\"} for more information.") + (ru "Guix Home отделился от проекта rde и теперь является частью +Guix. Новая команда @command{guix home} даёт возможность пользователям +управлять их пакетами и конфигурациями (дотфайлами) для них в декларативном +стиле, аналогично тому, как многие люди управляют своими системами с помощью +@command{guix system}. + +Чтобы получить список доступных действий и аргументов: +@example +guix home --help +@end example + +Смотрите @command{info \"(guix) Home Configuration\"} для получения более +детальных сведений."))) (entry (commit "82daab42811a2e3c7684ebdf12af75ff0fa67b99") (title -- cgit v1.2.3 From 1c1bfe681a1d746fe824cd6022ae009e48e7cb6d Mon Sep 17 00:00:00 2001 From: Florian Pelz Date: Mon, 27 Sep 2021 18:50:13 +0200 Subject: news: Add 'de' translation. * etc/news.scm: Add German translation of Guix Home entry. --- etc/news.scm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'etc') diff --git a/etc/news.scm b/etc/news.scm index dc45aaf496..77808b126e 100644 --- a/etc/news.scm +++ b/etc/news.scm @@ -26,6 +26,7 @@ (entry (commit "a2324d8b56eabf8117bca220a507cc791edffd2e") (title (en "Guix Home is a part of GNU Guix") + (de "Guix Home ist jetzt Teil von GNU Guix") (ru "Guix Home теперь поставляется в составе GNU Guix")) (body (en "Guix Home splitted out from rde project and now is a part of @@ -39,6 +40,19 @@ @end example See @command{info \"(guix) Home Configuration\"} for more information.") + (de "Guix Home ist aus dem rde-Projekt ins offizielle Guix übernommen +worden. Der neue Befehl @command{guix home} ermöglicht es, die Pakete und +Konfigurationsdateien (Dotfiles) für ein Benutzerkonto im deklarativen Stil zu +verwalten. Es ist analog dazu, wie man @command{guix system} benutzen kann, um +sein System zu verwalten. + +Werfen Sie einen Blick auf die verfügbaren Aktionen und Argumente: +@example +guix home --help +@end example + +Führen Sie für mehr Informationen @command{info \"(guix) Home Configuration\"} +aus.") (ru "Guix Home отделился от проекта rde и теперь является частью Guix. Новая команда @command{guix home} даёт возможность пользователям управлять их пакетами и конфигурациями (дотфайлами) для них в декларативном -- cgit v1.2.3 From 62180be2ee342fb3a866531385e179563dae87a0 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 27 Sep 2021 21:33:46 +0200 Subject: news: Mention that Home is a "technology preview". * etc/news.scm: Mention that Home is a "technology preview". --- etc/news.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'etc') diff --git a/etc/news.scm b/etc/news.scm index 77808b126e..70757323d4 100644 --- a/etc/news.scm +++ b/etc/news.scm @@ -30,7 +30,10 @@ (ru "Guix Home теперь поставляется в составе GNU Guix")) (body (en "Guix Home splitted out from rde project and now is a part of -Guix proper. The new @command{guix home} with its actions allows users to +Guix proper. It is available as a @emph{technology preview} and thus subject +to change. + +The new @command{guix home} command with its actions allows users to manage their packages and configurations (aka. dotfiles) in a declarative way, similar to how many people manage their system with @command{guix system}. -- cgit v1.2.3 From 4687ee9cacae7dcc63d44365062de30e20da8b0e Mon Sep 17 00:00:00 2001 From: Florian Pelz Date: Wed, 29 Sep 2021 10:36:06 +0200 Subject: news: Adapt 'de' translation. * etc/news.scm: Mention that Guix Home is a "technology preview". --- etc/news.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'etc') diff --git a/etc/news.scm b/etc/news.scm index 70757323d4..47b4437426 100644 --- a/etc/news.scm +++ b/etc/news.scm @@ -44,7 +44,10 @@ See @command{info \"(guix) Home Configuration\"} for more information.") (de "Guix Home ist aus dem rde-Projekt ins offizielle Guix übernommen -worden. Der neue Befehl @command{guix home} ermöglicht es, die Pakete und +worden. Es ist als @emph{Technologievorschau} bereits verfügbar, aber die +Schnittstelle kann sich in Zukunft noch ändern. + +Der neue Befehl @command{guix home} ermöglicht es, die Pakete und Konfigurationsdateien (Dotfiles) für ein Benutzerkonto im deklarativen Stil zu verwalten. Es ist analog dazu, wie man @command{guix system} benutzen kann, um sein System zu verwalten. -- cgit v1.2.3 From e4ed0b3969ddbe44347c468c96ccfa057b2dd256 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Wed, 29 Sep 2021 16:53:17 +0200 Subject: guix-install.sh: Don't swallow wget errors. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using ‘-q’ suppresses *all* stderr output, including errors. * etc/guix-install.sh (chk_gpg_keyring, guix_get_bin_list, guix_get_bin): Substitute ‘--no-verbose’ for ‘-q’. Reported by Maxim Cournoyer --- etc/guix-install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'etc') diff --git a/etc/guix-install.sh b/etc/guix-install.sh index 4f0f89100d..b0d4a8b95e 100755 --- a/etc/guix-install.sh +++ b/etc/guix-install.sh @@ -139,12 +139,12 @@ chk_gpg_keyring() required to verify the Guix binary signature: $gpg_key_id. Would you like me to fetch it for you? (yes/no)"; then wget "https://sv.gnu.org/people/viewgpg.php?user_id=$user_id" \ - -qO - | gpg --import - + --no-verbose -O- | gpg --import - else _err "${ERR}Missing OpenPGP public key ($gpg_key_id). Fetch it with this command: - wget \"https://sv.gnu.org/people/viewgpg.php?user_id=$user_id\" -qO - | \ + wget \"https://sv.gnu.org/people/viewgpg.php?user_id=$user_id\" -O - | \ sudo -i gpg --import -" exit_flag=yes fi @@ -272,7 +272,7 @@ guix_get_bin_list() _debug "--- [ ${FUNCNAME[0]} ] ---" # Filter only version and architecture - bin_ver_ls=("$(wget -qO- "$gnu_url" \ + bin_ver_ls=("$(wget "$gnu_url" --no-verbose -O- \ | sed -n -e 's/.*guix-binary-\([0-9.]*[a-z0-9]*\)\..*.tar.xz.*/\1/p' \ | sort -Vu)") @@ -305,7 +305,7 @@ guix_get_bin() _msg "${INF}Downloading Guix release archive" wget --help | grep -q '\--show-progress' \ - && wget_args=("-q" "--show-progress") + && wget_args=("--no-verbose" "--show-progress") if wget "${wget_args[@]}" -P "$dl_path" \ "${url}/${bin_ver}.tar.xz" "${url}/${bin_ver}.tar.xz.sig"; then -- cgit v1.2.3 From 6fba67df1928a62abc7939bd8ff020e998ad8d6b Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 3 Oct 2021 13:15:56 +0200 Subject: bash completion: Consolidate similar $command ‘if’ branches. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * etc/completion/bash/guix (_guix_complete): Combine the ‘upgrade’ and ‘remove’ commands, as well as ‘download’, ‘gc’, and ‘hash’. --- etc/completion/bash/guix | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'etc') diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix index a9386e7794..112ea789de 100644 --- a/etc/completion/bash/guix +++ b/etc/completion/bash/guix @@ -237,15 +237,7 @@ _guix_complete () else _guix_complete_available_package "$word_at_point" fi - elif [[ "$command" = "remove" ]] - then - if _guix_is_dash_L || _guix_is_dash_m || _guix_is_dash_p - then - _guix_complete_file - else - _guix_complete_installed_package "$word_at_point" - fi - elif [[ "$command" = "upgrade" ]] + elif [[ "$command" = "upgrade" || "$command" = "remove" ]] then if _guix_is_dash_L || _guix_is_dash_m || _guix_is_dash_p then @@ -272,9 +264,9 @@ _guix_complete () else _guix_complete_available_package "$word_at_point" fi - elif [[ "$command" = "download" ]] + elif [[ "$command" = "download" || "$command" = "gc" || "$command" = "hash" ]] then - _guix_complete_file + _guix_complete_file elif [[ "$command" = "system" ]] then case $COMP_CWORD in @@ -305,9 +297,6 @@ _guix_complete () elif [[ "$command" = "import" ]] then _guix_complete_subcommand - elif [[ "$command" = "hash" || "$command" = "gc" ]] - then - _guix_complete_file elif [[ "$command" = "weather" ]] then if _guix_is_dash_m -- cgit v1.2.3 From 17f76b209ceca9972dcd375d2a0f869abc6d1f26 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 3 Oct 2021 14:02:04 +0200 Subject: bash completion: Append to $COMPREPLY where possible. _guix_complete is always called with a fresh empty array. * etc/completion/bash/guix (_guix_complete_command) (_guix_complete_subcommand, _guix_complete_installed_package) (_guix_complete_option, _guix_complete_pid): Append to $COMPREPLY rather than re-assigning. --- etc/completion/bash/guix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'etc') diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix index 112ea789de..ea8f76f3e0 100644 --- a/etc/completion/bash/guix +++ b/etc/completion/bash/guix @@ -32,7 +32,7 @@ _guix_complete_command () | grep '^ ' \ | sed '-es/^ *\([a-z-]\+\).*$/\1/g')" fi - COMPREPLY=($(compgen -W "$_guix_commands" -- "$word_at_point")) + COMPREPLY+=($(compgen -W "$_guix_commands" -- "$word_at_point")) } _guix_complete_subcommand () @@ -41,7 +41,7 @@ _guix_complete_subcommand () local subcommands="$(${COMP_WORDS[0]} $command --help 2> /dev/null \ | grep '^ [a-z]' \ | sed -e's/^ \+\([a-z-]\+\).*$/\1/g')" - COMPREPLY=($(compgen -W "$subcommands" -- "${COMP_WORDS[$COMP_CWORD]}")) + COMPREPLY+=($(compgen -W "$subcommands" -- "${COMP_WORDS[$COMP_CWORD]}")) } _guix_complete_available_package () @@ -54,7 +54,7 @@ _guix_complete_available_package () _guix_available_packages="$(${COMP_WORDS[0]} package -A 2> /dev/null \ | cut -f1)" fi - COMPREPLY=($(compgen -W "$_guix_available_packages" -- "$prefix")) + COMPREPLY+=($(compgen -W "$_guix_available_packages" -- "$prefix")) } _guix_complete_installed_package () @@ -64,7 +64,7 @@ _guix_complete_installed_package () local prefix="$1" local packages="$(${COMP_WORDS[0]} package -I "^$prefix" 2> /dev/null \ | cut -f1)" - COMPREPLY=($(compgen -W "$packages" -- "$prefix")) + COMPREPLY+=($(compgen -W "$packages" -- "$prefix")) } _guix_complete_option () @@ -79,7 +79,7 @@ _guix_complete_option () | grep '^ \+-' \ | sed -e's/^.*--\([a-zA-Z0-9_-]\+\)\(=\?\).*/--\1\2/g')" compopt -o nospace - COMPREPLY=($(compgen -W "$options" -- "$2")) + COMPREPLY+=($(compgen -W "$options" -- "$2")) } _guix_is_option () @@ -174,7 +174,7 @@ _guix_complete_file () _guix_complete_pid () { local pids="$(cd /proc; echo [0-9]*)" - COMPREPLY=($(compgen -W "$pids" -- "$1")) + COMPREPLY+=($(compgen -W "$pids" -- "$1")) } _guix_complete () -- cgit v1.2.3 From ee5e4779e21b6eaf3229ab4201e731d8dde7e4b2 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 3 Oct 2021 13:26:35 +0200 Subject: bash completion: Complete ‘guix weather’ packages. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * etc/completion/bash/guix (_guix_complete): Complete available package names for ‘guix weather’ when not following ‘-m’. --- etc/completion/bash/guix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'etc') diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix index ea8f76f3e0..724d35b21f 100644 --- a/etc/completion/bash/guix +++ b/etc/completion/bash/guix @@ -302,6 +302,8 @@ _guix_complete () if _guix_is_dash_m then _guix_complete_file + else + _guix_complete_available_package "$word_at_point" fi else _guix_complete_available_package "$word_at_point" -- cgit v1.2.3 From 9e3355d2a35796276d17af13ac45814dbf6c4203 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 3 Oct 2021 13:50:10 +0200 Subject: bash completion: Complete ‘guix build’ file names. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * etc/completion/bash/guix (_guix_complete_available_package_or_store_file): New function. (_guix_complete): Call it in place of _guix_complete_available_package after the ‘build’ command. --- etc/completion/bash/guix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'etc') diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix index 724d35b21f..fcf9482639 100644 --- a/etc/completion/bash/guix +++ b/etc/completion/bash/guix @@ -171,6 +171,18 @@ _guix_complete_file () COMPREPLY=() } +_guix_complete_available_package_or_store_file () +{ + _guix_complete_available_package "$@" + + # The current _guix_complete_file implementation doesn't compose (append to + # COMPREPLY), so we suggest file names only if no package names matched. + if [[ -z "$COMPREPLY" ]] + then + _guix_complete_file # TODO: restrict to store files + fi +} + _guix_complete_pid () { local pids="$(cd /proc; echo [0-9]*)" @@ -251,7 +263,7 @@ _guix_complete () then _guix_complete_file else - _guix_complete_available_package "$word_at_point" + _guix_complete_available_package_or_store_file "$word_at_point" fi elif [[ "$command" = "environment" ]] then -- cgit v1.2.3 From d71cfaea3006bc02dc6d309d916809e1f799f04e Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 3 Oct 2021 13:59:54 +0200 Subject: bash completion: Complete ‘guix size’ file names. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * etc/completion/bash/guix (_guix_complete): Complete store file names after the ‘size’ command. --- etc/completion/bash/guix | 3 +++ 1 file changed, 3 insertions(+) (limited to 'etc') diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix index fcf9482639..d5ec427e0c 100644 --- a/etc/completion/bash/guix +++ b/etc/completion/bash/guix @@ -279,6 +279,9 @@ _guix_complete () elif [[ "$command" = "download" || "$command" = "gc" || "$command" = "hash" ]] then _guix_complete_file + elif [[ "$command" = "size" ]] + then + _guix_complete_available_package_or_store_file "$word_at_point" elif [[ "$command" = "system" ]] then case $COMP_CWORD in -- cgit v1.2.3 From ed14bc298470f77f4ffacdc315ae87939f81c765 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 3 Oct 2021 14:47:44 +0200 Subject: bash completion: Fix ‘system’ & ‘container’ subcommands. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * etc/completion/bash/guix (_guix_complete): Count words from the innermost command. --- etc/completion/bash/guix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'etc') diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix index d5ec427e0c..87d9911e53 100644 --- a/etc/completion/bash/guix +++ b/etc/completion/bash/guix @@ -284,8 +284,8 @@ _guix_complete () _guix_complete_available_package_or_store_file "$word_at_point" elif [[ "$command" = "system" ]] then - case $COMP_CWORD in - 2) _guix_complete_subcommand;; + case $((COMP_CWORD - command_index)) in + 1) _guix_complete_subcommand;; *) _guix_complete_file;; # TODO: restrict to *.scm esac elif [[ "$command" = "pull" ]] @@ -304,9 +304,9 @@ _guix_complete () fi elif [[ "$command" = "container" ]] then - case $COMP_CWORD in - 2) _guix_complete_subcommand;; - 3) _guix_complete_pid "$word_at_point";; + case $((COMP_CWORD - command_index)) in + 1) _guix_complete_subcommand;; + 2) _guix_complete_pid "$word_at_point";; *) _guix_complete_file;; esac elif [[ "$command" = "import" ]] -- cgit v1.2.3 From 2ad1ef844632b7605ad6dd362e947a122a0a3925 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 7 Oct 2021 23:41:31 +0200 Subject: disarchive-manifest: Provide valid 'version' string. * etc/disarchive-manifest.scm : Turn 'version' field into a string. --- etc/disarchive-manifest.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'etc') diff --git a/etc/disarchive-manifest.scm b/etc/disarchive-manifest.scm index 5cc59f5e2a..60edee8eac 100644 --- a/etc/disarchive-manifest.scm +++ b/etc/disarchive-manifest.scm @@ -108,5 +108,5 @@ (define (disarchive-collection origins) (manifest (list (manifest-entry (name "disarchive-collection") - (version (length origins)) + (version (number->string (length origins))) (item (disarchive-collection origins)))))) -- cgit v1.2.3