composer / satis

Simple static Composer repository generator - For a full private Composer repo use Private Packagist
MIT License
3.14k stars 519 forks source link

Gitlab zip dist download using token with "rearchive: false" #578

Open sacesare opened 4 years ago

sacesare commented 4 years ago

Describe the bug For repository "type:gitlab". Satisfy is not working with "rearchive:false" option in "archive" section=download existing archive.

To Reproduce Create satis.json with : "repositories": [ { "type": "gitlab", "url": "http://mygitlabrep/test/test.git", "installation-source": "dist" }, ... ], "archive": { "format": "zip", "rearchive": false, ... "checksum": true } execute: ./bin/satis build satis.json web --no-ansi --verbose --repository-url=http://mygitlabrep/test/test.git --repository-strict

Outcome ``In Filesystem.php line 286:

[ErrorException] copy(/tmp/composer_archiver5de50e72b0140/archive.zip?sha=686b4b3598e5314db0a5757590f0282413e02b41): failed to open stream: No such file or directory

Exception trace: at /var/www/satisfy/vendor/composer/composer/src/Composer/Util/Filesystem.php:286 Composer\Util\ErrorHandler::handle() at n/a:n/a copy() at /var/www/satisfy/vendor/composer/composer/src/Composer/Util/Filesystem.php:286 Composer\Util\Filesystem->copy() at /var/www/satisfy/vendor/composer/composer/src/Composer/Util/Filesystem.php:266 Composer\Util\Filesystem->copyThenRemove() at /var/www/satisfy/vendor/composer/composer/src/Composer/Util/Filesystem.php:343 Composer\Util\Filesystem->rename() at /var/www/satisfy/vendor/composer/satis/src/Builder/ArchiveBuilder.php:258 Composer\Satis\Builder\ArchiveBuilder->archive() at /var/www/satisfy/vendor/composer/satis/src/Builder/ArchiveBuilder.php:139 Composer\Satis\Builder\ArchiveBuilder->dump() at /var/www/satisfy/vendor/composer/satis/src/Console/Command/BuildCommand.php:195 Composer\Satis\Console\Command\BuildCommand->execute() at /var/www/satisfy/vendor/symfony/console/Command/Command.php:255 Symfony\Component\Console\Command\Command->run() at /var/www/satisfy/vendor/symfony/console/Application.php:934 Symfony\Component\Console\Application->doRunCommand() at /var/www/satisfy/vendor/symfony/console/Application.php:273 Symfony\Component\Console\Application->doRun() at /var/www/satisfy/vendor/composer/satis/src/Console/Application.php:56 Composer\Satis\Console\Application->doRun() at /var/www/satisfy/vendor/symfony/console/Application.php:149 Symfony\Component\Console\Application->run() at /var/www/satisfy/vendor/composer/satis/bin/satis:26`

Expected behavior Archive for gitlab repository downloaded and stored in "dist" directory.

Additional context There's no "archive.zip?sha=686b4b3598e5314db0a5757590f0282413e02b41" in directory, for corresponding commit, but it has simple "/tmp/composer_archiver5de50e72b0140/archive.zip" file. So, question is-why satis tries to create file with name including hash it downloaded from.

stof commented 4 years ago

I suspect that the rearchive: false implementation is buggy when the original URL has a query string. It should be renaming /tmp/composer_archiver5de50e72b0140/archive.zip, not /tmp/composer_archiver5de50e72b0140/archive.zip?sha=686b4b3598e5314db0a5757590f0282413e02b41