* a few minor, fixes, make specfilenewtests complete successfully

This commit is contained in:
Eray Özkural
2005-10-31 22:24:58 +00:00
parent e5d3130b11
commit 8ce334422a
3 changed files with 23 additions and 29 deletions
+19 -25
View File
@@ -160,6 +160,8 @@ class Source:
t_Archive = [Archive, xmlfile.mandatory ] t_Archive = [Archive, xmlfile.mandatory ]
t_Patches = [ [Patch], xmlfile.optional] t_Patches = [ [Patch], xmlfile.optional]
t_BuildDependencies = [ [Dependency], xmlfile.optional] t_BuildDependencies = [ [Dependency], xmlfile.optional]
t_Version = [ xmlfile.String, xmlfile.optional]
t_Release = [ xmlfile.String, xmlfile.optional]
class Package: class Package:
@@ -207,20 +209,12 @@ class SpecFile(XmlFile):
self.merge_tags() self.merge_tags()
self.override_tags() self.override_tags()
#FIXME: copy only needed information
# no need to keep full history with comments in metadata.xml
self.source.history = self.history
for p in self.packages:
p.history = self.history
self.unlink() self.unlink()
errs = self.check() errs = self.check()
if errs: if errs:
e = "" errs.append(_("File '%s' has errors") % filename)
for x in errs: raise Error(*errs)
e += x + "\n"
raise Error(_("File '%s' has errors:\n%s") % (filename, e))
def override_tags(self): def override_tags(self):
"""Override tags from Source in Packages. Some tags in Packages """Override tags from Source in Packages. Some tags in Packages
@@ -229,41 +223,41 @@ class SpecFile(XmlFile):
tmp = [] tmp = []
for pkg in self.packages: for pkg in self.packages:
if not pkg.summary: if not pkg.summary:
pkg.summary = self.source.summary pkg.summary = self.source.summary
if not pkg.description: if not pkg.description:
pkg.description = self.source.description pkg.description = self.source.description
if not pkg.partOf: if not pkg.partOf:
pkg.partOf = self.source.partOf pkg.partOf = self.source.partOf
if not pkg.license: if not pkg.license:
pkg.license = self.source.license pkg.license = self.source.license
if not pkg.icon: if not pkg.icon:
pkg.icon = self.source.icon pkg.icon = self.source.icon
tmp.append(pkg) tmp.append(pkg)
self.packages = tmp self.packages = tmp
def merge_tags(self): def merge_tags(self):
"""Merge tags from Source in Packages. Some tags in Packages merged """Merge tags from Source in Packages. Some tags in Packages merged
with the tags from Source. There is a more detailed with the tags from Source. There is a more detailed
description in documents.""" description in documents."""
# FIXME: copy only needed information
# no need to keep full history with comments in metadata.xml
self.source.history = self.history
# To avoid tag duplication in PSPEC we need to get
# the last version and release information
# from the most recent History/Update.
if not self.source.version:
self.source.version = self.history[0].version
if not self.source.release:
self.source.release = self.history[0].release
tmp = [] tmp = []
for pkg in self.packages: for pkg in self.packages:
pkg.isA.extend(self.source.isA)
if pkg.isA and self.source.isA: pkg.history = self.history
pkg.isA.append(self.source.isA)
elif not pkg.isA and self.source.isA:
pkg.isA = self.source.isA
tmp.append(pkg) tmp.append(pkg)
self.packages = tmp self.packages = tmp
def write(self, filename): def write(self, filename):
+2 -2
View File
@@ -391,7 +391,7 @@ class autoxml(oo.autosuper):
errs = [] errs = []
if hasattr(self, name): if hasattr(self, name):
value = getattr(self,name) value = getattr(self,name)
errs.extend(check_a(value, unicode("%s: " %name))) errs.extend(check_a(value, where + name + ': ' ))
else: else:
if req == mandatory: if req == mandatory:
errs.append(where + _('Mandatory variable %s not available') % name) errs.append(where + _('Mandatory variable %s not available') % name)
@@ -595,7 +595,7 @@ class autoxml(oo.autosuper):
def check(l, where): def check(l, where):
errs = [] errs = []
for ix in range(len(l)): for ix in range(len(l)):
errs.extend(check_item(l[ix], unicode(ix))) errs.extend(check_item(l[ix], where + '[%s]' % ix))
return errs return errs
def format(l, f, errs): def format(l, f, errs):
+2 -2
View File
@@ -31,7 +31,7 @@ class SpecFileNewTestCase(testcase.TestCase):
self.assertEqual(self.spec.source.release, "3") self.assertEqual(self.spec.source.release, "3")
self.assertEqual(self.spec.source.archiveSHA1, self.assertEqual(self.spec.source.archive.sha1sum,
"66f3c77b87a160951b180447f4a6dce68ad2f71b") "66f3c77b87a160951b180447f4a6dce68ad2f71b")
patches = self.spec.source.patches patches = self.spec.source.patches
@@ -47,7 +47,7 @@ class SpecFileNewTestCase(testcase.TestCase):
# search for a path in package.paths # search for a path in package.paths
pn = "/usr/lib" pn = "/usr/lib"
matched = [p for p in package.paths if p.pathname == pn] matched = [p for p in package.files if p.path == pn]
if not matched: if not matched:
self.fail("Failed to match pathname: %s" %pn) self.fail("Failed to match pathname: %s" %pn)