From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nikita Karetnikov Subject: Re: Generation 0 Date: Tue, 24 Sep 2013 04:54:47 +0400 Message-ID: <87vc1r6nu0.fsf@karetnikov.org> References: <87vc2o4qwc.fsf@gnu.org> <87y57kljro.fsf@karetnikov.org> <87hae81uvo.fsf@gnu.org> <87li2oslzh.fsf_-_@karetnikov.org> <87hadcr4sh.fsf_-_@karetnikov.org> <8738ow5zif.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOGpQ-0005fo-SN for guix-devel@gnu.org; Mon, 23 Sep 2013 20:50:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VOGpO-0005is-NU for guix-devel@gnu.org; Mon, 23 Sep 2013 20:50:12 -0400 In-Reply-To: <8738ow5zif.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Sun, 22 Sep 2013 23:15:36 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >> I think we should change =E2=80=98--list-generations=E2=80=99 to not out= put the zeroth >> generation. Even though it could be present in the profile, users >> shouldn=E2=80=99t be concerned about it. > Agreed. Can I push these patches to =E2=80=98master=E2=80=99? Should I document th= at the zeroth generation is always ignored? --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-tests-Test-that-list-generations-may-not-output-anyt.patch Content-Transfer-Encoding: quoted-printable From=207fc042876bf00031d6b36b8d697984ce1ee1700e Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov Date: Mon, 23 Sep 2013 22:56:21 +0000 Subject: [PATCH 1/3] tests: Test that '--list-generations' may not output anything. =2D-- tests/guix-package.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/guix-package.sh b/tests/guix-package.sh index b09a9c0..e2c0374 100644 =2D-- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -85,6 +85,9 @@ then test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -n1= `" \ =3D " guile-bootstrap" =20 + # Do not output anything when a generation does not exist. + test -z "`guix package -p "$profile" -l 42`" + # Remove a package. guix package --bootstrap -p "$profile" -r "guile-bootstrap" test -L "$profile-3-link" =2D-=20 1.7.9.5 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0002-guix-package-Do-not-list-the-zeroth-generation.patch Content-Transfer-Encoding: quoted-printable From=20ac4c69fea488e4028f3957986104159fca467ecb Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov Date: Mon, 23 Sep 2013 23:31:15 +0000 Subject: [PATCH 2/3] 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. =2D-- guix/scripts/package.scm | 35 ++++++++++++++++++----------------- tests/guix-package.sh | 3 +++ 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 1d00e39..9ed499d 100644 =2D-- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -955,23 +955,24 @@ more information.~%")) (match (assoc-ref opts 'query) (('list-generations pattern) (define (list-generation number) =2D (begin =2D (format #t (_ "Generation ~a\t~a~%") number =2D (date->string =2D (time-utc->date =2D (generation-time profile number)) =2D "~b ~d ~Y ~T")) =2D (for-each (match-lambda =2D ((name version output location _) =2D (format #t " ~a\t~a\t~a\t~a~%" =2D name version output location))) =2D =2D ;; Show most recently installed packages last. =2D (reverse =2D (manifest-packages =2D (profile-manifest =2D (format #f "~a-~a-link" profile number))))) =2D (newline))) + (or (zero? number) + (begin + (format #t (_ "Generation ~a\t~a~%") number + (date->string + (time-utc->date + (generation-time profile number)) + "~b ~d ~Y ~T")) + (for-each (match-lambda + ((name version output location _) + (format #t " ~a\t~a\t~a\t~a~%" + name version output location))) + + ;; Show most recently installed packages last. + (reverse + (manifest-packages + (profile-manifest + (format #f "~a-~a-link" profile number))))) + (newline)))) =20 (cond ((not (file-exists? profile)) ; XXX: race condition (leave (_ "profile '~a' does not exist~%") diff --git a/tests/guix-package.sh b/tests/guix-package.sh index e2c0374..b4bd414 100644 =2D-- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -110,6 +110,9 @@ then test "`readlink_base "$profile"`" =3D "$profile-0-link" done =20 + # Test that '--list-generations' does not output the zeroth generation. + test -z "`guix package -p "$profile" -l 0`" + # Reinstall after roll-back to the empty profile. guix package --bootstrap -p "$profile" -e "$boot_make" test "`readlink_base "$profile"`" =3D "$profile-1-link" =2D-=20 1.7.9.5 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0003-tests-Use-test-z-to-check-that-a-string-equals-zero.patch Content-Transfer-Encoding: quoted-printable From=2064b01b6414d42b9b495059223e5312d9d01ba860 Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov Date: Tue, 24 Sep 2013 00:36:51 +0000 Subject: [PATCH 3/3] tests: Use 'test -z' to check that a string equals zer= o. =2D-- tests/guix-package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/guix-package.sh b/tests/guix-package.sh index b4bd414..2b8b146 100644 =2D-- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -79,7 +79,7 @@ then # Search. test "`guix package -s "An example GNU package" | grep ^name:`" =3D \ "name: hello" =2D test "`guix package -s "n0t4r341p4ck4g3"`" =3D "" + test -z "`guix package -s "n0t4r341p4ck4g3"`" =20 # List generations. test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -n1= `" \ =2D-=20 1.7.9.5 --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBAgAGBQJSQOLdAAoJEM+IQzI9IQ38CgYP/j+XLI9vxg374aGAmluHmiBI dgjRMpWIcEsnPjWdSS7Ef/mYkcFoZbYeK1FDub1yVbTLb+6ukizm8e8/8cUDT+Ed yRLg1GHOMUsF0HaQpSYpyqTkcS2pxFNjHO1syDwRXrW6fKrbBSlfR5qu8B8xnrWl 0F7ad4CaBQZvTbrlhnfb1Wo15bfUl75GwXxa5qxqAJhrAYP97lDYNGgFgZbFFebH 1mYZ6+5W2ZGuzouDQcK31U1pmJECpSN0vrZl6wUr/hmta9urn7pV6LSIc2yZSQyB 61lTt2q1AZ/4hPuq3QbtIZB1HTuNFkVhmtajGcE2FWv8V7/LZqnl2fpHX3+2pK0b m1Y7dZJpv4gPaYb0NEH9gYaWFe6rW0x+ByflloYoyWClzwAxobx7+GPU4MCC/Afu xqxLnr2csaTDp4D9aXDQeZ7X37pkbL1tTtDu3TPJdnOOLvmQvpWvCJwogz8jIbYe 6LwCVSPumJoZuuOt7Za5GtrPiFM3JjF8xf8ITCluzrq0Hcy1YNi/5kfEzAcw/opG EWjGCgFckDN66MJYFCWZx2k9kNMerzi84y5sNwY8/Yn6MFtK2SO67gqIsWoMieF7 G7wfIBedOP2ev9d4FvCa85Mtix2LF46WFbOvnGmbYRV6MURMiui3nPMHk0ENJcAU J5GOWmdXjST7HK3W7K7R =3l4n -----END PGP SIGNATURE----- --==-=-=--