This repository was archived by the owner on Jan 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
bake.py: add warning if building on unsupported os #161
Open
vmbracvlvm
wants to merge
5
commits into
oe-lite:master
Choose a base branch
from
vmbracvlvm:jsch/oe_make_oe_warn_unsupported_os
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| import oebakery | ||
| import oelite.baker | ||
| import logging | ||
|
|
||
| import setup | ||
| import os | ||
| import sys | ||
|
|
||
| description = "Build something" | ||
|
|
||
|
|
@@ -14,6 +16,9 @@ def add_parser_options(parser): | |
| parser.add_option("--debug-loglines", | ||
| action="store", default=42, metavar="N", | ||
| help="Show last N lines of logfiles of failed tasks (default: 42)") | ||
| parser.add_option("-s", "--skip-os-check", | ||
| action="store_true", default=False, metavar="skip_os_check", | ||
| help="Skip supported OS check") | ||
| return | ||
|
|
||
|
|
||
|
|
@@ -23,8 +28,46 @@ def parse_args(options, args): | |
| else: | ||
| logging.getLogger().setLevel(logging.INFO) | ||
|
|
||
| def os_check(config): | ||
| distro, release = setup.get_host_distro() | ||
| if distro and release: | ||
| setup_file, supported = setup.get_setup_file(config, distro, release) | ||
| if supported: | ||
| return True | ||
|
|
||
| if distro and release: | ||
| print('WARNING: Host distribution (%s %s) has not been validated'%(distro, release)) | ||
| else: | ||
| print("WARNING: Cannot determine host distribution") | ||
|
|
||
| response = 'n' | ||
|
|
||
| if os.isatty(sys.stdin.fileno()): | ||
| while True: | ||
| try: | ||
| response = raw_input( | ||
| "Do you want to continue [Y/n]? ") | ||
| except KeyboardInterrupt: | ||
| response = 'n' | ||
| response = response.lower() | ||
| if response == '': | ||
| response = 'y' | ||
| if response in ('y', 'n'): | ||
| break | ||
|
|
||
| if response == 'n': | ||
| print "Maybe another time" | ||
| return False | ||
| return True | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't this a duplication of the other place where we interactively ask if we should continue? Let us not do that, we already have a mess of duplication and responsibility in the code. Please refactor this out to a place where it can be used by commands that need it. |
||
|
|
||
| def run(options, args, config): | ||
|
|
||
| if not options.skip_os_check: | ||
| if not os_check(config): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this line is basically what I would imagine should be needed in bake, but by calling into the setup code. |
||
| return 1 | ||
|
|
||
| try: | ||
| baker = oelite.baker.OEliteBaker(options, args, config) | ||
| except oelite.parse.ParseError as e: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Debian 8.x | ||
| sudo apt-get install -y apt-utils sudo ssh-client git subversion python-ply python-setuptools python-pysqlite2 python-magic python-pycurl python-svn python-dev build-essential wget bzip2 zip unzip quilt autoconf automake libtool pkg-config gawk bison flex texinfo curl ncurses-dev groff-base cpio intltool liblzo2-2 bc gperf tree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Ubuntu 15.04 | ||
| sudo apt-get --yes install python-support python-magic python-pycurl python-pkg-resources python-dev coreutils sed git-core cvs subversion mercurial quilt gawk texinfo automake autoconf autopoint libtool curl texi2html diffstat openjade groff mtd-utils build-essential make gcc g++ binutils bison flex bc ncurses-dev zip unzip lzma gtk-doc-tools docbook-utils libxml2-utils xmlto help2man libglib2.0-dev lzop gperf python-svn libacl1-dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Ubuntu 16.04 | ||
| sudo apt-get --yes install python python-magic python-pycurl python-pkg-resources python-dev coreutils sed git-core cvs subversion mercurial quilt gawk texinfo automake autoconf autopoint libtool curl texi2html diffstat openjade groff mtd-utils build-essential make gcc g++ binutils bison flex bc ncurses-dev zip unzip lzma gtk-doc-tools docbook-utils libxml2-utils xmlto help2man libglib2.0-dev lzop gperf python-svn libacl1-dev fakeroot cpio |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this stuff does not really belong in bake. Let us make good use of OO and keep the responsibility for the logic about support host OS in the setup code.
What is needed is a refactor of the setup code, so you can simply ask it from bake "are we running on a supported host OS", probably something like a "is_supported()" method or the like. The rest of the setup code should of cause use that as well