* 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_Patches = [ [Patch], xmlfile.optional]
t_BuildDependencies = [ [Dependency], xmlfile.optional]
t_Version = [ xmlfile.String, xmlfile.optional]
t_Release = [ xmlfile.String, xmlfile.optional]
class Package:
@@ -207,20 +209,12 @@ class SpecFile(XmlFile):
self.merge_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()
errs = self.check()
if errs:
e = ""
for x in errs:
e += x + "\n"
raise Error(_("File '%s' has errors:\n%s") % (filename, e))
errs.append(_("File '%s' has errors") % filename)
raise Error(*errs)
def override_tags(self):
"""Override tags from Source in Packages. Some tags in Packages
@@ -229,41 +223,41 @@ class SpecFile(XmlFile):
tmp = []
for pkg in self.packages:
if not pkg.summary:
pkg.summary = self.source.summary
if not pkg.description:
pkg.description = self.source.description
if not pkg.partOf:
pkg.partOf = self.source.partOf
if not pkg.license:
pkg.license = self.source.license
if not pkg.icon:
pkg.icon = self.source.icon
tmp.append(pkg)
self.packages = tmp
def merge_tags(self):
"""Merge tags from Source in Packages. Some tags in Packages merged
with the tags from Source. There is a more detailed
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 = []
for pkg in self.packages:
if pkg.isA and self.source.isA:
pkg.isA.append(self.source.isA)
elif not pkg.isA and self.source.isA:
pkg.isA = self.source.isA
pkg.isA.extend(self.source.isA)
pkg.history = self.history
tmp.append(pkg)
self.packages = tmp
def write(self, filename):
+2 -2
View File
@@ -391,7 +391,7 @@ class autoxml(oo.autosuper):
errs = []
if hasattr(self, name):
value = getattr(self,name)
errs.extend(check_a(value, unicode("%s: " %name)))
errs.extend(check_a(value, where + name + ': ' ))
else:
if req == mandatory:
errs.append(where + _('Mandatory variable %s not available') % name)
@@ -595,7 +595,7 @@ class autoxml(oo.autosuper):
def check(l, where):
errs = []
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
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.archiveSHA1,
self.assertEqual(self.spec.source.archive.sha1sum,
"66f3c77b87a160951b180447f4a6dce68ad2f71b")
patches = self.spec.source.patches
@@ -47,7 +47,7 @@ class SpecFileNewTestCase(testcase.TestCase):
# search for a path in package.paths
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:
self.fail("Failed to match pathname: %s" %pn)