summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2016-01-26 15:34:30 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-18 07:41:16 +0000
commitca552bb4b1d877193ba6235e6216d06b984c62db (patch)
treed6c12a0cf6b77e0a9a859dd85c51539207d87246 /bitbake/lib/bb/fetch2
parent8f61f2d8812df8d8e57affd7c8a45c1054c59b83 (diff)
downloadpoky-ca552bb4b1d877193ba6235e6216d06b984c62db.tar.gz
bitbake: FileChecksumCache: add get_checksums() method
Move the local file checksum functionality from bb.fetch2 into bb.checksum module. (Bitbake rev: 4f60933283f377d68f191db849dac6c1dc7a0aed) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py45
1 files changed, 1 insertions, 44 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 83122e856c..914553aaf7 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -29,11 +29,9 @@ from __future__ import absolute_import
29from __future__ import print_function 29from __future__ import print_function
30import os, re 30import os, re
31import signal 31import signal
32import glob
33import logging 32import logging
34import urllib 33import urllib
35import urlparse 34import urlparse
36import operator
37import bb.persist_data, bb.utils 35import bb.persist_data, bb.utils
38import bb.checksum 36import bb.checksum
39from bb import data 37from bb import data
@@ -1108,48 +1106,7 @@ def get_file_checksums(filelist, pn):
1108 it proceeds 1106 it proceeds
1109 1107
1110 """ 1108 """
1111 1109 return _checksum_cache.get_checksums(filelist, pn)
1112 def checksum_file(f):
1113 try:
1114 checksum = _checksum_cache.get_checksum(f)
1115 except OSError as e:
1116 bb.warn("Unable to get checksum for %s SRC_URI entry %s: %s" % (pn, os.path.basename(f), e))
1117 return None
1118 return checksum
1119
1120 def checksum_dir(pth):
1121 # Handle directories recursively
1122 dirchecksums = []
1123 for root, dirs, files in os.walk(pth):
1124 for name in files:
1125 fullpth = os.path.join(root, name)
1126 checksum = checksum_file(fullpth)
1127 if checksum:
1128 dirchecksums.append((fullpth, checksum))
1129 return dirchecksums
1130
1131 checksums = []
1132 for pth in filelist.split():
1133 exist = pth.split(":")[1]
1134 if exist == "False":
1135 continue
1136 pth = pth.split(":")[0]
1137 if '*' in pth:
1138 # Handle globs
1139 for f in glob.glob(pth):
1140 if os.path.isdir(f):
1141 checksums.extend(checksum_dir(f))
1142 else:
1143 checksum = checksum_file(f)
1144 checksums.append((f, checksum))
1145 elif os.path.isdir(pth):
1146 checksums.extend(checksum_dir(pth))
1147 else:
1148 checksum = checksum_file(pth)
1149 checksums.append((pth, checksum))
1150
1151 checksums.sort(key=operator.itemgetter(1))
1152 return checksums
1153 1110
1154 1111
1155class FetchData(object): 1112class FetchData(object):