MINOR: speed up release script
Fixes slow release due to establishing a separate SSH connection per file to copy.
Reviewers: Manikumar Reddy
@@ -567,8 +567,9 @@ print("Temporary build working director:", work_dir)
kafka_dir = os.path.join(work_dir, 'kafka')
streams_quickstart_dir = os.path.join(kafka_dir, 'streams/quickstart')
print("Streams quickstart dir", streams_quickstart_dir)
-cmd("Creating staging area for release artifacts", "mkdir kafka-" + rc_tag, cwd=work_dir)
-artifacts_dir = os.path.join(work_dir, "kafka-" + rc_tag)
+artifact_name = "kafka-" + rc_tag
+cmd("Creating staging area for release artifacts", "mkdir " + artifact_name, cwd=work_dir)
+artifacts_dir = os.path.join(work_dir, artifact_name)
cmd("Cloning clean copy of repo", "git clone %s kafka" % REPO_HOME, cwd=work_dir)
cmd("Checking out RC tag", "git checkout -b %s %s" % (release_version, rc_tag), cwd=kafka_dir)
current_year = datetime.datetime.now().year
@@ -617,25 +618,14 @@ for filename in os.listdir(artifacts_dir):
cmd("Listing artifacts to be uploaded:", "ls -R %s" % artifacts_dir)
if not user_ok("Going to upload the artifacts in %s, listed above, to your Apache home directory. Ok (y/n)?): " % artifacts_dir):
fail("Quitting")
-sftp_mkdir("public_html")
-kafka_output_dir = "kafka-" + rc_tag
-sftp_mkdir(os.path.join("public_html", kafka_output_dir))
-public_release_dir = os.path.join("public_html", kafka_output_dir)
-# The sftp -r option doesn't seem to work as would be expected, at least with the version shipping on OS X. To work around this we process all the files and directories manually...
-sftp_cmds = ""
-for root, dirs, files in os.walk(artifacts_dir):
- assert root.startswith(artifacts_dir)
-
- for dir in dirs:
- sftp_mkdir(os.path.join("public_html", kafka_output_dir, root[len(artifacts_dir)+1:], dir))
-
- for file in files:
- local_path = os.path.join(root, file)
- remote_path = os.path.join("public_html", kafka_output_dir, root[len(artifacts_dir)+1:], file)
- sftp_cmds = """
-put %s %s
-""" % (local_path, remote_path)
- cmd("Uploading artifacts in %s to your Apache home directory" % root, "sftp -b - %s@home.apache.org" % apache_id, stdin=sftp_cmds)
+
+cmd("Zipping artifacts", "tar -czf %s.tar.gz %s" % (artifact_name, artifact_name), cwd=work_dir)
+cmd("Uploading artifacts in %s to your Apache home directory" % artifacts_dir, "rsync %s.tar.gz %s@home.apache.org:%s.tar.gz" % (artifact_name, apache_id, artifact_name), cwd=work_dir)
+cmd("Extracting artifacts in Apache public_html directory",
+ ["ssh",
+ "%s@home.apache.org" % (apache_id),
+ "mkdir -p public_html && rm -rf public_html/%s && mv %s.tar.gz public_html/ && cd public_html/ && tar -xf %s.tar.gz && rm %s.tar.gz" % (artifact_name, artifact_name, artifact_name, artifact_name)
+ ])
with open(os.path.expanduser("~/.gradle/gradle.properties")) as f:
contents = f.read()
