From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#19219: Package names with digits following dashes Date: Mon, 21 Dec 2015 22:46:30 +0100 Message-ID: <87k2o7h3ux.fsf@gnu.org> References: <20141129203122.GA15720@debian> <87ppbws61p.fsf@gnu.org> <874mfssrxd.fsf@gnu.org> <87si3ah1d1.fsf@gnu.org> <87h9jblks4.fsf@gnu.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]:38020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aB8IL-0001XU-LI for bug-guix@gnu.org; Mon, 21 Dec 2015 16:47:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aB8II-0000A8-Fn for bug-guix@gnu.org; Mon, 21 Dec 2015 16:47:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:51560) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aB8II-0000A4-5X for bug-guix@gnu.org; Mon, 21 Dec 2015 16:47:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aB8II-0001eo-0q for bug-guix@gnu.org; Mon, 21 Dec 2015 16:47:02 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87h9jblks4.fsf@gnu.org> (Mathieu Lirzin's message of "Mon, 21 Dec 2015 19:27:23 +0100") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Mathieu Lirzin Cc: 19219@debbugs.gnu.org Mathieu Lirzin skribis: > The test case contains the example "guile-2.0.6.65-134c9" which > invalidates my proposal. Here is another idea which identifies the > version part by the presence of dots. WDYT? Sometimes the version part does not contain dots, as in =E2=80=9Cdiffoscope= -34=E2=80=9D. Here=E2=80=99s the complete list of dot-less versions: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,use(gnu packages) scheme@(guile-user)> (fold-packages (lambda (p r) (if (string-index (package-version p) #\.) r (cons (package-full-name p) r))) '()) $38 =3D ("xterm-320" "unclutter-8" "tidy-20091223" "perl-uri-find-20140709"= "libx264-20150706-2245" "vapoursynth-28" "texlive-texmf-2015" "texlive-bin= -2015" "texlive-2015" "scmutils-20140302" "perl-regexp-common-2013031301" "= parallel-20151122" "diffoscope-34" "mg-20050429" "ngircd-22" "bootstrap-tar= balls-0" "static-binaries-tarball-0" "usbutils-006" "kmod-17" "less-481" "l= ibjpeg-9a" "libjpeg-8d" "hugs-Sep2006" "ghc-bifunctors-5" "ghc-nats-1" "brd= f-explorer-17" "libgudev-230" "psutils-17" "gcal-4" "libspiro-20071029" "fo= ntforge-20120731-b" "font-gnu-freefont-ttf-20100919" "pcb-20140316" "paredi= t-24" "sfarkxtc-b5e0a2ba39" "lz4-131" "ld-wrapper-0" "glibc-bootstrap-0" "g= cc-bootstrap-0" "binutils-bootstrap-0" "bootstrap-binaries-0" "bless-1p02" = "tzdata-2015c" "freepats-20060219" "acpica-20150410") --8<---------------cut here---------------end--------------->8--- Would they still be suitably parsed? I liked that the initial algorithm was trivial, as in Nix: --8<---------------cut here---------------start------------->8--- /* Parse a derivation name. The `name' part of a derivation name is everything up to but not including the first dash *not* followed by a letter. The `version' part is the rest (excluding the separating dash). E.g., `apache-httpd-2.0.48' is parsed to (`apache-httpd', '2.0.48'). */ DrvName::DrvName(const string & s) : hits(0) { name =3D fullName =3D s; for (unsigned int i =3D 0; i < s.size(); ++i) { /* !!! isalpha/isdigit are affected by the locale. */ if (s[i] =3D=3D '-' && i + 1 < s.size() && !isalpha(s[i + 1])) { name =3D string(s, 0, i); version =3D string(s, i + 1); break; } } } --8<---------------cut here---------------end--------------->8--- Another option would be to return a list of possible name version pairs, and to change the UI to try them one after another? The downside would be that it moves complexity to the UI. Hmm=E2=80=A6 Ludo=E2=80=99.