* rebuild-db paket kurulum tarihini xml dosyasından anlasın (fixes #1119)

This commit is contained in:
Faik Uygur
2005-12-10 10:53:04 +00:00
parent 2f21dcc3ab
commit f922cf330c
3 changed files with 21 additions and 5 deletions
+2
View File
@@ -243,6 +243,7 @@ class Install(AtomicOperation):
self.metadata.package.release, self.metadata.package.release,
self.metadata.package.build, self.metadata.package.build,
self.metadata.package.distribution, self.metadata.package.distribution,
False,
txn) txn)
# filesdb # filesdb
@@ -432,6 +433,7 @@ def virtual_install(metadata, files, txn):
metadata.package.release, metadata.package.release,
metadata.package.build, metadata.package.build,
metadata.package.distribution, metadata.package.distribution,
True,
txn) txn)
# filesdb # filesdb
+12 -5
View File
@@ -40,14 +40,13 @@ class InstallInfo:
# we store as an object, hey, we can waste O(1) space. # we store as an object, hey, we can waste O(1) space.
# this is also easier to modify in the future, without # this is also easier to modify in the future, without
# requiring database upgrades! wow! # requiring database upgrades! wow!
def __init__(self, state, version, release, build, distribution): def __init__(self, state, version, release, build, distribution, time):
self.state = state self.state = state
self.version = version self.version = version
self.release = release self.release = release
self.build = build self.build = build
self.distribution = distribution self.distribution = distribution
import time self.time = time
self.time = time.localtime()
def one_liner(self): def one_liner(self):
import time import time
@@ -146,7 +145,7 @@ class InstallDB:
else: else:
return False return False
def install(self, pkg, version, release, build, distro = "", txn = None): def install(self, pkg, version, release, build, distro = "", rebuild=False, txn = None):
"""install package with specific version, release, build""" """install package with specific version, release, build"""
pkg = str(pkg) pkg = str(pkg)
def proc(txn): def proc(txn):
@@ -157,7 +156,15 @@ class InstallDB:
self.dp.put(pkg, True, txn) self.dp.put(pkg, True, txn)
else: else:
state = 'i' state = 'i'
self.d.put(pkg, InstallInfo(state, version, release, build, distro), txn)
if not rebuild:
import time
ctime = time.localtime()
else:
files_xml = self.files_name(pkg, version, release)
ctime = util.creation_time(files_xml)
self.d.put(pkg, InstallInfo(state, version, release, build, distro, ctime), txn)
self.d.txn_proc(proc,txn) self.d.txn_proc(proc,txn)
+7
View File
@@ -254,6 +254,13 @@ def clean_dir(path):
if os.path.exists(path): if os.path.exists(path):
shutil.rmtree(path) shutil.rmtree(path)
def creation_time(file):
"""returns the creation time of the given file"""
if check_file(file):
import time
st = os.stat(file)
return time.localtime(st.st_ctime)
def dir_size(dir): def dir_size(dir):
""" calculate the size of files under a dir """ calculate the size of files under a dir
based on the os module example""" based on the os module example"""