summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorTim Orling <timothy.t.orling@linux.intel.com>2020-03-31 13:03:01 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-04-01 11:44:23 +0100
commit420c926f8a425d0fc52d58373ca447a2ce7b3b54 (patch)
tree2dc47210063701e1aeadb6e45235a8c0cbdc969f /scripts
parenta6faf56477af523e88f2c864121a801e66358be5 (diff)
downloadpoky-420c926f8a425d0fc52d58373ca447a2ce7b3b54.tar.gz
scripts/install-buildtools: improvements
* Install directory defaults to scripts/../buildtools e.g. --directory is set by default This avoids the user having to type in their sudo password to install in /opt/poky/<installer-version> * Use "." rather than "source" for sourcing the environment script as not all distros (e.g. Debian) have "source" by default. * Add buildtools/ to .gitignore * Fix typos in example usage (--install-version -> --installer-version) [YOCTO #13832] (From OE-Core rev: c6c3a58dbf0ca6c4a41df7ff50fa56d39d7ee23f) Signed-off-by: Tim Orling <timothy.t.orling@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/install-buildtools13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/install-buildtools b/scripts/install-buildtools
index 0947e9c4d6..49cab1345a 100755
--- a/scripts/install-buildtools
+++ b/scripts/install-buildtools
@@ -17,7 +17,7 @@
17# $ install-buildtools \ 17# $ install-buildtools \
18# --base-url http://downloads.yoctoproject.org/releases/yocto \ 18# --base-url http://downloads.yoctoproject.org/releases/yocto \
19# --release yocto-3.1_M2 \ 19# --release yocto-3.1_M2 \
20# --install-version 3.0+snapshot 20# --installer-version 3.0+snapshot
21# --build-date 202000122 21# --build-date 202000122
22# 22#
23# Example usage (standard buildtools from release): 23# Example usage (standard buildtools from release):
@@ -29,7 +29,7 @@
29# $ install-buildtools --without-extended-buildtools \ 29# $ install-buildtools --without-extended-buildtools \
30# --base-url http://downloads.yoctoproject.org/releases/yocto \ 30# --base-url http://downloads.yoctoproject.org/releases/yocto \
31# --release yocto-3.0.2 \ 31# --release yocto-3.0.2 \
32# --install-version 3.0.2 32# --installer-version 3.0.2
33# 33#
34 34
35import argparse 35import argparse
@@ -59,6 +59,7 @@ if not bitbakepath:
59PROGNAME = 'install-buildtools' 59PROGNAME = 'install-buildtools'
60logger = scriptutils.logger_create(PROGNAME, stream=sys.stdout) 60logger = scriptutils.logger_create(PROGNAME, stream=sys.stdout)
61 61
62DEFAULT_INSTALL_DIR: str = os.path.join(os.path.split(scripts_path)[0],'buildtools')
62DEFAULT_BASE_URL: str = 'http://downloads.yoctoproject.org/releases/yocto' 63DEFAULT_BASE_URL: str = 'http://downloads.yoctoproject.org/releases/yocto'
63DEFAULT_RELEASE: str = 'yocto-3.1_M2' 64DEFAULT_RELEASE: str = 'yocto-3.1_M2'
64DEFAULT_INSTALLER_VERSION: str = '3.0+snapshot' 65DEFAULT_INSTALLER_VERSION: str = '3.0+snapshot'
@@ -66,6 +67,7 @@ DEFAULT_BUILDDATE: str = "20200122"
66 67
67 68
68def main(): 69def main():
70 global DEFAULT_INSTALL_DIR
69 global DEFAULT_BASE_URL 71 global DEFAULT_BASE_URL
70 global DEFAULT_RELEASE 72 global DEFAULT_RELEASE
71 global DEFAULT_INSTALLER_VERSION 73 global DEFAULT_INSTALLER_VERSION
@@ -73,6 +75,7 @@ def main():
73 filename: str = "" 75 filename: str = ""
74 release: str = "" 76 release: str = ""
75 buildtools_url: str = "" 77 buildtools_url: str = ""
78 install_dir: str = ""
76 79
77 parser = argparse.ArgumentParser( 80 parser = argparse.ArgumentParser(
78 description="Buildtools installation helper", 81 description="Buildtools installation helper",
@@ -87,6 +90,7 @@ def main():
87 '(optional)\nRequires --url', 90 '(optional)\nRequires --url',
88 action='store') 91 action='store')
89 parser.add_argument('-d', '--directory', 92 parser.add_argument('-d', '--directory',
93 default=DEFAULT_INSTALL_DIR,
90 help='directory where buildtools SDK will be installed (optional)', 94 help='directory where buildtools SDK will be installed (optional)',
91 action='store') 95 action='store')
92 parser.add_argument('-r', '--release', 96 parser.add_argument('-r', '--release',
@@ -216,12 +220,12 @@ def main():
216 st = os.stat(tmpbuildtools) 220 st = os.stat(tmpbuildtools)
217 os.chmod(tmpbuildtools, st.st_mode | stat.S_IEXEC) 221 os.chmod(tmpbuildtools, st.st_mode | stat.S_IEXEC)
218 logger.debug(os.stat(tmpbuildtools)) 222 logger.debug(os.stat(tmpbuildtools))
219 install_dir = "/opt/poky/%s" % args.installer_version
220 if args.directory: 223 if args.directory:
221 install_dir = args.directory 224 install_dir = args.directory
222 ret = subprocess.call("%s -d %s -y" % 225 ret = subprocess.call("%s -d %s -y" %
223 (tmpbuildtools, install_dir), shell=True) 226 (tmpbuildtools, install_dir), shell=True)
224 else: 227 else:
228 install_dir = "/opt/poky/%s" % args.installer_version
225 ret = subprocess.call("%s -y" % tmpbuildtools, shell=True) 229 ret = subprocess.call("%s -y" % tmpbuildtools, shell=True)
226 if ret != 0: 230 if ret != 0:
227 logger.error("Could not run buildtools installer") 231 logger.error("Could not run buildtools installer")
@@ -238,7 +242,8 @@ def main():
238 tool = 'gcc' 242 tool = 'gcc'
239 else: 243 else:
240 tool = 'tar' 244 tool = 'tar'
241 proc = subprocess.run("source %s/environment-setup-x86_64-pokysdk-linux && which %s" % 245 logger.debug("install_dir: %s" % install_dir)
246 proc = subprocess.run(". %s/environment-setup-x86_64-pokysdk-linux && which %s" %
242 (install_dir, tool), 247 (install_dir, tool),
243 shell=True, stdout=subprocess.PIPE) 248 shell=True, stdout=subprocess.PIPE)
244 which_tool = proc.stdout.decode("utf-8") 249 which_tool = proc.stdout.decode("utf-8")