aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/checksum.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bb/checksum.py')
-rw-r--r--lib/bb/checksum.py40
1 files changed, 24 insertions, 16 deletions
diff --git a/lib/bb/checksum.py b/lib/bb/checksum.py
index 4e1598fe8..557793d36 100644
--- a/lib/bb/checksum.py
+++ b/lib/bb/checksum.py
@@ -2,30 +2,22 @@
#
# Copyright (C) 2012 Intel Corporation
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
+# SPDX-License-Identifier: GPL-2.0-only
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import glob
import operator
import os
import stat
-import pickle
import bb.utils
import logging
+import re
from bb.cache import MultiProcessCache
logger = logging.getLogger("BitBake.Cache")
+filelist_regex = re.compile(r'(?:(?<=:True)|(?<=:False))\s+')
+
# mtime cache (non-persistent)
# based upon the assumption that files do not change during bitbake run
class FileMtimeCache(object):
@@ -61,6 +53,7 @@ class FileChecksumCache(MultiProcessCache):
MultiProcessCache.__init__(self)
def get_checksum(self, f):
+ f = os.path.normpath(f)
entry = self.cachedata[0].get(f)
cmtime = self.mtime_cache.cached_mtime(f)
if entry:
@@ -84,7 +77,7 @@ class FileChecksumCache(MultiProcessCache):
else:
dest[0][h] = source[0][h]
- def get_checksums(self, filelist, pn):
+ def get_checksums(self, filelist, pn, localdirsexclude):
"""Get checksums for a list of files"""
def checksum_file(f):
@@ -95,21 +88,36 @@ class FileChecksumCache(MultiProcessCache):
return None
return checksum
+ #
+ # Changing the format of file-checksums is problematic as both OE and Bitbake have
+ # knowledge of them. We need to encode a new piece of data, the portion of the path
+ # we care about from a checksum perspective. This means that files that change subdirectory
+ # are tracked by the task hashes. To do this, we do something horrible and put a "/./" into
+ # the path. The filesystem handles it but it gives us a marker to know which subsection
+ # of the path to cache.
+ #
def checksum_dir(pth):
# Handle directories recursively
if pth == "/":
bb.fatal("Refusing to checksum /")
+ pth = pth.rstrip("/")
dirchecksums = []
- for root, dirs, files in os.walk(pth):
+ for root, dirs, files in os.walk(pth, topdown=True):
+ [dirs.remove(d) for d in list(dirs) if d in localdirsexclude]
for name in files:
- fullpth = os.path.join(root, name)
+ fullpth = os.path.join(root, name).replace(pth, os.path.join(pth, "."))
checksum = checksum_file(fullpth)
if checksum:
dirchecksums.append((fullpth, checksum))
return dirchecksums
checksums = []
- for pth in filelist.split():
+ for pth in filelist_regex.split(filelist):
+ if not pth:
+ continue
+ pth = pth.strip()
+ if not pth:
+ continue
exist = pth.split(":")[1]
if exist == "False":
continue