mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 12:59:02 +02:00
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>
This commit is contained in:
parent
a6faf56477
commit
420c926f8a
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -8,6 +8,7 @@ pstage/
|
||||||
scripts/oe-git-proxy-socks
|
scripts/oe-git-proxy-socks
|
||||||
sources/
|
sources/
|
||||||
meta-*/
|
meta-*/
|
||||||
|
buildtools/
|
||||||
!meta-skeleton
|
!meta-skeleton
|
||||||
!meta-selftest
|
!meta-selftest
|
||||||
hob-image-*.bb
|
hob-image-*.bb
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
# $ install-buildtools \
|
# $ install-buildtools \
|
||||||
# --base-url http://downloads.yoctoproject.org/releases/yocto \
|
# --base-url http://downloads.yoctoproject.org/releases/yocto \
|
||||||
# --release yocto-3.1_M2 \
|
# --release yocto-3.1_M2 \
|
||||||
# --install-version 3.0+snapshot
|
# --installer-version 3.0+snapshot
|
||||||
# --build-date 202000122
|
# --build-date 202000122
|
||||||
#
|
#
|
||||||
# Example usage (standard buildtools from release):
|
# Example usage (standard buildtools from release):
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
# $ install-buildtools --without-extended-buildtools \
|
# $ install-buildtools --without-extended-buildtools \
|
||||||
# --base-url http://downloads.yoctoproject.org/releases/yocto \
|
# --base-url http://downloads.yoctoproject.org/releases/yocto \
|
||||||
# --release yocto-3.0.2 \
|
# --release yocto-3.0.2 \
|
||||||
# --install-version 3.0.2
|
# --installer-version 3.0.2
|
||||||
#
|
#
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
@ -59,6 +59,7 @@ if not bitbakepath:
|
||||||
PROGNAME = 'install-buildtools'
|
PROGNAME = 'install-buildtools'
|
||||||
logger = scriptutils.logger_create(PROGNAME, stream=sys.stdout)
|
logger = scriptutils.logger_create(PROGNAME, stream=sys.stdout)
|
||||||
|
|
||||||
|
DEFAULT_INSTALL_DIR: str = os.path.join(os.path.split(scripts_path)[0],'buildtools')
|
||||||
DEFAULT_BASE_URL: str = 'http://downloads.yoctoproject.org/releases/yocto'
|
DEFAULT_BASE_URL: str = 'http://downloads.yoctoproject.org/releases/yocto'
|
||||||
DEFAULT_RELEASE: str = 'yocto-3.1_M2'
|
DEFAULT_RELEASE: str = 'yocto-3.1_M2'
|
||||||
DEFAULT_INSTALLER_VERSION: str = '3.0+snapshot'
|
DEFAULT_INSTALLER_VERSION: str = '3.0+snapshot'
|
||||||
|
@ -66,6 +67,7 @@ DEFAULT_BUILDDATE: str = "20200122"
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
global DEFAULT_INSTALL_DIR
|
||||||
global DEFAULT_BASE_URL
|
global DEFAULT_BASE_URL
|
||||||
global DEFAULT_RELEASE
|
global DEFAULT_RELEASE
|
||||||
global DEFAULT_INSTALLER_VERSION
|
global DEFAULT_INSTALLER_VERSION
|
||||||
|
@ -73,6 +75,7 @@ def main():
|
||||||
filename: str = ""
|
filename: str = ""
|
||||||
release: str = ""
|
release: str = ""
|
||||||
buildtools_url: str = ""
|
buildtools_url: str = ""
|
||||||
|
install_dir: str = ""
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="Buildtools installation helper",
|
description="Buildtools installation helper",
|
||||||
|
@ -87,6 +90,7 @@ def main():
|
||||||
'(optional)\nRequires --url',
|
'(optional)\nRequires --url',
|
||||||
action='store')
|
action='store')
|
||||||
parser.add_argument('-d', '--directory',
|
parser.add_argument('-d', '--directory',
|
||||||
|
default=DEFAULT_INSTALL_DIR,
|
||||||
help='directory where buildtools SDK will be installed (optional)',
|
help='directory where buildtools SDK will be installed (optional)',
|
||||||
action='store')
|
action='store')
|
||||||
parser.add_argument('-r', '--release',
|
parser.add_argument('-r', '--release',
|
||||||
|
@ -216,12 +220,12 @@ def main():
|
||||||
st = os.stat(tmpbuildtools)
|
st = os.stat(tmpbuildtools)
|
||||||
os.chmod(tmpbuildtools, st.st_mode | stat.S_IEXEC)
|
os.chmod(tmpbuildtools, st.st_mode | stat.S_IEXEC)
|
||||||
logger.debug(os.stat(tmpbuildtools))
|
logger.debug(os.stat(tmpbuildtools))
|
||||||
install_dir = "/opt/poky/%s" % args.installer_version
|
|
||||||
if args.directory:
|
if args.directory:
|
||||||
install_dir = args.directory
|
install_dir = args.directory
|
||||||
ret = subprocess.call("%s -d %s -y" %
|
ret = subprocess.call("%s -d %s -y" %
|
||||||
(tmpbuildtools, install_dir), shell=True)
|
(tmpbuildtools, install_dir), shell=True)
|
||||||
else:
|
else:
|
||||||
|
install_dir = "/opt/poky/%s" % args.installer_version
|
||||||
ret = subprocess.call("%s -y" % tmpbuildtools, shell=True)
|
ret = subprocess.call("%s -y" % tmpbuildtools, shell=True)
|
||||||
if ret != 0:
|
if ret != 0:
|
||||||
logger.error("Could not run buildtools installer")
|
logger.error("Could not run buildtools installer")
|
||||||
|
@ -238,7 +242,8 @@ def main():
|
||||||
tool = 'gcc'
|
tool = 'gcc'
|
||||||
else:
|
else:
|
||||||
tool = 'tar'
|
tool = 'tar'
|
||||||
proc = subprocess.run("source %s/environment-setup-x86_64-pokysdk-linux && which %s" %
|
logger.debug("install_dir: %s" % install_dir)
|
||||||
|
proc = subprocess.run(". %s/environment-setup-x86_64-pokysdk-linux && which %s" %
|
||||||
(install_dir, tool),
|
(install_dir, tool),
|
||||||
shell=True, stdout=subprocess.PIPE)
|
shell=True, stdout=subprocess.PIPE)
|
||||||
which_tool = proc.stdout.decode("utf-8")
|
which_tool = proc.stdout.decode("utf-8")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user