Ejemplo n.º 1
0
 def readComps(self):
     # Try to read a comps.xml file if there is any before we parse the
     # primary.xml
     if self.repomd.has_key("group"):
         if not self.repomd["group"].has_key("location"):
             log.error(
                 "Couldn't find proper location for comps.xml in repomd")
             return 0
         comps = self.repomd["group"]["location"]
         (csum, destfile) = self.nc.checksum(comps, "sha")
         if self.repomd["group"].has_key("checksum") and \
                csum == self.repomd["group"]["checksum"]:
             filename = destfile
         else:
             filename = self.nc.cache(comps, 1)
         if not filename:
             return 0
         try:
             self.comps = RpmCompsXML(self.config, filename)
             self.comps.read()
         except IOError:
             return 0
     return 1