def __init__(self, args): PackageKitBaseBackend.__init__(self, args) # conary configurations conary = ConaryPk() self.cfg = conary.cfg self.client = conary.cli self.conary = conary self.callback = UpdateCallback(self, self.cfg) self.client.setUpdateCallback(self.callback) self.xmlcache = XMLCache()
def __init__(self): self.conarypk = ConaryPk() self.labels = (x for x in self.conarypk.get_labels_from_config()) self.pk = PackageKitBaseBackend("") if not os.path.isdir(self.dbPath): os.makedirs(self.dbPath) if not os.path.isdir(self.jobPath): os.mkdir(self.jobPath) if not os.path.isdir(self.xml_path): os.makedirs(self.xml_path) for label in self.labels: if not os.path.exists(self.xml_path + label + ".xml"): self._fetchXML(label) self.repos.append(XMLRepo(label + ".xml", self.xml_path, self.pk))
def init(label, fileoutput): conarypk = ConaryPk() cli = conarypk.cli cfg = conarypk.cfg log.info("Attempting to retrieve repository data for %s" % label) try: pkgs = getPackagesFromLabel(cfg, cli, label) troves = conarypk.repos.getTroves(pkgs, withFiles=False) nodes = generate_xml(troves, label) cElementTree.ElementTree(nodes).write(fileoutput) log.info("Successfully wrote XML data for label %s into file %s" % (label, fileoutput)) except: log.error("Failed to gather data from the repository")