COMMONSSITE-117: remove md5 hashes from release artifacts
Project: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/commit/d59a1c6f Tree: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/tree/d59a1c6f Diff: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/diff/d59a1c6f Branch: refs/heads/1.3 Commit: d59a1c6f6ec5fbe3fb8bb0bdc4d885512d07b51c Parents: b1bc7a3 Author: Rob Tompkins <chtom...@apache.org> Authored: Fri Jun 15 10:49:51 2018 -0400 Committer: Rob Tompkins <chtom...@apache.org> Committed: Fri Jun 15 10:49:51 2018 -0400 ---------------------------------------------------------------------- RELEASE-NOTES.txt | 1 + src/changes/changes.xml | 3 +- .../CommonsDistributionDetachmentMojo.java | 51 +++++++++----------- .../CommonsDistributionDetachmentMojoTest.java | 8 --- .../CommonsDistributionStagingMojoTest.java | 8 --- 5 files changed, 26 insertions(+), 45 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/d59a1c6f/RELEASE-NOTES.txt ---------------------------------------------------------------------- diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 0957286..62d3e1f 100755 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -24,6 +24,7 @@ o COMMONSSITE-108: Adding README.html and HEADER.html to staged release CHANGES ======= +o COMMONSSITE-117: Remove md5 signatures from release artifacts. o COMMONSSITE-113: Put unpacked site in scm dev dist directory for navigating purposes. o Update platform requirement from Java 7 to Java 8. http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/d59a1c6f/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index e661348..435a427 100755 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -25,7 +25,8 @@ </properties> <body> - <release version="1.3" date="YYYY-MM-DD" description="TBD"> + <release version="1.3" date="2018-06-15" description="Version 1.3"> + <action issue="COMMONSSITE-117" type="update" dev="chtompki">Remove md5 signatures from release artifacts.</action> <action issue="COMMONSSITE-113" type="update" dev="chtompki">Put unpacked site in scm dev dist directory for navigating purposes.</action> <action issue="COMMONSSITE-112" type="add" dev="ggregory">Add a vote.txt file.</action> <action issue="COMMONSSITE-108" type="add" dev="chtompki">Adding README.html and HEADER.html to staged release</action> http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/d59a1c6f/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java index 9c95127..97a622e 100755 --- a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java +++ b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojo.java @@ -159,14 +159,9 @@ public class CommonsDistributionDetachmentMojo extends AbstractMojo { */ private void putAttachedArtifactInSha1Map(Artifact artifact) throws MojoExecutionException { try { - StringBuffer artifactKey = new StringBuffer(); - artifactKey - .append(artifact.getArtifactId()).append('-') - .append(artifact.getVersion()).append('-') - .append(artifact.getClassifier()).append('-') - .append(artifact.getType()); + String artifactKey = getArtifactKey(artifact); try (FileInputStream fis = new FileInputStream(artifact.getFile())) { - artifactSha1s.put(artifactKey.toString(), DigestUtils.sha1Hex(fis)); + artifactSha1s.put(artifactKey, DigestUtils.sha1Hex(fis)); } } catch (IOException e) { throw new MojoExecutionException( @@ -190,14 +185,9 @@ public class CommonsDistributionDetachmentMojo extends AbstractMojo { */ private void putAttachedArtifactInSha256Map(Artifact artifact) throws MojoExecutionException { try { - StringBuffer artifactKey = new StringBuffer(); - artifactKey - .append(artifact.getArtifactId()).append('-') - .append(artifact.getVersion()).append('-') - .append(artifact.getClassifier()).append('-') - .append(artifact.getType()); + String artifactKey = getArtifactKey(artifact); try (FileInputStream fis = new FileInputStream(artifact.getFile())) { - artifactSha256s.put(artifactKey.toString(), DigestUtils.sha256Hex(fis)); + artifactSha256s.put(artifactKey, DigestUtils.sha256Hex(fis)); } } catch (IOException e) { throw new MojoExecutionException( @@ -277,22 +267,9 @@ public class CommonsDistributionDetachmentMojo extends AbstractMojo { private void hashArtifacts() throws MojoExecutionException { for (Artifact artifact : detachedArtifacts) { if (!artifact.getFile().getName().contains("asc")) { - StringBuffer artifactKey = new StringBuffer(); - artifactKey.append(artifact.getArtifactId()).append('-') - .append(artifact.getVersion()).append('-') - .append(artifact.getClassifier()).append('-') - .append(artifact.getType()); + String artifactKey = getArtifactKey(artifact); try { - // MD5 String digest; - try (FileInputStream fis = new FileInputStream(artifact.getFile())) { - digest = DigestUtils.md5Hex(fis); - } - getLog().info(artifact.getFile().getName() + " md5: " + digest); - try (PrintWriter printWriter = new PrintWriter( - getMd5FilePath(workingDirectory, artifact.getFile()))) { - printWriter.println(digest); - } // SHA-1 digest = artifactSha1s.getProperty(artifactKey.toString()); getLog().info(artifact.getFile().getName() + " sha1: " + digest); @@ -358,4 +335,22 @@ public class CommonsDistributionDetachmentMojo extends AbstractMojo { buffer.append(".sha256"); return buffer.toString(); } + + /** + * Generates the unique artifact key for storage in our sha1 map and sha256 map. For example, + * commons-test-1.4-src.tar.gz should have it's name as the key. + * + * @param artifact the {@link Artifact} that we wish to generate a key for. + * @return the generated key + */ + private String getArtifactKey(Artifact artifact) { + StringBuffer artifactKey = new StringBuffer(); + artifactKey.append(artifact.getArtifactId()).append('-') + .append(artifact.getVersion()).append('-'); + if (artifact.hasClassifier()) { + artifactKey.append(artifact.getClassifier()).append('-'); + } + artifactKey.append(artifact.getType()); + return artifactKey.toString(); + } } http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/d59a1c6f/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java index 39906b0..dda67ad 100755 --- a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java +++ b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionDetachmentMojoTest.java @@ -67,22 +67,18 @@ public class CommonsDistributionDetachmentMojoTest { mojo.execute(); File detachedSrcTarGz = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-src.tar.gz"); File detachedSrcTarGzAsc = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-src.tar.gz.asc"); - File detachedSrcTarMd5 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-src.tar.gz.md5"); File detachedSrcTarGzSha1 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-src.tar.gz.sha1"); File detachedSrcTarGzSha256 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-src.tar.gz.sha256"); File detachedSrcZip = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-src.zip"); File detachedSrcZipAsc = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-src.zip.asc"); - File detachedSrcZipMd5 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-src.zip.md5"); File detachedSrcZipSha1 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-src.zip.sha1"); File detachedSrcZipSha256 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-src.zip.sha256"); File detachedBinTarGz = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-bin.tar.gz"); File detachedBinTarGzAsc = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-bin.tar.gz.asc"); - File detachedBinTarMd5 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-bin.tar.gz.md5"); File detachedBinTarGzSha1 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-bin.tar.gz.sha1"); File detachedBinTarGzSha256 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-bin.tar.gz.sha256"); File detachedBinZip = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-bin.zip"); File detachedBinZipAsc = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-bin.zip.asc"); - File detachedBinZipMd5 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-bin.zip.md5"); File detachedBinZipSha1 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-bin.zip.sha1"); File detachedBinZipSha256 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4-bin.zip.sha256"); File notDetachedMockAttachedFile = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/commons-text-1.4.jar"); @@ -90,22 +86,18 @@ public class CommonsDistributionDetachmentMojoTest { File sha256Properties = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/sha256.properties"); assertTrue(detachedSrcTarGz.exists()); assertTrue(detachedSrcTarGzAsc.exists()); - assertTrue(detachedSrcTarMd5.exists()); assertTrue(detachedSrcTarGzSha1.exists()); assertTrue(detachedSrcTarGzSha256.exists()); assertTrue(detachedSrcZip.exists()); assertTrue(detachedSrcZipAsc.exists()); - assertTrue(detachedSrcZipMd5.exists()); assertTrue(detachedSrcZipSha1.exists()); assertTrue(detachedSrcZipSha256.exists()); assertTrue(detachedBinTarGz.exists()); assertTrue(detachedBinTarGzAsc.exists()); - assertTrue(detachedBinTarMd5.exists()); assertTrue(detachedBinTarGzSha1.exists()); assertTrue(detachedBinTarGzSha256.exists()); assertTrue(detachedBinZip.exists()); assertTrue(detachedBinZipAsc.exists()); - assertTrue(detachedBinZipMd5.exists()); assertTrue(detachedBinZipSha1.exists()); assertTrue(detachedBinZipSha256.exists()); assertTrue(sha1Properties.exists()); http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/d59a1c6f/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java index e5d4734..2e90d57 100755 --- a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java +++ b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java @@ -98,24 +98,20 @@ public class CommonsDistributionStagingMojoTest { File binariesHeaderHtml = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/binaries/HEADER.html"); File binTar = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/binaries/commons-text-1.4-bin.tar.gz"); File binTarASC = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/binaries/commons-text-1.4-bin.tar.gz.asc"); - File binTarMD5 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/binaries/commons-text-1.4-bin.tar.gz.md5"); File binTarSHA1 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/binaries/commons-text-1.4-bin.tar.gz.sha1"); File binTarSHA256 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/binaries/commons-text-1.4-bin.tar.gz.sha256"); File binZip = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/binaries/commons-text-1.4-bin.zip"); File binZipASC = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/binaries/commons-text-1.4-bin.zip.asc"); - File binZipMD5 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/binaries/commons-text-1.4-bin.zip.md5"); File binZipSHA1 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/binaries/commons-text-1.4-bin.zip.sha1"); File binZipSHA256 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/binaries/commons-text-1.4-bin.zip.sha256"); File sourcesReadmeHtml = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/binaries/README.html"); File sourceHeaderHtml = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/binaries/HEADER.html"); File srcTar = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/source/commons-text-1.4-src.tar.gz"); File srcTarASC = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/source/commons-text-1.4-src.tar.gz.asc"); - File srcTarMD5 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/source/commons-text-1.4-src.tar.gz.md5"); File srcTarSHA1 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/source/commons-text-1.4-src.tar.gz.sha1"); File srcTarSHA256 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/source/commons-text-1.4-src.tar.gz.sha256"); File srcZip = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/source/commons-text-1.4-src.zip"); File srcZipASC = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/source/commons-text-1.4-src.zip.asc"); - File srcZipMD5 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/source/commons-text-1.4-src.zip.md5"); File srcZipSHA1 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/source/commons-text-1.4-src.zip.sha1"); File srcZipSHA256 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/source/commons-text-1.4-src.zip.sha256"); File site = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/1.0-SNAPSHOT-RC1/site"); @@ -130,24 +126,20 @@ public class CommonsDistributionStagingMojoTest { assertTrue(binariesHeaderHtml.exists()); assertTrue(binTar.exists()); assertTrue(binTarASC.exists()); - assertTrue(binTarMD5.exists()); assertTrue(binTarSHA1.exists()); assertTrue(binTarSHA256.exists()); assertTrue(binZip.exists()); assertTrue(binZipASC.exists()); - assertTrue(binZipMD5.exists()); assertTrue(binZipSHA1.exists()); assertTrue(binZipSHA256.exists()); assertTrue(sourcesReadmeHtml.exists()); assertTrue(sourceHeaderHtml.exists()); assertTrue(srcTar.exists()); assertTrue(srcTarASC.exists()); - assertTrue(srcTarMD5.exists()); assertTrue(srcTarSHA1.exists()); assertTrue(srcTarSHA256.exists()); assertTrue(srcZip.exists()); assertTrue(srcZipASC.exists()); - assertTrue(srcZipMD5.exists()); assertTrue(srcZipSHA1.exists()); assertTrue(srcZipSHA256.exists()); assertTrue(site.exists());