From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: PRELIMINARY: [PATCH] guix package: Add '--list-generations'. Date: Wed, 18 Sep 2013 23:32:43 +0200 Message-ID: <87mwn924uc.fsf@gnu.org> References: <87vc2o4qwc.fsf@gnu.org> <87r4d9r2lv.fsf@gnu.org> <874na4jfp4.fsf_-_@karetnikov.org> <87eh97616m.fsf@gnu.org> <87bo48xdgb.fsf@karetnikov.org> <87hadz9gze.fsf@gnu.org> <87fvtjdl7y.fsf@karetnikov.org> <87bo444e9q.fsf@gnu.org> <87fvtfzihg.fsf@karetnikov.org> <87ioybxdun.fsf@gnu.org> <877geq9wx6.fsf@karetnikov.org> <87zjrmgcjh.fsf@gnu.org> <87ob80os3c.fsf@karetnikov.org> <87li336ofs.fsf@gnu.org> <87wqmmxutb.fsf@karetnikov.org> <87zjrins47.fsf@gnu.org> <87zjrgok6l.fsf@karetnikov.org> <8738p8wgun.fsf@gnu.org> <87k3ihyq8a.fsf@karetnikov.org> <87ob7tm05z.fsf@gnu.org> <87d2o7q7rj.fsf@karetnikov.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMPRa-0002U1-EK for guix-devel@gnu.org; Wed, 18 Sep 2013 17:37:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VMPRT-0004gK-SR for guix-devel@gnu.org; Wed, 18 Sep 2013 17:37:54 -0400 Received: from hera.aquilenet.fr ([141.255.128.1]:40129) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMPRT-0004gE-H0 for guix-devel@gnu.org; Wed, 18 Sep 2013 17:37:47 -0400 In-Reply-To: <87d2o7q7rj.fsf@karetnikov.org> (Nikita Karetnikov's message of "Wed, 18 Sep 2013 04:43:28 +0400") List-Id: 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: Nikita Karetnikov Cc: guix-devel@gnu.org Nikita Karetnikov skribis: >> Not sure what you mean by =E2=80=9Ctwo record sets=E2=80=9D. > > =E2=80=9CYou can have two record sets: one for generations, one for > packages.=E2=80=9D=C2=A0[1] Ah so I was referring to recutils record sets (I thought you were talking about SRFI-9 records or something.) So what=E2=80=99s the question? :-) >>> Why do you suggest to put =E2=80=98string->duration=E2=80=99 into (guix= ui)? > >> Because it=E2=80=99s a user-interface function. > > Done. However, I think it would be better to write more generic > procedures if we want to place them in separate modules, so they can be > reused. (I can replace the current version with a more generic one if > you want.) Well, =E2=80=98string->duration=E2=80=99 is just as generic as =E2=80=98str= ing->number=E2=80=99. However I agree =E2=80=98string->generation=E2=80=99 could remain internal = to (guix scripts package). No big deal though. > I=E2=80=99m attaching the patch. Please don=E2=80=99t push it yet. I=E2= =80=99ve just found a > bug. On my machine, =E2=80=98guix package -p test -l 2d=E2=80=99 and =E2= =80=98guix package -p > test -l=E2=80=99 should return the same set of generations, but the fourth > generation is shown twice in the former case. OK. > Other issues: > > 1. =E2=80=98false-if-exception=E2=80=99 in =E2=80=98generation-ctime=E2= =80=99. > > 2. A race condition (marked with XXX). > > 3. =E2=80=98guix package -l -p test=E2=80=99 returns =E2=80=98guix packag= e: error: test: > extraneous argument=E2=80=99. (However, the same happens with =E2=80= =98-I=E2=80=99.) > > 4. There must be a better way to write the test in > =E2=80=98tests/guix-package.sh=E2=80=99. [...] > --- a/doc/guix.texi > +++ b/doc/guix.texi > @@ -606,6 +606,42 @@ library are installed in the profile, then @code{--s= earch-paths} will > suggest setting these variables to @code{@var{profile}/include} and > @code{@var{profile}/lib}, respectively. >=20=20 > +@item --list-generations[=3D@var{regexp}] > +@itemx -l [@var{regexp}] s/regexp/pattern/ > +Return a list of generations along with their creation dates. > + > +For each installed package, print the following items, separated by > +tabs: the name of a package, its version string, the part of the package > +that is installed (@pxref{Packages with Multiple Outputs}), and the > +location of this package in the store. > + > +When @var{regexp} is used, the command returns only matching > +generations. Valid patterns include: > + > +@itemize > +@item @emph{Integers and comma-separated integers}. Both patterns will = simply > +return the corresponding generations. For instance, > +@code{--list-generations=3D1} will return the first one. I=E2=80=99d use @table rather than @itemize. Wording: a pattern doesn=E2=80=99t =E2=80=9Creturn=E2=80=9D anything, so pe= rhaps: These patterns denote generation numbers. > +If you pass @code{--list-generations=3D1,8,2}, the command will return > +three generations in the specified order. Neither spaces nor trailing > +commas are allowed. s/If you pass/Passing/ s/will return/specifies/ > @@ -441,6 +502,9 @@ Install, remove, or upgrade PACKAGES in a single tran= saction.\n")) > --roll-back roll back to the previous generation")) > (display (_ " > --search-paths display needed environment variable definitions= ")) > + (display (_ " > + -l --list-generations[=3DREGEXP] > + list generations matching REGEXP")) Should be =E2=80=9C-l, --list-generations=E2=80=9D, with a comma. s/REGEXP/PATTERN/ > --- a/tests/guix-package.sh > +++ b/tests/guix-package.sh > @@ -81,6 +81,10 @@ then > "name: hello" > test "`guix package -s "n0t4r341p4ck4g3"`" =3D "" >=20=20 > + # List generations. > + test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -= n1`" \ > + =3D " guile-bootstrap" That=E2=80=99s OK. You could also grep the string =E2=80=9Cgeneration 1=E2= =80=9D (assuming we=E2=80=99re running in the C locale, dunno if it=E2=80=99s the case.) > +(test-equal "infinite end range" s/infinite/indefinite/ Looks like this is ready to get in! Ludo=E2=80=99.