summaryrefslogtreecommitdiff
path: root/poky/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'poky/bitbake')
-rwxr-xr-xpoky/bitbake/bin/bitbake-worker8
-rw-r--r--poky/bitbake/bitbake/contrib/vim/indent/bitbake.vim (renamed from poky/bitbake/bitbake/contrib/vim/bitbake.vim)107
-rw-r--r--poky/bitbake/lib/bb/cooker.py4
-rw-r--r--poky/bitbake/lib/bb/fetch2/__init__.py4
-rw-r--r--poky/bitbake/lib/bb/fetch2/hg.py27
-rw-r--r--poky/bitbake/lib/bb/runqueue.py28
-rw-r--r--poky/bitbake/lib/prserv/serv.py1
7 files changed, 142 insertions, 37 deletions
diff --git a/poky/bitbake/bin/bitbake-worker b/poky/bitbake/bin/bitbake-worker
index 6776cadda3..1e641e81c2 100755
--- a/poky/bitbake/bin/bitbake-worker
+++ b/poky/bitbake/bin/bitbake-worker
@@ -195,9 +195,6 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha
global worker_pipe_lock
pipein.close()
- signal.signal(signal.SIGTERM, sigterm_handler)
- # Let SIGHUP exit as SIGTERM
- signal.signal(signal.SIGHUP, sigterm_handler)
bb.utils.signal_on_parent_exit("SIGTERM")
# Save out the PID so that the event can include it the
@@ -212,6 +209,11 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha
# This ensures signals sent to the controlling terminal like Ctrl+C
# don't stop the child processes.
os.setsid()
+
+ signal.signal(signal.SIGTERM, sigterm_handler)
+ # Let SIGHUP exit as SIGTERM
+ signal.signal(signal.SIGHUP, sigterm_handler)
+
# No stdin
newsi = os.open(os.devnull, os.O_RDWR)
os.dup2(newsi, sys.stdin.fileno())
diff --git a/poky/bitbake/bitbake/contrib/vim/bitbake.vim b/poky/bitbake/bitbake/contrib/vim/indent/bitbake.vim
index ff86c19fac..1381034098 100644
--- a/poky/bitbake/bitbake/contrib/vim/bitbake.vim
+++ b/poky/bitbake/bitbake/contrib/vim/indent/bitbake.vim
@@ -1,14 +1,25 @@
+" Vim indent file
+" Language: BitBake
+" Copyright: Copyright (C) 2019 Agilent Technologies, Inc.
+" Maintainer: Chris Laplante <chris.laplante@agilent.com>
+" License: You may redistribute this under the same terms as Vim itself
+
+
if exists("b:did_indent")
finish
endif
+if exists("*BitbakeIndent")
+ finish
+endif
+
runtime! indent/sh.vim
unlet b:did_indent
setlocal indentexpr=BitbakeIndent(v:lnum)
setlocal autoindent nolisp
-function s:is_python_func_def(lnum)
+function s:is_bb_python_func_def(lnum)
let stack = synstack(a:lnum, 1)
if len(stack) == 0
return 0
@@ -79,7 +90,9 @@ function GetPythonIndent(lnum)
\ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
\ searchpair_stopline, searchpair_timeout)
if parlnum > 0
- if s:is_python_func_def(parlnum)
+ " We may have found the opening brace of a BitBake Python task, e.g. 'python do_task {'
+ " If so, ignore it here - it will be handled later.
+ if s:is_bb_python_func_def(parlnum)
let parlnum = 0
let plindent = indent(plnum)
let plnumstart = plnum
@@ -104,7 +117,19 @@ function GetPythonIndent(lnum)
\ . " =~ '\\(Comment\\|Todo\\|String\\)$'",
\ searchpair_stopline, searchpair_timeout)
if p > 0
- if s:is_python_func_def(p)
+ if s:is_bb_python_func_def(p)
+ " Handle first non-empty line inside a BB Python task
+ if p == plnum
+ return shiftwidth()
+ endif
+
+ " Handle the user actually trying to close a BitBake Python task
+ let line = getline(a:lnum)
+ if line =~ '^\s*}'
+ return -2
+ endif
+
+ " Otherwise ignore the brace
let p = 0
else
if p == plnum
@@ -167,7 +192,8 @@ function GetPythonIndent(lnum)
endif
" If the previous line was a stop-execution statement...
- if getline(plnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\)\>'
+ " TODO: utilize this logic to deindent when ending a bbPyDefRegion
+ if getline(plnum) =~ '^\s*\(break\|continue\|raise\|return\|pass\|bb\.fatal\)\>'
" See if the user has already dedented
if indent(a:lnum) > indent(plnum) - shiftwidth()
" If not, recommend one dedent
@@ -228,21 +254,90 @@ unlet s:keepcpo
let b:did_indent = 1
+setlocal indentkeys+=0\"
function BitbakeIndent(lnum)
- let stack = synstack(a:lnum, col("."))
+ if !has('syntax_items')
+ return -1
+ endif
+
+ let stack = synstack(a:lnum, 1)
if len(stack) == 0
return -1
endif
let name = synIDattr(stack[0], "name")
+ " TODO: support different styles of indentation for assignments. For now,
+ " we only support like this:
+ " VAR = " \
+ " value1 \
+ " value2 \
+ " "
+ "
+ " i.e. each value indented by shiftwidth(), with the final quote " completely unindented.
+ if name == "bbVarValue"
+ " Quote handling is tricky. kernel.bbclass has this line for instance:
+ " EXTRA_OEMAKE = " HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" " HOSTCPP="${BUILD_CPP}""
+ " Instead of trying to handle crazy cases like that, just assume that a
+ " double-quote on a line by itself (following an assignment) means the
+ " user is closing the assignment, and de-dent.
+ if getline(a:lnum) =~ '^\s*"$'
+ return 0
+ endif
+
+ let prevstack = synstack(a:lnum - 1, 1)
+ if len(prevstack) == 0
+ return -1
+ endif
+
+ let prevname = synIDattr(prevstack[0], "name")
+
+ " Only indent if there was actually a continuation character on
+ " the previous line, to avoid misleading indentation.
+ let prevlinelastchar = synIDattr(synID(a:lnum - 1, col([a:lnum - 1, "$"]) - 1, 1), "name")
+ let prev_continued = prevlinelastchar == "bbContinue"
+
+ " Did the previous line introduce an assignment?
+ if index(["bbVarDef", "bbVarFlagDef"], prevname) != -1
+ if prev_continued
+ return shiftwidth()
+ endif
+ endif
+
+ if !prev_continued
+ return 0
+ endif
+
+ " Autoindent can take it from here
+ return -1
+ endif
+
if index(["bbPyDefRegion", "bbPyFuncRegion"], name) != -1
let ret = GetPythonIndent(a:lnum)
+ " Should normally always be indented by at least one shiftwidth; but allow
+ " return of -1 (defer to autoindent) or -2 (force indent to 0)
+ if ret == 0
+ return shiftwidth()
+ elseif ret == -2
+ return 0
+ endif
return ret
endif
+ " TODO: GetShIndent doesn't detect tasks prepended with 'fakeroot'
+ " Need to submit a patch upstream to Vim to provide an extension point.
+ " Unlike the Python indenter, the Sh indenter is way too large to copy and
+ " modify here.
+ if name == "bbShFuncRegion"
+ return GetShIndent()
+ endif
+
+ " TODO:
+ " + heuristics for de-denting out of a bbPyDefRegion? e.g. when the user
+ " types an obvious BB keyword like addhandler or addtask, or starts
+ " writing a shell task. Maybe too hard to implement...
+
return -1
- "return s:pythonIndentExpr()
endfunction
diff --git a/poky/bitbake/lib/bb/cooker.py b/poky/bitbake/lib/bb/cooker.py
index 20ef04d3ff..e6442bff93 100644
--- a/poky/bitbake/lib/bb/cooker.py
+++ b/poky/bitbake/lib/bb/cooker.py
@@ -371,10 +371,6 @@ class BBCooker:
self.data.setVar('BB_CMDLINE', self.ui_cmdline)
- #
- # Copy of the data store which has been expanded.
- # Used for firing events and accessing variables where expansion needs to be accounted for
- #
if CookerFeatures.BASEDATASTORE_TRACKING in self.featureset:
self.disableDataTracking()
diff --git a/poky/bitbake/lib/bb/fetch2/__init__.py b/poky/bitbake/lib/bb/fetch2/__init__.py
index 1f5f8f1f14..07de6c2693 100644
--- a/poky/bitbake/lib/bb/fetch2/__init__.py
+++ b/poky/bitbake/lib/bb/fetch2/__init__.py
@@ -1593,7 +1593,7 @@ class Fetch(object):
fn = d.getVar('FILE')
mc = d.getVar('__BBMULTICONFIG') or ""
if cache and fn and mc + fn in urldata_cache:
- self.ud = urldata_cache[mc + fn]
+ self.ud = urldata_cache[mc + fn + str(id(d))]
for url in urls:
if url not in self.ud:
@@ -1605,7 +1605,7 @@ class Fetch(object):
pass
if fn and cache:
- urldata_cache[mc + fn] = self.ud
+ urldata_cache[mc + fn + str(id(d))] = self.ud
def localpath(self, url):
if url not in self.urls:
diff --git a/poky/bitbake/lib/bb/fetch2/hg.py b/poky/bitbake/lib/bb/fetch2/hg.py
index 15d729e7b2..e21115debf 100644
--- a/poky/bitbake/lib/bb/fetch2/hg.py
+++ b/poky/bitbake/lib/bb/fetch2/hg.py
@@ -54,13 +54,6 @@ class Hg(FetchMethod):
else:
ud.proto = "hg"
- ud.setup_revisions(d)
-
- if 'rev' in ud.parm:
- ud.revision = ud.parm['rev']
- elif not ud.revision:
- ud.revision = self.latest_revision(ud, d)
-
# Create paths to mercurial checkouts
hgsrcname = '%s_%s_%s' % (ud.module.replace('/', '.'), \
ud.host, ud.path.replace('/', '.'))
@@ -74,6 +67,13 @@ class Hg(FetchMethod):
ud.localfile = ud.moddir
ud.basecmd = d.getVar("FETCHCMD_hg") or "/usr/bin/env hg"
+ ud.setup_revisions(d)
+
+ if 'rev' in ud.parm:
+ ud.revision = ud.parm['rev']
+ elif not ud.revision:
+ ud.revision = self.latest_revision(ud, d)
+
ud.write_tarballs = d.getVar("BB_GENERATE_MIRROR_TARBALLS")
def need_update(self, ud, d):
@@ -139,7 +139,7 @@ class Hg(FetchMethod):
cmd = "%s --config auth.default.prefix=* --config auth.default.username=%s --config auth.default.password=%s --config \"auth.default.schemes=%s\" pull" % (ud.basecmd, ud.user, ud.pswd, proto)
else:
cmd = "%s pull" % (ud.basecmd)
- elif command == "update":
+ elif command == "update" or command == "up":
if ud.user and ud.pswd:
cmd = "%s --config auth.default.prefix=* --config auth.default.username=%s --config auth.default.password=%s --config \"auth.default.schemes=%s\" update -C %s" % (ud.basecmd, ud.user, ud.pswd, proto, " ".join(options))
else:
@@ -247,12 +247,19 @@ class Hg(FetchMethod):
scmdata = ud.parm.get("scmdata", "")
if scmdata != "nokeep":
+ proto = ud.parm.get('protocol', 'http')
if not os.access(os.path.join(codir, '.hg'), os.R_OK):
logger.debug(2, "Unpack: creating new hg repository in '" + codir + "'")
runfetchcmd("%s init %s" % (ud.basecmd, codir), d)
logger.debug(2, "Unpack: updating source in '" + codir + "'")
- runfetchcmd("%s pull %s" % (ud.basecmd, ud.moddir), d, workdir=codir)
- runfetchcmd("%s up -C %s" % (ud.basecmd, revflag), d, workdir=codir)
+ if ud.user and ud.pswd:
+ runfetchcmd("%s --config auth.default.prefix=* --config auth.default.username=%s --config auth.default.password=%s --config \"auth.default.schemes=%s\" pull %s" % (ud.basecmd, ud.user, ud.pswd, proto, ud.moddir), d, workdir=codir)
+ else:
+ runfetchcmd("%s pull %s" % (ud.basecmd, ud.moddir), d, workdir=codir)
+ if ud.user and ud.pswd:
+ runfetchcmd("%s --config auth.default.prefix=* --config auth.default.username=%s --config auth.default.password=%s --config \"auth.default.schemes=%s\" up -C %s" % (ud.basecmd, ud.user, ud.pswd, proto, revflag), d, workdir=codir)
+ else:
+ runfetchcmd("%s up -C %s" % (ud.basecmd, revflag), d, workdir=codir)
else:
logger.debug(2, "Unpack: extracting source to '" + codir + "'")
runfetchcmd("%s archive -t files %s %s" % (ud.basecmd, revflag, codir), d, workdir=ud.moddir)
diff --git a/poky/bitbake/lib/bb/runqueue.py b/poky/bitbake/lib/bb/runqueue.py
index 18049436fd..8622738fd9 100644
--- a/poky/bitbake/lib/bb/runqueue.py
+++ b/poky/bitbake/lib/bb/runqueue.py
@@ -1397,7 +1397,7 @@ class RunQueue:
cache[tid] = iscurrent
return iscurrent
- def validate_hashes(self, tocheck, data, currentcount=0, siginfo=False):
+ def validate_hashes(self, tocheck, data, currentcount=0, siginfo=False, summary=True):
valid = set()
if self.hashvalidate:
sq_data = {}
@@ -1410,15 +1410,15 @@ class RunQueue:
sq_data['hashfn'][tid] = self.rqdata.dataCaches[mc].hashfn[taskfn]
sq_data['unihash'][tid] = self.rqdata.runtaskentries[tid].unihash
- valid = self.validate_hash(sq_data, data, siginfo, currentcount)
+ valid = self.validate_hash(sq_data, data, siginfo, currentcount, summary)
return valid
- def validate_hash(self, sq_data, d, siginfo, currentcount):
- locs = {"sq_data" : sq_data, "d" : d, "siginfo" : siginfo, "currentcount" : currentcount}
+ def validate_hash(self, sq_data, d, siginfo, currentcount, summary):
+ locs = {"sq_data" : sq_data, "d" : d, "siginfo" : siginfo, "currentcount" : currentcount, "summary" : summary}
# Metadata has **kwargs so args can be added, sq_data can also gain new fields
- call = self.hashvalidate + "(sq_data, d, siginfo=siginfo, currentcount=currentcount)"
+ call = self.hashvalidate + "(sq_data, d, siginfo=siginfo, currentcount=currentcount, summary=summary)"
return bb.utils.better_eval(call, locs)
@@ -1605,7 +1605,7 @@ class RunQueue:
tocheck.add(tid)
- valid_new = self.validate_hashes(tocheck, self.cooker.data, 0, True)
+ valid_new = self.validate_hashes(tocheck, self.cooker.data, 0, True, summary=False)
# Tasks which are both setscene and noexec never care about dependencies
# We therefore find tasks which are setscene and noexec and mark their
@@ -1986,7 +1986,7 @@ class RunQueueExecute:
continue
logger.debug(1, "Task %s no longer deferred" % nexttask)
del self.sq_deferred[nexttask]
- valid = self.rq.validate_hashes(set([nexttask]), self.cooker.data, 0, False)
+ valid = self.rq.validate_hashes(set([nexttask]), self.cooker.data, 0, False, summary=False)
if not valid:
logger.debug(1, "%s didn't become valid, skipping setscene" % nexttask)
self.sq_task_failoutright(nexttask)
@@ -2361,9 +2361,13 @@ class RunQueueExecute:
if tid in self.build_stamps:
del self.build_stamps[tid]
- logger.info("Setscene task %s now valid and being rerun" % tid)
+ origvalid = False
+ if tid in self.sqdata.valid:
+ origvalid = True
self.sqdone = False
- update_scenequeue_data([tid], self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self)
+ update_scenequeue_data([tid], self.sqdata, self.rqdata, self.rq, self.cooker, self.stampcache, self, summary=False)
+ if tid in self.sqdata.valid and not origvalid:
+ logger.info("Setscene task %s became valid" % tid)
if changed:
self.holdoff_need_update = True
@@ -2692,9 +2696,9 @@ def build_scenequeue_data(sqdata, rqdata, rq, cooker, stampcache, sqrq):
sqdata.stamppresent = set()
sqdata.valid = set()
- update_scenequeue_data(sqdata.sq_revdeps, sqdata, rqdata, rq, cooker, stampcache, sqrq)
+ update_scenequeue_data(sqdata.sq_revdeps, sqdata, rqdata, rq, cooker, stampcache, sqrq, summary=True)
-def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq):
+def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq, summary=True):
tocheck = set()
@@ -2728,7 +2732,7 @@ def update_scenequeue_data(tids, sqdata, rqdata, rq, cooker, stampcache, sqrq):
tocheck.add(tid)
- sqdata.valid |= rq.validate_hashes(tocheck, cooker.data, len(sqdata.stamppresent), False)
+ sqdata.valid |= rq.validate_hashes(tocheck, cooker.data, len(sqdata.stamppresent), False, summary=summary)
sqdata.hashes = {}
for mc in sorted(sqdata.multiconfigs):
diff --git a/poky/bitbake/lib/prserv/serv.py b/poky/bitbake/lib/prserv/serv.py
index 2bc68904f3..b854ba14b7 100644
--- a/poky/bitbake/lib/prserv/serv.py
+++ b/poky/bitbake/lib/prserv/serv.py
@@ -243,6 +243,7 @@ class PRServer(SimpleXMLRPCServer):
try:
pid = os.fork()
if pid > 0:
+ self.socket.close() # avoid ResourceWarning in parent
return pid
except OSError as e:
raise Exception("%s [%d]" % (e.strerror, e.errno))