pisi history içinde delta ile yapılan güncellemeler belli olsun

This commit is contained in:
Faik Uygur
2008-06-26 06:51:14 +00:00
parent f1a0194f87
commit 03971823f7
3 changed files with 17 additions and 10 deletions
+3 -2
View File
@@ -417,8 +417,9 @@ class Install(AtomicOperation):
# installed packages
self.installdb.add_package(self.pkginfo)
self.historydb.add_and_update(pkgBefore=self.old_pkginfo, pkgAfter=self.pkginfo, operation=opttostr[self.operation])
otype = "delta" if self.package_fname.endswith("delta.pisi") else None
self.historydb.add_and_update(pkgBefore=self.old_pkginfo, pkgAfter=self.pkginfo, operation=opttostr[self.operation], otype=otype)
def install_single(pkg, upgrade = False):
"""install a single package from URI or ID"""
+4 -4
View File
@@ -36,12 +36,12 @@ class HistoryDB(lazydb.LazyDB):
self.history = pisi.history.History()
self.history.create(operation)
def add_and_update(self, pkgBefore=None, pkgAfter=None, operation=None):
self.add_package(pkgBefore, pkgAfter, operation)
def add_and_update(self, pkgBefore=None, pkgAfter=None, operation=None, otype=None):
self.add_package(pkgBefore, pkgAfter, operation, otype)
self.update_history()
def add_package(self, pkgBefore=None, pkgAfter=None, operation=None):
self.history.add(pkgBefore, pkgAfter, operation)
def add_package(self, pkgBefore=None, pkgAfter=None, operation=None, otype=None):
self.history.add(pkgBefore, pkgAfter, operation, otype)
def load_config(self, operation, package):
config_dir = os.path.join(ctx.config.history_dir(), "%03d" % operation, package)
+10 -4
View File
@@ -34,6 +34,7 @@ class PackageInfo:
class Package:
a_operation = [autoxml.String, autoxml.mandatory]
a_type = [autoxml.String, autoxml.optional]
t_Name = [autoxml.String, autoxml.mandatory]
t_Before = [PackageInfo, autoxml.optional]
@@ -43,7 +44,10 @@ class Package:
# "upgrade", "remove", "install", "reinstall", "downgrade"
operation = ""
if self.operation == "upgrade":
return _("%s is upgraded from %s to %s.") % (self.name, self.before, self.after)
if self.type == "delta":
return _("%s is upgraded from %s to %s with delta.") % (self.name, self.before, self.after)
else:
return _("%s is upgraded from %s to %s.") % (self.name, self.before, self.after)
elif self.operation == "remove":
return _("%s %s is removed.") % (self.name, self.before)
elif self.operation == "install":
@@ -78,7 +82,7 @@ class History(xmlfile.XmlFile):
if operation not in ["upgrade", "remove", "emerge", "install", "snapshot", "takeback"]:
raise Exception("Unknown package operation")
opno = self._get_latest()
self.histfile = "%s_%s.xml" % (opno, operation)
@@ -88,13 +92,15 @@ class History(xmlfile.XmlFile):
self.operation.time = "%02d:%02d" % (hour, minute)
self.operation.no = opno
def add(self, pkgBefore=None, pkgAfter=None, operation=None):
# @param otype is currently only used to hold if an upgrade is from "delta"
def add(self, pkgBefore=None, pkgAfter=None, operation=None, otype=None):
if operation not in ["upgrade", "remove", "install", "reinstall", "downgrade", "snapshot"]:
raise Exception("Unknown package operation")
package = Package()
package.operation = operation
package.type = otype
package.name = (pkgAfter and pkgAfter.name) or (pkgBefore and pkgBefore.name)
if not pkgBefore:
@@ -108,7 +114,7 @@ class History(xmlfile.XmlFile):
histInfo.version = str(pkgInfo.version)
histInfo.release = str(pkgInfo.release)
histInfo.build = pkgInfo.build and str(pkgInfo.build)
self.operation.packages.append(package)
def update(self):