diff options
Diffstat (limited to 'poky/bitbake')
-rw-r--r-- | poky/bitbake/lib/bb/build.py | 79 | ||||
-rw-r--r-- | poky/bitbake/lib/bb/cache.py | 12 | ||||
-rw-r--r-- | poky/bitbake/lib/bb/cooker.py | 61 | ||||
-rw-r--r-- | poky/bitbake/lib/bb/cookerdata.py | 16 | ||||
-rw-r--r-- | poky/bitbake/lib/bb/fetch2/__init__.py | 5 | ||||
-rw-r--r-- | poky/bitbake/lib/bb/fetch2/npm.py | 19 | ||||
-rw-r--r-- | poky/bitbake/lib/bb/fetch2/svn.py | 19 | ||||
-rwxr-xr-x | poky/bitbake/lib/bb/main.py | 2 | ||||
-rw-r--r-- | poky/bitbake/lib/bb/progress.py | 16 | ||||
-rw-r--r-- | poky/bitbake/lib/bb/runqueue.py | 8 | ||||
-rw-r--r-- | poky/bitbake/lib/bb/siggen.py | 8 | ||||
-rw-r--r-- | poky/bitbake/lib/bb/taskdata.py | 2 | ||||
-rw-r--r-- | poky/bitbake/lib/bb/tests/fetch.py | 80 | ||||
-rw-r--r-- | poky/bitbake/lib/bb/tests/utils.py | 4 | ||||
-rw-r--r-- | poky/bitbake/lib/bb/ui/knotty.py | 2 | ||||
-rw-r--r-- | poky/bitbake/lib/toaster/orm/fixtures/oe-core.xml | 2 | ||||
-rw-r--r-- | poky/bitbake/lib/toaster/orm/fixtures/poky.xml | 2 |
17 files changed, 264 insertions, 73 deletions
diff --git a/poky/bitbake/lib/bb/build.py b/poky/bitbake/lib/bb/build.py index dae42ac47..e2f91fa3b 100644 --- a/poky/bitbake/lib/bb/build.py +++ b/poky/bitbake/lib/bb/build.py @@ -163,12 +163,35 @@ class LogTee(object): def __repr__(self): return '<LogTee {0}>'.format(self.name) + def flush(self): self.outfile.flush() + +class StdoutNoopContextManager: + """ + This class acts like sys.stdout, but adds noop __enter__ and __exit__ methods. + """ + def __enter__(self): + return sys.stdout + + def __exit__(self, *exc_info): + pass + + def write(self, string): + return sys.stdout.write(string) + + def flush(self): + sys.stdout.flush() + + @property + def name(self): + return sys.stdout.name + + # # pythonexception allows the python exceptions generated to be raised -# as the real exceptions (not FuncFailed) and without a backtrace at the +# as the real exceptions (not FuncFailed) and without a backtrace at the # origin of the failure. # def exec_func(func, d, dirs = None, pythonexception=False): @@ -323,6 +346,42 @@ trap 'bb_exit_handler' 0 set -e ''' +def create_progress_handler(func, progress, logfile, d): + if progress == 'percent': + # Use default regex + return bb.progress.BasicProgressHandler(d, outfile=logfile) + elif progress.startswith('percent:'): + # Use specified regex + return bb.progress.BasicProgressHandler(d, regex=progress.split(':', 1)[1], outfile=logfile) + elif progress.startswith('outof:'): + # Use specified regex + return bb.progress.OutOfProgressHandler(d, regex=progress.split(':', 1)[1], outfile=logfile) + elif progress.startswith("custom:"): + # Use a custom progress handler that was injected via OE_EXTRA_IMPORTS or __builtins__ + import functools + from types import ModuleType + + parts = progress.split(":", 2) + _, cls, otherargs = parts[0], parts[1], (parts[2] or None) if parts[2:] else None + if cls: + def resolve(x, y): + if not x: + return None + if isinstance(x, ModuleType): + return getattr(x, y, None) + return x.get(y) + cls_obj = functools.reduce(resolve, cls.split("."), bb.utils._context) + if not cls_obj: + # Fall-back on __builtins__ + cls_obj = functools.reduce(lambda x, y: x.get(y), cls.split("."), __builtins__) + if cls_obj: + return cls_obj(d, outfile=logfile, otherargs=otherargs) + bb.warn('%s: unknown custom progress handler in task progress varflag value "%s", ignoring' % (func, cls)) + else: + bb.warn('%s: invalid task progress varflag value "%s", ignoring' % (func, progress)) + + return logfile + def exec_func_shell(func, d, runfile, cwd=None): """Execute a shell function from the metadata @@ -360,23 +419,13 @@ exit $ret cmd = [fakerootcmd, runfile] if bb.msg.loggerDefaultVerbose: - logfile = LogTee(logger, sys.stdout) + logfile = LogTee(logger, StdoutNoopContextManager()) else: - logfile = sys.stdout + logfile = StdoutNoopContextManager() progress = d.getVarFlag(func, 'progress') if progress: - if progress == 'percent': - # Use default regex - logfile = bb.progress.BasicProgressHandler(d, outfile=logfile) - elif progress.startswith('percent:'): - # Use specified regex - logfile = bb.progress.BasicProgressHandler(d, regex=progress.split(':', 1)[1], outfile=logfile) - elif progress.startswith('outof:'): - # Use specified regex - logfile = bb.progress.OutOfProgressHandler(d, regex=progress.split(':', 1)[1], outfile=logfile) - else: - bb.warn('%s: invalid task progress varflag value "%s", ignoring' % (func, progress)) + logfile = create_progress_handler(func, progress, logfile, d) fifobuffer = bytearray() def readfifo(data): @@ -428,7 +477,7 @@ exit $ret bb.debug(2, "Executing shell function %s" % func) try: - with open(os.devnull, 'r+') as stdin: + with open(os.devnull, 'r+') as stdin, logfile: bb.process.run(cmd, shell=False, stdin=stdin, log=logfile, extrafiles=[(fifo,readfifo)]) except bb.process.CmdError: logfn = d.getVar('BB_LOGFILE') diff --git a/poky/bitbake/lib/bb/cache.py b/poky/bitbake/lib/bb/cache.py index 060758e0c..5fb2f17cd 100644 --- a/poky/bitbake/lib/bb/cache.py +++ b/poky/bitbake/lib/bb/cache.py @@ -237,7 +237,7 @@ def virtualfn2realfn(virtualfn): Convert a virtual file name to a real one + the associated subclass keyword """ mc = "" - if virtualfn.startswith('multiconfig:'): + if virtualfn.startswith('mc:'): elems = virtualfn.split(':') mc = elems[1] virtualfn = ":".join(elems[2:]) @@ -258,7 +258,7 @@ def realfn2virtual(realfn, cls, mc): if cls: realfn = "virtual:" + cls + ":" + realfn if mc: - realfn = "multiconfig:" + mc + ":" + realfn + realfn = "mc:" + mc + ":" + realfn return realfn def variant2virtual(realfn, variant): @@ -267,11 +267,11 @@ def variant2virtual(realfn, variant): """ if variant == "": return realfn - if variant.startswith("multiconfig:"): + if variant.startswith("mc:"): elems = variant.split(":") if elems[2]: - return "multiconfig:" + elems[1] + ":virtual:" + ":".join(elems[2:]) + ":" + realfn - return "multiconfig:" + elems[1] + ":" + realfn + return "mc:" + elems[1] + ":virtual:" + ":".join(elems[2:]) + ":" + realfn + return "mc:" + elems[1] + ":" + realfn return "virtual:" + variant + ":" + realfn def parse_recipe(bb_data, bbfile, appends, mc=''): @@ -349,7 +349,7 @@ class NoCache(object): bb_data = self.databuilder.mcdata[mc].createCopy() newstores = parse_recipe(bb_data, bbfile, appends, mc) for ns in newstores: - datastores["multiconfig:%s:%s" % (mc, ns)] = newstores[ns] + datastores["mc:%s:%s" % (mc, ns)] = newstores[ns] return datastores diff --git a/poky/bitbake/lib/bb/cooker.py b/poky/bitbake/lib/bb/cooker.py index c8e14042d..0008c2fde 100644 --- a/poky/bitbake/lib/bb/cooker.py +++ b/poky/bitbake/lib/bb/cooker.py @@ -378,8 +378,9 @@ class BBCooker: if CookerFeatures.BASEDATASTORE_TRACKING in self.featureset: self.disableDataTracking() - self.data.renameVar("__depends", "__base_depends") - self.add_filewatch(self.data.getVar("__base_depends", False), self.configwatcher) + for mc in self.databuilder.mcdata.values(): + mc.renameVar("__depends", "__base_depends") + self.add_filewatch(mc.getVar("__base_depends", False), self.configwatcher) self.baseconfig_valid = True self.parsecache_valid = False @@ -494,6 +495,7 @@ class BBCooker: """ fn = None envdata = None + mc = '' if not pkgs_to_build: pkgs_to_build = [] @@ -502,6 +504,12 @@ class BBCooker: self.enableDataTracking() self.reset() + def mc_base(p): + if p.startswith('mc:'): + s = p.split(':') + if len(s) == 2: + return s[1] + return None if buildfile: # Parse the configuration here. We need to do it explicitly here since @@ -512,18 +520,16 @@ class BBCooker: fn = self.matchFile(fn) fn = bb.cache.realfn2virtual(fn, cls, mc) elif len(pkgs_to_build) == 1: - ignore = self.data.getVar("ASSUME_PROVIDED") or "" - if pkgs_to_build[0] in set(ignore.split()): - bb.fatal("%s is in ASSUME_PROVIDED" % pkgs_to_build[0]) + mc = mc_base(pkgs_to_build[0]) + if not mc: + ignore = self.data.getVar("ASSUME_PROVIDED") or "" + if pkgs_to_build[0] in set(ignore.split()): + bb.fatal("%s is in ASSUME_PROVIDED" % pkgs_to_build[0]) - taskdata, runlist = self.buildTaskData(pkgs_to_build, None, self.configuration.abort, allowincomplete=True) + taskdata, runlist = self.buildTaskData(pkgs_to_build, None, self.configuration.abort, allowincomplete=True) - mc = runlist[0][0] - fn = runlist[0][3] - else: - envdata = self.data - data.expandKeys(envdata) - parse.ast.runAnonFuncs(envdata) + mc = runlist[0][0] + fn = runlist[0][3] if fn: try: @@ -532,6 +538,12 @@ class BBCooker: except Exception as e: parselog.exception("Unable to read %s", fn) raise + else: + if not mc in self.databuilder.mcdata: + bb.fatal('Not multiconfig named "%s" found' % mc) + envdata = self.databuilder.mcdata[mc] + data.expandKeys(envdata) + parse.ast.runAnonFuncs(envdata) # Display history with closing(StringIO()) as env: @@ -571,10 +583,10 @@ class BBCooker: wildcard = False # Wild card expansion: - # Replace string such as "multiconfig:*:bash" - # into "multiconfig:A:bash multiconfig:B:bash bash" + # Replace string such as "mc:*:bash" + # into "mc:A:bash mc:B:bash bash" for k in targetlist: - if k.startswith("multiconfig:"): + if k.startswith("mc:"): if wildcard: bb.fatal('multiconfig conflict') if k.split(":")[1] == "*": @@ -607,7 +619,7 @@ class BBCooker: runlist = [] for k in fulltargetlist: mc = "" - if k.startswith("multiconfig:"): + if k.startswith("mc:"): mc = k.split(":")[1] k = ":".join(k.split(":")[2:]) ktask = task @@ -626,9 +638,13 @@ class BBCooker: runlist.append([mc, k, ktask, fn]) bb.event.fire(bb.event.TreeDataPreparationProgress(current, len(fulltargetlist)), self.data) + havemc = False + for mc in self.multiconfigs: + if taskdata[mc].get_mcdepends(): + havemc = True # No need to do check providers if there are no mcdeps or not an mc build - if len(self.multiconfigs) > 1: + if havemc or len(self.multiconfigs) > 1: seen = set() new = True # Make sure we can provide the multiconfig dependency @@ -688,7 +704,7 @@ class BBCooker: @staticmethod def add_mc_prefix(mc, pn): if mc: - return "multiconfig:%s:%s" % (mc, pn) + return "mc:%s:%s" % (mc, pn) return pn def buildDependTree(self, rq, taskdata): @@ -1465,7 +1481,7 @@ class BBCooker: ntargets = [] for target in runlist: if target[0]: - ntargets.append("multiconfig:%s:%s:%s" % (target[0], target[1], target[2])) + ntargets.append("mc:%s:%s:%s" % (target[0], target[1], target[2])) ntargets.append("%s:%s" % (target[1], target[2])) for mc in self.multiconfigs: @@ -1588,6 +1604,9 @@ class BBCooker: for pkg in pkgs_to_build: if pkg in ignore: parselog.warning("Explicit target \"%s\" is in ASSUME_PROVIDED, ignoring" % pkg) + if pkg.startswith("multiconfig:"): + pkgs_to_build.remove(pkg) + pkgs_to_build.append(pkg.replace("multiconfig:", "mc:")) if 'world' in pkgs_to_build: pkgs_to_build.remove('world') @@ -1595,7 +1614,7 @@ class BBCooker: bb.providers.buildWorldTargetList(self.recipecaches[mc], task) for t in self.recipecaches[mc].world_target: if mc: - t = "multiconfig:" + mc + ":" + t + t = "mc:" + mc + ":" + t pkgs_to_build.append(t) if 'universe' in pkgs_to_build: @@ -1614,7 +1633,7 @@ class BBCooker: bb.debug(1, "Skipping %s for universe tasks as task %s doesn't exist" % (t, task)) continue if mc: - t = "multiconfig:" + mc + ":" + t + t = "mc:" + mc + ":" + t pkgs_to_build.append(t) return pkgs_to_build diff --git a/poky/bitbake/lib/bb/cookerdata.py b/poky/bitbake/lib/bb/cookerdata.py index f8ae41093..842275d53 100644 --- a/poky/bitbake/lib/bb/cookerdata.py +++ b/poky/bitbake/lib/bb/cookerdata.py @@ -342,14 +342,24 @@ class CookerDataBuilder(object): data = parse_config_file(layerconf, data) layers = (data.getVar('BBLAYERS') or "").split() + broken_layers = [] data = bb.data.createCopy(data) approved = bb.utils.approved_variables() + + # Check whether present layer directories exist for layer in layers: if not os.path.isdir(layer): - parselog.critical("Layer directory '%s' does not exist! " - "Please check BBLAYERS in %s" % (layer, layerconf)) - sys.exit(1) + broken_layers.append(layer) + + if broken_layers: + parselog.critical("The following layer directories do not exist:") + for layer in broken_layers: + parselog.critical(" %s", layer) + parselog.critical("Please check BBLAYERS in %s" % (layerconf)) + sys.exit(1) + + for layer in layers: parselog.debug(2, "Adding layer %s", layer) if 'HOME' in approved and '~' in layer: layer = os.path.expanduser(layer) diff --git a/poky/bitbake/lib/bb/fetch2/__init__.py b/poky/bitbake/lib/bb/fetch2/__init__.py index 0126e0d7c..f6b5529bb 100644 --- a/poky/bitbake/lib/bb/fetch2/__init__.py +++ b/poky/bitbake/lib/bb/fetch2/__init__.py @@ -843,6 +843,11 @@ def runfetchcmd(cmd, d, quiet=False, cleanup=None, log=None, workdir=None): if val: cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd) + # Ensure that a _PYTHON_SYSCONFIGDATA_NAME value set by a recipe + # (for example via python3native.bbclass since warrior) is not set for + # host Python (otherwise tools like git-make-shallow will fail) + cmd = 'unset _PYTHON_SYSCONFIGDATA_NAME; ' + cmd + # Disable pseudo as it may affect ssh, potentially causing it to hang. cmd = 'export PSEUDO_DISABLED=1; ' + cmd diff --git a/poky/bitbake/lib/bb/fetch2/npm.py b/poky/bitbake/lib/bb/fetch2/npm.py index f08bdee73..4427b1bb8 100644 --- a/poky/bitbake/lib/bb/fetch2/npm.py +++ b/poky/bitbake/lib/bb/fetch2/npm.py @@ -151,20 +151,11 @@ class Npm(FetchMethod): Parse the output of npm view --json; the last JSON result is assumed to be the one that we're interested in. ''' - pdata = None - outdeps = {} - datalines = [] - bracelevel = 0 - for line in output.splitlines(): - if bracelevel: - datalines.append(line) - elif '{' in line: - datalines = [] - datalines.append(line) - bracelevel = bracelevel + line.count('{') - line.count('}') - if datalines: - pdata = json.loads('\n'.join(datalines)) - return pdata + pdata = json.loads(output); + try: + return pdata[-1] + except: + return pdata def _getdependencies(self, pkg, data, version, d, ud, optional=False, fetchedlist=None): if fetchedlist is None: diff --git a/poky/bitbake/lib/bb/fetch2/svn.py b/poky/bitbake/lib/bb/fetch2/svn.py index baeb0e7ee..59ce93160 100644 --- a/poky/bitbake/lib/bb/fetch2/svn.py +++ b/poky/bitbake/lib/bb/fetch2/svn.py @@ -91,6 +91,13 @@ class Svn(FetchMethod): svncmd = "%s log --limit 1 %s %s://%s/%s/" % (ud.basecmd, " ".join(options), proto, svnroot, ud.module) else: suffix = "" + + # externals may be either 'allowed' or 'nowarn', but not both. Allowed + # will not issue a warning, but will log to the debug buffer what has likely + # been downloaded by SVN. + if not ("externals" in ud.parm and ud.parm["externals"] == "allowed"): + options.append("--ignore-externals") + if ud.revision: options.append("-r %s" % ud.revision) suffix = "@%s" % (ud.revision) @@ -136,6 +143,18 @@ class Svn(FetchMethod): bb.fetch2.check_network_access(d, svnfetchcmd, ud.url) runfetchcmd(svnfetchcmd, d, workdir=ud.pkgdir) + if not ("externals" in ud.parm and ud.parm["externals"] == "nowarn"): + # Warn the user if this had externals (won't catch them all) + output = runfetchcmd("svn propget svn:externals", d, workdir=ud.moddir) + if output: + if "--ignore-externals" in svnfetchcmd.split(): + bb.warn("%s contains svn:externals." % ud.url) + bb.warn("These should be added to the recipe SRC_URI as necessary.") + bb.warn("svn fetch has ignored externals:\n%s" % output) + bb.warn("To disable this warning add ';externals=nowarn' to the url.") + else: + bb.debug(1, "svn repository has externals:\n%s" % output) + scmdata = ud.parm.get("scmdata", "") if scmdata == "keep": tar_flags = "" diff --git a/poky/bitbake/lib/bb/main.py b/poky/bitbake/lib/bb/main.py index 8d1978f98..ca59eb9af 100755 --- a/poky/bitbake/lib/bb/main.py +++ b/poky/bitbake/lib/bb/main.py @@ -491,7 +491,7 @@ def setup_bitbake(configParams, configuration, extrafeatures=None): def lockBitbake(): topdir = bb.cookerdata.findTopdir() if not topdir: - bb.error("Unable to find conf/bblayers.conf or conf/bitbake.conf. BBAPTH is unset and/or not in a build directory?") + bb.error("Unable to find conf/bblayers.conf or conf/bitbake.conf. BBPATH is unset and/or not in a build directory?") raise BBMainFatal lockfile = topdir + "/bitbake.lock" return topdir, bb.utils.lockfile(lockfile, False, False) diff --git a/poky/bitbake/lib/bb/progress.py b/poky/bitbake/lib/bb/progress.py index e9b72e28b..4022caa71 100644 --- a/poky/bitbake/lib/bb/progress.py +++ b/poky/bitbake/lib/bb/progress.py @@ -13,6 +13,7 @@ import time import inspect import bb.event import bb.build +from bb.build import StdoutNoopContextManager class ProgressHandler(object): """ @@ -27,7 +28,14 @@ class ProgressHandler(object): if outfile: self._outfile = outfile else: - self._outfile = sys.stdout + self._outfile = StdoutNoopContextManager() + + def __enter__(self): + self._outfile.__enter__() + return self + + def __exit__(self, *excinfo): + self._outfile.__exit__(*excinfo) def _fire_progress(self, taskprogress, rate=None): """Internal function to fire the progress event""" @@ -147,6 +155,12 @@ class MultiStageProgressReporter(object): self._stage_total = None self._callers = [] + def __enter__(self): + return self + + def __exit__(self, *excinfo): + pass + def _fire_progress(self, taskprogress): bb.event.fire(bb.build.TaskProgress(taskprogress), self._data) diff --git a/poky/bitbake/lib/bb/runqueue.py b/poky/bitbake/lib/bb/runqueue.py index d573ed460..010b08501 100644 --- a/poky/bitbake/lib/bb/runqueue.py +++ b/poky/bitbake/lib/bb/runqueue.py @@ -39,7 +39,7 @@ def taskname_from_tid(tid): return tid.rsplit(":", 1)[1] def mc_from_tid(tid): - if tid.startswith('multiconfig:'): + if tid.startswith('mc:'): return tid.split(':')[1] return "" @@ -48,12 +48,12 @@ def split_tid(tid): return (mc, fn, taskname) def split_tid_mcfn(tid): - if tid.startswith('multiconfig:'): + if tid.startswith('mc:'): elems = tid.split(':') mc = elems[1] fn = ":".join(elems[2:-1]) taskname = elems[-1] - mcfn = "multiconfig:" + mc + ":" + fn + mcfn = "mc:" + mc + ":" + fn else: tid = tid.rsplit(":", 1) mc = "" @@ -65,7 +65,7 @@ def split_tid_mcfn(tid): def build_tid(mc, fn, taskname): if mc: - return "multiconfig:" + mc + ":" + fn + ":" + taskname + return "mc:" + mc + ":" + fn + ":" + taskname return fn + ":" + taskname class RunQueueStats: diff --git a/poky/bitbake/lib/bb/siggen.py b/poky/bitbake/lib/bb/siggen.py index e0a66e68d..fe580e487 100644 --- a/poky/bitbake/lib/bb/siggen.py +++ b/poky/bitbake/lib/bb/siggen.py @@ -179,7 +179,7 @@ class SignatureGeneratorBasic(SignatureGenerator): def get_taskhash(self, fn, task, deps, dataCache): mc = '' - if fn.startswith('multiconfig:'): + if fn.startswith('mc:'): mc = fn.split(':')[1] k = fn + "." + task @@ -194,7 +194,7 @@ class SignatureGeneratorBasic(SignatureGenerator): depmc = pkgname.split(':')[1] if mc != depmc: continue - if dep.startswith("multiconfig:") and not mc: + if dep.startswith("mc:") and not mc: continue depname = dataCache.pkg_fn[pkgname] if not self.rundep_check(fn, recipename, task, dep, depname, dataCache): @@ -412,13 +412,13 @@ def list_inline_diff(oldlist, newlist, colors=None): def clean_basepath(a): mc = None - if a.startswith("multiconfig:"): + if a.startswith("mc:"): _, mc, a = a.split(":", 2) b = a.rsplit("/", 2)[1] + '/' + a.rsplit("/", 2)[2] if a.startswith("virtual:"): b = b + ":" + a.rsplit(":", 1)[0] if mc: - b = b + ":multiconfig:" + mc + b = b + ":mc:" + mc return b def clean_basepaths(a): diff --git a/poky/bitbake/lib/bb/taskdata.py b/poky/bitbake/lib/bb/taskdata.py index c7de3db38..d13bd7c3b 100644 --- a/poky/bitbake/lib/bb/taskdata.py +++ b/poky/bitbake/lib/bb/taskdata.py @@ -81,7 +81,7 @@ class TaskData: def add_mcdepends(task): for dep in task_deps['mcdepends'][task].split(): if len(dep.split(':')) != 5: - bb.msg.fatal("TaskData", "Error for %s:%s[%s], multiconfig dependency %s does not contain exactly four ':' characters.\n Task '%s' should be specified in the form 'multiconfig:fromMC:toMC:packagename:task'" % (fn, task, 'mcdepends', dep, 'mcdepends')) + bb.msg.fatal("TaskData", "Error for %s:%s[%s], multiconfig dependency %s does not contain exactly four ':' characters.\n Task '%s' should be specified in the form 'mc:fromMC:toMC:packagename:task'" % (fn, task, 'mcdepends', dep, 'mcdepends')) if dep not in self.mcdepends: self.mcdepends.append(dep) diff --git a/poky/bitbake/lib/bb/tests/fetch.py b/poky/bitbake/lib/bb/tests/fetch.py index 6bdf0416d..16f975b13 100644 --- a/poky/bitbake/lib/bb/tests/fetch.py +++ b/poky/bitbake/lib/bb/tests/fetch.py @@ -991,6 +991,86 @@ class FetcherNetworkTest(FetcherTest): self.assertTrue(os.path.exists(os.path.join(repo_path, 'edgelet/hsm-sys/azure-iot-hsm-c/deps/utpm/deps/c-utility/testtools/umock-c/deps/ctest/README.md')), msg='Missing submodule checkout') self.assertTrue(os.path.exists(os.path.join(repo_path, 'edgelet/hsm-sys/azure-iot-hsm-c/deps/utpm/deps/c-utility/testtools/umock-c/deps/testrunner/readme.md')), msg='Missing submodule checkout') +class SVNTest(FetcherTest): + def skipIfNoSvn(): + import shutil + if not shutil.which("svn"): + return unittest.skip("svn not installed, tests being skipped") + + if not shutil.which("svnadmin"): + return unittest.skip("svnadmin not installed, tests being skipped") + + return lambda f: f + + @skipIfNoSvn() + def setUp(self): + """ Create a local repository """ + + super(SVNTest, self).setUp() + + # Create something we can fetch + src_dir = tempfile.mkdtemp(dir=self.tempdir, + prefix='svnfetch_srcdir_') + src_dir = os.path.abspath(src_dir) + bb.process.run("echo readme > README.md", cwd=src_dir) + + # Store it in a local SVN repository + repo_dir = tempfile.mkdtemp(dir=self.tempdir, + prefix='svnfetch_localrepo_') + repo_dir = os.path.abspath(repo_dir) + bb.process.run("svnadmin create project", cwd=repo_dir) + + self.repo_url = "file://%s/project" % repo_dir + bb.process.run("svn import --non-interactive -m 'Initial import' %s %s/trunk" % (src_dir, self.repo_url), + cwd=repo_dir) + + bb.process.run("svn co %s svnfetch_co" % self.repo_url, cwd=self.tempdir) + # Github will emulate SVN. Use this to check if we're downloding... + bb.process.run("svn propset svn:externals 'bitbake http://github.com/openembedded/bitbake' .", + cwd=os.path.join(self.tempdir, 'svnfetch_co', 'trunk')) + bb.process.run("svn commit --non-interactive -m 'Add external'", + cwd=os.path.join(self.tempdir, 'svnfetch_co', 'trunk')) + + self.src_dir = src_dir + self.repo_dir = repo_dir + + @skipIfNoSvn() + def tearDown(self): + os.chdir(self.origdir) + if os.environ.get("BB_TMPDIR_NOCLEAN") == "yes": + print("Not cleaning up %s. Please remove manually." % self.tempdir) + else: + bb.utils.prunedir(self.tempdir) + + @skipIfNoSvn() + @skipIfNoNetwork() + def test_noexternal_svn(self): + # Always match the rev count from setUp (currently rev 2) + url = "svn://%s;module=trunk;protocol=file;rev=2" % self.repo_url.replace('file://', '') + fetcher = bb.fetch.Fetch([url], self.d) + fetcher.download() + os.chdir(os.path.dirname(self.unpackdir)) + fetcher.unpack(self.unpackdir) + + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, 'trunk')), msg="Missing trunk") + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, 'trunk', 'README.md')), msg="Missing contents") + self.assertFalse(os.path.exists(os.path.join(self.unpackdir, 'trunk/bitbake/trunk')), msg="External dir should NOT exist") + self.assertFalse(os.path.exists(os.path.join(self.unpackdir, 'trunk/bitbake/trunk', 'README')), msg="External README should NOT exit") + + @skipIfNoSvn() + def test_external_svn(self): + # Always match the rev count from setUp (currently rev 2) + url = "svn://%s;module=trunk;protocol=file;externals=allowed;rev=2" % self.repo_url.replace('file://', '') + fetcher = bb.fetch.Fetch([url], self.d) + fetcher.download() + os.chdir(os.path.dirname(self.unpackdir)) + fetcher.unpack(self.unpackdir) + + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, 'trunk')), msg="Missing trunk") + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, 'trunk', 'README.md')), msg="Missing contents") + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, 'trunk/bitbake/trunk')), msg="External dir should exist") + self.assertTrue(os.path.exists(os.path.join(self.unpackdir, 'trunk/bitbake/trunk', 'README')), msg="External README should exit") + class TrustedNetworksTest(FetcherTest): def test_trusted_network(self): # Ensure trusted_network returns False when the host IS in the list. diff --git a/poky/bitbake/lib/bb/tests/utils.py b/poky/bitbake/lib/bb/tests/utils.py index 4d788281a..f4adf1d44 100644 --- a/poky/bitbake/lib/bb/tests/utils.py +++ b/poky/bitbake/lib/bb/tests/utils.py @@ -29,6 +29,10 @@ class VerCmpString(unittest.TestCase): self.assertTrue(result < 0) result = bb.utils.vercmp_string('1.1', '1.0+1.1-beta1') self.assertTrue(result > 0) + result = bb.utils.vercmp_string('1a', '1a1') + self.assertTrue(result < 0) + result = bb.utils.vercmp_string('1a1', '1a') + self.assertTrue(result > 0) result = bb.utils.vercmp_string('1.', '1.1') self.assertTrue(result < 0) result = bb.utils.vercmp_string('1.1', '1.') diff --git a/poky/bitbake/lib/bb/ui/knotty.py b/poky/bitbake/lib/bb/ui/knotty.py index 3d9e2031b..88f638fb3 100644 --- a/poky/bitbake/lib/bb/ui/knotty.py +++ b/poky/bitbake/lib/bb/ui/knotty.py @@ -300,8 +300,8 @@ class TerminalFilter(object): if start_time: pbar.start_time = start_time pbar.setmessage('%s:%s' % (tasknum, pbar.msg.split(':', 1)[1])) + pbar.setextra(rate) if progress > -1: - pbar.setextra(rate) content = pbar.update(progress) else: content = pbar.update(1) diff --git a/poky/bitbake/lib/toaster/orm/fixtures/oe-core.xml b/poky/bitbake/lib/toaster/orm/fixtures/oe-core.xml index bd9c32685..9ae2e423e 100644 --- a/poky/bitbake/lib/toaster/orm/fixtures/oe-core.xml +++ b/poky/bitbake/lib/toaster/orm/fixtures/oe-core.xml @@ -53,7 +53,7 @@ <object model="orm.release" pk="4"> <field type="CharField" name="name">thud</field> <field type="CharField" name="description">Openembedded Thud</field> - <field rel="ManyToOneRel" to="orm.bitbakeversion" name="bitbake_version">1</field> + <field rel="ManyToOneRel" to="orm.bitbakeversion" name="bitbake_version">4</field> <field type="CharField" name="branch_name">thud</field> <field type="TextField" name="helptext">Toaster will run your builds using the tip of the <a href=\"http://cgit.openembedded.org/openembedded-core/log/?h=thud\">OpenEmbedded Thud</a> branch.</field> </object> diff --git a/poky/bitbake/lib/toaster/orm/fixtures/poky.xml b/poky/bitbake/lib/toaster/orm/fixtures/poky.xml index 4162e4fba..da3b93032 100644 --- a/poky/bitbake/lib/toaster/orm/fixtures/poky.xml +++ b/poky/bitbake/lib/toaster/orm/fixtures/poky.xml @@ -58,7 +58,7 @@ <object model="orm.release" pk="4"> <field type="CharField" name="name">thud</field> <field type="CharField" name="description">Yocto Project 2.6 "Thud"</field> - <field rel="ManyToOneRel" to="orm.bitbakeversion" name="bitbake_version">1</field> + <field rel="ManyToOneRel" to="orm.bitbakeversion" name="bitbake_version">4</field> <field type="CharField" name="branch_name">thud</field> <field type="TextField" name="helptext">Toaster will run your builds using the tip of the <a href="http://git.yoctoproject.org/cgit/cgit.cgi/poky/log/?h=thud">Yocto Project Thud branch</a>.</field> </object> |