summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/install-buildtools13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/install-buildtools b/scripts/install-buildtools
index 639ebb12d7..6287416c9a 100755
--- a/scripts/install-buildtools
+++ b/scripts/install-buildtools
@@ -142,6 +142,9 @@ def main():
142 default=DEFAULT_INSTALL_DIR, 142 default=DEFAULT_INSTALL_DIR,
143 help='directory where buildtools SDK will be installed (optional)', 143 help='directory where buildtools SDK will be installed (optional)',
144 action='store') 144 action='store')
145 parser.add_argument('--downloads-directory',
146 help='use this directory for tarball/checksum downloads and do not erase them (default is a temporary directory which is deleted after unpacking and installing the buildtools)',
147 action='store')
145 parser.add_argument('-r', '--release', 148 parser.add_argument('-r', '--release',
146 default=DEFAULT_RELEASE, 149 default=DEFAULT_RELEASE,
147 help='Yocto Project release string for SDK which will be ' 150 help='Yocto Project release string for SDK which will be '
@@ -235,11 +238,12 @@ def main():
235 safe_filename = quote(filename) 238 safe_filename = quote(filename)
236 buildtools_url = "%s/%s/buildtools/%s" % (base_url, args.release, safe_filename) 239 buildtools_url = "%s/%s/buildtools/%s" % (base_url, args.release, safe_filename)
237 240
238 tmpsdk_dir = tempfile.mkdtemp() 241 sdk_dir = args.downloads_directory or tempfile.mkdtemp()
242 os.makedirs(sdk_dir, exist_ok=True)
239 try: 243 try:
240 # Fetch installer 244 # Fetch installer
241 logger.info("Fetching buildtools installer") 245 logger.info("Fetching buildtools installer")
242 tmpbuildtools = os.path.join(tmpsdk_dir, filename) 246 tmpbuildtools = os.path.join(sdk_dir, filename)
243 ret = subprocess.call("wget -q -O %s %s" % 247 ret = subprocess.call("wget -q -O %s %s" %
244 (tmpbuildtools, buildtools_url), shell=True) 248 (tmpbuildtools, buildtools_url), shell=True)
245 if ret != 0: 249 if ret != 0:
@@ -252,7 +256,7 @@ def main():
252 checksum_type = "sha256sum" 256 checksum_type = "sha256sum"
253 check_url = "{}.{}".format(buildtools_url, checksum_type) 257 check_url = "{}.{}".format(buildtools_url, checksum_type)
254 checksum_filename = "{}.{}".format(filename, checksum_type) 258 checksum_filename = "{}.{}".format(filename, checksum_type)
255 tmpbuildtools_checksum = os.path.join(tmpsdk_dir, checksum_filename) 259 tmpbuildtools_checksum = os.path.join(sdk_dir, checksum_filename)
256 ret = subprocess.call("wget -q -O %s %s" % 260 ret = subprocess.call("wget -q -O %s %s" %
257 (tmpbuildtools_checksum, check_url), shell=True) 261 (tmpbuildtools_checksum, check_url), shell=True)
258 if ret != 0: 262 if ret != 0:
@@ -347,7 +351,8 @@ def main():
347 351
348 finally: 352 finally:
349 # cleanup tmp directory 353 # cleanup tmp directory
350 shutil.rmtree(tmpsdk_dir) 354 if not args.downloads_directory:
355 shutil.rmtree(sdk_dir)
351 356
352 357
353if __name__ == '__main__': 358if __name__ == '__main__':