~ubuntu-branches/ubuntu/maverick/update-manager/maverick-updates

« back to all changes in this revision

Viewing changes to DistUpgrade/DistUpgradeViewNonInteractive.py

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt, Michael Vogt, Brian Murray
  • Date: 2010-06-09 14:32:05 UTC
  • Revision ID: james.westby@ubuntu.com-20100609143205-ov7osgcx3qlwz5hd
Tags: 1:0.142
[ Michael Vogt ]
* check-new-release-gtk: 
  - fix "ask me later" button time
* DistUpgrade/DistUpgradeController.py,
  DistUpgrade/DistUpgradeCache.py,
  UpdateManager/Core/MetaRelease.py,
  UpdateManager/Core/utils.py,
  UpdateManager/Core/MyCache.py,
  UpdateManager/Core/UpdateList.py,
  UpdateManager/GtkProgress.py,
  UpdateManager/UpdateManager.py:
  - update for python-apt 0.8 API, add tests (LP: #591236)
* check-new-release-gtk:
  - remove no longer needed warnings filter

[ Brian Murray ]
* string fix for 'is aborted now' to 'has aborted'
* fix in debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
202
202
                                                        pkg,
203
203
                                                        status_str))
204
204
    def updateInterface(self):
 
205
        InstallProgress.updateInterface(self)
205
206
        if self.statusfd == None:
206
207
            return
207
208
 
210
211
            # ctrl-c
211
212
            os.write(self.master_fd,chr(3))
212
213
 
213
 
 
214
 
        # read status fd from dpkg
215
 
        # from python-apt/apt/progress.py (but modified a bit)
216
 
        # -------------------------------------------------------------
217
 
        res = select.select([self.statusfd],[],[],0.1)
218
 
        while len(res[0]) > 0:
219
 
            self.last_activity = time.time()
220
 
            while not self.read.endswith("\n"):
221
 
                self.read += os.read(self.statusfd.fileno(),1)
222
 
            if self.read.endswith("\n"):
223
 
                s = self.read
224
 
                #print s
225
 
                (status, pkg, percent, status_str) = string.split(s, ":")
226
 
                if status == "pmerror":
227
 
                    self.error(pkg,status_str)
228
 
                elif status == "pmconffile":
229
 
                    # we get a string like this:
230
 
                    # 'current-conffile' 'new-conffile' useredited distedited
231
 
                    match = re.compile("\s*\'(.*)\'\s*\'(.*)\'.*").match(status_str)
232
 
                    if match:
233
 
                        self.conffile(match.group(1), match.group(2))
234
 
                elif status == "pmstatus":
235
 
                    if (float(percent) != self.percent or 
236
 
                        status_str != self.status):
237
 
                        self.statusChange(pkg, float(percent), status_str.strip())
238
 
                        self.percent = float(percent)
239
 
                        self.status = string.strip(status_str)
240
 
                        sys.stdout.write("[%s] %s: %s\n" % (float(percent), pkg, status_str.strip()))
241
 
                        sys.stdout.flush()
242
 
            self.read = ""
243
 
            res = select.select([self.statusfd],[],[],0.1)
244
 
        # -------------------------------------------------------------
245
 
 
246
 
        #fcntl.fcntl(self.master_fd, fcntl.F_SETFL, os.O_NDELAY)
247
 
        # read master fd (terminal output)
248
 
        res = select.select([self.master_fd],[],[],0.1)
249
 
        while len(res[0]) > 0:
250
 
           self.last_activity = time.time()
251
 
           try:
252
 
               s = os.read(self.master_fd, 1)
253
 
               sys.stdout.write("%s" % s)
254
 
           except OSError,e:
255
 
               # happens after we are finished because the fd is closed
256
 
               return
257
 
           res = select.select([self.master_fd],[],[],0.1)
258
 
        sys.stdout.flush()
259
 
 
260
214
    def fork(self):
261
215
        logging.debug("doing a pty.fork()")
262
216
        # some maintainer scripts fail without
263
217
        os.environ["TERM"] = "dumb"
264
218
        # unset PAGER so that we can do "diff" in the dpkg prompt
265
219
        os.environ["PAGER"] = "true"
266
 
        (self.pid, self.master_fd) = pty.fork()
267
 
        if self.pid != 0:
268
 
            logging.debug("pid is: %s" % self.pid)
269
 
        return self.pid
 
220
        return InstallProgress.fork(self)
270
221
        
271
222
 
272
223
class DistUpgradeViewNonInteractive(DistUpgradeView):