Message ID | bbf925b124979bf1203f3619d06dc51948b0f81e.1615822877.git.public@yoctocell.xyz |
---|---|
State | Accepted |
Headers | show |
Series | [bug#47163] refresh: Add '--installed' option. | expand |
Context | Check | Description |
---|---|---|
cbaines/submitting builds | success | |
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
Hi, Xinglu Chen <public@yoctocell.xyz> skribis: > This lets the user to only check for updates for packages installed in the > current profile. > > If the user is using the imperative way to install packages, or uses > multiple manifests, this is a quick way to check for updates for the > installed packages. > > * guix/scripts/refresh.scm (%options): Add '--installed' option. > * guix.texi (Invoking guix refresh): Document it. I sometimes run: guix refresh $(guix package -I | cut -f1) I’m not sure an extra ‘guix refresh’ option is warranted. WDYT? Thanks, Ludo’.
On Mon, Mar 15 2021, Ludovic Courtès wrote: > Hi, > > Xinglu Chen <public@yoctocell.xyz> skribis: > >> This lets the user to only check for updates for packages installed in the >> current profile. >> >> If the user is using the imperative way to install packages, or uses >> multiple manifests, this is a quick way to check for updates for the >> installed packages. >> >> * guix/scripts/refresh.scm (%options): Add '--installed' option. >> * guix.texi (Invoking guix refresh): Document it. > > I sometimes run: > > guix refresh $(guix package -I | cut -f1) > > I’m not sure an extra ‘guix refresh’ option is warranted. WDYT? That's cool, I think your solution would suffice. Maybe we could add it to the manual or cookbok?
Hi, Xinglu Chen <public@yoctocell.xyz> skribis: > On Mon, Mar 15 2021, Ludovic Courtès wrote: > >> Hi, >> >> Xinglu Chen <public@yoctocell.xyz> skribis: >> >>> This lets the user to only check for updates for packages installed in the >>> current profile. >>> >>> If the user is using the imperative way to install packages, or uses >>> multiple manifests, this is a quick way to check for updates for the >>> installed packages. >>> >>> * guix/scripts/refresh.scm (%options): Add '--installed' option. >>> * guix.texi (Invoking guix refresh): Document it. >> >> I sometimes run: >> >> guix refresh $(guix package -I | cut -f1) >> >> I’m not sure an extra ‘guix refresh’ option is warranted. WDYT? > > That's cool, I think your solution would suffice. Maybe we could add it > to the manual or cookbok? That’s a good idea. Do you want to propose a short section on this? You may also like the new ‘--with-latest’ package transformation option. :-) Thanks, Ludo’.
On Tue, 2021-03-16 at 10:08 +0100, Ludovic Courtès wrote: > Hi, > > Xinglu Chen <public@yoctocell.xyz> skribis: > > > On Mon, Mar 15 2021, Ludovic Courtès wrote: > > > > > Hi, > > > > > > Xinglu Chen <public@yoctocell.xyz> skribis: > > > > > > > This lets the user to only check for updates for packages > > > > installed in the > > > > current profile. > > > > > > > > If the user is using the imperative way to install packages, or > > > > uses > > > > multiple manifests, this is a quick way to check for updates > > > > for the > > > > installed packages. > > > > > > > > * guix/scripts/refresh.scm (%options): Add '--installed' > > > > option. > > > > * guix.texi (Invoking guix refresh): Document it. > > > > > > I sometimes run: > > > > > > guix refresh $(guix package -I | cut -f1) > > > > > > I’m not sure an extra ‘guix refresh’ option is warranted. WDYT? > > > > That's cool, I think your solution would suffice. Maybe we could > > add it > > to the manual or cookbok? > > That’s a good idea. Do you want to propose a short section on this? > > You may also like the new ‘--with-latest’ package transformation > option. :-) > > Thanks, > Ludo’. I would also really like such option for 'lint' and 'refresh' that can take an operating-system definition so I can ensure a certain set of packages are up to some standards and help me focus my efforts on my or some fellow's configuration (especially w.r.t. security), rather than randomly trying to maintain *everything* in the GNU Guix repo which is quite exhausting and large work to take on. Starting from a place of actual need for myself and some fellow's configurations looks like a more achieveable goal mid-term.
Hi Léo, On Tue, 16 Mar 2021 at 10:18, Léo Le Bouter via Guix-patches via <guix-patches@gnu.org> wrote: > I would also really like such option for 'lint' and 'refresh' that can > take an operating-system definition so I can ensure a certain set of > packages are up to some standards and help me focus my efforts on my or > some fellow's configuration (especially w.r.t. security), rather than > randomly trying to maintain *everything* in the GNU Guix repo which is > quite exhausting and large work to take on. Starting from a place of > actual need for myself and some fellow's configurations looks like a > more achieveable goal mid-term. Adding the manifest option to "guix lint", is it not enough? I do not know how many packages you have in your operating-system definition but from my understanding your user-wide packages should be in manifest.scm files, and you could also maintain a manifest.scm file for your packages system-wide. Anyway. Here an example with an hard-coded path, saved in /tmp/manifest-from-os.scm: --8<---------------cut here---------------start------------->8--- (use-modules (gnu system) (guix profiles)) (define os (load "/home/simon/src/guix/guix/gnu/system/examples/bare-bones.tmpl")) (define pkgs (operating-system-packages os)) (packages->manifest pkgs) --8<---------------cut here---------------end--------------->8--- Then "guix refresh -m /tmp/manifest-from-os.scm" should do the job. Well, it is an example, the point is simply to show that an option is not necessary, IMHO. However, a robust script could be in etc/ with some other tools and with a line in the manual. Maybe. :-) It seems better to keep separated what operates on packages and what operates on system. Cheers, simon
On Tue, 2021-03-16 at 13:58 +0100, zimoun wrote: > Adding the manifest option to "guix lint", is it not enough? I do > not > know how many packages you have in your operating-system definition > but from my understanding your user-wide packages should be in > manifest.scm files, and you could also maintain a manifest.scm file > for your packages system-wide. Anyway. > > Here an example with an hard-coded path, saved in /tmp/manifest-from- > os.scm: > > --8<---------------cut here---------------start------------->8--- > (use-modules > (gnu system) > (guix profiles)) > > (define os > (load "/home/simon/src/guix/guix/gnu/system/examples/bare- > bones.tmpl")) > > (define pkgs (operating-system-packages os)) > > (packages->manifest pkgs) > --8<---------------cut here---------------end--------------->8--- > > Then "guix refresh -m /tmp/manifest-from-os.scm" should do the job. > Well, it is an example, the point is simply to show that an option is > not necessary, IMHO. However, a robust script could be in etc/ with > some other tools and with a line in the manual. Maybe. :-) > It seems better to keep separated what operates on packages and what > operates on system. > > > Cheers, > simon You are right that looks great!
On Tue, Mar 16 2021, Ludovic Courtès wrote: >>> I sometimes run: >>> >>> guix refresh $(guix package -I | cut -f1) >>> >>> I’m not sure an extra ‘guix refresh’ option is warranted. WDYT? >> >> That's cool, I think your solution would suffice. Maybe we could add it >> to the manual or cookbok? > > That’s a good idea. Do you want to propose a short section on this? Sure, I will send a followup patch to this.
On Tue, Mar 16 2021, Ludovic Courtès wrote: > You may also like the new ‘--with-latest’ package transformation > option. :-) I really like package transformations but is there a way to use specify them with Guile so I can use them with `guix home`[1] or in manifests? Ccing guix-devel [1]: https://yhetil.org/guix-devel/878s6u2pco.fsf@trop.in
Hi, On Tue, 16 Mar 2021 at 17:46, Xinglu Chen <public@yoctocell.xyz> wrote: > On Tue, Mar 16 2021, Ludovic Courtès wrote: > > > You may also like the new ‘--with-latest’ package transformation > > option. :-) > > I really like package transformations but is there a way to use specify > them with Guile so I can use them with `guix home`[1] or in manifests? There is several ways to have package transformations at the manifest level. One is: --8<---------------cut here---------------start------------->8--- (use-modules (guix transformations)) (define transform1 (options->transformation '((with-c-toolchain . "hello=gcc-toolchain@8")))) (packages->manifest (list (transform1 (specification->package "hello")))) --8<---------------cut here---------------end--------------->8--- HTH, simon
On Tue, Mar 16 2021, zimoun wrote: >> I really like package transformations but is there a way to use specify >> them with Guile so I can use them with `guix home`[1] or in manifests? > > There is several ways to have package transformations at the manifest > level. One is: > > --8<---------------cut here---------------start------------->8--- > (use-modules (guix transformations)) > > (define transform1 > (options->transformation > '((with-c-toolchain . "hello=gcc-toolchain@8")))) > > (packages->manifest > (list (transform1 (specification->package "hello")))) > --8<---------------cut here---------------end--------------->8--- Cool, thanks for the help.
Hi, zimoun <zimon.toutoune@gmail.com> skribis: > There is several ways to have package transformations at the manifest > level. One is: > > (use-modules (guix transformations)) > > (define transform1 > (options->transformation > '((with-c-toolchain . "hello=gcc-toolchain@8")))) > > (packages->manifest > (list (transform1 (specification->package "hello")))) On this topic, do not miss this section of the fine manual: <https://guix.gnu.org/manual/en/html_node/Defining-Package-Variants.html>. :-) Ludo’.
The v2 patch has been applied. Closing.
diff --git a/doc/guix.texi b/doc/guix.texi index 3e7ffc81bc..c778a877d8 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11657,6 +11657,11 @@ Select all the packages from the manifest in @var{file}. This is useful to check if any packages of the user manifest can be updated. +@item --installed +@itemx -i +Select all the packages installed in the current profile. This is +useful to check if any of the packages the user is using can be updated. + @item --type=@var{updater} @itemx -t @var{updater} Select only packages handled by @var{updater} (may be a comma-separated diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index fb6c52a567..c1c672dc0b 100644 --- a/guix/scripts/refresh.scm +++ b/guix/scripts/refresh.scm @@ -86,6 +86,9 @@ (option '(#\m "manifest") #t #f (lambda (opt name arg result) (alist-cons 'manifest arg result))) + (option '(#\i "installed") #f #f + (lambda (opt name arg result) + (alist-cons 'installed #t result))) (option '(#\e "expression") #t #f (lambda (opt name arg result) (alist-cons 'expression arg result))) @@ -156,6 +159,9 @@ specified with `--select'.\n")) (display (G_ " -m, --manifest=FILE select all the packages from the manifest in FILE")) (display (G_ " + -i --installed select all the packages installed in the current + profile")) + (display (G_ " -t, --type=UPDATER,... restrict to updates from the specified updaters (e.g., 'gnu')")) (display (G_ " @@ -253,7 +259,13 @@ update would trigger a complete rebuild." (define packages (match (assoc-ref opts 'manifest) - (#f args-packages) + (#f (if (assoc-ref opts 'installed) + ;; All packages installed in current profile + (manifest->packages + (match (manifest->code (profile-manifest %current-profile)) + (('begin expr) (eval expr + (make-user-module '((gnu packages))))))) + args-packages)) ((? string? file) (packages-from-manifest file)))) (if (assoc-ref opts 'recursive?)