From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:58031) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ikuVy-0002OI-Lr for guix-patches@gnu.org; Fri, 27 Dec 2019 13:39:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ikuVw-0005Mk-Md for guix-patches@gnu.org; Fri, 27 Dec 2019 13:39:10 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:51817) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ikuVq-0005Lq-Ao for guix-patches@gnu.org; Fri, 27 Dec 2019 13:39:08 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ikuVq-0000sL-6e for guix-patches@gnu.org; Fri, 27 Dec 2019 13:39:02 -0500 Subject: [bug#38408] [PATCH v4 1/6] gnu: added new function, find-packages-by-name*/direct Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <877e2sm0vv.fsf@gnu.org> <6e56589639ea75bfec2c97f7e9e31ad9@riseup.net> Date: Fri, 27 Dec 2019 19:38:10 +0100 In-Reply-To: <6e56589639ea75bfec2c97f7e9e31ad9@riseup.net> (Martin Becze's message of "Fri, 20 Dec 2019 10:37:38 -0800") Message-ID: <87blrtfwbx.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Martin Becze Cc: 38408@debbugs.gnu.org Hi Martin, Sorry for the late reply. Martin Becze skribis: >> Providing an explicit cache bypassing method also sounds worrying to me: >> the cache is supposed to be transparent and semantics-preserving. >>=20 >> More generally, I think adding new features to an importer shouldn=E2=80= =99t >> require modifications in this area, as a matter of separating concerns. >>=20 >> WDYT? >>=20 >> Thanks, >> Ludo=E2=80=99. > > yes I agree, I removed that in the last version! Which also rebases off > the new topological sort procedure. I'll attach the latest patches here, > in case you missed it. Thanks! > From eeffdf569c4d7fbfd843e0b48404b6a2f3d46343 Mon Sep 17 00:00:00 2001 > From: Martin Becze > Date: Mon, 16 Dec 2019 17:08:16 -0500 > Subject: [PATCH v5 1/4] guix: import: added recusive-import-semver > > * guix/import/utils.scm (recusive-import-semver): New Varible > * guix/import/utils.scm (package->definition)[arguments]: Add append-veri= ons option [...] > +(define* (recursive-import-semver #:key > + name > + (range "*") > + name->metadata > + metadata->package > + metadata-versions > + package-dependencies > + dependency-name > + dependency-range > + guix-name > + make-sexp) > + "Generates a list of package expressions for the dependencies of the g= iven=20 > +NAME and version RANGE. The dependencies will be resolved using semantic= versioning. > +This procedure makes the assumption that most package repositories will,= for a > +given package provide some on that package that includes what > +versions of the package that are available and a list of dependencies fo= r each > +version. Dependencies are assumed to be composed of a NAME, a semantic R= ANGE and > +other data. > + > +This procedure takes the following keys: > + NAME - The name of the package to import > + RANGE - The version range of the package to import > + NAME->METADATA - A procedure that takes a NAME of a package and return= s that > +package's > + METADATA->PACKAGE A procedure that takes a package's and VE= RSION=20 > +and returns the for the given VERSION > + METADATA-VERSIONS A procedure that that takes a packages and > +returns a list of version as strings that are available for the given pa= ckage > + PACKAGE-DEPENDENCIES a procedure that returns a list of g= iven a=20 > + > + DEPENDENCY-NAME A procedure that takes a and returns the = its name > + DEPENDENCY-RANGE A procedure that takes a and returns that > +decency's range as a string > + GUIX-NAME A procedure that take a NAME and returns the Guix version of= it > + MAKE-SEXP A procedure that takes , and a list of p= airs > +containing (EXPORT-NAME ), returning the package expression = as an=20 > +s-expression" As noted in my previous message, I think this interface is too complex, and since it=E2=80=99s used in a single importer, it would be best to have = it directly in (guix import crate). If/when there=E2=80=99s a need to share that logic among several importers,= then we can look for ways to factorize whatever needs to be factorized. In the meantime, there are probably semver-related things that could naturally to a helper (guix import semver) module, although perhaps most of that is already provided by guile-semver? > + (define-record-type Also, as a rule of thumb, we wouldn=E2=80=99t want to duplicate these data = types and related code. WDYT? Thanks, Ludo=E2=80=99.