Example #1
0
    def handler(self, package, signal, args):

        if signal in ["started", "finished"]:
            logger.debug("Signal: %s" % str(signal))
            logger.debug("Args: %s" % str(args))

        # FIXME: manager.py should just send either a status or signal
        if signal in ["status", "progress"]:
            signal = args[0]
            args = args[1:]
        ####

        if signal == "finished":
            self.state.chainAction(args[0])
            if args[0] in self.nop:  # no operation
                return
            self.emit(SIGNAL("finished(QString)"), args[0])

        elif signal == "fetching":
            if not args[0].startswith("pisi-index.xml"):
                self.emit(SIGNAL("operationChanged(QString, QString)"),
                          i18n("downloading"), args[0])
            self.updateTotalDownloaded(args[4], args[5], args[2], args[3])
            self.calculateTimeLeft(args[2], args[3])
            self.updateTotalOperationPercent()

        elif signal == "updatingrepo":
            self.emit(SIGNAL("operationChanged(QString, QString)"), signal,
                      args[0])

        elif signal == "error":
            self.emit(SIGNAL("exception(QString)"), unicode(args[0]))

        elif signal == "started":
            if args[0] in self.nop:  # no operation
                return
            self.initialize()
            self.emit(SIGNAL("started(QString)"), args[0])

        elif signal in ["installing", "removing", "extracting", "configuring"]:
            self.emit(SIGNAL("operationChanged(QString, QString)"),
                      i18n(signal), args[0])

        if signal == "cancelled":
            self.emit(SIGNAL("operationCancelled()"))

        elif signal == "desktopfile":
            self.addDesktopFile(str(args[0]))

        elif signal == "cached":
            self.totalSize = int(args[0]) - int(args[1])

        elif signal in ["removed", "installed", "upgraded"]:
            # Bug 4030
            if not self.state.inRemove() and signal == "removed":
                return
            self.packageNo += 1
            self.updatePackageProgress()
            self.emit(SIGNAL("packageChanged(int, int, QString)"),
                      self.packageNo, self.totalPackages, i18n(signal))
Example #2
0
    def handler(self, package, signal, args):

        if signal in ["started", "finished"]:
            logger.debug("Signal: %s" % str(signal))
            logger.debug("Args: %s" % str(args))

        # FIXME: iface should just send either a status or signal
        if signal in ["status", "progress"]:
            signal = args[0]
            args = args[1:]
        ####

        if signal == "finished":
            self.state.chainAction(args[0])
            if args[0] in self.nop: # no operation
                return
            self.finished[str].emit(args[0])

        elif signal == "fetching":
            if not args[0].startswith("pisi-index.xml"):
                self.operationChanged[str,str].emit(i18n("downloading"), args[0])
            self.updateTotalDownloaded(args[4], args[5], args[2], args[3])
            self.calculateTimeLeft(args[2], args[3])
            self.updateTotalOperationPercent()

        elif signal == "updatingrepo":
            self.operationChanged[str,str].emit(signal, args[0])

        elif signal == "error":
            self.exception[str].emit(unicode(args[0]))

        elif signal == "started":
            if args[0] in self.nop: # no operation
                return
            self.initialize()
            self.started[str].emit(args[0])

        elif signal in ["installing", "removing", "extracting", "configuring"]:
            self.operationChanged[str,str].emit(self._operation_signals[signal], args[0])

        if signal == "cancelled":
            self.operationCancelled.emit()

        elif signal == "desktopfile":
            self.addDesktopFile(str(args[0]))

        elif signal == "cached":
            self.totalSize = int(args[0])

        elif signal in ["removed", "installed", "upgraded"]:
            # Bug 4030
            if not self.state.inRemove() and signal == "removed":
                return
            self.packageNo += 1
            # If the number of operated packages more than total packages just fix them
            # The issue is related to the pm-install remote package installs
            if self.packageNo > self.totalPackages:
                self.totalPackages = self.packageNo
            self.updatePackageProgress()
            self.packageChanged[int,int,str].emit(self.packageNo, self.totalPackages, i18n(signal))
Example #3
0
 def updateRepositories(self, check_repos=None):
     if not repos_available(self, check_repos):
         return False
     logger.debug("Updating repositories...")
     self.link.System.Manager["pisi"].updateAllRepositories(
         async=self.handler, timeout=2**16 - 1)
     return True
Example #4
0
 def reinstallPackages(self, packages):
     packages = get_real_paths(packages)
     logger.debug("Re-Installing packages: %s" % packages)
     packages = string.join(packages, ",")
     self.link.System.Manager["pisi"].reinstallPackage(packages,
                                                       async=self.handler,
                                                       timeout=2**16 - 1)
Example #5
0
 def setCacheLimit(self, useCache, limit):
     logger.debug("Use cache: %s - change limit to: %s" % (useCache, limit))
     if not self.__configChanged("general", "package_cache",
                                 useCache) and not self.__configChanged(
                                     "general", "package_cache_limit",
                                     limit):
         return
     self.link.System.Manager["pisi"].setCache(useCache, limit)
Example #6
0
    def handler(self, package, signal, args):

        if signal in ["started", "finished"]:
            logger.debug("Signal: %s" % str(signal))
            logger.debug("Args: %s" % str(args))

        # FIXME: iface should just send either a status or signal
        if signal in  ["status", "progress"]:
            signal = args[0]
            args = args[1:]
        ####

        if signal == "finished":
            self.state.chainAction(args[0])
            if args[0] in self.nop: # no operation
                return
            self.emit(SIGNAL("finished(QString)"), args[0])

        elif signal == "fetching":
            if not args[0].startswith("pisi-index.xml"):
                self.emit(SIGNAL("operationChanged(QString, QString)"), i18n("downloading"), args[0])
            self.updateTotalDownloaded(args[4], args[5], args[2], args[3])
            self.calculateTimeLeft(args[2], args[3])
            self.updateTotalOperationPercent()

        elif signal == "updatingrepo":
            self.emit(SIGNAL("operationChanged(QString, QString)"), signal, args[0])

        elif signal == "error":
            self.emit(SIGNAL("exception(QString)"), unicode(args[0]))

        elif signal == "started":
            if args[0] in self.nop: # no operation
                return
            self.initialize()
            self.emit(SIGNAL("started(QString)"), args[0])

        elif signal in ["installing", "removing", "extracting", "configuring"]:
            self.emit(SIGNAL("operationChanged(QString, QString)"), i18n(signal), args[0])

        if signal == "cancelled":
            self.emit(SIGNAL("operationCancelled()"))

        elif signal == "desktopfile":
            self.addDesktopFile(str(args[0]))

        elif signal == "cached":
            self.totalSize = int(args[0])

        elif signal in ["removed", "installed", "upgraded"]:
            # Bug 4030
            if not self.state.inRemove() and signal == "removed":
                return
            self.packageNo += 1
            self.updatePackageProgress()
            self.emit(SIGNAL("packageChanged(int, int, QString)"), self.packageNo, self.totalPackages, i18n(signal))
Example #7
0
 def handler(self, package, exception, args):
     """ Handler just for exceptions """
     if exception:
         logger.debug("Exception caught by COMAR: %s" % exception)
         self.invalidate_db_caches()
         self.exceptionHandler(exception)
Example #8
0
 def handler(self, package, exception, args):
     if exception:
         logger.debug("Exception caught by COMAR: %s" % exception)
         self.invalidate_db_caches()
         self.exceptionHandler(exception)
Example #9
0
 def setConfig(self, category, name, value):
     logger.debug("Setting config... Category: %s, Name: %s, Value: %s" %
                  (category, name, value))
     if not self.__configChanged(category, name, value):
         return
     self.link.System.Manager["pisi"].setConfig(category, name, value)
Example #10
0
 def removePackages(self, packages):
     logger.debug("Removing packages: %s" % packages)
     packages = string.join(packages,",")
     self.link.System.Manager["pisi"].removePackage(packages, async=self.handler, timeout=2**16-1)
Example #11
0
 def clearCache(self, limit):
     config = self.getConfig()
     cache_dir = config.get("directories", "cached_packages_dir")
     logger.debug("Clearing cache %s with limit: %s" % (cache_dir, limit))
     self.link.System.Manager["pisi"].clearCache(cache_dir, limit)
Example #12
0
 def clearCache(self, limit):
     config = self.getConfig()
     cache_dir = config.get("directories", "cached_packages_dir")
     logger.debug("Clearing cache %s with limit: %s" % (cache_dir, limit))
     self.link.System.Manager["pisi"].clearCache(cache_dir, limit)
Example #13
0
 def removeRepository(self, repo):
     logger.debug("Removing repository: %s" % repo)
     self.link.System.Manager["pisi"].removeRepository(repo, async=self.handler, timeout=2**16-1)
Example #14
0
 def updateRepository(self, repo):
     logger.debug("Updating %s..." % repo)
     self.link.System.Manager["pisi"].updateRepository(repo, async=self.handler, timeout=2**16-1)
Example #15
0
 def updateRepositories(self):
     logger.debug("Updating repositories...")
     self.link.System.Manager["pisi"].updateAllRepositories(async=self.handler, timeout=2**16-1)
Example #16
0
 def upgradePackages(self, packages):
     logger.debug("Upgrading packages: %s" % packages)
     packages = string.join(packages,",")
     self.link.System.Manager["pisi"].updatePackage(packages, async=self.handler, timeout=2**16-1)
Example #17
0
 def removePackages(self, packages):
     logger.debug("Removing packages: %s" % packages)
     packages = string.join(packages,",")
     self.link.System.Manager["pisi"].removePackage(packages, async=self.handler, timeout=2**16-1)
Example #18
0
 def updateRepositories(self, check_repos = None):
     if not repos_available(self, check_repos):
         return False
     logger.debug("Updating repositories...")
     self.link.System.Manager["pisi"].updateAllRepositories(async=self.handler, timeout=2**16-1)
     return True
Example #19
0
 def setConfig(self, category, name, value):
     logger.debug("Setting config... Category: %s, Name: %s, Value: %s" % (category, name, value))
     if not self.__configChanged(category, name, value):
         return
     self.link.System.Manager["pisi"].setConfig(category, name, value)
Example #20
0
 def updateRepository(self, repo):
     logger.debug("Updating %s..." % repo)
     self.link.System.Manager["pisi"].updateRepository(repo, async=self.handler, timeout=2**16-1)
Example #21
0
 def removeRepository(self, repo):
     logger.debug("Removing repository: %s" % repo)
     self.link.System.Manager["pisi"].removeRepository(repo, async=self.handler, timeout=2**16-1)
Example #22
0
 def setRepoActivities(self, repos):
     logger.debug("Re-setting repo activities: %s" % repos)
     self.link.System.Manager["pisi"].setRepoActivities(repos)
Example #23
0
 def updateRepositories(self):
     logger.debug("Updating repositories...")
     self.link.System.Manager["pisi"].updateAllRepositories(async=self.handler, timeout=2**16-1)
Example #24
0
 def setCacheLimit(self, useCache, limit):
     logger.debug("Use cache: %s - change limit to: %s" % (useCache, limit))
     if not self.__configChanged("general", "package_cache", useCache) and not self.__configChanged("general", "package_cache_limit", limit):
         return
     self.link.System.Manager["pisi"].setCache(useCache, limit)
Example #25
0
 def clearCache(self, limit):
     logger.debug("Clearing cache with limit: %s" % limit)
     self.link.System.Manager["pisi"].clearCache("/var/cache/pisi/packages", limit)
Example #26
0
 def reinstallPackages(self, packages):
     packages = get_real_paths(packages)
     logger.debug("Re-Installing packages: %s" % packages)
     packages = string.join(packages,",")
     self.link.System.Manager["pisi"].reinstallPackage(packages, async=self.handler, timeout=2**16-1)
Example #27
0
 def clearCache(self, limit):
     logger.debug("Clearing cache with limit: %s" % limit)
     self.link.System.Manager["pisi"].clearCache("/var/cache/pisi/packages",
                                                 limit)
Example #28
0
 def upgradePackages(self, packages):
     logger.debug("Upgrading packages: %s" % packages)
     packages = string.join(packages,",")
     self.link.System.Manager["pisi"].updatePackage(packages, async=self.handler, timeout=2**16-1)
Example #29
0
 def setRepoActivities(self, repos):
     logger.debug("Re-setting repo activities: %s" % repos)
     self.link.System.Manager["pisi"].setRepoActivities(repos)