[bug#67902,00/95] PHP package chain.

Message ID 20231219134708.18227-1-ngraves@ngraves.fr
Headers
Series PHP package chain. |

Message

Nicolas Graves Dec. 19, 2023, 1:42 p.m. UTC
This patch series introduces a PHP package chain able to build phpunit
and test the vast majority of this chain's packages. phpunit is the
standard tool to test php packages.

Note that this patch series has to be applied as a whole, packages are
added in the order from the file, and not in the order required to
build a the subset of previous packages.

Nicolas Graves (95):
  gnu: Add abnfgen.
  gnu: php-xyz: Add copyright and useful modules.
  gnu: Add php-cache-tag-interop.
  gnu: Add php-doctrine-collections.
  gnu: Add php-doctrine-common.
  gnu: Add php-doctrine-deprecations.
  gnu: Add php-doctrine-event-manager.
  gnu: Add php-doctrine-instantiator.
  gnu: Add php-doctrine-lexer.
  gnu: Add php-doctrine-persistence.
  gnu: Add php-dms-phpunit-arraysubset-asserts.
  gnu: Add php-egulias-email-validator.
  gnu: Add php-fig-log-test.
  gnu: Add php-hamcrest-hamcrest-php.
  gnu: Add php-mockery-mockery.
  gnu: Add php-myclabs-deep-copy.
  gnu: Add php-nikic-php-parser.
  gnu: Add php-phar-io-manifest.
  gnu: Add php-phar-io-version.
  gnu: Add php-phpdocumentor-reflection-common.
  gnu: Add php-phpdocumentor-reflection-docblock.
  gnu: Add php-phpdocumentor-type-resolver.
  gnu: Add php-phpspec-prophecy.
  gnu: Add php-phpstan-phpdoc-parser.
  gnu: Add php-phpunit-php-code-coverage.
  gnu: Add php-phpunit-php-file-iterator.
  gnu: Add php-phpunit-php-invoker.
  gnu: Add php-phpunit-php-timer.
  gnu: Add php-phpunit-php-text-template.
  gnu: Add php-phpunit-php-token-stream.
  gnu: Add php-predis-predis.
  gnu: Add php-psr-log.
  gnu: Add php-psr-cache.
  gnu: Add php-psr-cache-1.
  gnu: Add php-psr-container.
  gnu: Add php-psr-event-dispatcher.
  gnu: Add php-psr-simple-cache.
  gnu: Add php-sebastian-cli-parser.
  gnu: Add php-sebastian-code-unit.
  gnu: Add php-sebastian-code-unit-reverse-lookup.
  gnu: Add php-sebastian-comparator.
  gnu: Add php-sebastian-complexity.
  gnu: Add php-sebastian-diff.
  gnu: Add php-sebastian-environment.
  gnu: Add php-sebastian-exporter.
  gnu: Add php-sebastian-global-state.
  gnu: Add php-sebastian-lines-of-code.
  gnu: Add php-sebastian-object-enumerator.
  gnu: Add php-sebastian-object-reflector.
  gnu: Add php-sebastian-recursion-context.
  gnu: Add php-sebastian-resource-operations.
  gnu: Add php-sebastian-type.
  gnu: Add php-sebastian-version.
  gnu: Add php-symfony-cache.
  gnu: Add php-cache-integration-tests.
  gnu: Add php-symfony-cache-contracts.
  gnu: Add php-symfony-config.
  gnu: Add php-symfony-console.
  gnu: Add php-symfony-dependency-injection.
  gnu: Add php-symfony-deprecation-contracts.
  gnu: Add php-symfony-error-handler.
  gnu: Add php-symfony-event-dispatcher.
  gnu: Add php-symfony-event-dispatcher-contracts.
  gnu: Add php-symfony-expression-language.
  gnu: Add php-symfony-filesystem.
  gnu: Add php-symfony-finder.
  gnu: Add php-symfony-http-foundation.
  gnu: Add php-symfony-http-kernel.
  gnu: Add php-symfony-intl.
  gnu: Add php-symfony-lock.
  gnu: Add php-symfony-mime.
  gnu: Add php-symfony-phpunit-bridge.
  gnu: Add php-symfony-process.
  gnu: Add php-symfony-property-info.
  gnu: Add php-symfony-polyfill-ctype.
  gnu: Add php-symfony-polyfill-intl-grapheme.
  gnu: Add php-symfony-polyfill-intl-idn.
  gnu: Add php-symfony-polyfill-intl-normalizer.
  gnu: Add php-symfony-polyfill-mbstring.
  gnu: Add php-symfony-polyfill-uuid.
  gnu: Add php-symfony-service-contracts.
  gnu: Add php-symfony-stopwatch.
  gnu: Add php-symfony-string.
  gnu: Add php-symfony-translation-contracts.
  gnu: Add php-symfony-uid.
  gnu: Add php-symfony-var-dumper.
  gnu: Add php-symfony-var-exporter.
  gnu: Add php-symfony-yaml.
  gnu: Add php-doctrine-cache.
  gnu: Add php-doctrine-annotations.
  gnu: Add php-doctrine-dbal.
  gnu: Add php-theseer-tokenizer.
  gnu: Add php-twig-twig.
  gnu: Add php-webmozart-assert.
  gnu: Add php-phpunit-phpunit.

 gnu/packages/check.scm                        |   24 +
 ...t-hamcrest-php-phpunit-compatibility.patch |  190 ++
 ...ymfony-phpunit-bridge-getVendors-fix.patch |   46 +
 gnu/packages/php-xyz.scm                      | 2588 ++++++++++++++++-
 4 files changed, 2845 insertions(+), 3 deletions(-)
 create mode 100644 gnu/packages/patches/php-hamcrest-hamcrest-php-phpunit-compatibility.patch
 create mode 100644 gnu/packages/patches/php-symfony-phpunit-bridge-getVendors-fix.patch
  

Comments

Wilko Meyer March 23, 2024, 4:36 p.m. UTC | #1
Hi Nicolas,

I applied v1 of the patchset and the one patch of v2 locally, which
worked pretty well. Patch 01/95 introducing abfngen got rejected, so I
manually applied the changes:

#+begin_src
~/devel/guix [env]$ cat gnu/packages/check.scm.rej 
diff a/gnu/packages/check.scm b/gnu/packages/check.scm	(rejected hunks)
@@ -109,6 +109,30 @@ (define-module (gnu packages check)
   #:use-module (guix deprecation)
   #:use-module (srfi srfi-1))
 
+(define-public abnfgen
+  (package
+    (name "abnfgen")
+    (version "0.21")
+    (source
+     (origin
+       (method url-fetch)
+       (uri "https://www.quut.com/abnfgen/abnfgen-0.21.tar.gz")
+       (sha256
+        (base32 "0vjkbsgr193r0fz0f29sljkw28djwavk51m1izinfjqb07k89xsv"))))
+    (build-system gnu-build-system)
+    (home-page "https://www.quut.com/abnfgen")
+    (synopsis "Generate random documents matching an ABNF grammar.")
+    (description
+     "Given an Augmented Backus-Naur form (ABNF) grammar (RFC 4234),
+this package provides a binary to quickly generate lots of random documents
+that match that grammar. That is useful for
+@itemize
+@item verifying an ABNF grammar's syntactical correctness
+@item illustrating a grammar with non-obvious examples
+@item testing software that is supposed to consume documents described by a grammar
+@end itemize")
+    (license license:expat)))
+
 (define-public pict
   (package
     (name "pict")
#+end_src

However I cannot get phpunit to be build successfully as one dependency
php-doctrine-instantiator seems to be faulty. I'm not too familiar
with guixes composer/php build system, but as far as I can see it fails
while creating the autoload_conf.php:

#+begin_src
error: in phase 'install': uncaught exception:
wrong-type-arg "delete-duplicates" "Wrong type argument in position ~A: ~S" (2 ()) (()) 
Backtrace:
          11 (primitive-load "/gnu/store/2rwq2xc8dcnacns2maqwlkcx85i…")
In guix/build/gnu-build-system.scm:
    908:2 10 (gnu-build #:source _ #:outputs _ #:inputs _ #:phases . #)
In ice-9/boot-9.scm:
  1752:10  9 (with-exception-handler _ _ #:unwind? _ # _)
In srfi/srfi-1.scm:
    634:9  8 (for-each #<procedure 7ffff777eac0 at guix/build/gnu-b…> …)
In ice-9/boot-9.scm:
  1752:10  7 (with-exception-handler _ _ #:unwind? _ # _)
In guix/build/gnu-build-system.scm:
   929:23  6 (_)
In ice-9/ports.scm:
   433:17  5 (call-with-output-file _ _ #:binary _ #:encoding _)
    476:4  4 (_ _)
In guix/build/composer-build-system.scm:
    194:9  3 (_)
In unknown file:
           2 (delete-duplicates (("Doctrine\\Instantiator\\" . "s…")) …)
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure delete-duplicates: Wrong type argument in position 2: ()
builder for `/gnu/store/23dv5mprah2xiz2skzf806cybn96zyv1-php-doctrine-instantiator-2.0.0.drv' failed with exit code 1
build of /gnu/store/23dv5mprah2xiz2skzf806cybn96zyv1-php-doctrine-instantiator-2.0.0.drv failed
View build log at '/var/log/guix/drvs/23/dv5mprah2xiz2skzf806cybn96zyv1-php-doctrine-instantiator-2.0.0.drv.gz'.
cannot build derivation `/gnu/store/aflr3m81hpaj4y1m62gnz171z3wnbflj-phpunit-9.6.10.drv': 1 dependencies couldn't be built
guix build: error: build of `/gnu/store/aflr3m81hpaj4y1m62gnz171z3wnbflj-phpunit-9.6.10.drv' failed
#+end_src

Maybe I'll find some time to debug this further/figure out what the
compose-build-system is trying there and why exactly it fails so I can
fix it myself; but just in case this wasn't already known I wanted to
document the issue here.

Thanks for the extensive package set and as far as git log tells me for
the composer-build-system as well! :)
  
Ludovic Courtès April 5, 2024, 8:12 p.m. UTC | #2
Hey Nicolas,

Wilko Meyer <w@wmeyer.eu> skribis:

> I applied v1 of the patchset and the one patch of v2 locally, which
> worked pretty well. Patch 01/95 introducing abfngen got rejected, so I
> manually applied the changes:

[...]

> However I cannot get phpunit to be build successfully as one dependency
> php-doctrine-instantiator seems to be faulty. I'm not too familiar
> with guixes composer/php build system, but as far as I can see it fails
> while creating the autoload_conf.php:

Could you look into these issues?

I know nothing about PHP but I’m happy to apply the patch series when
the two of you tell me it’s ready.

Thanks,
Ludo’.
  
Nicolas Graves April 5, 2024, 10:43 p.m. UTC | #3
On 2024-04-05 22:12, Ludovic Courtès wrote:

> Hey Nicolas,
>
> Wilko Meyer <w@wmeyer.eu> skribis:
>
>> I applied v1 of the patchset and the one patch of v2 locally, which
>> worked pretty well. Patch 01/95 introducing abfngen got rejected, so I
>> manually applied the changes:
>
> [...]
>
>> However I cannot get phpunit to be build successfully as one dependency
>> php-doctrine-instantiator seems to be faulty. I'm not too familiar
>> with guixes composer/php build system, but as far as I can see it fails
>> while creating the autoload_conf.php:
>
> Could you look into these issues?

Hi Ludo,

As far as I remember, it did work on my side after the patches I sent on
19th December.

Most likely these remaining errors come from those faulty parts, so I'll
suggest reviewing them and confirming that phpunit indeed builds rather
than further investigating from there.

These were the patches concerned :

      - "first" here is 67895
      - "second" here is 67898 v2
      - the packages are in 67902, only with the 02/95 patch in a v2.

      >>>> It would also be nice if the updater would fill in the ‘inputs’ fields
      >>>> of <upstream-source>: that would allow ‘guix refresh -u’ to
      >>>> automatically update inputs.
      >
      > I'll try to give it a look now.

      This is now done in 67906.

I've seen the review in 67898 which I'll address in a v3.
IIRC, 67898 depends on 67895.

>
> I know nothing about PHP but I’m happy to apply the patch series when
> the two of you tell me it’s ready.
>
> Thanks,
> Ludo’.
  
jgart July 13, 2024, 1:38 p.m. UTC | #4
Hi all,

Are people still interested in working on this?

Could you send a v3, if so for review?

I can review it.
  
Wilko Meyer July 13, 2024, 3:53 p.m. UTC | #5
Hi,

jgart <jgart@dismail.de> writes:

> Are people still interested in working on this?

I don't know what the state of this patch series and the adjacent patch
series are, but could offer to try to build this patch series again and
see if I'm able to build phpunit from it this time. Having phpunit in
Guix would certainly help to be able to package other php libraries, so
it may be a good thing to have.

Nicolas offered some suggestions that may fix the build errors I've
encountered some time ago. So I'll try that and send feedback
afterwards.

If there's something else I can assist with, let me know.
  
Wilko Meyer July 14, 2024, 12:28 a.m. UTC | #6
Wilko Meyer <w@wmeyer.eu> writes:
> Nicolas offered some suggestions that may fix the build errors I've
> encountered some time ago. So I'll try that and send feedback
> afterwards.

Found time to do so a few hours later and was able to build phpunit
succesfully from it:

(~/devel/guix) λ ./pre-inst-env guix shell phpunit
wilko@optiplex ~/devel/guix [env]$ phpunit --version
PHPUnit 9.6.10 by Sebastian Bergmann and contributors.

Tried building a few other packages from this series,
e.g. php-doctrine-common, as well:

successfully built /gnu/store/fq0z825ng9hkfz834b80kjvyv74q3pag-php-doctrine-common-3.4.3.drv
/gnu/store/4kan2qn6n7qnsiirrpmkx2f0p8qv9sf9-php-doctrine-common-3.4.3

Another one, php-symfony-console can be build when tests for its
dependency on php-symfony-error-handler are skipped:

(~/devel/guix) λ ./pre-inst-env guix build --without-tests=php-symfony-error-handler php-symfony-console
successfully built /gnu/store/9bl3c2m2rsv9qqn0n4pcxxhhgmpygr9p-php-symfony-console-6.3.2.drv
/gnu/store/wgsqpj2qgxmjp6zv8rnmy55r07c47hvx-php-symfony-console-6.3.2

for php-symfony-error-handler only one out of 5 tests fail, and the one
failing test seems to fail because it throws a deprecation warning which
isn't expected, it could probably be skipped for now, the affected test
is:

/tmp/guix-build-php-symfony-error-handler-6.0.19.drv-0/source/Tests/phpt/fatal_with_nested_handlers.phpt

I don't know how feasible it is to invest time in testing other packages
from this patch series (maybe nudging ci.guix.gnu.org into doing this
could be beneficial here?), but as phpunit works it could very well be
that the series is mostly fine?
  
jgart July 15, 2024, 5:46 p.m. UTC | #7
> from this patch series (maybe nudging ci.guix.gnu.org into doing this
> 
> could be beneficial here?), but as phpunit works it could very well be
> 
> that the series is mostly fine?
> 

Hi,

If you can send a latest updated patch set for merge consideration that you think I should review, I can schedule time to review it.

all best,

jgart