* package'a yeni interface ekle (icindekileri kabak gibi cikarmak icin)
* install iskeletini file size disinda tamamla (nasil yapilacagi belli degil. caglar?) * installdb ve testlerini duzelt, ufak tefek hatalar vardi ahem *
This commit is contained in:
+8
-2
@@ -33,14 +33,20 @@ def install_package_file(package_fn):
|
||||
|
||||
# check file system requirements
|
||||
# what to do if / is split into /usr, /var, etc.?
|
||||
|
||||
|
||||
# check conflicts
|
||||
# check dependencies
|
||||
if not dependency.installable(metadata.packages[0].name):
|
||||
raise InstallError("Package not installable")
|
||||
|
||||
# unzip package in place
|
||||
package.extract_dir_flat(ctx.destdir)
|
||||
|
||||
# update databases
|
||||
|
||||
# installdb
|
||||
installdb.install(spec.spec.install_dir() + '/files.xml')
|
||||
installdb.install(metadata.packages[0].name,
|
||||
metadata.source.version,
|
||||
metadata.source.release,
|
||||
ctx.install_dir() + '/files.xml')
|
||||
|
||||
|
||||
+8
-5
@@ -10,6 +10,7 @@ import util
|
||||
|
||||
util.check_dir(ctx.db_dir())
|
||||
d = shelve.open(ctx.db_dir() + '/install.bdb')
|
||||
print 'installdb:', ctx.db_dir() + '/install.bdb'
|
||||
files_dir = ctx.archives_dir() + "/files"
|
||||
|
||||
class InstallDBError(Exception):
|
||||
@@ -36,7 +37,7 @@ def get_version(pkg):
|
||||
(status, version, release) = d[pkg]
|
||||
return (version, release)
|
||||
|
||||
def is_removed(name):
|
||||
def is_removed(pkg):
|
||||
if is_recorded(pkg):
|
||||
(status, version, release) = d[pkg]
|
||||
return status=='r'
|
||||
@@ -51,11 +52,13 @@ def install(pkg, version, release, files_xml):
|
||||
util.copy_file(files_xml, files_name(pkg, version, release))
|
||||
|
||||
def remove(pkg):
|
||||
d[pkg] = 'r'
|
||||
(status, version, release) = d[pkg]
|
||||
d[pkg] = ('r', version, release)
|
||||
|
||||
def purge(pkg):
|
||||
(status, version, release) = d[pkg]
|
||||
os.unlink(files_name(pkg, version, release))
|
||||
del d[pkg]
|
||||
if d.has_key(pkg):
|
||||
(status, version, release) = d[pkg]
|
||||
os.unlink(files_name(pkg, version, release))
|
||||
del d[pkg]
|
||||
|
||||
|
||||
|
||||
+7
-1
@@ -20,8 +20,14 @@ class Package:
|
||||
"""extract file with path to outdir"""
|
||||
|
||||
def extract_dir(self, dir, outdir):
|
||||
"""extract directory recursively"""
|
||||
"""extract directory recursively, this function
|
||||
copies the directory archiveroot/dir to outdir"""
|
||||
|
||||
def extract_dir_flat(self, dir, outdir):
|
||||
"""extract directory recursively, this function
|
||||
unpacks the *contents* of directory archiveroot/dir inside outdir
|
||||
this is the function used by the installer"""
|
||||
|
||||
def extract_PISI_files(self, outdir):
|
||||
"""extract PISI control files: metadata.xml, files.xml,
|
||||
action scripts, etc."""
|
||||
|
||||
@@ -103,3 +103,8 @@ class MetaData(SpecFile):
|
||||
architecture = self.getNodeText("Source/Architecture")
|
||||
installSize = self.getNodeText("Source/InstallSize")
|
||||
|
||||
def verify():
|
||||
if len(packages) != 1:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class InstallDBTestCase(unittest.TestCase):
|
||||
self.assert_(not installdb.is_installed('installtest'))
|
||||
|
||||
def testInstall(self):
|
||||
installdb.remove('installtest')
|
||||
installdb.purge('installtest')
|
||||
installdb.install('installtest', '0.1', '2', './tests/sandbox/files.xml')
|
||||
f = installdb.files('installtest')
|
||||
a = f.readlines()
|
||||
@@ -28,8 +28,8 @@ class InstallDBTestCase(unittest.TestCase):
|
||||
self.assert_(installdb.is_installed('installtest'))
|
||||
installdb.remove('installtest')
|
||||
self.assert_(installdb.is_removed('installtest'))
|
||||
installdb.purge('installtest', '0.1', '2')
|
||||
installdb.purge('installtest')
|
||||
self.assert_(not installdb.is_recorded('installtest'))
|
||||
self.assert_(not os.access(installdb.files_name('installtest'), os.F_OK))
|
||||
self.assert_(not os.access(installdb.files_name('installtest', '0.1','2'), os.F_OK))
|
||||
|
||||
suite = unittest.makeSuite(InstallDBTestCase)
|
||||
|
||||
Reference in New Issue
Block a user