From f7d943d7bad614e95c77e8c2127cd8dcd1d3c552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Fri, 31 May 2024 18:14:09 +0200 Subject: [PATCH] Remove no longer valid checksum properties Currently Tycho/P2 only *adds* checksums but as some are now disabled for publish this can lead to the case where an existing checksum is kept as-is. This now performs and additional check if there are old checksums and remove them when recreate the repository. Fix https://github.com/eclipse-tycho/tycho/issues/2875 --- .../copiedfromp2/RecreateRepositoryApplication.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2tools/copiedfromp2/RecreateRepositoryApplication.java b/tycho-core/src/main/java/org/eclipse/tycho/p2tools/copiedfromp2/RecreateRepositoryApplication.java index 22573e21f2..017b3f8e13 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2tools/copiedfromp2/RecreateRepositoryApplication.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2tools/copiedfromp2/RecreateRepositoryApplication.java @@ -151,8 +151,18 @@ private MultiStatus recreateRepository(IProgressMonitor monitor) throws Provisio } Map checksumsToProperties = ChecksumUtilities .checksumsToProperties(IArtifactDescriptor.DOWNLOAD_CHECKSUM, checksums); + //remove checksums that are no longer marked for publishing + String checksumProperty = IArtifactDescriptor.DOWNLOAD_CHECKSUM + "."; + for (String property : newDescriptor.getProperties().keySet().toArray(String[]::new)) { + if (property.startsWith(checksumProperty)) { + String id = property.substring(checksumProperty.length()); + if (checksumsToProperties.containsKey(id)) { + continue; + } + newDescriptor.setProperty(checksumProperty + id, null); + } + } newDescriptor.addProperties(checksumsToProperties); - repository.addDescriptor(newDescriptor, null); } }