def do_list_imp(self, what = None, stream=sys.stdout): if what is None: augmentedYaml.writeAsYaml(self, stream) list_to_do = list() if isinstance(what, str): list_to_do.append(what) elif isinstance(what, list): list_to_do.extend(what) whole_sections_to_write = list() individual_items_to_write = list() for item_to_do in list_to_do: if guid_re.match(item_to_do): whole_sections_to_write.append({item_to_do: iids_from_guid(self.install_definitions_index, item_to_do)}) elif item_to_do == "define": whole_sections_to_write.append(augmentedYaml.YamlDumpDocWrap(var_list, '!define', "Definitions", explicit_start=True, sort_mappings=True)) elif item_to_do == "index": whole_sections_to_write.append(augmentedYaml.YamlDumpDocWrap(self.install_definitions_index, '!index', "Installation index", explicit_start=True, sort_mappings=True)) elif item_to_do == "guid": guid_dict = dict() for lic in guid_list(self.install_definitions_index): guid_dict[lic] = iids_from_guid(self.install_definitions_index, lic) whole_sections_to_write.append(augmentedYaml.YamlDumpDocWrap(guid_dict, '!guid', "guid to IID", explicit_start=True, sort_mappings=True)) else: individual_items_to_write.append(item_to_do) augmentedYaml.writeAsYaml(whole_sections_to_write+self.repr_for_yaml(individual_items_to_write), stream)
def calculate_full_install_items_set(self, instlObj): """ calculate the set of iids to install by starting with the root set and adding all dependencies. Initial list of iids should already be in self.root_install_items. If an install items was not found for a iid, the iid is added to the orphan set. """ if len(self.root_install_items) > 0: logging.info(" ".join(("Main install items:", ", ".join(self.root_install_items)))) else: logging.error("Main install items list is empty") # root_install_items might have guid in it, translate them to iids root_install_iids_translated = unique_list() for IID in self.root_install_items: # if IID is a guid iids_from_guid will translate to iid's, or return the IID otherwise iids_from_the_guid = iids_from_guid(instlObj.install_definitions_index, IID) if len(iids_from_the_guid) > 0: root_install_iids_translated.extend(iids_from_the_guid) logging.debug("GUID %s, translated to %d iids: %s", IID, len(iids_from_the_guid), ", ".join(iids_from_the_guid)) else: self.orphan_install_items.append(IID) logging.warning("%s is a guid but could not be translated to iids", IID) logging.info(" ".join(("Main install items translated:", ", ".join(root_install_iids_translated)))) for IID in root_install_iids_translated: try: # all items in the root list are marked as required by them selves instlObj.install_definitions_index[IID].required_by.append(IID) instlObj.install_definitions_index[IID].get_recursive_depends(instlObj.install_definitions_index, self.full_install_items, self.orphan_install_items) except KeyError: self.orphan_install_items.append(IID) logging.warning("%s not found in index", IID) logging.info(" ".join(("Full install items:", ", ".join(self.full_install_items)))) self.sort_install_items_by_target_folder(instlObj)