summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/runqueue.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-07-03 15:38:24 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-07-15 10:28:12 +0100
commit2c0d4b6816dedcc52c7eea030a556cd58e9e5e47 (patch)
tree26a7548563e304f21b72ae943a5abdda0491ac3d /bitbake/lib/bb/runqueue.py
parent2a3a81b422660c06c1d8e2f2335070288e0101a2 (diff)
downloadpoky-2c0d4b6816dedcc52c7eea030a556cd58e9e5e47.tar.gz
bitbake: runqueue: Factor out the process_setscene_whitelist checks
For ease of refactoring, move this code to its own separate function until it becomes clear what we should do with it. (Bitbake rev: 4b96b204f986dd62fba485876b7208665c14268d) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/runqueue.py')
-rw-r--r--bitbake/lib/bb/runqueue.py85
1 files changed, 45 insertions, 40 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index ffab5b2fcb..6aa4dabe16 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -1679,6 +1679,50 @@ class RunQueue:
1679 output = bb.siggen.compare_sigfiles(latestmatch, match, recursecb) 1679 output = bb.siggen.compare_sigfiles(latestmatch, match, recursecb)
1680 bb.plain("\nTask %s:%s couldn't be used from the cache because:\n We need hash %s, closest matching task was %s\n " % (pn, taskname, h, prevh) + '\n '.join(output)) 1680 bb.plain("\nTask %s:%s couldn't be used from the cache because:\n We need hash %s, closest matching task was %s\n " % (pn, taskname, h, prevh) + '\n '.join(output))
1681 1681
1682def process_setscene_whitelist(rq, rqdata, stampcache, sched, rqex):
1683 # Check tasks that are going to run against the whitelist
1684 def check_norun_task(tid, showerror=False):
1685 (mc, fn, taskname, taskfn) = split_tid_mcfn(tid)
1686 # Ignore covered tasks
1687 if tid in rq.scenequeue_covered:
1688 return False
1689 # Ignore stamped tasks
1690 if rq.check_stamp_task(tid, taskname, cache=stampcache):
1691 return False
1692 # Ignore noexec tasks
1693 taskdep = rqdata.dataCaches[mc].task_deps[taskfn]
1694 if 'noexec' in taskdep and taskname in taskdep['noexec']:
1695 return False
1696
1697 pn = rqdata.dataCaches[mc].pkg_fn[taskfn]
1698 if not check_setscene_enforce_whitelist(pn, taskname, rqdata.setscenewhitelist):
1699 if showerror:
1700 if tid in rqdata.runq_setscene_tids:
1701 logger.error('Task %s.%s attempted to execute unexpectedly and should have been setscened' % (pn, taskname))
1702 else:
1703 logger.error('Task %s.%s attempted to execute unexpectedly' % (pn, taskname))
1704 return True
1705 return False
1706 # Look to see if any tasks that we think shouldn't run are going to
1707 unexpected = False
1708 for tid in rqdata.runtaskentries:
1709 if check_norun_task(tid):
1710 unexpected = True
1711 break
1712 if unexpected:
1713 # Run through the tasks in the rough order they'd have executed and print errors
1714 # (since the order can be useful - usually missing sstate for the last few tasks
1715 # is the cause of the problem)
1716 task = sched.next()
1717 while task is not None:
1718 check_norun_task(task, showerror=True)
1719 rqex.task_skip(task, 'Setscene enforcement check')
1720 task = sched.next()
1721
1722 rq.state = runQueueCleanUp
1723 return True
1724
1725
1682class RunQueueExecute: 1726class RunQueueExecute:
1683 1727
1684 def __init__(self, rq): 1728 def __init__(self, rq):
@@ -1920,46 +1964,7 @@ class RunQueueExecuteTasks(RunQueueExecute):
1920 if self.rqdata.setscenewhitelist is not None and not self.rqdata.setscenewhitelist_checked: 1964 if self.rqdata.setscenewhitelist is not None and not self.rqdata.setscenewhitelist_checked:
1921 self.rqdata.setscenewhitelist_checked = True 1965 self.rqdata.setscenewhitelist_checked = True
1922 1966
1923 # Check tasks that are going to run against the whitelist 1967 if process_setscenewhitelist(self.rq, self.rqdata, self.stampcache, self.sched, self):
1924 def check_norun_task(tid, showerror=False):
1925 (mc, fn, taskname, taskfn) = split_tid_mcfn(tid)
1926 # Ignore covered tasks
1927 if tid in self.rq.scenequeue_covered:
1928 return False
1929 # Ignore stamped tasks
1930 if self.rq.check_stamp_task(tid, taskname, cache=self.stampcache):
1931 return False
1932 # Ignore noexec tasks
1933 taskdep = self.rqdata.dataCaches[mc].task_deps[taskfn]
1934 if 'noexec' in taskdep and taskname in taskdep['noexec']:
1935 return False
1936
1937 pn = self.rqdata.dataCaches[mc].pkg_fn[taskfn]
1938 if not check_setscene_enforce_whitelist(pn, taskname, self.rqdata.setscenewhitelist):
1939 if showerror:
1940 if tid in self.rqdata.runq_setscene_tids:
1941 logger.error('Task %s.%s attempted to execute unexpectedly and should have been setscened' % (pn, taskname))
1942 else:
1943 logger.error('Task %s.%s attempted to execute unexpectedly' % (pn, taskname))
1944 return True
1945 return False
1946 # Look to see if any tasks that we think shouldn't run are going to
1947 unexpected = False
1948 for tid in self.rqdata.runtaskentries:
1949 if check_norun_task(tid):
1950 unexpected = True
1951 break
1952 if unexpected:
1953 # Run through the tasks in the rough order they'd have executed and print errors
1954 # (since the order can be useful - usually missing sstate for the last few tasks
1955 # is the cause of the problem)
1956 task = self.sched.next()
1957 while task is not None:
1958 check_norun_task(task, showerror=True)
1959 self.task_skip(task, 'Setscene enforcement check')
1960 task = self.sched.next()
1961
1962 self.rq.state = runQueueCleanUp
1963 return True 1968 return True
1964 1969
1965 self.rq.read_workers() 1970 self.rq.read_workers()