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


Message #113 received at 42338 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Julien Lepiller <julien <at> lepiller.eu>
Cc: 42338 <at> debbugs.gnu.org
Subject: Re: [bug#42338] [PATCH 03/34] guix: Add composer-build-system.
Date: Mon, 07 Sep 2020 16:09:01 +0200
Julien Lepiller <julien <at> lepiller.eu> skribis:

> * guix/build-system/composer.scm: New file.
> * guix/build/composer-build-system.scm: New file.
> * guix/build-system/findclass.php: New file.
> * Makefile.am: Add them.
> * doc/guix.texi (Build Systems): Document it.

[...]

> +++ b/guix/build-system/findclass.php
> @@ -0,0 +1,102 @@
> +<?php
> +/**
> + * Extract the classes in the given file
> + *
> + * @param  string            $path The file to check
> + * @throws \RuntimeException
> + * @return array             The found classes
> + */

This should rather be under gnu/packages/aux-files IMO.  Also, could you
add a copyright header and possibly info as to where it originates?

> +(define* (create-autoload vendor composer-file inputs #:key dev-dependencies?)
> +  (with-output-to-file (string-append vendor "/autoload.php")
> +    (lambda _
> +      (format #t "<?php~%")
> +      (format #t "// autoload.php @generated by Guix~%")
> +      (format #t "$map = $psr4map = $classmap = array();~%")
> +      (format #t "require_once '~a/autoload_conf.php';~%" vendor)
> +      (format #t "require_once '~a/share/web/composer/ClassLoader.php';~%"
> +                 (assoc-ref inputs "composer-classloader"))
> +      (format #t "$loader = new \\Composer\\Autoload\\ClassLoader();~%")
> +      (format #t "foreach ($map as $namespace => $path) {~%")
> +      (format #t "  $loader->set($namespace, $path);~%")
> +      (format #t "}~%")
> +      (format #t "foreach ($psr4map as $namespace => $path) {~%")
> +      (format #t "  $loader->setPsr4($namespace, $path);~%")
> +      (format #t "}~%")
> +      (format #t "$loader->addClassMap($classmap);~%")
> +      (format #t "$loader->register();~%")))

I think it’d be clearer as a single string:

  (display "\
<?php
// autoload.php …")

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.