From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nikita Karetnikov Subject: Re: [PATCH] guix package: Show which generation is the current one. Date: Wed, 25 Sep 2013 06:10:35 +0400 Message-ID: <87a9j1bqhw.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> <87vc1r6nu0.fsf@karetnikov.org> <87ob7izrsp.fsf_-_@karetnikov.org> <8761tqbd6h.fsf@gnu.org> <87wqm6tjd5.fsf@karetnikov.org> <87txha8fu4.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]:36219) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOeUG-0003ug-D3 for guix-devel@gnu.org; Tue, 24 Sep 2013 22:05:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VOeUF-0002qA-FD for guix-devel@gnu.org; Tue, 24 Sep 2013 22:05:56 -0400 In-Reply-To: <87txha8fu4.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Tue, 24 Sep 2013 16:16:51 +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=E2=80=99m 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=E2=80=99s called =E2=80=98generation-= number=E2=80=99. What do you think about this patch? Can I push it to =E2=80=98master=E2=80= =99? --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-guix-package-Show-which-generation-is-the-current-on.patch Content-Transfer-Encoding: quoted-printable From=205ed5be5c786683cd5ec86d9834afca88d965d5f0 Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov Date: Wed, 25 Sep 2013 01:55:27 +0000 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. =2D-- guix/scripts/package.scm | 14 +++++++++----- tests/guix-package.sh | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index dab3d5b..66505f1 100644 =2D-- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -956,11 +956,15 @@ more information.~%")) (('list-generations pattern) (define (list-generation number) (unless (zero? number) =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")) + (let ((header (format #f (_ "Generation ~a\t~a") number + (date->string + (time-utc->date + (generation-time profile number)) + "~b ~d ~Y ~T"))) + (current (generation-number profile))) + (if (=3D number current) + (format #t (_ "~a\t(current)~%") header) + (format #t "~a~%" header))) (for-each (match-lambda ((name version output location _) (format #t " ~a\t~a\t~a\t~a~%" diff --git a/tests/guix-package.sh b/tests/guix-package.sh index 524ff32..5f97aff 100644 =2D-- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -119,6 +119,9 @@ then test "`readlink_base "$profile"`" =3D "$profile-1-link" test -x "$profile/bin/guile" && ! test -x "$profile/bin/make" =20 + # Check that the first generation is the current one. + test "`guix package -p "$profile" -l 1 | cut -f3 | head -n1`" =3D "(cu= rrent)" + # Roll-back to generation 0, and install---all at once. guix package --bootstrap -p "$profile" --roll-back -i guile-bootstrap test "`readlink_base "$profile"`" =3D "$profile-1-link" =2D-=20 1.7.9.5 --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBAgAGBQJSQkYfAAoJEM+IQzI9IQ38KDcQAIXntjZgHCgvEuH/SgOTCHgD lJYKVTyshlSfdZrYBXqi5ZsnXbwEQGnMWfEiT8IAqwLGpyR+Hycd04USdBbaZ3Ud rgBT6vnuSDjiDDksLF18aNuU978DTJccaFJ5ZyESfw4pR6i3Indtx/UV8dC9ZETT xjNK6ZnbULlNfaOWewg/b/kMvY0Ddq9veoA7mAEcfjJmShv3GDyCXbWAGgjy4igx k7KOYy1CfDCDxBEZD9RnP2mWrcWv7nscwYQRwm5iCLyFZaPeLJK7nYYQ3M0ExUGY 5nMVjU0BfX7dTkcdo8dS/TXP/LxBqO5IvNZFSqBOo4b7O92j1eBeHqdu8l0s4Ayh ibc8U2aqj8tMqHlk2ubmUVPlzE0VfIys4ND4yMzbAqtBH+hBxlifncRCjFl41EpW ewgloalirJoaxZDxMcUwGjplXkyJ0AN6aMWYd4gxMzDwbWDyD3Oa31ut12+br4K9 VJ0Gj8OU7kduFfJtpoW5Ihn1EtoH0i9XNJ/z+V9Xc3U7HWD/HdHHF3dZf3Sz9CR6 lO8lAcOVCns1NIKS4/08ZuyZdl+nlYc4B62AcdwRI9jpiBWnGKvsvk4GrAgYlcty 3Oe83Luk1dX/DlVYgeScAkWI4E8DjSgrguIzW5xCyI44G1swa89FLutnyrFwuC8j qqRZ8HFqt51Ig5wWzC71 =gcTP -----END PGP SIGNATURE----- --==-=-=--