Subject: [PATCH] Broken composer-build-system example.

From: jgart <[email-masked]>
Date: Fri, 12 Jul 2024 00:00:45 -0500

Change-Id: Ice1cc8a46f12b21bc841da1578c2c58123194110
---

Hi Guixers,

I'm attaching this patch to show a bug with the composer-build-system currently.

When building I the package in the patch, I get the following error in the install phase:

starting phase `install'
`./.gitattributes' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/.gitattributes'
`./.gitignore' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/.gitignore'
`./.php-cs-fixer.dist.php' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/.php-cs-fixer.dist.php'
`./ChangeLog.md' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/ChangeLog.md'
`./LICENSE' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/LICENSE'
`./README.md' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/README.md'
`./SECURITY.md' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/SECURITY.md'
`./build.xml' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/build.xml'
`./composer.json' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/composer.json'
`./phpstan.neon' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/phpstan.neon'
`./.github/FUNDING.yml' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/.github/FUNDING.yml'
`./.github/workflows/ci.yml' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/.github/workflows/ci.yml'
`./.github/workflows/release.yaml' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/.github/workflows/release.yaml'
`./.phive/phars.xml' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/.phive/phars.xml'
`./build/scripts/extract-release-notes.php' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/build/scripts/extract-release-notes.php'
`./src/Version.php' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/src/Version.php'
`./tools/composer' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/tools/composer'
`./tools/php-cs-fixer' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/tools/php-cs-fixer'
`./tools/phpstan' -> `/gnu/store/7722ygk95qwwy32sg4pildppv41i21q1-php-sebastian-version-5.0.1/share/web/sebastian/version/tools/phpstan'
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/kvrm5fmbdjlwga3khhfg0s9idk3…")
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 7ffff4a37aa0 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 () ())
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/49731nw1bwrxc1yipbhdrzblp39cv6qf-php-sebastian-version-5.0.1.drv' failed with exit code 1
build of /gnu/store/49731nw1bwrxc1yipbhdrzblp39cv6qf-php-sebastian-version-5.0.1.drv failed
View build log at '/var/log/guix/drvs/49/731nw1bwrxc1yipbhdrzblp39cv6qf-php-sebastian-version-5.0.1.drv.gz'.
guix build: error: build of `/gnu/store/49731nw1bwrxc1yipbhdrzblp39cv6qf-php-sebastian-version-5.0.1.drv' failed

WDYT?

 gnu/packages/php-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/php-xyz.scm b/gnu/packages/php-xyz.scm
index bef5a2dcb4..1ac4997934 100644
--- a/gnu/packages/php-xyz.scm
+++ b/gnu/packages/php-xyz.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019 Julien Lepiller <[email-masked]>
+;;; Copyright © 2024 jgart <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,6 +22,7 @@ (define-module (gnu packages php-xyz)
   #:use-module (gnu packages php)
   #:use-module (guix packages)
   #:use-module (guix git-download)
+  #:use-module (guix build-system composer)
   #:use-module (guix build-system copy)
   #:use-module (guix utils)
   #:use-module ((guix licenses) #:prefix license:))
@@ -48,3 +50,23 @@ (define-public composer-classloader
 build its autoloading feature.  This package is used by the composer-build-system
 to build its own store-aware autoloading feature.")
     (license license:expat)))
+
+(define-public php-sebastian-version
+  (package
+    (name "php-sebastian-version")
+    (version "5.0.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/sebastianbergmann/version")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "13l1s8k41vsndvjnijbg7i33bjamynz1y056xk4aps5yigzhvczs"))))
+    (build-system composer-build-system)
+    (synopsis "Manages the version number of Git-hosted PHP projects")
+    (description
+     "Library that helps with managing the version number of Git-hosted PHP projects")
+    (home-page "https://github.com/sebastianbergmann/version")
+    (license license:bsd-3)))

base-commit: 2d6a3799fcda5c017f653c6e96b91964b07a7ee0
-- 
2.45.2