summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Heinlein <sebi@glatzor.de>2008-08-24 23:37:15 +0200
committerSebastian Heinlein <sebi@glatzor.de>2008-08-24 23:37:15 +0200
commit7e98c1633f22a652b7a69080d822c0af87331d04 (patch)
treea282da0220743f8b190eb0a8bd6f71b952d924e5
parentc03e8ae24331b8dce8d9b9865c0656f36dd429ad (diff)
parentbd6c809c2ea32c16c0222e82283dbe4b059ebbad (diff)
downloadpython-apt-7e98c1633f22a652b7a69080d822c0af87331d04.tar.gz
Merge local changes from today's train ride.
-rw-r--r--apt/debfile.py36
-rw-r--r--apt/progress.py4
2 files changed, 19 insertions, 21 deletions
diff --git a/apt/debfile.py b/apt/debfile.py
index 745742bb..4fcd6ec0 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
@@ -31,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
@@ -209,7 +214,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 +234,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 +255,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 +275,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):
"""
@@ -318,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
@@ -342,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")
@@ -361,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
@@ -422,7 +418,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 +451,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):
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