GNU bug report logs - #42338
[PATCH] Add composer build system (PHP)

Previous Next

Package: guix-patches;

Reported by: Julien Lepiller <julien <at> lepiller.eu>

Date: Sun, 12 Jul 2020 22:22:02 UTC

Severity: normal

Tags: patch

Done: Steve George <steve <at> futurile.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Julien Lepiller <julien <at> lepiller.eu>
Cc: 42338 <at> debbugs.gnu.org
Subject: [bug#42338] [PATCH 01/34] guix: import: Add composer importer.
Date: Fri, 25 Sep 2020 12:27:01 +0200
Hi Julien,

Julien Lepiller <julien <at> lepiller.eu> skribis:

> From 70b9cb2bb389f3e5f9dcc75a44d7d60c28f997bc Mon Sep 17 00:00:00 2001
> From: Julien Lepiller <julien <at> lepiller.eu>
> Date: Tue, 29 Oct 2019 08:07:38 +0100
> Subject: [PATCH 01/34] guix: import: Add composer importer.
>
> * guix/import/composer.scm: New file.
> * guix/scripts/import/composer.scm: New file.
> * guix/tests/composer.scm: New file.
> * Makefile.am: Add them.
> * guix/scripts/import.scm: Add composer importer.
> * doc/guix.texi (Invoking guix import): Mention it.

[...]

> +@cindex PHP
> +Import metadat from the @uref{https://getcomposer.org/, Composer} package
                ^
Typo.

> +(define* (composer-fetch name #:optional version)
> +  "Return an alist representation of the Composer metadata for the package NAME,
> +or #f on failure."
> +  (let ((package (json-fetch
> +                   (string-append (%composer-base-url) "/p/" name ".json"))))
> +    (if package
> +        (let* ((packages (assoc-ref package "packages"))
> +               (package (or (assoc-ref packages name) package))
> +               (versions (filter
> +                           (lambda (version)
> +                             (and (not (string-contains version "dev"))
> +                                  (not (string-contains version "beta"))))
> +                           (map car package)))
> +               (version (or (if (null? version) #f version)
> +                            (latest-version versions))))
> +          (assoc-ref package version))
> +        #f)))

I think this should directly return a <composer-package> since the all
the callers pass the alist through ‘json->composer-package’.  The idea
is that alists should be converted to records as soon as they enter the
process.

Also it’s weird that ‘package’ above has a “packages” (plural) entry.
Perhaps we’re missing another JSON mapping?

[...]

> +++ b/guix/scripts/import/composer.scm
> @@ -0,0 +1,107 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2015 David Thompson <davet <at> gnu.org>
> +;;; Copyright © 2018 Oleg Pykhalov <go.wigust <at> gmail.com>

You can preserve these two lines if you think it’s relevant, but I’d
suggest adding one for yourself.

OK to push with changes along these lines.

Thanks for taking the time to convert to ‘define-json-mapping’ and all!

Ludo’.




This bug report was last modified 271 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.