diff --git a/ci/sync-dist.py b/ci/sync-dist.py
index d74ac7ca567..d3bdaa531ef 100644
--- a/ci/sync-dist.py
+++ b/ci/sync-dist.py
@@ -10,12 +10,18 @@
# * Sync local bins to dev archives
# python sync-dist.py local-to-dev-archives 0.2.0
#
+# * Update dev release number
+# python sync-dist.py update-dev-release 0.2.0
+#
# * Sync local bins to prod archives
# python sync-dist.py local-to-prod-archives 0.2.0
#
# * Sync local bins to prod
# python sync-dist.py local-to-prod
#
+# * Update prod release number
+# python sync-dist.py update-prod-release 0.2.0
+#
# Don't forget to tag the release, dummy!
import sys
@@ -26,8 +32,10 @@
def usage():
print ("usage: sync-dist dev-to-local [--live-run]\n"
" sync-dist local-to-dev-archives $version [--live-run]\n"
+ " sync-dist update-dev-release $version [--live-run]\n"
" sync-dist local-to-prod-archives $version [--live-run]\n"
- " sync-dist local-to-prod [--live-run]\n")
+ " sync-dist local-to-prod [--live-run]\n"
+ " sync-dist update-prod-release $version [--live-run]\n")
sys.exit(1)
command = None
@@ -41,11 +49,13 @@ def usage():
if not command in ["dev-to-local",
"local-to-dev-archives",
+ "update-dev-release",
"local-to-prod-archives",
- "local-to-prod"]:
+ "local-to-prod",
+ "update-prod-release"]:
usage()
-if "archives" in command:
+if "archives" in command or "release" in command:
if len(sys.argv) < 3:
usage()
archive_version = sys.argv[2]
@@ -77,12 +87,22 @@ def usage():
s3cmd = "s3cmd sync ./local-rustup/dist/ s3://{}/rustup/archive/{}/".format(s3_bucket, archive_version)
elif command == "local-to-prod":
s3cmd = "s3cmd sync ./local-rustup/dist/ s3://{}/rustup/dist/".format(s3_bucket)
+elif command == "update-dev-release" \
+ or command == "update-prod-release":
+ s3cmd = "s3cmd put ./local-rustup/release-stable.toml s3://{}/rustup/release-stable.toml".format(s3_bucket)
else:
sys.exit(1)
print "s3 command: {}".format(s3cmd)
print
+# Create the release information
+if command == "update-dev-release" \
+ or command == "update-prod-release":
+ with open("./local-rustup/release-stable.toml", "w") as f:
+ f.write("schema-version = '1'\n")
+ f.write("version = '{}'\n".format(archive_version))
+
def run_s3cmd(command):
s3cmd = command.split(" ")
diff --git a/src/rustup-cli/main.rs b/src/rustup-cli/main.rs
index 2e7f5e6a7fb..50ba59fe0b7 100644
--- a/src/rustup-cli/main.rs
+++ b/src/rustup-cli/main.rs
@@ -19,6 +19,7 @@ extern crate scopeguard;
extern crate tempdir;
extern crate sha2;
extern crate markdown;
+extern crate toml;
#[cfg(windows)]
extern crate winapi;
diff --git a/src/rustup-cli/self_update.rs b/src/rustup-cli/self_update.rs
index 1ba99ae68e2..7cefa0a2acf 100644
--- a/src/rustup-cli/self_update.rs
+++ b/src/rustup-cli/self_update.rs
@@ -34,13 +34,11 @@ use common::{self, Confirm};
use errors::*;
use rustup_dist::dist;
use rustup_utils::utils;
-use sha2::{Sha256, Digest};
use std::env;
use std::env::consts::EXE_SUFFIX;
use std::path::{Path, PathBuf};
use std::process::{self, Command};
-use std::fs::{self, File};
-use std::io::Read;
+use std::fs;
use tempdir::TempDir;
use term2;
use regex::Regex;
@@ -1210,6 +1208,8 @@ fn parse_new_rustup_version(version: String) -> String {
}
pub fn prepare_update() -> Result