michael-o commented on code in PR #200: URL: https://github.com/apache/maven-resolver/pull/200#discussion_r991632848
########## maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/checksum/SummaryFileTrustedChecksumsSource.java: ########## @@ -159,9 +178,63 @@ private ConcurrentHashMap<String, String> loadProvidedChecksums( Path checksumsF } else { - LOGGER.debug( "Checksums file '{}' not found", checksumsFile ); + LOGGER.debug( "The {} trusted checksums for remote repository {} not exist at '{}'", + checksumAlgorithmFactory.getName(), artifactRepository.getId(), checksumsFile ); } return result; } + + private String calculateSummaryPath( boolean originAware, + ArtifactRepository artifactRepository, + ChecksumAlgorithmFactory checksumAlgorithmFactory ) + { + final String fileName; + if ( originAware ) + { + fileName = CHECKSUMS_FILE_PREFIX + "-" + artifactRepository.getId(); + } + else + { + fileName = CHECKSUMS_FILE_PREFIX; + } + return fileName + "." + checksumAlgorithmFactory.getFileExtension(); + } + + private class SummaryFileWriter implements Writer + { + private final Path basedir; + + private final boolean originAware; + + private SummaryFileWriter( Path basedir, boolean originAware ) + { + this.basedir = basedir; + this.originAware = originAware; + } + + @Override + public void addTrustedArtifactChecksums( Artifact artifact, ArtifactRepository artifactRepository, + List<ChecksumAlgorithmFactory> checksumAlgorithmFactories, + Map<String, String> trustedArtifactChecksums ) throws IOException + { + for ( ChecksumAlgorithmFactory checksumAlgorithmFactory : checksumAlgorithmFactories ) + { + String checksum = requireNonNull( + trustedArtifactChecksums.get( checksumAlgorithmFactory.getName() ) ); + String summaryLine = ArtifactIdUtils.toId( artifact ) + " " + checksum + "\n"; + Path summaryPath = basedir.resolve( + calculateSummaryPath( originAware, artifactRepository, checksumAlgorithmFactory ) ); + Files.createDirectories( summaryPath.getParent() ); + Files.write( summaryPath, summaryLine.getBytes( StandardCharsets.UTF_8 ), + StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.APPEND ); Review Comment: Can you drop a line or two as comment about this limitation? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org