Files
pisi/tests/packagetest.py
T
Fatih Aşıcı b713d35a65 build: Change filename format of packages
The new format is:

    <name>-<version>-<release>-<distribution id>-<architecture>.pisi

    e.g. pisi-2.3.2-180-p11-x86_64.pisi

We will not use build numbers any more. This commit removes some of the code
related to build numbers. New pisi will not deal with build numbers.
Before the stable release, all buildno-related code will be removed.

It is now possible to use digits after a dash character (e.g. polkit-qt-1).

Distribution id is a short string to represent the distribution release
(e.g. p11 for Pardus 2011).

Architecture strings cannot start with a digit. This is needed to
distinguish old and new packages.
2010-10-06 10:53:53 +00:00

44 lines
1.3 KiB
Python

import unittest
import os
from pisi import util
from pisi import package
import pisi.context as ctx
class PackageTestCase(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
self.pkgName = "test-7.1-2-p11-x86_64.pisi"
def testAddPackage(self):
cur = os.getcwd()
tmp = ctx.config.tmp_dir()
test = os.path.join(cur, 'history')
pkg_path = os.path.join(tmp, self.pkgName)
pkg = package.Package(pkg_path, "w")
os.chdir(test)
pkg.add_to_package('002_remove.xml')
pkg.add_to_package('003_install.xml')
os.chdir(cur)
pkg.extract_file('002_remove.xml', cur)
if os.path.exists('files.xml'):
self.fail("Package add error")
os.remove('002_remove.xml')
os.remove(pkg_path)
def testExtractFile(self):
cur = os.getcwd()
tmp = ctx.config.tmp_dir()
pkg_path = os.path.join(tmp, self.pkgName)
pkg = package.Package(pkg_path,"w")
pkg.extract_file("files.xml",cur)
if os.path.exists("files.xml"):
self.fail("File extract error")
pkg.extract_pisi_files("002_remove.xml")
if os.path.exists("002_remove.xml"):
self.fail("Pisi files extract error")