Esempio n. 1
0
    def process_data(self):
        if self.pkgs:
            log.debug("call proxy.install_select_pkgs")
            proxy.install_select_pkgs(self.pkgs)
            log.debug("done proxy.install_select_pkgs")
        else:
            log.debug("No pkgs to downloaded, just done")
            self.downgrade_done = True

        while True:
            if not self.downgrade_done:
                time.sleep(0.2)
                continue

#            ppa_source_dict = get_ppa_source_dict()

            # Sort out the unique owner urls, so that the PPAs from same owner will only fetch key fingerprint only once
            key_fingerprint_dict = {}
            for url in self.urls:
                #TODO get the key_fingerprint
#                if url in ppa_source_dict:
#                    id = ppa_source_dict[url]
#                    key_fingerprint = SOURCE_PARSER.get_key_fingerprint(id)
#                else:
                key_fingerprint = ''

                owner, ppa_name = url.split('/')[3:5]

                if owner not in key_fingerprint_dict:
                    key_fingerprint_dict[owner] = key_fingerprint
            log.debug("Get the key_fingerprint_dict done: %s" % key_fingerprint_dict)
            for url in self.urls:
                owner, ppa_name = url.split('/')[3:5]
                key_fingerprint = key_fingerprint_dict[owner]

                self.set_progress_text(_('Removing key files...'))
                if not key_fingerprint:
                    try:
                        #TODO wrap the LP API or use library
                        owner, ppa_name = url.split('/')[3:5]
                        lp_url = 'https://launchpad.net/api/beta/~%s/+archive/%s' % (owner, ppa_name)
                        req = Request(lp_url)
                        req.add_header("Accept","application/json")
                        lp_page = urlopen(req).read()
                        data = json.loads(lp_page)
                        key_fingerprint = data['signing_key_fingerprint']
                    except Exception, e:
                        log.error(e)
                        continue

                log.debug("Get the key fingerprint: %s", key_fingerprint)
                result = proxy.purge_source(url, key_fingerprint)
                log.debug("Set source: %s to %s" % (url, str(result)))

            self.removekey_done = True
            log.debug("removekey_done is True")
            break
Esempio n. 2
0
    def on_package_work_finished(self, transaction, status, kwargs):
        unset_busy(self)

        parent = kwargs['parent']
        url_list = kwargs['url_list']

        for url in url_list:
            #TODO remove vendor key
            result = proxy.purge_source(url, '')
            log.debug("Set source: %s to %s" % (url, str(result)))
        self.sourceview.to_purge = []
        self.update_sourceview()

        notify = Notify.Notification(summary=_('PPA has been purged'),
                                     body=_('It is highly recommend to do a "Refresh" source operation.'))
        notify.set_icon_from_pixbuf(self.get_pixbuf(size=48))
        notify.set_hint_string ("x-canonical-append", "")
        notify.show()
Esempio n. 3
0
    def on_package_work_finished(self, transaction, status, kwargs):
        unset_busy(self)

        parent = kwargs['parent']
        url_list = kwargs['url_list']

        for url in url_list:
            #TODO remove vendor key
            result = proxy.purge_source(url, '')
            log.debug("Set source: %s to %s" % (url, str(result)))
        self.sourceview.to_purge = []
        self.update_sourceview()

        notify = Notify.Notification(
            summary=_('PPA has been purged'),
            body=_(
                'It is highly recommend to do a "Refresh" source operation.'))
        notify.set_icon_from_pixbuf(self.get_pixbuf(size=48))
        notify.set_hint_string("x-canonical-append", "")
        notify.show()