Add components.xml support..

pisi index will now need components.xml, else no component info will be added.

Until we figure out some way to delete component.xml files, they will
be used to find out the PartOf of the packages as before.
This commit is contained in:
Faik Uygur
2009-06-12 18:23:14 +00:00
parent 0aeee4d047
commit 18bbeabe88
3 changed files with 28 additions and 12 deletions
+18 -4
View File
@@ -50,13 +50,11 @@ class Distribution(xmlfile.XmlFile):
t_Obsoletes = [ [Obsolete], autoxml.optional, "Obsoletes/Package"] t_Obsoletes = [ [Obsolete], autoxml.optional, "Obsoletes/Package"]
class Component(xmlfile.XmlFile): class Component:
"representation for component declarations" "representation for component declarations"
__metaclass__ = autoxml.autoxml __metaclass__ = autoxml.autoxml
tag = "PISI"
t_Name = [autoxml.String, autoxml.mandatory] # fully qualified name t_Name = [autoxml.String, autoxml.mandatory] # fully qualified name
# component name in other languages, for instance in Turkish # component name in other languages, for instance in Turkish
@@ -69,10 +67,26 @@ class Component(xmlfile.XmlFile):
t_Summary = [autoxml.LocalText, autoxml.mandatory] t_Summary = [autoxml.LocalText, autoxml.mandatory]
t_Description = [autoxml.LocalText, autoxml.mandatory] t_Description = [autoxml.LocalText, autoxml.mandatory]
t_Icon = [ autoxml.String, autoxml.optional] t_Icon = [ autoxml.String, autoxml.optional]
t_VisibleTo = [autoxml.String, autoxml.optional] t_Group = [ autoxml.LocalText, autoxml.optional ]
# the parts of this component. # the parts of this component.
# to be filled by the component database, thus it is optional. # to be filled by the component database, thus it is optional.
t_Packages = [ [autoxml.String], autoxml.optional, "Parts/Package"] t_Packages = [ [autoxml.String], autoxml.optional, "Parts/Package"]
t_Sources = [ [autoxml.String], autoxml.optional, "Parts/Source"] t_Sources = [ [autoxml.String], autoxml.optional, "Parts/Source"]
class Components(xmlfile.XmlFile):
"representation for component declarations"
__metaclass__ = autoxml.autoxml
tag = "PISI"
t_Components = [ [Component], autoxml.optional, "Components/Component" ]
# FIXME: there will be no component.xml only components.xml
class CompatComponent(Component, xmlfile.XmlFile):
tag = "PISI"
t_VisibleTo = [autoxml.String, autoxml.optional]
+9 -7
View File
@@ -93,9 +93,8 @@ class Index(xmlfile.XmlFile):
elif fn.endswith(ctx.const.package_suffix): elif fn.endswith(ctx.const.package_suffix):
packages.append(os.path.join(root, fn)) packages.append(os.path.join(root, fn))
if fn == 'component.xml': if fn == 'components.xml':
ctx.ui.info(_('Adding %s to component index') % fn) self.add_components(os.path.join(root, fn))
self.add_component(os.path.join(root, fn))
if fn == 'pspec.xml' and not skip_sources: if fn == 'pspec.xml' and not skip_sources:
self.add_spec(os.path.join(root, fn), repo_uri) self.add_spec(os.path.join(root, fn), repo_uri)
if fn == 'distribution.xml': if fn == 'distribution.xml':
@@ -148,16 +147,19 @@ class Index(xmlfile.XmlFile):
self.packages.append(md.package) self.packages.append(md.package)
def add_component(self, path): def add_components(self, path):
comp = component.Component() ctx.ui.info("Adding components.xml to index...")
components_xml = component.Components()
components_xml.read(path)
#try: #try:
comp.read(path) for comp in components_xml.components:
self.components.append(comp) self.components.append(comp)
#except: #except:
# raise Error(_('Component in %s is corrupt') % path) # raise Error(_('Component in %s is corrupt') % path)
#ctx.ui.error(str(Error(*errs))) #ctx.ui.error(str(Error(*errs)))
def add_distro(self, path): def add_distro(self, path):
ctx.ui.info("Adding distribution.xml to index...")
distro = component.Distribution() distro = component.Distribution()
#try: #try:
distro.read(path) distro.read(path)
+1 -1
View File
@@ -364,7 +364,7 @@ class Builder:
if not os.path.exists(url): if not os.path.exists(url):
raise Exception(_('Cannot find component.xml in upper directory')) raise Exception(_('Cannot find component.xml in upper directory'))
path = url path = url
comp = component.Component() comp = component.CompatComponent()
comp.read(path) comp.read(path)
ctx.ui.info(_('Source is part of %s component') % comp.name) ctx.ui.info(_('Source is part of %s component') % comp.name)
self.spec.source.partOf = comp.name self.spec.source.partOf = comp.name