diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-08-09 12:53:06 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-08-13 09:28:14 +0100 |
commit | 0cb62f8ca7de95801aa6e47a4a37aedc6e311bd6 (patch) | |
tree | 63ff9427d672f8de57f4f2f9986621590c85dddb | |
parent | 801b0d29d435abe55df43da5036b4c8ff7bd59a6 (diff) | |
download | poky-0cb62f8ca7de95801aa6e47a4a37aedc6e311bd6.tar.gz |
bitbake: cooker: Track directories searched for bbappend/bb files
Some of the directories searched by BBFILES are not currently being added
to the inotify watch list. This can mean that added append files are not
noticed leading to misleading metadata results when using
BB_SERVER_TIMEOUT != 0.
We use glob to expand the BBFILES references and without writing our own
implentation, figuring out the directories it searches is hard. We use
some horrible hacks here to intecept the listdir calls, I'm open
to better ways to handle this but this does ensure we have the right
watches set.
(Bitbake rev: 4d508d35a224e3a25d2d59c8415ab7985964b14f)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/cooker.py | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 3740c61dc6..ea4df266f5 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -1192,7 +1192,7 @@ class BBCooker: | |||
1192 | bf = os.path.abspath(bf) | 1192 | bf = os.path.abspath(bf) |
1193 | 1193 | ||
1194 | self.collection = CookerCollectFiles(self.bbfile_config_priorities) | 1194 | self.collection = CookerCollectFiles(self.bbfile_config_priorities) |
1195 | filelist, masked = self.collection.collect_bbfiles(self.data, self.data) | 1195 | filelist, masked, searchdirs = self.collection.collect_bbfiles(self.data, self.data) |
1196 | try: | 1196 | try: |
1197 | os.stat(bf) | 1197 | os.stat(bf) |
1198 | bf = os.path.abspath(bf) | 1198 | bf = os.path.abspath(bf) |
@@ -1482,7 +1482,11 @@ class BBCooker: | |||
1482 | self.recipecaches[mc].ignored_dependencies.add(dep) | 1482 | self.recipecaches[mc].ignored_dependencies.add(dep) |
1483 | 1483 | ||
1484 | self.collection = CookerCollectFiles(self.bbfile_config_priorities) | 1484 | self.collection = CookerCollectFiles(self.bbfile_config_priorities) |
1485 | (filelist, masked) = self.collection.collect_bbfiles(self.data, self.data) | 1485 | (filelist, masked, searchdirs) = self.collection.collect_bbfiles(self.data, self.data) |
1486 | |||
1487 | # Add inotify watches for directories searched for bb/bbappend files | ||
1488 | for dirent in searchdirs: | ||
1489 | self.add_filewatch([[dirent]]) | ||
1486 | 1490 | ||
1487 | self.parser = CookerParser(self, filelist, masked) | 1491 | self.parser = CookerParser(self, filelist, masked) |
1488 | self.parsecache_valid = True | 1492 | self.parsecache_valid = True |
@@ -1654,6 +1658,18 @@ class CookerCollectFiles(object): | |||
1654 | collectlog.error("no recipe files to build, check your BBPATH and BBFILES?") | 1658 | collectlog.error("no recipe files to build, check your BBPATH and BBFILES?") |
1655 | bb.event.fire(CookerExit(), eventdata) | 1659 | bb.event.fire(CookerExit(), eventdata) |
1656 | 1660 | ||
1661 | # We need to track where we look so that we can add inotify watches. There | ||
1662 | # is no nice way to do this, this is horrid. We intercept the os.listdir() | ||
1663 | # calls while we run glob(). | ||
1664 | origlistdir = os.listdir | ||
1665 | searchdirs = [] | ||
1666 | |||
1667 | def ourlistdir(d): | ||
1668 | searchdirs.append(d) | ||
1669 | return origlistdir(d) | ||
1670 | |||
1671 | os.listdir = ourlistdir | ||
1672 | |||
1657 | # Can't use set here as order is important | 1673 | # Can't use set here as order is important |
1658 | newfiles = [] | 1674 | newfiles = [] |
1659 | for f in files: | 1675 | for f in files: |
@@ -1671,6 +1687,8 @@ class CookerCollectFiles(object): | |||
1671 | if g not in newfiles: | 1687 | if g not in newfiles: |
1672 | newfiles.append(g) | 1688 | newfiles.append(g) |
1673 | 1689 | ||
1690 | os.listdir = origlistdir | ||
1691 | |||
1674 | bbmask = config.getVar('BBMASK') | 1692 | bbmask = config.getVar('BBMASK') |
1675 | 1693 | ||
1676 | if bbmask: | 1694 | if bbmask: |
@@ -1729,7 +1747,7 @@ class CookerCollectFiles(object): | |||
1729 | topfile = bbfile_seen[base] | 1747 | topfile = bbfile_seen[base] |
1730 | self.overlayed[topfile].append(f) | 1748 | self.overlayed[topfile].append(f) |
1731 | 1749 | ||
1732 | return (bbfiles, masked) | 1750 | return (bbfiles, masked, searchdirs) |
1733 | 1751 | ||
1734 | def get_file_appends(self, fn): | 1752 | def get_file_appends(self, fn): |
1735 | """ | 1753 | """ |