From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: New =?utf-8?Q?=E2=80=98--list-generations=E2=80=99?= and =?utf-8?Q?=E2=80=98--delete-generations=E2=80=99?= options Date: Sun, 08 Sep 2013 22:22:56 +0200 Message-ID: <87ioybxdun.fsf@gnu.org> References: <87vc2o4qwc.fsf@gnu.org> <87y57kljro.fsf@karetnikov.org> <87hae81uvo.fsf@gnu.org> <87bo4fcbcz.fsf@karetnikov.org> <878uzj6nev.fsf@gnu.org> <877gf1yftq.fsf@karetnikov.org> <87bo4dspl2.fsf@gnu.org> <87a9jxeh05.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> 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]:60276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VIlaW-0004sw-LP for guix-devel@gnu.org; Sun, 08 Sep 2013 16:28:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VIlaQ-0004I4-UD for guix-devel@gnu.org; Sun, 08 Sep 2013 16:28:04 -0400 Received: from hera.aquilenet.fr ([141.255.128.1]:43884) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VIlaQ-0004I0-Jq for guix-devel@gnu.org; Sun, 08 Sep 2013 16:27:58 -0400 In-Reply-To: <87fvtfzihg.fsf@karetnikov.org> (Nikita Karetnikov's message of "Sun, 08 Sep 2013 14:59:55 +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: >> I=E2=80=99m asking because if we do that, =E2=80=98--list-generations=E2= =80=99 may just as well >> print out *all* the generation records. Users who want to select only >> less than one-month old generations can do that with =E2=80=98recsel=E2= =80=99, and we >> don=E2=80=99t have anything more to do. > >> WDYT? > > I see recutils as an advanced option (for those who need it), not a > replacement for the basic functionality. Yeah, possibly. In that case, would you suggest --list-generations=3Drec to specify the recutils output format (with no filtering)? >> OTOH, for =E2=80=98--delete-generations=E2=80=99 it will still be more c= onvenient to >> support =E2=80=98--delete-generations=E2=80=99. > > Could you rephrase? Oops, sorry; this should read: OTOH for =E2=80=98--delete-generations=E2=80=99 it will be more convenien= t to support date-range specifications such as =E2=80=98last-month=E2=80=99, etc. > I don=E2=80=99t understand the above. I believe we should think from a u= ser=E2=80=99s > perspective. One should be able to select the needed generations > without relying on a different program. Yes. >>>> What about splitting it in two functions: > >>>> =E2=80=98string->time-range=E2=80=99 =E2=86=92 return two SRFI-19 ti= me objects representing a >>>> time interval, or #f and #f on failure > >>>> =E2=80=98generation-within-time-range?=E2=80=99 > >>>> Writing tests for the former will be easy. > >> What do you think of the separation I proposed? > > We have the following cases: =E2=80=981=E2=80=99, =E2=80=981,2,3=E2=80=99= , =E2=80=981..9=E2=80=99, =E2=80=981..=E2=80=99, =E2=80=98..9=E2=80=99, > =E2=80=98first-month=E2=80=99, and =E2=80=98last-month=E2=80=99. It=E2= =80=99s easy to parse the first three and > output a list of generations without checking them. However, you=E2=80= =99ll > have to check the profile in the other cases. That=E2=80=99s the problem. [...] > I don=E2=80=99t understand how the =E2=80=98string->time-range=E2=80=99 f= unction will help to > solve the above problem. There are only two time-related cases: > =E2=80=98first-month=E2=80=99 and =E2=80=98last-month=E2=80=99. Why do y= ou want to return a time range > for every case? Could you show an example? Sorry I think I have been sloppy. So we want to support generation enumerations like =E2=80=981,2,3=E2=80=99,= ranges (incl. open-ended ranges) like =E2=80=981..9=E2=80=99, and age specificatio= ns. For the first one, I would do a =E2=80=98string->generations=E2=80=99 proce= dure: "1,2,3" =E2=87=92 (1 2 3) "1..9" =E2=87=92 (1 2 3 4 5 6 7 8 9) "..9" =E2=87=92 (<=3D 9) ; with the =E2=80=98<=3D=E2=80=99 symbol "1.." =E2=87=92 (>=3D 1) "foo" =E2=87=92 #f Age specifications would only be of the kind =E2=80=9Cat least X days/months old=E2=80=9D. A non-ambiguous syntax is needed, and something more flexible than just =E2=80=98last-month=E2=80=99. Let=E2=80=99s assume =E2=80=98stri= ng->duration=E2=80=99: "+22" =E2=87=92 #