本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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])