diff options
Diffstat (limited to 'bin/oebuild')
-rw-r--r-- | bin/oebuild | 143 |
1 files changed, 0 insertions, 143 deletions
diff --git a/bin/oebuild b/bin/oebuild deleted file mode 100644 index 1d0abe91a..000000000 --- a/bin/oebuild +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/env python -# ex:ts=4:sw=4:sts=4:et -# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- - -import os, sys, getopt, copy -sys.path.append('/usr/share/oe') -from oe import * -import oe - -def usage(errorlevel=0, txt=''): - print - if txt: - print txt - - print "Usage: oebuild [options]... [task] [oefile]" - print - print "Run task (defaults to 'build') on oefile (defaults to first" - print "*.oe file found in current dir)" - print - print "Options:" - print " %s\t\t%s" % ("-V, --version", "output version information and exit") - print " %s\t\t%s" % ("-f, --force", "forces execution of specified task") - print - print "Example: oebuild build content/glibc-2.3.1.oe" - print - sys.exit(0) - -__version__ = 1.0 -def version(): - print "OpenEmbedded Build Infrastructure Core version %s" % oe.__version__ - print "OEBuild version %s" % __version__ - -def get_oefile(): - """Returns the first *.oe file found in current directory""" - dirs = os.listdir(os.getcwd()) - dirs.sort() - for f in dirs: - if os.path.splitext(f)[1] == ".oe": - return os.path.abspath(os.path.join(os.getcwd(),f)) - return None - -def get_cmd(): - """Get default command, currently always 'build'""" - return "build" - -# -# Handle options: -# -try: - (opts, args) = getopt.getopt(sys.argv[1:], 'Vhf', [ 'version', 'help', 'force' ]) -except getopt.GetoptError: - usage(1) - -optsonly = [ opt for (opt,val) in opts] -if '--version' in optsonly or '-V' in optsonly: - version() - sys.exit(0) - -if '--help' in optsonly or '-h' in optsonly: - usage(1) - - - -# -# variable initialization -# - -oefile = None -cmd = None -oedata = None - -try: - make.cfg = parse.handle("conf/oe.conf", make.cfg) -except IOError: - (type, value, traceback) = sys.exc_info() - fatal("Unable to open oe.conf: %s" % value) - -if len(args) == 0: - # user didnt specify command or .oe - # see if we can find a .oe file in the current dir - oefile = get_oefile() - cmd = get_cmd() -elif len(args) == 1: - # one of two cases: - # 1) oebuild COMMAND - # 2) oebuild OEFILE - # First, see if this is a valid task. - try: - oedata, cached = oe.make.load_oefile(args[0]) - except Exception, e: - fatal("unable to read %s: %s" % (args[0], e)) - if not oedata: - # If so, assume its a command. - # If its a command, but we cant get a .oe file - # in the current dir, usage() - cmd = args[0] - else: - # If not, assume a .oe file. - oefile = args[0] - - if not cmd: - cmd = get_cmd() - - if not oefile: - oefile = get_oefile() -elif len(args) == 2: - # user specified both - cmd = args[0] - oefile = args[1] -else: - # invalid - usage(1) - -if not cmd: - usage(1) - -if not oefile: - usage(1) - -try: - if not oedata: - oedata, cached = make.load_oefile(oefile) - - if not oedata: - fatal("Unable to open %s" % oefile) - - if '--force' in optsonly or '-f' in optsonly: - data.setVarFlag('do_%s' % cmd, 'force', 1, oedata) - - -# -# Finally exec the requested task -# - - build.exec_task('do_%s' % cmd, oedata) -except build.FuncFailed: - fatal("task stack execution failed") -except build.EventException: - (type, value, traceback) = sys.exc_info() - e = value.event - fatal("%s event exception, aborting" % event.getName(e)) -except Exception, e: - fatal("%s" % e) |