def find_packages_release(self, release): """effects: parse the release options specified to find_packages and pick up the packages from the base release""" myrelease = get_field(self.bin() + "/rootcore_config", "release") if myrelease: print "using release set with set_release" release = string.split(myrelease) + release rel_parser = optparse.OptionParser() WorkArea.init_release_options(rel_parser, False) (release_args, extra_release_args) = rel_parser.parse_args(release) if len(extra_release_args) != 0: rel_parser.error("incorrect number of arguments") WORKAREAREL = self.relPath(self.area(), self.bin()) if os.path.isabs(WORKAREAREL): print "work area does not contain ROOTCOREBIN, aborting" print " ROOTCOREBIN=" + self.bin() print " WORKAREA=" + self.m_area print " WORKAREAREL=" + WORKAREAREL sys.exit(1) self.m_packages = PackageList(self) for place in release_args.places: for pkg in WorkArea(RootCoreBin=place[0]).parsePackages(): pkg.m_wa = self pkg.m_recompile = place[1] pkg.m_release = True self.m_packages.addPkg(pkg) self.m_pedantic = release_args.use_pedantic return release_args.restrict
def parsePackages(self): """returns: the list of all packages, as found by find_packages. if packages is specified it is used instead of the find_packages file.""" path = os.path.join(self.bin(), "packages") if not os.path.isfile(path): raise RCError("could not find:\n " + path + "\nplease try running:\n rc find_packages") result = PackageList(self) with open(self.bin() + "/packages") as file: for line in file: line = string.replace(line, "\n", "") if line != "" and line[0] != "#": result.addPkg(PackageInfo.parsePackagesLine(line, self)) return result
def find_packages_reorder(self, allowMiss, restrict): """effects: do the reordering of the packages based on dependencies for find_packages""" def addPkgDep(self, name, required, caller, cycle, catalog, allowMiss, wa): if self.getPkg(name): return for pkg in cycle: if name == pkg: raise Exception( "cyclical dependence involving packages: " + string.join(cycle)) pkg = catalog.getPkg(name) if not pkg: if allowMiss or not required: return message = "" if caller: message = "package " + name + " not known, required by " + caller else: message = "package " + name + " not known" shell_args = [ "grep", "/" + name + "/tags", wa.dir() + "/all_packages" ] known = shell_exec(shell_args, allowFail=True).split("\n") while len(known) > 0 and known[len(known) - 1] == "": known.remove("") if len(known) > 0: message += "\ntry checking it out with" for pkg in known: message += "\n rc checkout_pkg " + pkg raise RCError(message) for dep in pkg.harddep(): addPkgDep(self, dep, True, name, cycle + [name], catalog, allowMiss, wa) for dep in pkg.trydep(): addPkgDep(self, dep, False, name, cycle + [name], catalog, allowMiss, wa) self.addPkg(pkg) ordered = PackageList(self) max_auto = 1 while max_auto > 0: max_auto = 0 for pkg in self.m_packages: if not ordered.getPkg(pkg.name()): if pkg.auto() > max_auto: max_auto = pkg.auto() if max_auto == 0: break for pkg in self.m_packages: if pkg.auto() == max_auto: addPkgDep(ordered, pkg.name(), True, None, [], self.m_packages, allowMiss, self) if len(restrict) > 0: for pkg in restrict: addPkgDep(ordered, pkg, True, None, [], self.m_packages, allowMiss, self) else: for pkg in self.m_packages: addPkgDep(ordered, pkg.name(), True, None, [], self.m_packages, allowMiss, self) self.m_packages = ordered