Пример #1
0
    def refresh_cache(self):
        # get the lock
        try:
            apt_pkg.pkgsystem_lock()
        except SystemError:
            pass

        try:
            if self.cache is None:
                self.cache = MyCache(None)
            else:
                self.cache.open(None)
                self.cache._initDepCache()
        except AssertionError:
            # if the cache could not be opened for some reason,
            # let the release upgrader handle it, it deals
            # a lot better with this
            self._start_pane(PartialUpgradeDialog(self))
            # we assert a clean cache
            header = _("Software index is broken")
            desc = _("It is impossible to install or remove any software. "
                     "Please use the package manager \"Synaptic\" or run "
                     "\"sudo apt-get install -f\" in a terminal to fix "
                     "this issue at first.")
            self.start_error(True, header, desc)
        except SystemError as e:
            header = _("Could not initialize the package information")
            desc = _("An unresolvable problem occurred while "
                     "initializing the package information.\n\n"
                     "Please report this bug against the 'update-manager' "
                     "package and include the following error "
                     "message:\n") + str(e)
            self.start_error(True, header, desc)

        # Let the Gtk event loop breath if it hasn't had a chance.
        def iterate():
            while Gtk.events_pending():
                Gtk.main_iteration()

        iterate()

        self.update_list = UpdateList(self)
        try:
            self.update_list.update(self.cache, eventloop_callback=iterate)
        except SystemError as e:
            header = _("Could not calculate the upgrade")
            desc = _("An unresolvable problem occurred while "
                     "calculating the upgrade.\n\n"
                     "Please report this bug against the 'update-manager' "
                     "package and include the following error "
                     "message:\n") + str(e)
            self.start_error(True, header, desc)

        if self.update_list.distUpgradeWouldDelete > 0:
            self._start_pane(PartialUpgradeDialog(self))
Пример #2
0
 def try_acquire_lock(self):
     " check if we can lock the apt database "
     try:
         apt_pkg.pkgsystem_lock()
     except SystemError:
         self.error_header = _("Only one software management tool is allowed to"
                    " run at the same time")
         self.error_body = _("Please close the other application e.g. 'Update "
                  "Manager', 'aptitude' or 'Synaptic' first.")
         return False
     apt_pkg.pkgsystem_unlock()
     return True
Пример #3
0
    def refresh_cache(self):
        # get the lock
        try:
            apt_pkg.pkgsystem_lock()
        except SystemError:
            pass

        try:
            if self.cache is None:
                self.cache = MyCache(None)
            else:
                self.cache.open(None)
                self.cache._initDepCache()
        except AssertionError:
            # if the cache could not be opened for some reason,
            # let the release upgrader handle it, it deals
            # a lot better with this
            self._start_pane(PartialUpgradeDialog(self))
            # we assert a clean cache
            header = _("Software index is broken")
            desc = _("It is impossible to install or remove any software. "
                     "Please use the package manager \"Synaptic\" or run "
                     "\"sudo apt-get install -f\" in a terminal to fix "
                     "this issue at first.")
            self.start_error(True, header, desc)
        except SystemError as e:
            header = _("Could not initialize the package information")
            desc = _("An unresolvable problem occurred while "
                     "initializing the package information.\n\n"
                     "Please report this bug against the 'update-manager' "
                     "package and include the following error "
                     "message:\n") + str(e)
            self.start_error(True, header, desc)

        # Let the Gtk event loop breath if it hasn't had a chance.
        while Gtk.events_pending():
            Gtk.main_iteration()

        self.update_list = UpdateList(self)
        try:
            self.update_list.update(self.cache)
        except SystemError as e:
            header = _("Could not calculate the upgrade")
            desc = _("An unresolvable problem occurred while "
                     "calculating the upgrade.\n\n"
                     "Please report this bug against the 'update-manager' "
                     "package and include the following error "
                     "message:\n") + str(e)
            self.start_error(True, header, desc)

        if self.update_list.distUpgradeWouldDelete > 0:
            self._start_pane(PartialUpgradeDialog(self))
Пример #4
0
 def try_acquire_lock(self):
     " check if we can lock the apt database "
     try:
         apt_pkg.pkgsystem_lock()
     except SystemError:
         self.error_header = _(
             "Only one software management tool is allowed to"
             " run at the same time")
         self.error_body = _(
             "Please close the other application e.g. 'Update "
             "Manager', 'aptitude' or 'Synaptic' first.")
         return False
     apt_pkg.pkgsystem_unlock()
     return True
Пример #5
0
    def acquire_lock(self):
        " lock the pkgsystem for install "
        # sanity check ( moved here )
        if self._deb is None:
          return False

        # check if we can lock the apt database
        try:
            apt_pkg.pkgsystem_lock()
        except SystemError:
            self.error_header = _("Only one software management tool is allowed to"
                                  " run at the same time")
            self.error_body = _("Please close the other application e.g. 'Update "
                                "Manager', 'aptitude' or 'Synaptic' first.")
            return False
        return True
Пример #6
0
    def acquire_lock(self):
        " lock the pkgsystem for install "
        # sanity check ( moved here )
        if self._deb is None:
            return False

        # check if we can lock the apt database
        try:
            apt_pkg.pkgsystem_lock()
        except SystemError:
            self.error_header = _(
                "Only one software management tool is allowed to"
                " run at the same time")
            self.error_body = _(
                "Please close the other application e.g. 'Update "
                "Manager', 'aptitude' or 'Synaptic' first.")
            return False
        return True
    def __init__(self, datadir):
        self.screen = SnackScreen()
        # FIXME: self.screen.finish() clears the screen (and all messages)
        #        there too
        #atexit.register(self.restoreScreen)
        self.button_bar = ButtonBar(self.screen, ((_("Cancel"), "cancel"),
                                                  (_("Install"), "ok")),
                                    compact=True)
        self.textview_changes = Textbox(72, 8, _("Changelog"), True, True)
        self.checkbox_tree_updates = CheckboxTree(height=8, width=72, scroll=1)
        self.checkbox_tree_updates.setCallback(self.checkbox_changed)
        self.layout = GridForm(self.screen, _("Updates"), 1, 5)
        self.layout.add(self.checkbox_tree_updates, 0, 0)
        # empty line to make it look less crowded
        self.layout.add(Textbox(60, 1, " ", False, False), 0, 1)
        self.layout.add(self.textview_changes, 0, 2)
        # empty line to make it look less crowded
        self.layout.add(Textbox(60, 1, " ", False, False), 0, 3)
        self.layout.add(self.button_bar, 0, 4)
        # FIXME: better progress than the current suspend/resume screen thing
        self.screen.suspend()
        if not self.DEBUG:
            apt_pkg.pkgsystem_lock()
        self.openCache()
        print(_("Building Updates List"))
        self.fillstore()
        if self.list.distUpgradeWouldDelete > 0:
            print(
                _("""
A normal upgrade can not be calculated, please run:
  sudo apt-get dist-upgrade


This can be caused by:
 * A previous upgrade which didn't complete
 * Problems with some of the installed software
 * Unofficial software packages not provided by Ubuntu
 * Normal changes of a pre-release version of Ubuntu"""))
            sys.exit(1)
        self.screen.resume()
Пример #8
0
    def __init__(self, datadir):
        self.screen = SnackScreen()
        # FIXME: self.screen.finish() clears the screen (and all messages)
        #        there too
        #atexit.register(self.restoreScreen)
        self.button_bar = ButtonBar(self.screen,
                                    ((_("Cancel"), "cancel"),
                                     (_("Install"), "ok")),
                                    compact=True)
        self.textview_changes = Textbox(72, 8, _("Changelog"), True, True)
        self.checkbox_tree_updates = CheckboxTree(height=8, width=72, scroll=1)
        self.checkbox_tree_updates.setCallback(self.checkbox_changed)
        self.layout = GridForm(self.screen, _("Updates"), 1, 5)
        self.layout.add(self.checkbox_tree_updates, 0, 0)
        # empty line to make it look less crowded
        self.layout.add(Textbox(60, 1, " ", False, False), 0, 1)
        self.layout.add(self.textview_changes, 0, 2)
        # empty line to make it look less crowded
        self.layout.add(Textbox(60, 1, " ", False, False), 0, 3)
        self.layout.add(self.button_bar, 0, 4)
        # FIXME: better progress than the current suspend/resume screen thing
        self.screen.suspend()
        if not self.DEBUG:
            apt_pkg.pkgsystem_lock()
        self.openCache()
        print(_("Building Updates List"))
        self.fillstore()
        if self.list.distUpgradeWouldDelete > 0:
            print(_("""
A normal upgrade can not be calculated, please run:
  sudo apt-get dist-upgrade


This can be caused by:
 * A previous upgrade which didn't complete
 * Problems with some of the installed software
 * Unofficial software packages not provided by Ubuntu
 * Normal changes of a pre-release version of Ubuntu"""))
            sys.exit(1)
        self.screen.resume()
Пример #9
0
 def release_lock(self):
     " release the pkgsystem lock "
     apt_pkg.pkgsystem_lock()
     return True
Пример #10
0
            self.progressbar.hide()


if __name__ == "__main__":
    app = GDebiGtk("data/",None)

    pkgs = ["cw"]
    for pkg in pkgs:
        print("installing %s" % pkg)
        app._cache[pkg].mark_install()

    for pkg in app._cache:
        if pkg.marked_install or pkg.marked_upgrade:
            print(pkg.name)

    apt_pkg.pkgsystem_lock()
    app.dialog_deb_install.set_transient_for(app.window_main)
    app.dialog_deb_install.show_all()

    # install the dependecnies
    fprogress = app.FetchProgressAdapter(app.progressbar_install,
                                         app.label_action,
                                         app.dialog_deb_install)
    iprogress = app.InstallProgressAdapter(app.progressbar_install,
                                           app.vte_terminal,
                                           app.label_action,
                                           app.expander_install)
    res = app._cache.commit(fprogress,iprogress)
    print("commit retured: %s" % res)
    Gtk.main()
Пример #11
0
 def release_lock(self):
     " release the pkgsystem lock "
     apt_pkg.pkgsystem_lock()
     return True
Пример #12
0
            self.progressbar.hide()


if __name__ == "__main__":
    app = GDebiGtk("data/",None)

    pkgs = ["cw"]
    for pkg in pkgs:
        print("installing %s" % pkg)
        app._cache[pkg].mark_install()

    for pkg in app._cache:
        if pkg.marked_install or pkg.marked_upgrade:
            print(pkg.name)

    apt_pkg.pkgsystem_lock()
    app.dialog_deb_install.set_transient_for(app.window_main)
    app.dialog_deb_install.show_all()

    # install the dependecnies
    fprogress = app.FetchProgressAdapter(app.progressbar_install,
                                         app.label_action,
                                         app.dialog_deb_install)
    iprogress = app.InstallProgressAdapter(app.progressbar_install,
                                           app.vte_terminal,
                                           app.label_action,
                                           app.expander_install)
    res = app._cache.commit(fprogress,iprogress)
    print("commit retured: %s" % res)
    Gtk.main()
Пример #13
0
 def _lock(self):
     self.logger.verbose("Locking the global pkgsystem.")
     apt_pkg.pkgsystem_lock()
     self.locked = True