summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen <jmeeuwen@bofh002.genomicscenter.nl>2007-10-12 13:08:03 (GMT)
committerJeroen van Meeuwen <jmeeuwen@bofh002.genomicscenter.nl>2007-10-12 13:08:03 (GMT)
commit3c4341b13fe6ae78d99c472a6bbaf3ff3e06782d (patch)
treedaa06fc19b3d60ececfdde867e89caf10ba2fa49
parent99f79730dc371082471d297881bcd797f99aa32c (diff)
downloadrevisor-3c4341b13fe6ae78d99c472a6bbaf3ff3e06782d.zip
revisor-3c4341b13fe6ae78d99c472a6bbaf3ff3e06782d.tar.gz
revisor-3c4341b13fe6ae78d99c472a6bbaf3ff3e06782d.tar.xz
Fix using whatever comps
-rw-r--r--revisor/cfg.py25
-rw-r--r--revisor/pungi.py15
2 files changed, 24 insertions, 16 deletions
diff --git a/revisor/cfg.py b/revisor/cfg.py
index 598b2d0..fd20415 100644
--- a/revisor/cfg.py
+++ b/revisor/cfg.py
@@ -220,43 +220,40 @@ EndSection
# Thanks to pungi (but we can't use that code
# because we can't launch it for EL5)
- if not os.file.exists("/usr/bin/xsltproc"):
+ if not os.access("/usr/bin/xsltproc", os.R_OK):
# No xsltproc no glory
return self.comps
- self.comps = os.path.join(self.working_directory,"revisor-pungi",self.version,"work","comps.xml")
+ self.comps = os.path.join(self.working_directory,"revisor-pungi",self.version,self.revisor_model,"comps.xml")
ourcomps = open(self.comps, "w")
+ ourcomps.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE comps PUBLIC \"-//Red Hat, Inc.//DTD Comps info//EN\" \"comps.dtd\">\n<comps>\n")
+
for repo in self.yumobj.repos.repos.values():
try:
groupfile = repo.getGroups()
except yum.Errors.RepoMDError, e:
- self.log.debug("No group data found for %s" % repo.id)
+ self.log.debug(_("No group data found for %s") % repo.id)
pass
+ except AttributeError, e:
+ self.log.debug(_("Why is yum throwing AttributeErrors? %s") % e)
else:
+ start = 1
+ end = -1
compslines = open(groupfile, 'r').readlines()
for line in compslines:
if line.startswith('</comps>'):
end = compslines.index(line)
for line in compslines:
- if line.startswith('<comps>'):
+ if line.startswith('<comps>') or line.startswith('<comps xmlns="">'):
start = compslines.index(line) + 1
ourcomps.writelines(compslines[start:end])
- ourcomps.write(closestub)
+ ourcomps.write("\n</comps>\n")
ourcomps.close()
- # Run the xslt filter over our comps file
- compsfilter = ['/usr/bin/xsltproc', '--novalid']
- compsfilter.append('-o')
- compsfilter.append(self.comps)
- compsfilter.append('/usr/share/revisor/comps-cleanup.xsl')
- compsfilter.append(self.comps)
-
- self.base.run_command(compsfilter)
-
return self.comps
##
diff --git a/revisor/pungi.py b/revisor/pungi.py
index cf4673d..c074384 100644
--- a/revisor/pungi.py
+++ b/revisor/pungi.py
@@ -73,7 +73,8 @@ class RevisorPungi:
self.log.error(_("Error: Cannot recreate destination dir %s") % self.destdir)
def doCreateRepo(self, database=True, callback=None):
-
+ # Get our comps file
+ comps = self.cfg.get_comps()
# create repodata for the tree
createrepo = ['/usr/bin/createrepo']
createrepo.append('-v')
@@ -82,10 +83,20 @@ class RevisorPungi:
createrepo.append('--database')
createrepo.append('--groupfile')
- createrepo.append(self.cfg.get_comps())
+ createrepo.append(comps)
createrepo.append(self.topdir)
+ # Let's clean up the comps file before moving anything around
+ # Run the xslt filter over our comps file
+ compsfilter = ['/usr/bin/xsltproc', '--novalid']
+ compsfilter.append('-o')
+ compsfilter.append(comps)
+ compsfilter.append('/usr/share/revisor/comps-cleanup.xsl')
+ compsfilter.append(comps)
+
+ self.base.run_command(compsfilter)
+
# run the command
self.base.run_command(createrepo, rundir=self.topdir, callback=callback)