Re: Goals for 0.4
On Thu, Aug 29, 2013 at 10:42:23PM +0200, Andreas Enge wrote: On Thu, Aug 29, 2013 at 02:34:27PM +0200, Ludovic Courtès wrote: • Manual: improve as we see fit; notably add a section on font usage for X applications. I would volunteer for this one. The main problem that gtk+ applications would not find a font unless the user installed gs-fonts should be solved by the latest commit. I added gs-fonts as an input to fontconfig and added it to its configuration file. Andreas
Re: Generation 0
Nikita Karetnikov nik...@karetnikov.org skribis: What about these patches? Should the first patch also test the following case? +(let ((numbers (generation-numbers profile))) + (if (equal? numbers '(0)) + (exit 1) + (for-each list-generation numbers The first patch below already contains that snippet, so I’m not sure what you mean. From f42056aa768a405a893b5846dad8f8fa576b1156 Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov nik...@karetnikov.org Date: Tue, 24 Sep 2013 22:11:16 + Subject: [PATCH 1/2] guix package: Exit with 1 when a generation cannot be listed. * guix/scripts/package.scm (guix-package)[process-query]: Exit with 1 when a generation does not exist or the profile points to the zeroth generation. * tests/guix-package.sh: Test the former case. OK, please push. From bea0168c28932921e6e2d6dcf3e9a26c555b698c Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov nik...@karetnikov.org Date: Tue, 24 Sep 2013 22:18:09 + Subject: [PATCH 2/2] guix package: Do not list the zeroth generation. * guix/scripts/package.scm (guix-package)[process-query]: Change 'list-generation' to not list the zeroth generation. * tests/guix-package.sh: Test it. * doc/guix.texi (Invoking guix package): Document it, and use the right term when talking about generations. OK, push as well. Thanks, Ludo’.
Re: [PATCH] guix package: Show which generation is the current one.
Nikita Karetnikov nik...@karetnikov.org skribis: I’m suggesting to have a procedure like this: (define (current-generation-number profile) ;; Return the current generation number of PROFILE. ...) We already have such a procedure. It’s called ‘generation-number’. Oh, OK. What do you think about this patch? Can I push it to ‘master’? Yes! From 5ed5be5c786683cd5ec86d9834afca88d965d5f0 Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov nik...@karetnikov.org Date: Wed, 25 Sep 2013 01:55:27 + Subject: [PATCH] guix package: Show which generation is the current one. * guix/scripts/package.scm (guix-package)[process-query]: Show that a generation is the current one if the profile points to it. * tests/guix-package.sh: Test it. Thanks, Ludo’.
Re: [PATCH] guix package: Add '--delete-generations'.
Nikita Karetnikov nik...@karetnikov.org skribis: Oh. I’d prefer if it would delete all generations but the current one. That’s a fairly useful pattern: suppose you want to make space on your disk (and you know you won’t need to roll back), it’d be handy to run: guix package --delete-generations guix gc Whereas if you have to use ranges, you end up doing something like: guix package --list-generations |grep ^G # check the number of the last generation... guix package --delete-generations=..42 guix gc Conversely, removing *all* the generations is something you’re unlikely to do very often. ‘--delete-generations’ could accept an additional argument, say, ‘keep-current’. It’d be easier to implement, and I find it less confusing. Would you accept such a solution? Frankly, I don’t like it. I think the default behavior should not be to let the user shoot themself in the foot. WDYT? Ludo’.
Re: FAIL: tests/guix-register.sh
Could it be that something’s wrong with your setup? (Erroneous LD_LIBRARY_PATH, etc.) Maybe. This test also fails on a different machine of mine. LD_LIBRARY_PATH is not set. pgpMTcknFjC6O.pgp Description: PGP signature
Re: FAIL: tests/guix-register.sh
Nikita Karetnikov nik...@karetnikov.org skribis: Could it be that something’s wrong with your setup? (Erroneous LD_LIBRARY_PATH, etc.) Maybe. This test also fails on a different machine of mine. LD_LIBRARY_PATH is not set. Are you using a distro-provide SQLite package, or something you built yourself? If the problem is widespread, we can just remove this test. Thanks, Ludo’.
Re: FAIL: tests/guix-register.sh
Are you using a distro-provide SQLite package, or something you built yourself? If the problem is widespread, we can just remove this test. No need. I solved the problem by installing SQLite from Guix. pgpwaGLweKqG9.pgp Description: PGP signature
Re: Generation 0
There are two cases: 1. A generation does not exist. 2. The profile points to the zeroth generation, and there are no other generations. ‘tests/guix-package.sh’ tests the first case. Should we test the second case too? What would be the best way to do so? The second case is valid. Thus it’s OK for --list-generations to not print anything, but it must exit with 0. Likewise, --delete-generations should do nothing and exit with 0 with the only generation that would be deleted is Generation 0. Does it make sense? I was asking a different question, that is, whether we should test both cases in ‘tests/guix-package.sh’ or it’s OK to test only the first case. Currently, there’s a test for the first case. (Note that by the word “cases” I mean the ‘cond’ cases.) Anyway, can I push this patch? From 00188949e6c49592f6f2dc30bf21731ae142afc0 Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov nik...@karetnikov.org Date: Thu, 26 Sep 2013 02:00:06 + Subject: [PATCH 1/3] guix package: Exit with 0 when there is nothing to list. * guix/scripts/package.scm (guix-package)[process-query]: Exit with 0 when there are no generations containing packages or no profiles. --- guix/scripts/package.scm |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 66505f1..ed1e72c 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -983,7 +983,7 @@ more information.~%)) ((string-null? pattern) (let ((numbers (generation-numbers profile))) (if (equal? numbers '(0)) - (exit 1) + (exit 0) (for-each list-generation numbers ((matching-generations pattern profile) = -- 1.7.9.5 pgpMpMoVZSJxL.pgp Description: PGP signature
Re: [PATCH] guix package: Add '--delete-generations'.
Frankly, I don’t like it. I think the default behavior should not be to let the user shoot themself in the foot. WDYT? OK, what about these patches? Can I push them? From 86d29a8b233d5cf6549fbcddf43b185086b7d178 Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov nik...@karetnikov.org Date: Wed, 25 Sep 2013 03:34:49 + Subject: [PATCH 2/3] guix package: Add 'link-to-empty-profile'. * guix/scripts/package.scm (link-to-empty-profile): New function. (roll-back): Use it. --- guix/scripts/package.scm | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index ed1e72c..7865027 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -214,6 +214,15 @@ all of PACKAGES, a list of name/version/output/path/deps tuples. (compose string-number (cut match:substring 1))) 0)) +(define (link-to-empty-profile generation) + Link GENERATION, a string, to the empty profile. + (let* ((drv (profile-derivation (%store) '())) + (prof (derivation-output-path drv out))) +(when (not (build-derivations (%store) (list drv))) + (leave (_ failed to build the empty profile~%))) + +(switch-symlinks generation prof))) + (define (roll-back profile) Roll back to the previous generation of PROFILE. (let* ((number (generation-number profile)) @@ -236,13 +245,8 @@ all of PACKAGES, a list of name/version/output/path/deps tuples. (_ nothing to do: already at the empty profile~%))) ((or (zero? previous-number); going to emptiness (not (file-exists? previous-generation))) - (let* ((drv (profile-derivation (%store) '())) - (prof (derivation-output-path drv out))) - (when (not (build-derivations (%store) (list drv))) - (leave (_ failed to build the empty profile~%))) - - (switch-symlinks previous-generation prof) - (switch-link))) + (link-to-empty-profile previous-generation) + (switch-link)) (else (switch-link) ; anything else (define (generation-time profile number) -- 1.7.9.5 From c246f4a72ade85dffa95d7c598e24539896ca5a5 Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov nik...@karetnikov.org Date: Thu, 26 Sep 2013 02:36:24 + Subject: [PATCH 3/3] guix package: Add '--delete-generations'. * guix/scripts/package.scm (switch-to-previous-generation): New function. (roll-back): Use the new function instead of 'switch-link'. (show-help): Add '--delete-generations'. (%options): Likewise. (guix-package)[process-actions]: Add 'current-generation-number', 'display-and-delete', and 'delete-generation'. Add support for '--delete-generations', and reindent the code. * tests/guix-package.sh: Test '--delete-generations'. * doc/guix.texi (Invoking guix-package): Document '--delete-generations'. --- doc/guix.texi| 10 ++ guix/scripts/package.scm | 256 +- tests/guix-package.sh| 11 ++ 3 files changed, 185 insertions(+), 92 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 442cef2..2e6bdc5 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -714,6 +714,16 @@ or months by passing an integer along with the first letter of the duration, e.g., @code{--list-generations=20d}. @end itemize +@item --delete-generations[=@var{pattern}] +@itemx -d [@var{pattern}] +Delete all generations except the current one. Note that the zeroth +generation is never deleted. + +This command accepts the same patterns as @option{--list-generations}. +When @var{pattern} is specified, delete the matching generations. If +the current generation matches, it is deleted atomically, i.e., by +switching to the previous available generation. + @end table @node Packages with Multiple Outputs diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 7865027..35a5129 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -223,6 +223,16 @@ all of PACKAGES, a list of name/version/output/path/deps tuples. (switch-symlinks generation prof))) +(define (switch-to-previous-generation profile) + Atomically switch PROFILE to the previous generation. + (let* ((number (generation-number profile)) + (previous-number (previous-generation-number profile number)) + (previous-generation (format #f ~a-~a-link + profile previous-number))) +(format #t (_ switching from generation ~a to ~a~%) +number previous-number) +(switch-symlinks profile previous-generation))) + (define (roll-back profile) Roll back to the previous generation of PROFILE. (let* ((number (generation-number profile)) @@ -230,24 +240,18 @@ all of PACKAGES, a list of name/version/output/path/deps tuples. (previous-generation