vtsykun/packeton

Disable zipball creation for packages

Closed this issue ยท 7 comments

xelan commented

Description

Hi @vtsykun and first of all, thanks for this great project!

We would like to use Packeton to manage our composer packages, but we do not need/want the zipball feature.
Instead the applications should clone the packages directly from our GitLab server, ensuring authentication with the respective deploy keys.

After having a look at your documentation and code, we thought that the configuration option archive should allow such behavior.

So we tried to set the configuration option archive to false. However, now the Packeton application throws a RuntimeException:

[Symfony\Component\DependencyInjection\Exception\RuntimeException]                                               
  You have requested a non-existent parameter "packeton_archive_opts". Did you mean this: "packeton_dumper_opts"?

This exception can be mitigated by changing Packeton\DependencyInjection\PacketonExtension to initialize the packeton_archive_opts:

        [...]

        if (true === $config['archive']) {
            $container->setParameter('packeton_archive_opts', $config['archive_options'] ?? []);
        } else {
            $container->setParameter('packeton_archive_opts', []);
        }

        [...]

Now another exception is thrown:

  [Symfony\Component\DependencyInjection\Exception\EnvParameterException]                                    
  Environment variables "PACKAGIST_DIST_HOST" are never used. Please, check your container's configuration.

We tried to fix the issues, but could not find a satisfactory solution yet.

If we add --prefer-source to the composer install commands, we get the desired behavior for our internal packages.
However, we'd like to avoid changing all scripts where composer packages are installed. Furthermore, this is also applied to
external packages and therefore slows down the installation from packagist.org a lot.

How can we best achieve our goal (downloads only directly from the configured Git sources)?

Thank you very much, best regards

Can you reproduce the bug on the Packeton demo site?

N/A

Database

SQLite

Screenshots

No response

How are you running Packeton?

Official docker image

Hi @xelan
I pushed fixes for it, you can try for it b226293

xelan commented

Thanks for the fast response and fix, we'll test it ๐Ÿ‘

xelan commented

Works well so far. One thing we noticed: The dist key contains null for the latest version of a package, but "__unset" for the other versions. Composer apparently ignores those values, but we're still wondering if this is the intended behavior.

Thanks!

Hi @xelan
Looks like a bug. I pushed more fixes for this issue. After update the package the dist->null will be apply to all versions

xelan commented

Thanks @vtsykun. Now the database looks good (null), but in the JSON there are still entries with __unset in the p2 JSON. Is this ok or should it also be null?

Hi, yes __unset it's internal composer MetadataMinifier constant. https://github.com/composer/metadata-minifier/blob/main/src/MetadataMinifier.php#L35
Also you can see the package metadata for format v1 in /p/{name}.json

xelan commented

Ok, thank you very much @vtsykun