From ed4c10097afd41b6af0c5befcff3fa2bd78c82cd Mon Sep 17 00:00:00 2001 From: Sebastian Heinlein Date: Sun, 24 Aug 2008 21:21:46 +0200 Subject: Minor fixes: Call InstallProgress.startUpdate() and InstallProgress.finishUpdate() for dpkg installations. Remove broken warnings about obsolete methods. Fix parameters of DebPackage.requiredChanges --- apt/debfile.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'apt') diff --git a/apt/debfile.py b/apt/debfile.py index 745742bb..b5d2fea7 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -21,7 +21,6 @@ # import warnings -from warnings import warn warnings.filterwarnings("ignore", "apt API not stable yet", FutureWarning) import apt_inst, apt_pkg import apt @@ -209,7 +208,6 @@ class DebPackage(object): WARNING: This method will is deprecated. Please use the attribute DebPackage.depends instead. """ - warn.warning("Will is depricated. Please use the conflicts attribute") return self.depends def conflicts(self): @@ -230,7 +228,6 @@ class DebPackage(object): WARNING: This method will is deprecated. Please use the attribute DebPackage.depends instead. """ - warn.warning("Will is depricated. Please use the depends attribute") return self.depends def depends(self): @@ -252,8 +249,7 @@ class DebPackage(object): WARNING: This method will is deprecated. Please use the attribute DebPackage.provides instead. """ - warn.warning("Will is depricated. Please use the provides attribute") - self.provides + return self.provides def provides(self): """ @@ -273,8 +269,7 @@ class DebPackage(object): WARNING: This method will is deprecated. Please use the attribute DebPackage.replaces instead. """ - warn.warning("Will is depricated. Please use the replaces attribute") - self.replaces + return self.replaces def replaces(self): """ @@ -422,7 +417,7 @@ class DebPackage(object): return self._needPkgs missingDeps = property(missingDeps) - def requiredChanges(self, cache): + def requiredChanges(self): """ gets the required changes to satisfy the depends. returns a tuple with (install, remove, unauthenticated) """ @@ -455,7 +450,9 @@ class DebPackage(object): if installProgress == None: res = os.system("/usr/sbin/dpkg -i %s" % self.filename) else: + installProgress.startUpdate() res = installProgress.run(self.filename) + installProgress.finishUpdate() return res class DscSrcPackage(DebPackage): -- cgit v1.2.3 From e671440114f46b0c6a961cd995a0b7d8bfb3f2ba Mon Sep 17 00:00:00 2001 From: Sebastian Heinlein Date: Sun, 24 Aug 2008 21:39:38 +0200 Subject: Revert the os._exit call in the child of the progress --- apt/progress.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt') diff --git a/apt/progress.py b/apt/progress.py index 2ef100a8..09a3fb06 100644 --- a/apt/progress.py +++ b/apt/progress.py @@ -214,7 +214,7 @@ class InstallProgress(DumbInstallProgress): if pid == 0: # child res = pm.DoInstall(self.writefd) - os.exit(res) + os._exit(res) self.child_pid = pid res = self.waitChild() return res @@ -249,7 +249,7 @@ class DpkgInstallProgress(InstallProgress): # child res = os.system("/usr/bin/dpkg --status-fd %s -i %s" % \ (self.writefd, self.debfile)) - os.exit(res) + os._exit(os.WEXITSTATUS(res)) self.child_pid = pid res = self.waitChild() return res -- cgit v1.2.3 From 07edbff3df9d15403256f1ef6d8e4bc92433182e Mon Sep 17 00:00:00 2001 From: Sebastian Heinlein Date: Sun, 24 Aug 2008 21:59:17 +0200 Subject: Make version compare constants available globally and rename them for more consistency. --- apt/debfile.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'apt') diff --git a/apt/debfile.py b/apt/debfile.py index b5d2fea7..9545ca98 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -30,6 +30,12 @@ from gettext import gettext as _ from cache import Cache from progress import DpkgInstallProgress +# Constants for comparing the local package file with the version in the cache +(VERSION_NONE, + VERSION_OUTDATED, + VERSION_SAME, + VERSION_NEWER) = range(4) + class NoDebArchiveException(IOError): pass @@ -313,12 +319,7 @@ class DebPackage(object): res = False return res - # some constants - (NO_VERSION, - VERSION_OUTDATED, - VERSION_SAME, - VERSION_IS_NEWER) = range(4) - + def compareToVersionInCache(self, useInstalled=True): """ checks if the pkg is already installed or availabe in the cache and if so in what version, returns if the version of the deb @@ -337,12 +338,12 @@ class DebPackage(object): cmp = apt_pkg.VersionCompare(cachever,debver) self._dbg(1, "CompareVersion(debver,instver): %s" % cmp) if cmp == 0: - return self.VERSION_SAME + return VERSION_SAME elif cmp < 0: - return self.VERSION_IS_NEWER + return VERSION_NEWER elif cmp > 0: - return self.VERSION_OUTDATED - return self.NO_VERSION + return VERSION_OUTDATED + return VERSION_NONE def checkDeb(self): self._dbg(3,"checkDepends") -- cgit v1.2.3 From bd6c809c2ea32c16c0222e82283dbe4b059ebbad Mon Sep 17 00:00:00 2001 From: Sebastian Heinlein Date: Sun, 24 Aug 2008 22:18:13 +0200 Subject: Fix use of previously changed constants in checkDeb --- apt/debfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt') diff --git a/apt/debfile.py b/apt/debfile.py index 9545ca98..4fcd6ec0 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -357,7 +357,7 @@ class DebPackage(object): # check version res = self.compareToVersionInCache() - if res == self.VERSION_OUTDATED: # the deb is older than the installed + if res == VERSION_OUTDATED: # the deb is older than the installed self._failureString = _("A later version is already installed") return False -- cgit v1.2.3