From 8280afc1a43c67fad649b022d1604bd4a46832b0 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 (cherry picked from commit ae2aae158f852cde6fa19c97c54d344f3d8bb7ec) --- .../RecreateRepositoryApplication.java | 16 +++++++++++++++- 1 file changed, 15 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..16788293f9 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,22 @@ 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); + } + } + //remove legacy property if present + if (!checksumsToProperties.containsKey("md5")) { + newDescriptor.setProperty("download.md5", null); + } newDescriptor.addProperties(checksumsToProperties); - repository.addDescriptor(newDescriptor, null); } }