Message ID | 20200514141759.6455-1-zimon.toutoune@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | Support multiple profiles with '--list-installed'. | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
Hi! zimoun <zimon.toutoune@gmail.com> skribis: > * guix/scripts/package.scm (process-query): List installed multiple profiles. [...] > + (for-each > + (lambda (profile) > + (let* ((regexp (and regexp (make-regexp* regexp regexp/icase))) > + (manifest (profile-manifest profile)) > + (installed (manifest-entries manifest))) > + (leave-on-EPIPE > + (for-each (match-lambda > + (($ <manifest-entry> name version output path _) > + (when (or (not regexp) > + (regexp-exec regexp name)) > + (format #t "~a\t~a\t~a\t~a~%" > + name (or version "?") output path)))) > + > + ;; Show most recently installed packages last. > + (reverse installed))))) > + profiles) How about instead loading all the manifests, merging them with ‘concatenate-manifests’, and operating on that? That would avoid special-casing. Bonus point if you can add a test case for that, similar to ‘--search-paths’ with multiple profiles. :-) Thanks, Ludo’.
Hi Ludo, Sorry for the delay. On Sat, 16 May 2020 at 19:34, Ludovic Courtès <ludo@gnu.org> wrote: > How about instead loading all the manifests, merging them with > ‘concatenate-manifests’, and operating on that? That would avoid > special-casing. See v2. > Bonus point if you can add a test case for that, similar to > ‘--search-paths’ with multiple profiles. :-) Done in 'tests/guix-packages-net.sh'. See v2. BTW, I added a 'delete-duplicates' on profiles. And I was tempted to also add 'sort' to always process in the same order. And personally, I prefer the alphanumerical order than the order of installation because it is more reliable and easier to find what I am looking for -- otherwise I always do the extra step of pipe: |cut -f1| xargs echo| sort which is "ugly". The order of installation seems redundant with --list-generation. WDYT? Cheers, simon
Hi, zimoun <zimon.toutoune@gmail.com> skribis: > BTW, I added a 'delete-duplicates' on profiles. And I was tempted to > also add 'sort' to always process in the same order. And personally, > I prefer the alphanumerical order than the order of installation > because it is more reliable and easier to find what I am looking for > -- otherwise I always do the extra step of pipe: |cut -f1| xargs echo| > sort which is "ugly". The order of installation seems redundant with > --list-generation. WDYT? I’m not sure about ‘sort’ because the order (unfortunately) does make a difference when there are file-level collisions. If we were starting today, we could forcefully sort things, but I’m tempted to think that it’d break someone’s workflow if we did it now¹. Ludo’. ¹ Obligatory reference: <https://xkcd.com/1172/>.
Hi Ludo,
On Fri, 22 May 2020 at 22:31, Ludovic Courtès <ludo@gnu.org> wrote:
> ¹ Obligatory reference: <https://xkcd.com/1172/>.
Yeah! Exactly! :-)
But I feel one "formatter" to "pretty" display is lacking. It should
be an elegant solution for the recent discussion, a bit as "git log
--pretty=oneline|full|etc." does.
For example, I remember an old (rejected) patch by Robert Vollmer [1].
[1] https://lists.gnu.org/archive/html/guix-devel/2019-07/msg00304.html
Anyway, another topic. :-)
Thank you for the review.
All the best,
simon
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index a69efa365e..a4a6100a33 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -717,20 +717,23 @@ processed, #f otherwise." #t) (('list-installed regexp) - (let* ((regexp (and regexp (make-regexp* regexp regexp/icase))) - (manifest (profile-manifest profile)) - (installed (manifest-entries manifest))) - (leave-on-EPIPE - (for-each (match-lambda - (($ <manifest-entry> name version output path _) - (when (or (not regexp) - (regexp-exec regexp name)) - (format #t "~a\t~a\t~a\t~a~%" - name (or version "?") output path)))) - - ;; Show most recently installed packages last. - (reverse installed))) - #t)) + (for-each + (lambda (profile) + (let* ((regexp (and regexp (make-regexp* regexp regexp/icase))) + (manifest (profile-manifest profile)) + (installed (manifest-entries manifest))) + (leave-on-EPIPE + (for-each (match-lambda + (($ <manifest-entry> name version output path _) + (when (or (not regexp) + (regexp-exec regexp name)) + (format #t "~a\t~a\t~a\t~a~%" + name (or version "?") output path)))) + + ;; Show most recently installed packages last. + (reverse installed))))) + profiles) + #t) (('list-available regexp) (let* ((regexp (and regexp (make-regexp* regexp regexp/icase)))