Exemple #1
0
    def sort_column(self, model, row1, row2, col):
        value1 = model.get_value(row1, col)
        value2 = model.get_value(row2, col)
        if col == PackageListModel.COL_SIZE:
            value1 = HobPage._string_to_size(value1)
            value2 = HobPage._string_to_size(value2)

        cmp_res = cmp(value1, value2)
        if cmp_res != 0:
            if col == PackageListModel.COL_INC:
                return -cmp_res
            else:
                return cmp_res
        else:
            name1 = model.get_value(row1, PackageListModel.COL_NAME)
            name2 = model.get_value(row2, PackageListModel.COL_NAME)
            return cmp(name1, name2)
Exemple #2
0
    def sort_column(self, model, row1, row2, col):
        value1 = model.get_value(row1, col)
        value2 = model.get_value(row2, col)
        if col==PackageListModel.COL_SIZE:
            value1 = HobPage._string_to_size(value1)
            value2 = HobPage._string_to_size(value2)

        cmp_res = cmp(value1, value2)
        if cmp_res!=0:
            if col==PackageListModel.COL_INC:
                return -cmp_res
            else:
                return cmp_res
        else:
            name1 = model.get_value(row1, PackageListModel.COL_NAME)
            name2 = model.get_value(row2, PackageListModel.COL_NAME)
            return cmp(name1,name2)
Exemple #3
0
    def populate(self, pkginfolist):
        self.clear()
        self.pkgs_size = 0
        self.pn_path = {}
        self.pkg_path = {}
        self.rprov_pkg = {}

        def getpkgvalue(pkgdict, key, pkgname, defaultval = None):
            value = pkgdict.get('%s_%s' % (key, pkgname), None)
            if not value:
                value = pkgdict.get(key, defaultval)
            return value

        for pkginfo in pkginfolist:
            pn = pkginfo['PN']
            pv = pkginfo['PV']
            pr = pkginfo['PR']
            if pn in self.pn_path.keys():
                pniter = self.get_iter(self.pn_path[pn])
            else:
                pniter = self.append(None)
                self.set(pniter, self.COL_NAME, pn + '-' + pv + '-' + pr,
                                 self.COL_INC, False)
                self.pn_path[pn] = self.get_path(pniter)

            # PKG is always present
            pkg = pkginfo['PKG']
            pkgv = getpkgvalue(pkginfo, 'PKGV', pkg)
            pkgr = getpkgvalue(pkginfo, 'PKGR', pkg)
            # PKGSIZE is artificial, will always be overridden with the package name if present
            pkgsize = pkginfo.get('PKGSIZE_%s' % pkg, "0")
            # PKG_%s is the renamed version
            pkg_rename = pkginfo.get('PKG_%s' % pkg, "")
            # The rest may be overridden or not
            section = getpkgvalue(pkginfo, 'SECTION', pkg, "")
            summary = getpkgvalue(pkginfo, 'SUMMARY', pkg, "")
            rdep = getpkgvalue(pkginfo, 'RDEPENDS', pkg, "")
            rrec = getpkgvalue(pkginfo, 'RRECOMMENDS', pkg, "")
            rprov = getpkgvalue(pkginfo, 'RPROVIDES', pkg, "")
            for i in rprov.split():
                self.rprov_pkg[i] = pkg

            allow_empty = getpkgvalue(pkginfo, 'ALLOW_EMPTY', pkg, "")

            if pkgsize == "0" and not allow_empty:
                continue

            # pkgsize is in KB
            size = HobPage._size_to_string(HobPage._string_to_size(pkgsize + ' KB'))

            it = self.append(pniter)
            self.pkg_path[pkg] = self.get_path(it)
            self.set(it, self.COL_NAME, pkg, self.COL_VER, pkgv,
                     self.COL_REV, pkgr, self.COL_RNM, pkg_rename,
                     self.COL_SEC, section, self.COL_SUM, summary,
                     self.COL_RDEP, rdep + ' ' + rrec,
                     self.COL_RPROV, rprov, self.COL_SIZE, size,
                     self.COL_BINB, "", self.COL_INC, False, self.COL_FONT, '10')
    def populate(self, pkginfolist):
        # First clear the model, in case repopulating
        self.clear()

        def getpkgvalue(pkgdict, key, pkgname, defaultval=None):
            value = pkgdict.get('%s_%s' % (key, pkgname), None)
            if not value:
                value = pkgdict.get(key, defaultval)
            return value

        for pkginfo in pkginfolist:
            pn = pkginfo['PN']
            pv = pkginfo['PV']
            pr = pkginfo['PR']
            pkg = pkginfo['PKG']
            pkgv = getpkgvalue(pkginfo, 'PKGV', pkg)
            pkgr = getpkgvalue(pkginfo, 'PKGR', pkg)
            # PKGSIZE is artificial, will always be overridden with the package name if present
            pkgsize = pkginfo.get('PKGSIZE_%s' % pkg, "0")
            # PKG_%s is the renamed version
            pkg_rename = pkginfo.get('PKG_%s' % pkg, "")
            # The rest may be overridden or not
            section = getpkgvalue(pkginfo, 'SECTION', pkg, "")
            summary = getpkgvalue(pkginfo, 'SUMMARY', pkg, "")
            rdep = getpkgvalue(pkginfo, 'RDEPENDS', pkg, "")
            rrec = getpkgvalue(pkginfo, 'RRECOMMENDS', pkg, "")
            rprov = getpkgvalue(pkginfo, 'RPROVIDES', pkg, "")
            files_list = getpkgvalue(pkginfo, 'FILES_INFO', pkg, "")
            for i in rprov.split():
                self.rprov_pkg[i] = pkg

            recipe = pn + '-' + pv + '-' + pr

            allow_empty = getpkgvalue(pkginfo, 'ALLOW_EMPTY', pkg, "")

            if pkgsize == "0" and not allow_empty:
                continue

            # pkgsize is in KB
            size = HobPage._size_to_string(
                HobPage._string_to_size(pkgsize + ' KB'))

            self.set(self.append(), self.COL_NAME, pkg, self.COL_VER, pkgv,
                     self.COL_REV, pkgr, self.COL_RNM, pkg_rename,
                     self.COL_SEC, section, self.COL_SUM, summary,
                     self.COL_RDEP, rdep + ' ' + rrec, self.COL_RPROV, rprov,
                     self.COL_SIZE, size, self.COL_RCP, recipe, self.COL_BINB,
                     "", self.COL_INC, False, self.COL_FONT, '10',
                     self.COL_FLIST, files_list)

        self.pn_path = {}
        it = self.get_iter_first()
        while it:
            pn = self.get_value(it, self.COL_NAME)
            path = self.get_path(it)
            self.pn_path[pn] = path
            it = self.iter_next(it)
Exemple #5
0
    def populate(self, pkginfolist):
        # First clear the model, in case repopulating
        self.clear()

        def getpkgvalue(pkgdict, key, pkgname, defaultval = None):
            value = pkgdict.get('%s_%s' % (key, pkgname), None)
            if not value:
                value = pkgdict.get(key, defaultval)
            return value

        for pkginfo in pkginfolist:
            pn = pkginfo['PN']
            pv = pkginfo['PV']
            pr = pkginfo['PR']
            pkg = pkginfo['PKG']
            pkgv = getpkgvalue(pkginfo, 'PKGV', pkg)
            pkgr = getpkgvalue(pkginfo, 'PKGR', pkg)
            # PKGSIZE is artificial, will always be overridden with the package name if present
            pkgsize = pkginfo.get('PKGSIZE_%s' % pkg, "0")
            # PKG_%s is the renamed version
            pkg_rename = pkginfo.get('PKG_%s' % pkg, "")
            # The rest may be overridden or not
            section = getpkgvalue(pkginfo, 'SECTION', pkg, "")
            summary = getpkgvalue(pkginfo, 'SUMMARY', pkg, "")
            rdep = getpkgvalue(pkginfo, 'RDEPENDS', pkg, "")
            rrec = getpkgvalue(pkginfo, 'RRECOMMENDS', pkg, "")
            rprov = getpkgvalue(pkginfo, 'RPROVIDES', pkg, "")
            files_list = getpkgvalue(pkginfo, 'FILES_INFO', pkg, "")
            for i in rprov.split():
                self.rprov_pkg[i] = pkg

            recipe = pn + '-' + pv + '-' + pr

            allow_empty = getpkgvalue(pkginfo, 'ALLOW_EMPTY', pkg, "")

            if pkgsize == "0" and not allow_empty:
                continue

            # pkgsize is in KB
            size = HobPage._size_to_string(HobPage._string_to_size(pkgsize + ' KB'))

            self.set(self.append(), self.COL_NAME, pkg, self.COL_VER, pkgv,
                     self.COL_REV, pkgr, self.COL_RNM, pkg_rename,
                     self.COL_SEC, section, self.COL_SUM, summary,
                     self.COL_RDEP, rdep + ' ' + rrec,
                     self.COL_RPROV, rprov, self.COL_SIZE, size,
                     self.COL_RCP, recipe, self.COL_BINB, "",
                     self.COL_INC, False, self.COL_FONT, '10', self.COL_FLIST, files_list)

        self.pn_path = {}
        it = self.get_iter_first()
        while it:
            pn = self.get_value(it, self.COL_NAME)
            path = self.get_path(it)
            self.pn_path[pn] = path
            it = self.iter_next(it)
Exemple #6
0
    def populate(self, pkginfolist):
        self.clear()
        self.pkgs_size = 0
        self.pn_path = {}
        self.pkg_path = {}
        self.rprov_pkg = {}

        for pkginfo in pkginfolist:
            pn = pkginfo['PN']
            pv = pkginfo['PV']
            pr = pkginfo['PR']
            if pn in self.pn_path.keys():
                pniter = self.get_iter(self.pn_path[pn])
            else:
                pniter = self.append(None)
                self.set(pniter, self.COL_NAME, pn + '-' + pv + '-' + pr,
                                 self.COL_INC, False)
                self.pn_path[pn] = self.get_path(pniter)

            pkg = pkginfo['PKG']
            pkgv = pkginfo['PKGV']
            pkgr = pkginfo['PKGR']
            pkgsize = pkginfo['PKGSIZE_%s' % pkg] if 'PKGSIZE_%s' % pkg in pkginfo.keys() else "0"
            pkg_rename = pkginfo['PKG_%s' % pkg] if 'PKG_%s' % pkg in pkginfo.keys() else ""
            section = pkginfo['SECTION_%s' % pkg] if 'SECTION_%s' % pkg in pkginfo.keys() else ""
            summary = pkginfo['SUMMARY_%s' % pkg] if 'SUMMARY_%s' % pkg in pkginfo.keys() else ""
            rdep = pkginfo['RDEPENDS_%s' % pkg] if 'RDEPENDS_%s' % pkg in pkginfo.keys() else ""
            rrec = pkginfo['RRECOMMENDS_%s' % pkg] if 'RRECOMMENDS_%s' % pkg in pkginfo.keys() else ""
            rprov = pkginfo['RPROVIDES_%s' % pkg] if 'RPROVIDES_%s' % pkg in pkginfo.keys() else ""
            for i in rprov.split():
                self.rprov_pkg[i] = pkg

            if 'ALLOW_EMPTY_%s' % pkg in pkginfo.keys():
                allow_empty = pkginfo['ALLOW_EMPTY_%s' % pkg]
            elif 'ALLOW_EMPTY' in pkginfo.keys():
                allow_empty = pkginfo['ALLOW_EMPTY']
            else:
                allow_empty = ""

            if pkgsize == "0" and not allow_empty:
                continue

            # pkgsize is in KB
            size = HobPage._size_to_string(HobPage._string_to_size(pkgsize + ' KB'))

            it = self.append(pniter)
            self.pkg_path[pkg] = self.get_path(it)
            self.set(it, self.COL_NAME, pkg, self.COL_VER, pkgv,
                     self.COL_REV, pkgr, self.COL_RNM, pkg_rename,
                     self.COL_SEC, section, self.COL_SUM, summary,
                     self.COL_RDEP, rdep + ' ' + rrec,
                     self.COL_RPROV, rprov, self.COL_SIZE, size,
                     self.COL_BINB, "", self.COL_INC, False, self.COL_FONT, '10')
Exemple #7
0
    def get_packages_size(self):
        packages_size = 0
        it = self.get_iter_first()
        while it:
            if self.get_value(it, self.COL_INC):
                str_size = self.get_value(it, self.COL_SIZE)
                if not str_size:
                    continue

                packages_size += HobPage._string_to_size(str_size)

            it = self.iter_next(it)
        return packages_size
Exemple #8
0
    def get_packages_size(self):
        packages_size = 0
        it = self.get_iter_first()
        while it:
            if self.get_value(it, self.COL_INC):
                str_size = self.get_value(it, self.COL_SIZE)
                if not str_size:
                    continue

                packages_size += HobPage._string_to_size(str_size)

            it = self.iter_next(it)
        return packages_size