diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/install-buildtools | 13 |
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 | ||
35 | import argparse | 35 | import argparse |
@@ -59,6 +59,7 @@ if not bitbakepath: | |||
59 | PROGNAME = 'install-buildtools' | 59 | PROGNAME = 'install-buildtools' |
60 | logger = scriptutils.logger_create(PROGNAME, stream=sys.stdout) | 60 | logger = scriptutils.logger_create(PROGNAME, stream=sys.stdout) |
61 | 61 | ||
62 | DEFAULT_INSTALL_DIR: str = os.path.join(os.path.split(scripts_path)[0],'buildtools') | ||
62 | DEFAULT_BASE_URL: str = 'http://downloads.yoctoproject.org/releases/yocto' | 63 | DEFAULT_BASE_URL: str = 'http://downloads.yoctoproject.org/releases/yocto' |
63 | DEFAULT_RELEASE: str = 'yocto-3.1_M2' | 64 | DEFAULT_RELEASE: str = 'yocto-3.1_M2' |
64 | DEFAULT_INSTALLER_VERSION: str = '3.0+snapshot' | 65 | DEFAULT_INSTALLER_VERSION: str = '3.0+snapshot' |
@@ -66,6 +67,7 @@ DEFAULT_BUILDDATE: str = "20200122" | |||
66 | 67 | ||
67 | 68 | ||
68 | def main(): | 69 | def 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") |