Beispiel #1
0
    def run( self ):
        """fill upgrade tree"""
        debug.dprint("READERS: DeprecatedReader; process id = %d *******************" %os.getpid())
        # find deprecated packages
        for cat, packages in self.installed_items:
            #debug.dprint("READERS: DeprecatedReader; cat = " + str(cat))
            for name, package in packages.items():
                #debug.dprint("READERS: DeprecatedReader; name = " + str(name))
                self.count += 1
                if self.cancelled: self.done = True; return
                deprecated = package.deprecated
                if deprecated:
                    debug.dprint("READERS: DeprecatedReader; found deprecated package: " + package.full_name)
                    self.pkg_dict["Packages"][package.full_name] = package
                    self.pkg_count["Packages"] += 1
                else:
                    unavailable = package.get_unavailable()
                    for ebuild in unavailable:
                        debug.dprint("READERS: DeprecatedReader; found deprecated ebuild: " + ebuild)
                        self.pkg_dict["Ebuilds"][ebuild] = package
                        self.pkg_count["Ebuilds"] += 1

        debug.dprint("READERS: DeprecatedReader; done checks, totals next")
        self.pkg_dict_total = 0
        for key in self.pkg_count:
            self.pkg_dict_total += self.pkg_count[key]
            if self.pkg_dict[key] == {}:
                pkg = Package(_("None"))
                self.pkg_dict[key][_("None")] = pkg
        # set the thread as finished
        self.done = True
        debug.dprint("READERS: DeprecatedReader; done :)")
        return
Beispiel #2
0
    def run(self):
        """fill SETS tree"""
        debug.dprint(
            "READERS: SetListReader(); process id = %d *******************" %
            os.getpid())
        debug.dprint("READERS: SetListReader(); db.userconfigs is type : " +
                     str(type(db.userconfigs)))
        filenames = db.userconfigs.get_source_keys("SETS")
        debug.dprint("READERS: SetListReader(); filenames are: " +
                     str(filenames))
        for filename in filenames:
            debug.dprint("READERS: SetListReader(); filename is: " + filename)
            key = get_set_name(filename)
            if key not in self.pkg_dict.keys():
                self.pkg_dict[key] = {}
                self.pkg_count[key] = 0

            for atom in db.userconfigs.get_source_atoms('SETS', filename):
                debug.dprint("READERS: SetListReader(); atom.name is: " +
                             atom.name)
                self.count += 1
                if self.cancelled:
                    self.done = True
                    return
                self.pkg_dict[key][atom.name] = db.db.get_package(atom.name)
                if self.pkg_dict[key][atom.name] == None:
                    self.pkg_dict[key][atom.name] = Package(atom.name)
                self.pkg_count[key] += 1

        self.pkg_dict_total = 0
        for key in self.pkg_count:
            self.pkg_dict_total += self.pkg_count[key]
            if self.pkg_dict[key] == {}:
                pkg = Package(_("None"))
                self.pkg_dict[key][_("None")] = pkg
        #debug.dprint("READERS: SetListReader(); new pkg_list = " + str(self.pkg_dict))
        # set the thread as finished
        self.done = True
        return
Beispiel #3
0
 def add_pkg(self, entry, deprecated=False):
     #debug.dprint("DBREADER: add_pkg(); entry = %s" %entry)
     category, name = entry.split('/')
     if category in ["metadata", "distfiles", "eclass"]:
         return 0
     # why does getallnodes() return timestamps?
     if (name.endswith('tbz2') or \
             name.startswith('.') or \
             name in ['timestamp.x', 'metadata.xml', 'CVS'] ):
         return 0
     data = Package(entry)
     data.deprecated = deprecated
     if self.cancelled:
         self.done = True
         return 0
     #self.db.categories.setdefault(category, {})[name] = data;
     # look out for segfaults
     if category not in self.db.categories:
         self.db.categories[category] = {}
         self.db.pkg_count[category] = 0
         #debug.dprint("DBREADER: add_pkg(); added category %s" % str(category))
     self.db.categories[category][name] = data
     if entry in self.installed_list:
         if category not in self.db.installed:
             self.db.installed[category] = {}
             self.db.installed_pkg_count[category] = 0
             #debug.dprint("DBREADER: add_pkg(); added category %s to installed" % str(category))
         self.db.installed[category][name] = data
         self.db.installed_pkg_count[category] += 1
         self.db.installed_count += 1
         #debug.dprint("DBREADER: add_pkg(); adding %s to db.list" %name)
         # remove entry from installed list since it has been added to the db
         self.installed_list.remove(entry)
     self.db.list.append((name, data))
     self.db.pkg_count[category] += 1
     return 1
Beispiel #4
0
    def run(self):
        """fill upgrade tree"""
        debug.dprint(
            "READERS: DeprecatedReader; process id = %d *******************" %
            os.getpid())
        # find deprecated packages
        for cat, packages in self.installed_items:
            #debug.dprint("READERS: DeprecatedReader; cat = " + str(cat))
            for name, package in packages.items():
                #debug.dprint("READERS: DeprecatedReader; name = " + str(name))
                self.count += 1
                if self.cancelled:
                    self.done = True
                    return
                deprecated = package.deprecated
                if deprecated:
                    debug.dprint(
                        "READERS: DeprecatedReader; found deprecated package: "
                        + package.full_name)
                    self.pkg_dict["Packages"][package.full_name] = package
                    self.pkg_count["Packages"] += 1
                else:
                    # check for deprecated ebuilds
                    ebuilds = package.get_installed()
                    for ebuild in ebuilds:
                        overlay = portage_lib.get_overlay(ebuild)
                        if type(overlay) is IntType:  # catch obsolete
                            # add the ebuild to Ebuilds list
                            debug.dprint(
                                "READERS: DeprecatedReader; found deprecated ebuild: "
                                + ebuild)
                            self.pkg_dict["Ebuilds"][
                                package.full_name] = package
                            self.pkg_count["Ebuilds"] += 1

        debug.dprint("READERS: DeprecatedReader; done checks, totals next")
        self.pkg_dict_total = 0
        for key in self.pkg_count:
            self.pkg_dict_total += self.pkg_count[key]
            if self.pkg_dict[key] == {}:
                pkg = Package(_("None"))
                self.pkg_dict[key][_("None")] = pkg
        # set the thread as finished
        self.done = True
        debug.dprint("READERS: DeprecatedReader; done :)")
        return
Beispiel #5
0
 def run(self):
     """fill upgrade tree"""
     debug.dprint(
         "READERS: UpgradableListReader(); process id = %d *******************"
         % os.getpid())
     print >> stderr, "READERS: UpgradableListReader(); threading.enumerate() = ", threading.enumerate(
     )
     print >> stderr, "READERS: UpgradableListReader(); this thread is :", thread.get_ident(
     ), ' current thread ', threading.currentThread()
     self.get_system_list()
     self.get_sets()
     for key in self.cat_order:
         self.pkg_dict[key] = {}
         self.pkg_count[key] = 0
     ##upgradeflag = self.upgrade_only and True or False
     # find upgradable packages
     for cat, packages in self.installed_items:
         for name, package in packages.items():
             self.count += 1
             if self.cancelled:
                 self.done = True
                 return
             upgradable = package.is_upgradable()
             # if upgradable: # is_upgradable() = 1 for upgrade, -1 for downgrade
             if upgradable == 1 or upgradable == -1:
                 for key in self.cat_order:
                     if package.in_list(self.categories[key]):
                         self.pkg_dict[key][package.full_name] = package
                         self.pkg_count[key] += 1
                         break
     self.pkg_dict_total = 0
     for key in self.pkg_count:
         self.pkg_dict_total += self.pkg_count[key]
         if self.pkg_dict[key] == {}:
             pkg = Package(_("None"))
             self.pkg_dict[key][_("None")] = pkg
             self.pkg_count[key] = 0
     debug.dprint("READERS: UpgradableListReader(); new pkg_dict = " +
                  str(self.pkg_dict))
     debug.dprint("READERS: UpgradableListReader(); new pkg_counts = " +
                  str(self.pkg_count))
     # set the thread as finished
     self.done = True
     return