From 655946aa6a40e80a25949616968e4c00d10f2ce5 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Mon, 22 Sep 2003 16:43:59 +0000 Subject: --- bin/oe/build.py | 5 +++-- bin/oe/parse/ConfHandler.py | 1 + bin/oebuild | 7 ++++++- bin/oeinstall | 25 +++++++++---------------- bin/oemake | 30 +++++++++++++++++++++++++----- doc/DEVEL | 4 ++-- 6 files changed, 46 insertions(+), 26 deletions(-) diff --git a/bin/oe/build.py b/bin/oe/build.py index c4072b926..b09c60856 100644 --- a/bin/oe/build.py +++ b/bin/oe/build.py @@ -227,8 +227,9 @@ def exec_task(task, d): raise EventException("", InvalidTask(task, d)) # check whether this task needs executing.. - if stamp_is_current(task, d): - return 1 + if not data.getVarFlag(task, 'force', d): + if stamp_is_current(task, d): + return 1 # follow digraph path up, then execute our way back down def execute(graph, item): diff --git a/bin/oe/parse/ConfHandler.py b/bin/oe/parse/ConfHandler.py index 399f50eeb..44c85f5d1 100644 --- a/bin/oe/parse/ConfHandler.py +++ b/bin/oe/parse/ConfHandler.py @@ -117,6 +117,7 @@ def init(data): oe.data.setVarFlag("PF", "warnlevel", "3", data) oe.data.setVarFlag("S", "warnlevel", "3", data) oe.data.setVarFlag("T", "warnlevel", "3", data) + oe.data.setVarFlag("D", "inherit", "1", data) oe.data.setVarFlag("D", "warnlevel", "3", data) oe.data.setVarFlag("A", "warnlevel", "3", data) oe.data.setVarFlag("CATEGORY", "warnlevel", "2", data) diff --git a/bin/oebuild b/bin/oebuild index 8c3e1cc00..ad2be34a5 100644 --- a/bin/oebuild +++ b/bin/oebuild @@ -20,6 +20,7 @@ def usage(errorlevel=0, txt=''): print "Example: oebuild build content/glibc-2.3.1.oe" print "" print " %s\t\t%s" % ("-v, --version", "output version information and exit") + print " %s\t\t%s" % ("-f, --force", "forces execution of specified task") sys.exit(0) __version__ = 1.0 @@ -29,7 +30,7 @@ def version(): import getopt try: - (opts, args) = getopt.getopt(sys.argv[1:], 'vh', [ 'version', 'help' ]) + (opts, args) = getopt.getopt(sys.argv[1:], 'vhf', [ 'version', 'help', 'force' ]) except getopt.GetoptError: usage(1) @@ -171,6 +172,10 @@ for var in oedata.keys(): data.setVarFlag(pcontent, 'deps', pdeps, oedata) build.add_task(p, pcontent, pdeps) +if '--force' in optsonly or '-f' in optsonly: + print "setting force flag" + data.setVarFlag('do_%s' % cmd, 'force', 1, oedata) + try: build.exec_task('do_%s' % cmd, oedata) except build.FuncFailed: diff --git a/bin/oeinstall b/bin/oeinstall index 7c6bead8d..054d829b8 100644 --- a/bin/oeinstall +++ b/bin/oeinstall @@ -9,10 +9,11 @@ cfg_oe = data.init() def usage(): print "Usage: oeinstall [options ...]" print "Installs specified files of supported types into a root filesystem." - print "Supported types: tar.gz, ipk, deb, rpm" + print "Currently only supports installing OEFILES into the rootfs directly" + print "using their do_install target." print "" print " %s\t\t%s" % ("-r [arg], --root [arg]", "root directory (default=${IMAGE_ROOTFS})") - print " %s\t\t%s" % ("-f [arg], --files [arg]", "files to install (default=${INSTALL_FILES})") + print " %s\t\t%s" % ("-f [arg], --files [arg]", "files to install (default=${INSTALL_OEFILES})") print " %s\t\t%s" % ("-v, --version", "output version information and exit") sys.exit(0) @@ -61,22 +62,14 @@ if not rootfs: data.setVar('IMAGE_ROOTFS', rootfs, cfg_oe) -files = string.split(data.getVar('INSTALL_FILES', cfg_oe, 1) or "") - -if opthash.has_key('--files'): - files = opthash['--files'].split() -if opthash.has_key('-f'): - files = opthash['-f'].split() - -if not files: - oe.fatal("install files not specified") - -data.setVar('INSTALL_FILES', files, cfg_oe) - # grab OEDIR topdir = data.getVar('TOPDIR', cfg_oe, 1) or os.getcwd() oedir = data.getVar('OEDIR', cfg_oe, 1) or topdir mkdirhier(oedir) -for f in files: - oe.note("file is %s" % f) +os.environ["D"] = rootfs +oe.note("Spawning oemake to run do_install for each package.") +ret = os.system('oemake --cmd install --force --abort') +if ret != 0: + sys.exit(1) +sys.exit(0) diff --git a/bin/oemake b/bin/oemake index e5f609aa6..aca7e11a5 100644 --- a/bin/oemake +++ b/bin/oemake @@ -112,7 +112,10 @@ def build(graph, item): command = cmd debug(1, "oebuild %s %s" % (command, fn)) event.fire(PkgStarted(item, pkgdata[fn])) - ret = os.system("oebuild %s %s" % (command, fn)) + opts = "" + if force: + opts += " --force" + ret = os.system("oebuild %s %s %s" % (opts, command, fn)) if ret == 0: event.fire(PkgSucceeded(item, pkgdata[fn])) __build_cache.append(item) @@ -134,6 +137,8 @@ def usage(): print "" print " %s\t\t%s" % ("-v, --version", "output version information and exit") print " %s\t\t%s" % ("-c [arg], --cmd [arg]", "specify command to pass to oebuild") + print " %s\t\t%s" % ("-a, --abort", "abort build if any package build fails") + print " %s\t\t%s" % ("-f, --force", "force run of specified cmd, regardless of status") sys.exit(0) __version__ = 1.1 @@ -161,7 +166,7 @@ def get_oefile(): import getopt try: - (opts, args) = getopt.getopt(sys.argv[1:], 'vc:', [ 'version', 'cmd=' ]) + (opts, args) = getopt.getopt(sys.argv[1:], 'vc:fa', [ 'version', 'cmd=', 'abort', 'force' ]) except getopt.GetoptError: usage() @@ -181,6 +186,16 @@ if opthash.has_key('--version') or opthash.has_key('-v'): version() sys.exit(0) +if opthash.has_key('--abort') or opthash.has_key('-a'): + abort = 1 +else: + abort = 0 + +if opthash.has_key('--force') or opthash.has_key('-f'): + force = 1 +else: + force = 0 + if opthash.has_key('--cmd'): cmd = opthash['--cmd'] if opthash.has_key('-c'): @@ -188,7 +203,8 @@ if opthash.has_key('-c'): _depcmds = { "clean": None, "mrproper": None, - "build": "stage", } + "build": "stage", + "install": None, } if not cmd: cmd = "build" @@ -288,7 +304,7 @@ for pkg in pkgs.keys(): for pkg in pkgs.keys(): (deps, fn) = pkgs[pkg] - if _depcmds[cmd] is not None: + if _depcmds.has_key(cmd) and _depcmds[cmd] is not None: if deps is not None: for d in deps: if not graph.hasnode(d): @@ -313,8 +329,12 @@ packages = args or graph.okeys for k in packages: if pkgs.has_key(k): - graph.walkdown(k, build) + ret = graph.walkdown(k, build) + if abort and not ret: + oe.fatal("Build of %s failed, aborting." % k) else: oe.error("Unable to build %s: no .oe file provides it." % k) + if abort: + sys.exit(1) event.fire(BuildCompleted(buildname, graph.okeys, cfg)) diff --git a/doc/DEVEL b/doc/DEVEL index f2768d584..cfaccd553 100644 --- a/doc/DEVEL +++ b/doc/DEVEL @@ -38,13 +38,13 @@ any way, you can override any of the steps. For example: oe_runmake all } --or- +or do_install () { oe_runmake 'PREFIX=${D}' install } -You get the picture. See $OEDIR/bin/classes/base.oeclass for an idea +And so on. See $OEDIR/bin/classes/base.oeclass for an idea as to what tasks exist by default, and what their default behaviors are. The system will automatically assume that your .oe inherits base, in addition to whatever oeclasses you inherit manually. -- cgit 1.2.3-korg