From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nikita Karetnikov Subject: [PATCH] guix package: Show which generation is the current one. (was: Generation 0) Date: Tue, 24 Sep 2013 09:56:22 +0400 Message-ID: <87ob7izrsp.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> 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]:58556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOLXB-000327-74 for guix-devel@gnu.org; Tue, 24 Sep 2013 01:51:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VOLX9-0002CK-Vz for guix-devel@gnu.org; Tue, 24 Sep 2013 01:51:41 -0400 In-Reply-To: <87vc1r6nu0.fsf@karetnikov.org> (Nikita Karetnikov's message of "Tue, 24 Sep 2013 04:54:47 +0400") 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 Will these lines be i18n=E2=80=99d? I fail to configure the locales proper= ly, so I can=E2=80=99t check. + (format #t "~a\t(current)~%" header) + (format #t "~a~%" header))) Can I push this patch to =E2=80=98master=E2=80=99? (It should be applied o= n top of the other three.) --=-=-= 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=207759ad3ad89d236e766639c0875540e60a503d16 Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov Date: Tue, 24 Sep 2013 05:41:32 +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 | 17 ++++++++++++----- tests/guix-package.sh | 3 +++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 9ed499d..a8dfcbc 100644 =2D-- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -955,13 +955,20 @@ more information.~%")) (match (assoc-ref opts 'query) (('list-generations pattern) (define (list-generation number) + (define (current-generation? number) + (let ((generation (format #f "~a-~a-link" profile number))) + (string=3D? (readlink profile) generation))) + (or (zero? number) (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")) + (let ((header (format #f (_ "Generation ~a\t~a") number + (date->string + (time-utc->date + (generation-time profile number)) + "~b ~d ~Y ~T")))) + (if (current-generation? number) + (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 2b8b146..74deb3a 100644 =2D-- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -118,6 +118,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) iQIcBAEBAgAGBQJSQSmJAAoJEM+IQzI9IQ38N/QQAI51mn0NOHb0OdTZadXhOS+B gti4niIfT/hv1YPfru8CmMdRaHVXnb3zyIa3SJ+RoV3DYcG033OiqaWa9gdCuMHm yWCFiOogx3RHzUP5p7PDgp0ybOlAYDQB+q61hDggWK4i84+uEOOiWv1+HpbrRfJv GDtEl8sBtbisP8EeLIwFodI+dbth8Y3U/TlL4fDwkA9wcEaKI3F/1mnfsWwVOhjw azdynNWU412TR2zCFOuF957Qy9hLfM8taWndFw15uJYhaol0UDS0H2AIPU+S94KV 1sP/zYQrW/7dWVRedHtVVKvCmfrhmxrXkGWohPcMYUlJ1W4NM/lLFeWqYXMwGCpN BmBCIlRiIW6sO2j7cP55X+s+lplPJXd8uG7uAWc4/7MZ1BfOxl24jjhJLkdOg/oZ EI5VDgQAIobe3e6zn1QM7pdH3zY3ANXBESF2VgO4UsNAtos8k3VdjGRMtgiQZ0e0 J14hdSe7FrrITnaTn70ClyCjybQua/KIxaMzOtIlwCS1IcNMyPb4k+9oDVYQjwPx UEGFbEFuENIq6cb++y8VVp0kYdGi1J3+VTMjrjFHJ7mZaZv9BYYAI+O0VUt3eUSi tWr0w8ONnvOpjhxTdBuExA3iHFaD15csl67pE99xtlb/iNCR803GxM5eQqbAfGya GRex9o9iDJONTKSw9IoS =Ruas -----END PGP SIGNATURE----- --==-=-=--