llaville / php-compatinfo-db

Reference Database of all functions, constants, classes, interfaces on PHP standard distribution and about 110 extensions
https://llaville.github.io/php-compatinfo-db/6.13/
BSD 3-Clause "New" or "Revised" License
10 stars 3 forks source link

Cannot build the PHAR version of CompatInfoDB with metadata #111

Closed llaville closed 2 years ago

llaville commented 2 years ago

Bug report category

OS

1. Host operating system and version: Linux php 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 GNU/Linux

2. PHP version: do not depends of a specific version

3. PHP CompatInfoDB version: dev-master@6613dc8

Summary

Following commit 6613dc8fdadd6f8f7fa0f0f1263ee577c594a476, we cannot build the PHAR distrib anymore (depends of Composer components)

Expected behaviour

Be able to run the box compile command again and add the metadata as before.

Actual behaviour

Fatal error: Uncaught Error: Class 'Composer\Factory' not found in /shared/backups/bartlett/php-compatinfo-db/box-metadata.php:29
Stack trace:
#0 /shared/backups/bartlett/php-compatinfo-db/box-metadata.php(77): ComposerScripts::getPharMetadata()
#1 /usr/local/src/box/src/Console/Command/Compile.php(551): require('/shared/backups...')
#2 /usr/local/src/box/src/Console/Command/Compile.php(241): KevinGH\Box\Console\Command\Compile->configureMetadata(Object(KevinGH\Box\Configuration\Configuration), Object(KevinGH\Box\Box), Object(KevinGH\Box\Console\Logger\CompilerLogger))
#3 /usr/local/src/box/src/Console/Command/Compile.php(202): KevinGH\Box\Console\Command\Compile->createPhar(Object(KevinGH\Box\Configuration\Configuration), Object(KevinGH\Box\Console\Logger\CompilerLogger), Object(KevinGH\Box\Console\IO\IO), false)
#4 /usr/local/src/box/src/Console/Command/BaseCommand.php(42): KevinGH\Box\Console\Command\Compile->executeCommand(Object(KevinGH\Box\Console\IO\IO))
#5 /usr/local/src/box/vendor/symfony/console/Command/Command. in /shared/backups/bartlett/php-compatinfo-db/box-metadata.php on line 29
llaville commented 2 years ago

The standard box (version 3.14) is not yet able to manage metadata to handle a real PHAR manifest, except if you follow the workaround solution I've mentioned on https://github.com/box-project/box/issues/576#issuecomment-1028089574

But in the context of CompatInfoDB project, the box-metadata.php used to build the PHAR manifest required at least composer/composer ^2.0.

As I don't want to add it again (reason is usage of Composer 2.0 Runtime API), the box.json.dist file will be changed to remove the metadata entry.

Question:

Answer:

llaville commented 2 years ago

A solution is possible, and I really hope it come alive soon !

llaville commented 2 years ago

Will refactor code to use my standalone version available at https://github.com/llaville/box-manifest/

llaville commented 2 years ago

Code refactored with commit 54745f8 that will produce such output when invoking vendor/bin/box compile command.

Box version 3.16.0@adb282a

 // Loading the configuration file "/shared/backups/bartlett/php-compatinfo-db/box.json.dist".

🔨  Building the PHAR "/shared/backups/bartlett/php-compatinfo-db/bin/compatinfo-db.phar"

? Removing the existing PHAR "/shared/backups/bartlett/php-compatinfo-db/bin/compatinfo-db.phar"
? No compactor to register
? Adding main file: /shared/backups/bartlett/php-compatinfo-db/bin/compatinfo-db
? Adding requirements checker
? Adding binary files
    > No file found
? Auto-discover files? No
? Exclude dev files? Yes
? Adding files
    > 6183 file(s)
? Generating new stub
  - Using shebang line: #!/usr/bin/env php
  - Using banner:
    > Generated by Humbug Box 3.16.0@adb282a.
    >
    > @link https://github.com/humbug/box
? Setting metadata
  - bartlett/php-compatinfo-db: 4.x-dev@d88e010
bartlett/php-compatinfo-db requires php ^7.4|^8.0: 7.4.27
bartlett/php-compatinfo-db requires ext-json *: 7.4.27
bartlett/php-compatinfo-db requires ext-pcre *: 7.4.27
bartlett/php-compatinfo-db requires ext-pdo *: 7.4.27
bartlett/php-compatinfo-db requires ext-phar *: 7.4.27
bartlett/php-compatinfo-db requires ext-spl *: 7.4.27
bartlett/php-compatinfo-db requires amphp/amp : v2.6.1
bartlett/php-compatinfo-db requires amphp/byte-stream : v1.8.1
bartlett/php-compatinfo-db requires amphp/parallel : v1.4.1
bartlett/php-compatinfo-db requires amphp/parallel-functions : v1.1.0
bartlett/php-compatinfo-db requires amphp/parser : v1.0.0
bartlett/php-compatinfo-db requires amphp/process : v1.1.3
bartlett/php-compatinfo-db requires amphp/serialization : v1.0.0
bartlett/php-compatinfo-db requires amphp/sync : v1.4.2
bartlett/php-compatinfo-db requires (for development) bartlett/box-manifest dev-master: dev-master
bartlett/php-compatinfo-db requires (for development) bartlett/graph-uml ^1.2: 1.2.2
bartlett/php-compatinfo-db requires composer/package-versions-deprecated : 1.11.99.5
bartlett/php-compatinfo-db requires composer/pcre : 1.0.1
bartlett/php-compatinfo-db requires composer/semver ^3.0: 3.2.9
bartlett/php-compatinfo-db requires composer/xdebug-handler : 3.0.1
bartlett/php-compatinfo-db requires cweagans/composer-patches : 1.7.2
bartlett/php-compatinfo-db requires doctrine/annotations ^1.13: 1.13.2
bartlett/php-compatinfo-db requires doctrine/cache : 2.1.1
bartlett/php-compatinfo-db requires doctrine/collections : 1.6.8
bartlett/php-compatinfo-db requires doctrine/common : 3.2.2
bartlett/php-compatinfo-db requires doctrine/dbal ^3.2: 3.3.2
bartlett/php-compatinfo-db requires doctrine/deprecations : v0.5.3
bartlett/php-compatinfo-db requires doctrine/event-manager : 1.1.1
bartlett/php-compatinfo-db requires doctrine/inflector : 2.0.4
bartlett/php-compatinfo-db requires doctrine/instantiator : 1.4.0
bartlett/php-compatinfo-db requires doctrine/lexer : 1.2.2
bartlett/php-compatinfo-db requires doctrine/orm ^2.7: 2.11.1
bartlett/php-compatinfo-db requires doctrine/persistence : 2.3.0
bartlett/php-compatinfo-db requires fidry/console : 0.2.0
bartlett/php-compatinfo-db requires graphp/graph : dev-master
bartlett/php-compatinfo-db requires graphp/graphviz : dev-master
bartlett/php-compatinfo-db requires humbug/box : 3.16.0
bartlett/php-compatinfo-db requires humbug/php-scoper : 0.17.0
bartlett/php-compatinfo-db requires jetbrains/phpstorm-stubs : v2021.3
bartlett/php-compatinfo-db requires justinrainbow/json-schema : 5.2.11
bartlett/php-compatinfo-db requires laravel/serializable-closure : v1.1.1
bartlett/php-compatinfo-db requires nikic/iter : v2.2.0
bartlett/php-compatinfo-db requires nikic/php-parser : v4.13.2
bartlett/php-compatinfo-db requires paragonie/constant_time_encoding : v2.5.0
bartlett/php-compatinfo-db requires paragonie/pharaoh : v0.6.0
bartlett/php-compatinfo-db requires paragonie/random_compat : v9.99.100
bartlett/php-compatinfo-db requires paragonie/sodium_compat : v1.17.0
bartlett/php-compatinfo-db requires phpdocumentor/reflection-common : 2.2.0
bartlett/php-compatinfo-db requires phpdocumentor/reflection-docblock : 5.3.0
bartlett/php-compatinfo-db requires phpdocumentor/type-resolver : 1.6.0
bartlett/php-compatinfo-db requires psr/cache : 1.0.1
bartlett/php-compatinfo-db requires psr/container : 1.1.2
bartlett/php-compatinfo-db requires psr/event-dispatcher : 1.0.0
bartlett/php-compatinfo-db requires (for development) psr/log ^1.0: 1.1.4
bartlett/php-compatinfo-db requires seld/jsonlint : 1.8.3
bartlett/php-compatinfo-db requires symfony/amqp-messenger : v5.4.3
bartlett/php-compatinfo-db requires symfony/cache ^4.4|^5.0: v5.4.3
bartlett/php-compatinfo-db requires symfony/cache-contracts : v2.5.0
bartlett/php-compatinfo-db requires symfony/config ^4.4|^5.0: v5.4.3
bartlett/php-compatinfo-db requires symfony/console ^4.4|^5.0: v5.4.3
bartlett/php-compatinfo-db requires symfony/dependency-injection ^4.4|^5.0: v5.4.3
bartlett/php-compatinfo-db requires symfony/deprecation-contracts : v2.5.0
bartlett/php-compatinfo-db requires symfony/doctrine-messenger : v5.4.3
bartlett/php-compatinfo-db requires symfony/event-dispatcher ^4.4|^5.0: v5.4.3
bartlett/php-compatinfo-db requires symfony/event-dispatcher-contracts : v2.5.0
bartlett/php-compatinfo-db requires symfony/filesystem : v5.4.3
bartlett/php-compatinfo-db requires symfony/finder ^4.4|^5.0: v5.4.3
bartlett/php-compatinfo-db requires symfony/messenger ^4.4|^5.0: v5.4.3
bartlett/php-compatinfo-db requires symfony/polyfill-ctype : v1.24.0
bartlett/php-compatinfo-db requires symfony/polyfill-intl-grapheme : v1.24.0
bartlett/php-compatinfo-db requires symfony/polyfill-intl-normalizer : v1.24.0
bartlett/php-compatinfo-db requires symfony/polyfill-mbstring : v1.24.0
bartlett/php-compatinfo-db requires symfony/polyfill-php72 : v1.24.0
bartlett/php-compatinfo-db requires symfony/polyfill-php80 : v1.24.0
bartlett/php-compatinfo-db requires symfony/polyfill-php81 : v1.24.0
bartlett/php-compatinfo-db requires symfony/process ^4.4|^5.0: v5.4.3
bartlett/php-compatinfo-db requires symfony/redis-messenger : v5.4.3
bartlett/php-compatinfo-db requires symfony/requirements-checker ^2.0: v2.0.1
bartlett/php-compatinfo-db requires symfony/serializer : v5.4.3
bartlett/php-compatinfo-db requires symfony/service-contracts : v2.5.0
bartlett/php-compatinfo-db requires symfony/stopwatch ^4.4|^5.0: v5.4.3
bartlett/php-compatinfo-db requires symfony/string : v5.4.3
bartlett/php-compatinfo-db requires symfony/var-dumper : v5.4.3
bartlett/php-compatinfo-db requires symfony/var-exporter : v5.4.3
bartlett/php-compatinfo-db requires thecodingmachine/safe : v1.3.3
bartlett/php-compatinfo-db requires ulrichsg/getopt-php : v3.4.0
bartlett/php-compatinfo-db requires webmozart/assert : 1.10.0
bartlett/php-compatinfo-db requires webmozart/path-util : 2.3.0
? Dumping the Composer autoloader
? Removing the Composer dump artefacts
? Compressing with the algorithm "GZ"
    > Warning: the extension "zlib" will now be required to execute the PHAR
? Setting file permissions to 0755
* Done.

No recommendation found.
No warning found.

 // PHAR: 6206 files (8.36MB)
 // You can inspect the generated PHAR with the "info" command.

 // Memory usage: 106.08MB (peak: 107.61MB), time: 7secs
llaville commented 2 years ago

Used bartlett/box-manifest release 1.0.0 to build the simple text manifest