summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2008-01-18 17:05:34 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2008-01-18 17:05:34 +0100
commitf2cd8c2ab2b7886c11c44e17fb1341c06f60e1f9 (patch)
tree1ca9270daade0ecf7523fb93da44d9d3a12b744d
parentabfffe610b0f5256117a6af165ee182bbc60b6a5 (diff)
parentfd183f637afc8786991782d2135f8885c8490fc2 (diff)
downloadpython-apt-f2cd8c2ab2b7886c11c44e17fb1341c06f60e1f9.tar.gz
* python/tar.cc:
- fix .lzma extraction (thanks to bigjools)
-rw-r--r--debian/changelog2
-rwxr-xr-xdoc/examples/gui-inst.py55
-rw-r--r--python/tar.cc2
3 files changed, 17 insertions, 42 deletions
diff --git a/debian/changelog b/debian/changelog
index a652388a..6a33f128 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ python-apt (0.7.4ubuntu2) hardy; urgency=low
* use the new apt ListUpdate() code
* add example in doc/examples/update.py
+ * python/tar.cc:
+ - fix .lzma extraction (thanks to bigjools)
-- Michael Vogt <michael.vogt@ubuntu.com> Fri, 04 Jan 2008 21:17:00 +0100
diff --git a/doc/examples/gui-inst.py b/doc/examples/gui-inst.py
index deb325fe..c2555134 100755
--- a/doc/examples/gui-inst.py
+++ b/doc/examples/gui-inst.py
@@ -48,6 +48,7 @@ class GuiFetchProgress(gtk.Window, FetchProgress):
class TermInstallProgress(InstallProgress, gtk.Window):
def __init__(self):
gtk.Window.__init__(self)
+ InstallProgress.__init__(self)
self.show()
box = gtk.VBox()
box.show()
@@ -58,62 +59,32 @@ class TermInstallProgress(InstallProgress, gtk.Window):
self.reaper = vte.reaper_get()
self.reaper.connect("child-exited",self.child_exited)
self.finished = False
-
box.pack_start(self.term)
self.progressbar = gtk.ProgressBar()
self.progressbar.show()
box.pack_start(self.progressbar)
-
- (read, write) = os.pipe()
- self.writefd=write
- self.status = os.fdopen(read, "r")
- fcntl.fcntl(self.status.fileno(), fcntl.F_SETFL,os.O_NONBLOCK)
- print "read-fd: %s" % self.status.fileno()
- print "write-fd: %s" % self.writefd
- self.read = ""
-
def child_exited(self,term, pid, status):
print "child_exited: %s %s %s %s" % (self,term,pid,status)
self.apt_status = posix.WEXITSTATUS(status)
self.finished = True
-
def startUpdate(self):
print "start"
self.show()
- def updateInterface(self):
- if self.status != None:
- try:
- self.read += os.read(self.status.fileno(),1)
- except OSError, (errno,errstr):
- # resource temporarly unavailable is ignored
- if errno != 11:
- print errstr
- if self.read.endswith("\n"):
- s = self.read
- print s
- (status, pkg, percent, status_str) = string.split(s, ":")
- print "percent: %s %s" % (pkg, float(percent)/100.0)
- self.progressbar.set_fraction(float(percent)/100.0)
- self.progressbar.set_text(string.strip(status_str))
- self.read = ""
- while gtk.events_pending():
- gtk.main_iteration()
-
- def finishUpdate(self):
- sys.stdin.readline()
- def run(self, pm):
- print "fork"
- env = ["VTE_PTY_KEEP_FD=%s"%self.writefd]
- print env
- pid = self.term.forkpty(envv=env)
- if pid == 0:
- res = pm.DoInstall(self.writefd)
- print res
- sys.exit(res)
- print "After fork: %s " % pid
+ def waitChild(self):
while not self.finished:
self.updateInterface()
+ while gtk.events_pending():
+ gtk.main_iteration()
+ time.sleep(0.001)
+ sys.stdin.readline()
return self.apt_status
+ def statusChange(self, pkg, percent, status):
+ print "statusChange", pkg, percent
+ self.progressbar.set_fraction(float(percent)/100.0)
+ self.progressbar.set_text(string.strip(status))
+ def fork(self):
+ env = ["VTE_PTY_KEEP_FD=%s"%self.writefd]
+ return self.term.forkpty(envv=env)
cache = apt.Cache()
print "Available packages: %s " % cache._cache.PackageCount
diff --git a/python/tar.cc b/python/tar.cc
index 22c0327e..61c9d708 100644
--- a/python/tar.cc
+++ b/python/tar.cc
@@ -168,6 +168,8 @@ PyObject *debExtract(PyObject *Self,PyObject *Args)
// Extract it.
if (strcmp(".bz2", &Chunk[strlen(Chunk)-4]) == 0)
Comp = "bzip2";
+ else if(strcmp(".lzma", &Chunk[strlen(Chunk)-5]) == 0)
+ Comp = "lzma";
ExtractTar Tar(Deb.GetFile(),Member->Size,Comp);
ProcessTar Proc(Function);
if (Tar.Go(Proc) == false)