def __init__(self, tdir, tname, dg, txtioconfig, cfg, tlevel=0, tsuper=None): tracer.info("called: directory [%s] name [%s]" % (tdir, tname)) Digraph.Node.__init__(self, tname) self.dir = tdir # Master map is needed for deciping requirements into the # appropriate topic. self.digraph = dg self.txtioconfig = txtioconfig self.cfg = cfg # Idendation level of this topic self.level = tlevel self.super = tsuper # This is a list of requirements which contain to this topic. self.reqs = [] # The name of the Topic is mandatory (and also position # independent) # Note: there is also a .name field inherited from the # Digraph.Node (which hold in this case the topic's id). self.topic_name = None # This must only be done if there is a directory given if self.dir != None: self.read() self.extract_name() else: # In this case the tag list is (initally) empty self.t = []
def __init__(self, config, input_handler, commit, object_cache, input_mods): '''Read in all the dependent topics and the requirements.''' tracer.info("called") self.__config = config self.__input_handler = input_handler self.__commit = commit self.__object_cache = object_cache self.__input_mods = input_mods # First: read in all the requirements. self.__complete_requirement_set = None self.__read_requirement_set()
def __init__(self, ts_name, config, ts_config, object_cache, input_mods): tracer.info("called: name [%s]" % ts_name) self.config = config self.topic_sets = {} # This is the list of all version control system ids. # Those ids are sorted by time. # The oldest versions is the first one - sorted. # Note: this does not contain any other data, only the ids. # To access the data, use some construct like: # self.topic_sets[self.vcs_ids[n]] self.vcs_ids = [] self.__object_cache = object_cache self.__input_mods = input_mods self.__read_topic_sets(ts_config)
def __init__(self, config, input_handler, commit, object_cache, input_mods): '''Constructs a RequirementSet. This does not read everything in: please use the appropriate method to do so.''' tracer.info("called") Digraph.__init__(self) MemLogStore.__init__(self) self.__config = config self.__object_cache = object_cache self.__input_mods = input_mods # TODO: is this the structure that is needed? self.__requirements = {} self.__read_requirements(input_handler, commit)
def __init__(self, config): tracer.info("called") cfg = Cfg(config) self.__start_vers = cfg.get_value("start_vers") self.__end_vers = cfg.get_value("end_vers") self.__topic_root_node = cfg.get_value("topic_root_node") tracer.debug("start version [%s] end version [%s] " "topic root node [%s]" % (self.__start_vers, self.__end_vers, self.__topic_root_node)) # When the directory is not absolute, convert it to an # absolute path that it can be compared to the outcome of the # git.Repo. self.__dirs = {} self.__repo_base_dir = None self.__repo = None self.__setup_directories(cfg)
def DEPRECATED___init__(self, config, name, config_prefix_str, req_input_dir): tracer.info("name [%s] config_prefix [%s] req_input_dir [%s]" % (name, config_prefix_str, req_input_dir)) Digraph.__init__(self) MemLogStore.__init__(self) # The name of the TopicSet. self.name = name # The directory where all topics are stored. self.topic_dir = config.get_value(config_prefix_str + '.directory') # The master (i.e. the initial) topic. self.master_topic = config.get_value(config_prefix_str + '.name') self.config = config self.internal_init_requirements() # TODO: is this needed???? # if all_reqs != None: # self.mReqset = self.reqs_limit(all_reqs) self.output_handlers = [] self.init_output_handler()
def __read_requirements(self, input_handler, commit): '''Reads in all the requirements from the input_handler.''' tracer.debug("called") filenames = input_handler.get_file_names(commit, "requirements") print("FILENAMES [%s]" % filenames) for filename in filenames: # Check for correct filename m = re.match("^.*\.req$", filename) if m == None: tracer.info("skipping file [%s]" % filename) continue # Handle caching. vcs_id = input_handler.get_vcs_id(commit, filename) rid = filename[:-4] print("RID [%s]" % rid) assert False req = self.__object_cache.get("Requirement", vcs_id) if req != None: # Double check the id if req.get_id() != rid: # TODO: exception assert False else: fd = input_handler.get_fd(commit, filename) req = Requirement(fd, rid, self, self.__input_mods, self.__config) # Add the requirement to the cache. self.__object_cache.add(vcs_id, "Requirement", req) if req.ok(): # Store in the map, so that it is easy to access the # node by id. self.__requirements[req.get_id()] = req # Also store it in the digraph's node list for simple # access to the digraph algorithms. # TODO: self.nodes.append(req) else: self.error(45, "could not be parsed", req.id) everythings_fine = False
def __init__(self, input_mods, config): '''Sets up a TopicContinuum for use.''' tracer.info("called") MemLogStore.__init__(self) self.__input_mods = input_mods self.__config = config # This dictionary holds all the TopicSetCollections # available in the configured time period. self.__continuum = {} # The VCS repository. # If this is None - there is no repository available. self.__deprecated_repo = None # Because the construction / evaluation should continue even in # error cases, a flag is available to check if the (possible only # partially) constructed element is usable. self.__is_usable = True # Store objects with IDs also in the cache - so that they can be reused. self.__object_cache = ObjectCache() self.__init_continuum_set() self.__object_cache.log_stats()
def log_stats(self): '''Prints out the usage statistics.''' tracer.info("usage statistics: objects [%d] object types [%d] " "called get [%d] called get (found) [%d]" % (self.__stats_cnt_objects, self.__stats_cnt_object_types, self.__stats_cnt_get, self.__stats_cnt_get_found))