From b35a5c8a2a2f491d72c22491cef57f401c85fdcc Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Sun, 15 Oct 2023 10:27:40 +0200 Subject: [PATCH] Add support for Product Update-site names P2 part of https://github.com/eclipse-equinox/p2/issues/345 --- .../internal/p2/publisher/eclipse/ProductFile.java | 8 +++++--- .../equinox/p2/publisher/eclipse/ConfigCUsAction.java | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java index 1134bbf065..de22105174 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/internal/p2/publisher/eclipse/ProductFile.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2018 IBM Corporation and others. + * Copyright (c) 2005, 2023 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -1075,11 +1075,13 @@ private void processPluginConfiguration(Attributes attributes) { private void processRepositoryInformation(Attributes attributes) { try { URI uri = URIUtil.fromString(attributes.getValue(ATTRIBUTE_LOCATION)); + String name = attributes.getValue(ATTRIBUTE_NAME); boolean enabled = Boolean.parseBoolean(attributes.getValue(ATTRIBUTE_ENABLED)); + int options = enabled ? IRepository.ENABLED : IRepository.NONE; // First add a metadata repository - repositories.add(new RepositoryReference(uri, null, IRepository.TYPE_METADATA, enabled ? IRepository.ENABLED : IRepository.NONE)); + repositories.add(new RepositoryReference(uri, name, IRepository.TYPE_METADATA, options)); // Now a colocated artifact repository - repositories.add(new RepositoryReference(uri, null, IRepository.TYPE_ARTIFACT, enabled ? IRepository.ENABLED : IRepository.NONE)); + repositories.add(new RepositoryReference(uri, name, IRepository.TYPE_ARTIFACT, options)); } catch (URISyntaxException e) { // ignore malformed URI's. These should have already been caught by the UI } diff --git a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java index ba349e0475..5e0d1c728b 100644 --- a/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java +++ b/bundles/org.eclipse.equinox.p2.publisher.eclipse/src/org/eclipse/equinox/p2/publisher/eclipse/ConfigCUsAction.java @@ -272,6 +272,9 @@ protected String[] getConfigurationStrings(Collection configAdvic Map parameters = new LinkedHashMap<>(); parameters.put("type", Integer.toString(repo.getType())); //$NON-NLS-1$ parameters.put("location", repo.getLocation().toString()); //$NON-NLS-1$ + if (repo.getNickname() != null) { + parameters.put("name", repo.getNickname()); //$NON-NLS-1$ + } parameters.put("enabled", Boolean.toString((repo.getOptions() & IRepository.ENABLED) == IRepository.ENABLED)); //$NON-NLS-1$ configurationData += TouchpointInstruction.encodeAction("addRepository", parameters); //$NON-NLS-1$ parameters.remove("enabled"); //$NON-NLS-1$