* name fixes:
* remove obsolete test
This commit is contained in:
@@ -416,7 +416,7 @@ def resurrect_package(package_fn):
|
|||||||
metadata = MetaData()
|
metadata = MetaData()
|
||||||
metadata.read(metadata_xml)
|
metadata.read(metadata_xml)
|
||||||
|
|
||||||
errs = metadata.has_errors()
|
errs = metadata.errors()
|
||||||
if errs:
|
if errs:
|
||||||
util.Checks.print_errors(errs)
|
util.Checks.print_errors(errs)
|
||||||
raise Error, _("MetaData format wrong (%s)") % package_fn
|
raise Error, _("MetaData format wrong (%s)") % package_fn
|
||||||
@@ -430,7 +430,7 @@ def resurrect_package(package_fn):
|
|||||||
files = Files()
|
files = Files()
|
||||||
files.read(files_xml)
|
files.read(files_xml)
|
||||||
|
|
||||||
if files.has_errors():
|
if files.errors():
|
||||||
raise Error, _("Invalid %s") % ctx.const.files_xml
|
raise Error, _("Invalid %s") % ctx.const.files_xml
|
||||||
|
|
||||||
import pisi.atomicoperations
|
import pisi.atomicoperations
|
||||||
|
|||||||
+1
-1
@@ -107,7 +107,7 @@ class Package:
|
|||||||
|
|
||||||
self.files = Files()
|
self.files = Files()
|
||||||
self.files.read( join(outdir, ctx.const.files_xml) )
|
self.files.read( join(outdir, ctx.const.files_xml) )
|
||||||
if self.files.has_errors():
|
if self.files.errors():
|
||||||
raise Error, _("Invalid %s") % ctx.const.files_xml
|
raise Error, _("Invalid %s") % ctx.const.files_xml
|
||||||
|
|
||||||
def pkg_dir(self):
|
def pkg_dir(self):
|
||||||
|
|||||||
@@ -1,83 +0,0 @@
|
|||||||
# Copyright (C) 2005, TUBITAK/UEKAE
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify it under
|
|
||||||
# the terms of the GNU General Public License as published by the Free
|
|
||||||
# Software Foundation; either version 2 of the License, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# Please read the COPYING file.
|
|
||||||
#
|
|
||||||
|
|
||||||
import unittest
|
|
||||||
import os
|
|
||||||
|
|
||||||
from pisi import specfileold as specfile
|
|
||||||
import pisi.context as ctx
|
|
||||||
import pisi.util as util
|
|
||||||
|
|
||||||
import testcase
|
|
||||||
|
|
||||||
class SpecFileTestCase(testcase.TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
testcase.TestCase.setUp(self)
|
|
||||||
self.spec = specfile.SpecFile()
|
|
||||||
self.spec.read("tests/popt/pspec.xml")
|
|
||||||
|
|
||||||
def testReadSpec(self):
|
|
||||||
self.assertEqual(self.spec.source.name, "popt")
|
|
||||||
|
|
||||||
self.assertEqual(self.spec.source.version, "1.7")
|
|
||||||
|
|
||||||
self.assertEqual(self.spec.source.release, "3")
|
|
||||||
|
|
||||||
self.assertEqual(self.spec.source.archiveSHA1,
|
|
||||||
"66f3c77b87a160951b180447f4a6dce68ad2f71b")
|
|
||||||
|
|
||||||
patches = self.spec.source.patches
|
|
||||||
self.assertEqual(len(patches), 1)
|
|
||||||
patch = patches[0] #get first and the only patch
|
|
||||||
self.assertEqual(patch.filename, "popt-1.7-uclibc.patch.gz")
|
|
||||||
self.assertEqual(patch.compressionType, "gz")
|
|
||||||
|
|
||||||
packages = self.spec.packages
|
|
||||||
self.assertEqual(len(packages), 1)
|
|
||||||
package = packages[0] # get the first and the only package
|
|
||||||
self.assertEqual(package.name, "popt-libs")
|
|
||||||
|
|
||||||
# search for a path in package.paths
|
|
||||||
pn = "/usr/lib"
|
|
||||||
matched = [p for p in package.paths if p.pathname == pn]
|
|
||||||
if not matched:
|
|
||||||
self.fail("Failed to match pathname: %s" %pn)
|
|
||||||
|
|
||||||
def testIsAPartOf(self):
|
|
||||||
# test existence in Source
|
|
||||||
if not "library:util:optparser" in self.spec.source.isa:
|
|
||||||
self.fail("Failed to match IsA in Source")
|
|
||||||
if not isinstance(self.spec.source.isa, list):
|
|
||||||
self.fail("source.isa is not a list, but it must be...")
|
|
||||||
|
|
||||||
if "rpm:archive" != self.spec.source.partof:
|
|
||||||
self.fail("Failed to match PartOf in Source")
|
|
||||||
|
|
||||||
# test existence in Package
|
|
||||||
pkg = self.spec.packages[0]
|
|
||||||
if not "library:util:optparser" in pkg.isa:
|
|
||||||
self.fail("Failed to match IsA in Package")
|
|
||||||
if not isinstance(pkg.isa, list):
|
|
||||||
self.fail("source.isa is not a list, but it must be...")
|
|
||||||
|
|
||||||
if "rpm:archive" != pkg.partof:
|
|
||||||
self.fail("Failed to match PartOf in Package")
|
|
||||||
|
|
||||||
def testVerify(self):
|
|
||||||
if self.spec.has_errors():
|
|
||||||
self.fail("Failed to verify specfile")
|
|
||||||
|
|
||||||
def testCopy(self):
|
|
||||||
self.spec.read("tests/popt/pspec.xml")
|
|
||||||
util.check_dir(ctx.config.tmp_dir())
|
|
||||||
self.spec.write(os.path.join(ctx.config.tmp_dir(), 'popt-copy.pspec.xml'))
|
|
||||||
|
|
||||||
|
|
||||||
suite = unittest.makeSuite(SpecFileTestCase)
|
|
||||||
Reference in New Issue
Block a user