import argparse
import contextlib
+import datetime
import hashlib
import os
import shutil
import tarfile
import tempfile
+from time import time
+
def get(url, path, verbose=False):
sha_url = url + ".sha256"
data[a] = b
return data
+def format_build_time(duration):
+ return str(datetime.timedelta(seconds=int(duration)))
+
class RustBuild:
def download_stage0(self):
cache_dst = os.path.join(self.build_dir, "cache")
rb._rustc_channel, rb._rustc_date = data['rustc'].split('-', 1)
rb._cargo_channel, rb._cargo_date = data['cargo'].split('-', 1)
+ start_time = time()
+
# Fetch/build the bootstrap
rb.build = rb.build_triple()
rb.download_stage0()
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
rb.run(args, env)
+ end_time = time()
+
+ print("Build completed in %s" % format_build_time(end_time - start_time))
+
if __name__ == '__main__':
main()