You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2021/05/15 04:15:43 UTC

[tomee-release-tools] branch master updated: Command to add a key to the KEYS file

This is an automated email from the ASF dual-hosted git repository.

dblevins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomee-release-tools.git


The following commit(s) were added to refs/heads/master by this push:
     new fd7a178  Command to add a key to the KEYS file
fd7a178 is described below

commit fd7a1785649c9d47821fa71e8e0bca9060b8f2cc
Author: David Blevins <da...@gmail.com>
AuthorDate: Fri May 14 21:15:26 2021 -0700

    Command to add a key to the KEYS file
---
 .../org/apache/openejb/tools/release/cmd/Dist.java | 28 ++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java b/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java
index ba36631..dbd2f05 100644
--- a/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java
+++ b/src/main/java/org/apache/openejb/tools/release/cmd/Dist.java
@@ -169,7 +169,7 @@ public class Dist {
      *
      * Once this command is run it is a good idea to use `dist remove-release` to remove any older releases from the mirror
      * system that we no longer need.
-     * 
+     *
      * @param stagingDir  The name of the staging directory to release.  Example: staging-1179
      * @param dev  The specific location in dist.apache.org dev where this project's binaries are staged
      * @param release  The specific location in dist.apache.org release where this project's binaries are promoted
@@ -202,14 +202,14 @@ public class Dist {
      * If there are too many releases in our release directory, infra will ask us to remove the older binaries as they
      * are available in archive.apache.org.  After executing `dist dev-to-release` it is a good idea to clean up any
      * previous releases that are no longer necessary.
-     * 
+     *
      * @param releaseDirectory The release directory to remove from the mirror system.  Example: tomee-9.0.0-M3
      * @param releases  The specific location in dist.apache.org release where this project's binaries are promoted
      */
     @Command("remove-release")
     public void removeRelease(final String releaseDirectory,
-                        @Option("release-repo") @Default("https://dist.apache.org/repos/dist/release/tomee/") final URI releases,
-                        final @Out PrintStream out) throws IOException {
+                              @Option("release-repo") @Default("https://dist.apache.org/repos/dist/release/tomee/") final URI releases,
+                              final @Out PrintStream out) throws IOException {
 
         final URI releaseUri = releases.resolve(releaseDirectory);
         exec("svn", "-m", format("[release-tools] remove release %s", releaseDirectory), "rm", releaseUri.toASCIIString());
@@ -227,6 +227,26 @@ public class Dist {
         exec("svn", "list", releases.toASCIIString());
     }
 
+    @Command("add-key")
+    public void addKey(final File publicKey,
+                       @Option("release-repo") @Default("https://dist.apache.org/repos/dist/release/tomee/") final URI releases,
+                       @Out final PrintStream out) throws IOException {
+
+        final File tmpdir = Files.tmpdir();
+        //svn checkout https://dist.apache.org/repos/dist/release/tomee/ --depth files
+        exec("svn", "checkout", releases.toASCIIString(), tmpdir.getAbsolutePath(), "--depth", "files");
+
+        final File keys = new File(tmpdir, "KEYS");
+        final String contents = IO.slurp(publicKey);
+        try (final PrintStream keysStream = new PrintStream(IO.write(keys, true))) {
+            keysStream.println();
+            keysStream.println(contents);
+        }
+        final URI keysUri = releases.resolve("KEYS");
+        exec("svn", "-m", format("[release-tools] add key to %s", keysUri), "ci", keys.getAbsolutePath());
+        out.printf("Key added to %s%n", keysUri);
+    }
+
     /**
      * Return the last digits of a Nexus staging repo dir such as orgapachetomee-1136 or
      * return the month and day as a default.