From 03971823f74ae46f4eb0a7238d2478f00b1487af Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Thu, 26 Jun 2008 06:51:14 +0000 Subject: [PATCH] =?UTF-8?q?pisi=20history=20i=C3=A7inde=20delta=20ile=20ya?= =?UTF-8?q?p=C4=B1lan=20g=C3=BCncellemeler=20belli=20olsun?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pisi/atomicoperations.py | 5 +++-- pisi/db/historydb.py | 8 ++++---- pisi/history.py | 14 ++++++++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/pisi/atomicoperations.py b/pisi/atomicoperations.py index 3bf47f66..64ae57a1 100644 --- a/pisi/atomicoperations.py +++ b/pisi/atomicoperations.py @@ -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""" diff --git a/pisi/db/historydb.py b/pisi/db/historydb.py index a47434ee..998e9f10 100644 --- a/pisi/db/historydb.py +++ b/pisi/db/historydb.py @@ -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) diff --git a/pisi/history.py b/pisi/history.py index 13b12a16..5d585a4d 100644 --- a/pisi/history.py +++ b/pisi/history.py @@ -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):