当前位置: 首页>>代码示例>>Python>>正文


Python Filter.printError方法代码示例

本文整理汇总了Python中Filter.printError方法的典型用法代码示例。如果您正苦于以下问题:Python Filter.printError方法的具体用法?Python Filter.printError怎么用?Python Filter.printError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Filter的用法示例。


在下文中一共展示了Filter.printError方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check_file

# 需要导入模块: import Filter [as 别名]
# 或者: from Filter import printError [as 别名]
    def check_file(self, pkg, filename):
        if filename.startswith('/usr/lib/debug') or pkg.isSource():
            return
        if not stat.S_ISREG(pkg.files()[filename].mode):
            return

        if len(pkg.grep(self.build_root_re, filename)):
            Filter.printError(pkg, "file-contains-buildroot", filename)
开发者ID:jsegitz,项目名称:rpmlint-checks,代码行数:10,代码来源:CheckBuildRoot.py

示例2: check

# 需要导入模块: import Filter [as 别名]
# 或者: from Filter import printError [as 别名]
    def check(self, pkg):
        ghosts = pkg.ghostFiles()
        for filename in pkg.files():
            if filename in ghosts:
                continue

            if not stat.S_ISREG(pkg.files()[filename].mode):
                continue

            if wrong_compression(os.path.join(pkg.dirname, filename)):
                Filter.printError(pkg, 'files-wrong-compression', filename)
开发者ID:bmwiedemann,项目名称:rpmlint-checks,代码行数:13,代码来源:CompressionCheck.py

示例3: check_file

# 需要导入模块: import Filter [as 别名]
# 或者: from Filter import printError [as 别名]
    def check_file(self, pkg, filename):
        if pkg.isSource() or not stat.S_ISREG(pkg.files()[filename].mode):
            return

        if pkg.grep(self.suspicious_dir, filename):
            Filter.printError(pkg, "invalid-pkgconfig-file", filename)

        pc_file = file(pkg.dirName() + "/" + filename, "r")
        for l in pc_file:
            if l.startswith('Libs:') and self.wronglib_dir.search(l):
                Filter.printError(pkg, 'pkgconfig-invalid-libs-dir',
                                  filename, l)
开发者ID:StefanBruens,项目名称:rpmlint-checks,代码行数:14,代码来源:CheckPkgConfig.py

示例4: check_file

# 需要导入模块: import Filter [as 别名]
# 或者: from Filter import printError [as 别名]
    def check_file(self, pkg, filename):
        if filename.startswith('/usr/lib/debug') or pkg.isSource():
            return

        if not stat.S_ISREG(pkg.files()[filename].mode):
            return

        grep_date = pkg.grep(self.istoday, filename)

        if len(grep_date):
            grep_time = pkg.grep(self.looksliketime, filename)

            if len(grep_time):
                Filter.printError(pkg, "file-contains-date-and-time", filename)
            else:
                Filter.printWarning(pkg, "file-contains-current-date",
                                    filename)
开发者ID:jsegitz,项目名称:rpmlint-checks,代码行数:19,代码来源:CheckBuildDate.py

示例5: check

# 需要导入模块: import Filter [as 别名]
# 或者: from Filter import printError [as 别名]
    def check(self, pkg):

        if pkg.isSource():
            return

        files = pkg.files()
        complete_size = 0
        lang_size = 0
        for f, pkgfile in files.items():
            if stat.S_ISREG(pkgfile.mode):
                complete_size += pkgfile.size
                if pkgfile.lang != '':
                    lang_size += pkgfile.size

        doc_size = 0
        for f in pkg.docFiles():
            if stat.S_ISREG(files[f].mode):
                doc_size += files[f].size

        if doc_size * 2 >= complete_size and \
           doc_size > 100 * 1024 and \
           (complete_size - doc_size) * 20 > complete_size and \
           not ignore_pkg(pkg.name):
            Filter.printWarning(pkg, "package-with-huge-docs",
                                ("%3d%%" % (doc_size * 100 / complete_size)))

        if lang_size * 2 >= complete_size \
           and lang_size > 100 * 1024 and \
           (complete_size - lang_size) * 20 > complete_size and \
           not lang_ignore_pkg(pkg.name):
            Filter.printWarning(pkg, "package-with-huge-translation",
                                ("%3d%%" % (lang_size * 100 / complete_size)))

        for f in pkg.docFiles():
            mode = files[f].mode
            if not stat.S_ISREG(mode) or not mode & 0o111:
                continue
            for ext in ['txt', 'gif', 'jpg', 'html',
                        'pdf', 'ps', 'pdf.gz', 'ps.gz']:
                if f.endswith("." + ext):
                    Filter.printError(pkg, 'executable-docs', f)

            for name in ['README', 'NEWS', 'COPYING', 'AUTHORS']:
                if f.endswith("/" + name):
                    Filter.printError(pkg, 'executable-docs', f)
开发者ID:jsegitz,项目名称:rpmlint-checks,代码行数:47,代码来源:CheckExecDocs.py

示例6: check

# 需要导入模块: import Filter [as 别名]
# 或者: from Filter import printError [as 别名]
    def check(self, pkg):

        if pkg.isSource():
            return

        md5s = {}
        sizes = {}
        files = pkg.files()
        configFiles = pkg.configFiles()

        for f, pkgfile in files.items():
            if f in pkg.ghostFiles():
                continue

            if not stat.S_ISREG(pkgfile.mode):
                continue

            md5s.setdefault(pkgfile.md5, set()).add(f)
            sizes[pkgfile.md5] = pkgfile.size

        sum = 0
        for f in md5s:
            duplicates = md5s[f]
            if len(duplicates) == 1:
                continue

            one = duplicates.pop()
            one_is_config = False
            if one in configFiles:
                one_is_config = True

            partition = get_prefix(one)

            st = os.stat(pkg.dirName() + '/' + one)
            diff = 1 + len(duplicates) - st[stat.ST_NLINK]
            if diff <= 0:
                for dupe in duplicates:
                    if partition != get_prefix(dupe):
                        Filter.printError(pkg, "hardlink-across-partition",
                                          one, dupe)
                    if one_is_config and dupe in configFiles:
                        Filter.printError(pkg, "hardlink-across-config-files",
                                          one, dupe)
                continue

            for dupe in duplicates:
                if partition != get_prefix(dupe):
                    diff = diff - 1
            sum += sizes[f] * diff
            if sizes[f] and diff > 0:
                Filter.printWarning(pkg, 'files-duplicate', one,
                                    ":".join(duplicates))

        if sum > 100000:
            Filter.printError(pkg, 'files-duplicated-waste', sum)
开发者ID:StefanBruens,项目名称:rpmlint-checks,代码行数:57,代码来源:DuplicatesCheck.py

示例7: check

# 需要导入模块: import Filter [as 别名]
# 或者: from Filter import printError [as 别名]
    def check(self, pkg):

        if pkg.isSource():
            return
        files = pkg.files()
        for f in files:
            if f in pkg.ghostFiles():
                continue
            md5 = files[f].md5

            if len(md5) and md5 in (
                    'c59cbaf0df9bcf35feca0d0f1fc01dae',
                    'cf8c4d1a5ab88db006c47ae2b51a6b30',
                    '5d4638159851671944108691f23e4f28',
                    '0d6be33865b76025c20b48bcac87adb7'):
                Filter.printError(pkg, "generic-build-instructions", f)

            # bnc 379919
            # if len(md5) and md5 in (
            #        '94d55d512a9ba36caa9b7df079bae19f'):
            #    printError(pkg, "duplicated-file-gpl-v2", f)

            # if len(md5) and md5 in (
            #        'd32239bcb673463ab874e80d47fae504'):
            #    printError(pkg, "duplicated-file-gpl-v3", f)

            # bsd causes the false positive COPYING.BSD
            if (len(md5) and f.rsplit('/', 1)[1][0].lower() == 'r' and
                f.rsplit('.', 1)[-1].lower() in (
                    'aix', 'bsd', 'dos', 'hpux', 'irix', 'os2', 'mac', 'macos',
                    'tru64', 'sco', 'vms', 'win32', 'win', 'solaris')):
                Filter.printWarning(pkg, "non-linux-readme", f)

            if (f.endswith("/Makefile.am") and f[:-3] + ".in" in files and
                    f in pkg.docFiles()):
                if not len(pkg.grep(self.sources_am_re, f)):
                    Filter.printError(pkg, "makefile-junk", f)
                    Filter.printError(pkg, "makefile-junk", f[:-3] + ".in")
                    if f[:-3] in files:
                        Filter.printError(pkg, "makefile-junk", f[:-3])
开发者ID:jsegitz,项目名称:rpmlint-checks,代码行数:42,代码来源:CheckCommonFiles.py


注:本文中的Filter.printError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。