Index: lib/bb/shell.py =================================================================== --- lib/bb/shell.py (revision 581) +++ lib/bb/shell.py (working copy) @@ -103,6 +103,7 @@ self.parse( None ) def _findProvider( self, item ): + import bb self._checkParsed() preferred = data.getVar( "PREFERRED_PROVIDER_%s" % item, cooker.configuration.data, 1 ) if not preferred: preferred = item @@ -413,6 +414,120 @@ print "ERROR: Nothing provides '%s'" % params[0] reparse.usage = "" + def freeze( self, params ): + """Freeze BBFILES to currently built packages""" + import re, bb + bbfiles = open(os.path.join(data.expand("${TMPDIR}", cooker.configuration.data), + "..", + "conf", + "frozen-bbfiles.conf"), + "w") + bbfiles.write("BBFILES := \"\\\n") + packages = open(os.path.join(data.expand("${TMPDIR}", cooker.configuration.data), + "..", + "conf", + "frozen-packages.conf"), + "w") + packages.write("BBFILES := \"\\\n") + # use the feed to get real package names (probably superfluous) + bl = list() + pl = list() + ml = list() + pf = open(os.path.join(data.expand("${TMPDIR}", cooker.configuration.data), "deploy", "ipk", "Packages"), "r") + packageRE = re.compile('^Package: (.+)$') + dashRE = re.compile('-[^-]*$') + bbRE = re.compile("/([^/]+\.bb)$") + for l in pf: + m = packageRE.match(l) + if not m: + continue + m = m.group(1) + + p = None + while True: + if len(m) == 0: + break + if m in ml: + # if only python supported "continue x" + break + ml.append(m) + p = self._findProvider(m) + if p: + break + elif "-" in m: + m = re.sub(dashRE, '', m) + else: + break + + if not p: + # if only python supported "continue x" + if m in ml: + continue + bb.note(" none found for "+m.group(1)) + continue + if p in bl: + continue + bl.append(p) + bbfiles.write(p + " \\\n") + p = re.sub(bbRE, "/*.bb", p) + if p in pl: + continue + pl.append(p) + packages.write(p + " \\\n") + + # hack by parsing directories (needed for -native packages at least) + dir = os.path.join(bb.data.expand("${TMPDIR}", cooker.configuration.data), "work") + dirRE = re.compile('(.*)-(\d+(?:\.\d+)*)-(r\d+)') + for sub in os.listdir(dir): + fsub = os.path.join(dir, sub) + if not os.path.isdir(fsub): + continue + for subsub in os.listdir(fsub): + fsubsub = os.path.join(fsub, subsub) + if not os.path.isdir(fsubsub): + continue + m = dirRE.match(subsub) + if m: + m = m.group(1) + else: + m = subsub + p = None + while True: + if len(m) == 0: + break + if m in ml: + # if only python supported "continue x" + break + ml.append(m) + p = self._findProvider(m) + if p: + break + elif "-" in m: + m = re.sub(dashRE, '', m) + else: + break + + if not p: + # if only python supported "continue x" + if m in ml: + continue + bb.note(" none found for "+subsub) + if p in bl: + continue + bl.append(p) + bbfiles.write(p + " \\\n") + p = re.sub(bbRE, "/*.bb", p) + if p in pl: + continue + pl.append(p) + packages.write(p + " \\\n") + + bbfiles.write("\"\n") + bbfiles.close() + packages.write("\"\n") + packages.close() + freeze.usage = "" + def getvar( self, params ): """Dump the contents of an outer BitBake environment variable""" var = params[0]