(completes the fix for #165839). - Skip some checks for binaries not understood by objdump (#165173). - Improve long descriptions of some script warnings. - Fix command output parsing in non-English locales. - Import Enrico's latest DocFilesCheck (with some local tweaks). - Use rm instead of %exclude. Wed Nov 16 2005 Ville Skyttä <ville.skytta at iki.fi> - Add DocFilesCheck from Enrico Scholz. Sat Sep 3 2005 Ville Skyttä <ville.skytta at iki.fi> - Improve accuracy of doc, info and games path regexps. - Improve error message when invoked on non-rpm files. - Filter more Mandriva specific warnings.
85 lines
3.0 KiB
Diff
85 lines
3.0 KiB
Diff
--- BinariesCheck.py 17 Jun 2005 09:10:36 -0000 1.32
|
|
+++ BinariesCheck.py 20 Nov 2005 17:42:33 -0000
|
|
@@ -32,7 +32,8 @@
|
|
pic_regex=re.compile('^\s+\d+\s+\.rela?\.(data|text)')
|
|
non_pic_regex=re.compile('TEXTREL', re.MULTILINE)
|
|
|
|
- def __init__(self, path, file):
|
|
+ def __init__(self, pkg, path, file):
|
|
+ self.error=0
|
|
self.needed=[]
|
|
self.rpath=[]
|
|
self.comment=0
|
|
@@ -40,9 +41,9 @@
|
|
self.soname=0
|
|
self.non_pic=1
|
|
|
|
- res=commands.getoutput('objdump --headers --private-headers -T ' + path)
|
|
- if res:
|
|
- for l in string.split(res, '\n'):
|
|
+ res=commands.getstatusoutput('objdump --headers --private-headers -T ' + path)
|
|
+ if not res[0]:
|
|
+ for l in string.split(res[1], '\n'):
|
|
needed=BinaryInfo.needed_regex.search(l)
|
|
if needed:
|
|
self.needed.append(needed.group(1))
|
|
@@ -57,16 +58,14 @@
|
|
self.dynsyms=1
|
|
elif BinaryInfo.pic_regex.search(l):
|
|
self.non_pic=0
|
|
- else:
|
|
- r=BinaryInfo.unrecognized_regex.search(l)
|
|
- if r:
|
|
- sys.stderr.write('file format not recognized for %s in %s\n' % (r.group(1), file))
|
|
- #sys.exit(1)
|
|
r=BinaryInfo.soname_regex.search(l)
|
|
if r:
|
|
self.soname=r.group(1)
|
|
if self.non_pic:
|
|
- self.non_pic=BinaryInfo.non_pic_regex.search(res)
|
|
+ self.non_pic=BinaryInfo.non_pic_regex.search(res[1])
|
|
+ else:
|
|
+ self.error=1
|
|
+ printWarning(pkg, 'objdump-failed', res[1])
|
|
|
|
path_regex=re.compile('(.*/)([^/]+)')
|
|
numeric_dir_regex=re.compile('/usr(?:/share)/man/man./(.*)\.[0-9](?:\.gz|\.bz2)')
|
|
@@ -156,12 +155,14 @@
|
|
printWarning(pkg, 'unstripped-binary-or-object', i[0])
|
|
|
|
# inspect binary file
|
|
- bin_info=BinaryInfo(pkg.dirName()+i[0], i[0])
|
|
+ bin_info=BinaryInfo(pkg, pkg.dirName()+i[0], i[0])
|
|
|
|
# so name in library
|
|
if so_regex.search(i[0]):
|
|
has_lib.append(i[0])
|
|
- if not bin_info.soname:
|
|
+ if bin_info.error:
|
|
+ pass
|
|
+ elif not bin_info.soname:
|
|
printWarning(pkg, 'no-soname', i[0])
|
|
else:
|
|
if not validso_regex.search(bin_info.soname):
|
|
@@ -201,7 +202,9 @@
|
|
if is_exec and bin_regex.search(i[0]):
|
|
exec_files.append(i[0])
|
|
|
|
- if not bin_info.needed and \
|
|
+ if bin_info.error:
|
|
+ pass
|
|
+ elif not bin_info.needed and \
|
|
not (bin_info.soname and \
|
|
ldso_soname_regex.search(bin_info.soname)):
|
|
if shared_object_regex.search(i[1]):
|
|
@@ -333,6 +336,9 @@
|
|
'only-non-binary-in-usr-lib',
|
|
'''There are only non binary files in /usr/lib so they should be in /usr/share.''',
|
|
|
|
+'objdump-failed',
|
|
+'''Running objdump on some files failed, all checks could not be done.''',
|
|
+
|
|
)
|
|
|
|
# BinariesCheck.py ends here
|