nexus-repository-composer
nexus-repository-composer copied to clipboard
package.json difference between proxy and group
Hello there!
During the last couple of days I encountered the Problem that the package.json (e.g. /p/symfony/symfony.json
in the composer-proxy is different from the one available in composer-group.
We are missing a couple of keys. The ones we are struggling at the moment are especially include-path
and replace
. But according to the schema.json we are still lacking a couple more. I tried to update the ComposerJsonProcessor in my branch kununu/nexus-repository-composer#2 in the hope to fix it "quickly". But sadly that seem to not have any effect. Maybe I did something wrong or misunderstood how it works?
Help would be appreciated 🙂
More Information: First Object = Proxy Second Object = Group
[
{
"v4.1.1": {
"name": "symfony/symfony",
"description": "The Symfony PHP framework",
"keywords": [
"framework"
],
"homepage": "https://symfony.com",
"version": "v4.1.1",
"version_normalized": "4.1.1.0",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "[email protected]"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"dist": {
"url": "https://{internal-url}/repository/composer-proxy/symfony/symfony/v4.1.1/symfony-symfony-v4.1.1.zip",
"type": "zip",
"reference": "68b56033c43d2c499d8dcf79f374c33049184b96",
"shasum": ""
},
"type": "library",
"time": "2018-06-25T13:07:10+00:00",
"autoload": {
"psr-4": {
"Symfony\\Bridge\\Doctrine\\": "src/Symfony/Bridge/Doctrine/",
"Symfony\\Bridge\\Monolog\\": "src/Symfony/Bridge/Monolog/",
"Symfony\\Bridge\\ProxyManager\\": "src/Symfony/Bridge/ProxyManager/",
"Symfony\\Bridge\\Twig\\": "src/Symfony/Bridge/Twig/",
"Symfony\\Bundle\\": "src/Symfony/Bundle/",
"Symfony\\Component\\": "src/Symfony/Component/"
},
"classmap": [
"src/Symfony/Component/Intl/Resources/stubs"
],
"exclude-from-classmap": [
"**/Tests/"
]
},
"extra": {
"branch-alias": {
"dev-master": "4.1-dev"
}
},
"require": {
"doctrine/common": "~2.4@stable",
"ext-xml": "*",
"fig/link-util": "^1.0",
"php": "^7.1.3",
"psr/cache": "~1.0",
"psr/container": "^1.0",
"psr/link": "^1.0",
"psr/log": "~1.0",
"psr/simple-cache": "^1.0",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-intl-icu": "~1.0",
"symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php72": "~1.5",
"twig/twig": "^1.35|^2.4.4"
},
"require-dev": {
"cache/integration-tests": "dev-master",
"doctrine/annotations": "~1.0",
"doctrine/cache": "~1.6",
"doctrine/data-fixtures": "1.0.*",
"doctrine/dbal": "~2.4",
"doctrine/doctrine-bundle": "~1.4",
"doctrine/orm": "~2.4,>=2.4.5",
"egulias/email-validator": "~1.2,>=1.2.8|~2.0",
"monolog/monolog": "~1.11",
"ocramius/proxy-manager": "~0.4|~1.0|~2.0",
"phpdocumentor/reflection-docblock": "^3.0|^4.0",
"predis/predis": "~1.0",
"symfony/phpunit-bridge": "~3.4|~4.0",
"symfony/security-acl": "~2.8|~3.0"
},
"conflict": {
"phpdocumentor/reflection-docblock": "<3.0||>=3.2.0,<3.2.2",
"phpdocumentor/type-resolver": "<0.2.1",
"phpunit/phpunit": "<5.4.3"
},
"provide": {
"psr/cache-implementation": "1.0",
"psr/container-implementation": "1.0",
"psr/log-implementation": "1.0",
"psr/simple-cache-implementation": "1.0"
},
"replace": {
"symfony/asset": "self.version",
"symfony/browser-kit": "self.version",
"symfony/cache": "self.version",
"symfony/config": "self.version",
"symfony/console": "self.version",
"symfony/css-selector": "self.version",
"symfony/dependency-injection": "self.version",
"symfony/debug": "self.version",
"symfony/debug-bundle": "self.version",
"symfony/doctrine-bridge": "self.version",
"symfony/dom-crawler": "self.version",
"symfony/dotenv": "self.version",
"symfony/event-dispatcher": "self.version",
"symfony/expression-language": "self.version",
"symfony/filesystem": "self.version",
"symfony/finder": "self.version",
"symfony/form": "self.version",
"symfony/framework-bundle": "self.version",
"symfony/http-foundation": "self.version",
"symfony/http-kernel": "self.version",
"symfony/inflector": "self.version",
"symfony/intl": "self.version",
"symfony/ldap": "self.version",
"symfony/lock": "self.version",
"symfony/messenger": "self.version",
"symfony/monolog-bridge": "self.version",
"symfony/options-resolver": "self.version",
"symfony/process": "self.version",
"symfony/property-access": "self.version",
"symfony/property-info": "self.version",
"symfony/proxy-manager-bridge": "self.version",
"symfony/routing": "self.version",
"symfony/security": "self.version",
"symfony/security-core": "self.version",
"symfony/security-csrf": "self.version",
"symfony/security-guard": "self.version",
"symfony/security-http": "self.version",
"symfony/security-bundle": "self.version",
"symfony/serializer": "self.version",
"symfony/stopwatch": "self.version",
"symfony/templating": "self.version",
"symfony/translation": "self.version",
"symfony/twig-bridge": "self.version",
"symfony/twig-bundle": "self.version",
"symfony/validator": "self.version",
"symfony/var-dumper": "self.version",
"symfony/web-link": "self.version",
"symfony/web-profiler-bundle": "self.version",
"symfony/web-server-bundle": "self.version",
"symfony/workflow": "self.version",
"symfony/yaml": "self.version"
},
"uid": 2287735
}
},
{
"v4.1.1": {
"name": "symfony/symfony",
"version": "v4.1.1",
"dist": {
"url": "https://{internal-url}/repository/composer/symfony/symfony/v4.1.1/symfony-symfony-v4.1.1.zip",
"type": "zip",
"reference": "68b56033c43d2c499d8dcf79f374c33049184b96",
"shasum": ""
},
"time": "2018-06-25T13:07:10+00:00",
"uid": 1865870344,
"autoload": {
"psr-4": {
"Symfony\\Bridge\\Doctrine\\": "src/Symfony/Bridge/Doctrine/",
"Symfony\\Bridge\\Monolog\\": "src/Symfony/Bridge/Monolog/",
"Symfony\\Bridge\\ProxyManager\\": "src/Symfony/Bridge/ProxyManager/",
"Symfony\\Bridge\\Twig\\": "src/Symfony/Bridge/Twig/",
"Symfony\\Bundle\\": "src/Symfony/Bundle/",
"Symfony\\Component\\": "src/Symfony/Component/"
},
"classmap": [
"src/Symfony/Component/Intl/Resources/stubs"
],
"exclude-from-classmap": [
"**/Tests/"
]
},
"require": {
"doctrine/common": "~2.4@stable",
"ext-xml": "*",
"fig/link-util": "^1.0",
"php": "^7.1.3",
"psr/cache": "~1.0",
"psr/container": "^1.0",
"psr/link": "^1.0",
"psr/log": "~1.0",
"psr/simple-cache": "^1.0",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-intl-icu": "~1.0",
"symfony/polyfill-mbstring": "~1.0",
"symfony/polyfill-php72": "~1.5",
"twig/twig": "^1.35|^2.4.4"
},
"require-dev": {
"cache/integration-tests": "dev-master",
"doctrine/annotations": "~1.0",
"doctrine/cache": "~1.6",
"doctrine/data-fixtures": "1.0.*",
"doctrine/dbal": "~2.4",
"doctrine/doctrine-bundle": "~1.4",
"doctrine/orm": "~2.4,>=2.4.5",
"egulias/email-validator": "~1.2,>=1.2.8|~2.0",
"monolog/monolog": "~1.11",
"ocramius/proxy-manager": "~0.4|~1.0|~2.0",
"phpdocumentor/reflection-docblock": "^3.0|^4.0",
"predis/predis": "~1.0",
"symfony/phpunit-bridge": "~3.4|~4.0",
"symfony/security-acl": "~2.8|~3.0"
},
"authors": [
{
"name": "Fabien Potencier",
"email": "[email protected]"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"conflict": {
"phpdocumentor/reflection-docblock": "<3.0||>=3.2.0,<3.2.2",
"phpdocumentor/type-resolver": "<0.2.1",
"phpunit/phpunit": "<5.4.3"
},
"description": "The Symfony PHP framework",
"extra": {
"branch-alias": {
"dev-master": "4.1-dev"
}
},
"homepage": "https://symfony.com",
"keywords": [
"framework"
],
"license": [
"MIT"
],
"provide": {
"psr/cache-implementation": "1.0",
"psr/container-implementation": "1.0",
"psr/log-implementation": "1.0",
"psr/simple-cache-implementation": "1.0"
}
}
}
]
@TheBay0r, I've checked out your branch and tried it out for both include-path
and replace
, and in my testing it seems to be working.
My exact setup:
- I built the Docker image using the instructions in our README.md.
- I set up a composer-proxy repository pointing to packagist.org.
- I set up a composer-group repository containing the composer-proxy repository.
- I fetched the content for
p/symfony/symfony.json
from packagist.org as a baseline. - I fetched the content for
p/symfony/symfony.json
from the proxy repo. - I fetched the content for
p/symfony/symfony.json
from the group repo.
Counts for include-path
:
- packagist.org (0)
- composer-proxy (0)
- composer-group (0)
Counts for replace
:
- packagist.org (357)
- composer-proxy (357)
- composer-group (357)
So to me, it looks like it works. Your branch only has test cases for the include-path
key, so I'd go add ones for the replace
key as well (exactly as you did for include-path
), then rebuild and try it again.
The only other difference I can think of is that if perhaps we're using different staging setups. Are you by any chance using a hosted repo for test purposes in the group scenario? Are you sure that you have a clean build and a new Docker image containing your most recent commit (containing the addition of the replace
key)?
(By the way, I also like your cleanup on https://github.com/kununu/nexus-repository-composer/tree/restructure-composer-json-processor as a means of reducing technical debt; most of our format implementations adopt a pattern of using string constants for each key, but past a certain point that gets very unwieldy as you've no doubt noticed. There are a couple of stylistic changes that would be nice to make it fit the Nexus coding style but I'd like you to open up a PR so we could get that merged in as well.)
Hey @fjmilens3 thanks for your feedback… I didn't write tests for replace, because it doesn't seem to be working in my setup. I can add tests ofc.
Are you by any chance using a hosted repo for test purposes in the group scenario?
Yes, in my scenario the group repository is a combination from the packagist proxy and a hosted repository. Although I have to admit that my testing setup was more an upgrade to an existing instance. I will give it a try with a clean instance as well 🤔If it works with a clean installation, is there any chance to get it working in an existing setup too?
By the way, I also like your cleanup on …
Thanks! Sadly it fails the tests and I didn't have the time to investigate why. I first thought of a more JavaScripty way of doing this, but then I got reminded that Java doesn't support dynamic objects (assigning new properties to existing objects), at least not that I'm aware. My alternative thought would have been to retrieve this information via a resource template.json... but also no time to look into this in more detail. I'll open a PR were we can discuss this further