From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QgknC-0002OS-QI for garchives@archives.gentoo.org; Tue, 12 Jul 2011 21:46:59 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5A6DE21C0E4; Tue, 12 Jul 2011 21:45:26 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1ED3221C0E4 for ; Tue, 12 Jul 2011 21:45:26 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7F82D2AC229 for ; Tue, 12 Jul 2011 21:45:25 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 7C2798004C for ; Tue, 12 Jul 2011 21:45:24 +0000 (UTC) From: "Paul Varner" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Paul Varner" Message-ID: <016a60ce9a134f1dba61bcbae6e0b5a286cf6c90.fuzzyray@gentoo> Subject: [gentoo-commits] proj/gentoolkit:gentoolkit commit in: pym/gentoolkit/revdep_rebuild/ X-VCS-Repository: proj/gentoolkit X-VCS-Files: pym/gentoolkit/revdep_rebuild/revdep-rebuild.py X-VCS-Directories: pym/gentoolkit/revdep_rebuild/ X-VCS-Committer: fuzzyray X-VCS-Committer-Name: Paul Varner X-VCS-Revision: 016a60ce9a134f1dba61bcbae6e0b5a286cf6c90 Date: Tue, 12 Jul 2011 21:45:24 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: bccf634d721b911806c812a204f05cc7 commit: 016a60ce9a134f1dba61bcbae6e0b5a286cf6c90 Author: lis.slawek 5234894e-44cd-11de-9a4c-a76526a19= 3c6> AuthorDate: Thu Nov 18 07:26:14 2010 +0000 Commit: Paul Varner gentoo org> CommitDate: Tue Jul 12 21:29:00 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoolkit.gi= t;a=3Dcommit;h=3D016a60ce Fixed problem with 32/64 bit libraries and binaries git-svn-id: http://genscripts.googlecode.com/svn/trunk/gentoolkit@484 523= 4894e-44cd-11de-9a4c-a76526a193c6 --- pym/gentoolkit/revdep_rebuild/revdep-rebuild.py | 44 +++++++++++++++++= +----- 1 files changed, 35 insertions(+), 9 deletions(-) diff --git a/pym/gentoolkit/revdep_rebuild/revdep-rebuild.py b/pym/gentoo= lkit/revdep_rebuild/revdep-rebuild.py index fb864da..0bc006e 100755 --- a/pym/gentoolkit/revdep_rebuild/revdep-rebuild.py +++ b/pym/gentoolkit/revdep_rebuild/revdep-rebuild.py @@ -20,11 +20,12 @@ import stat import time import glob import portage +import platform from portage import portdb from portage.output import bold, red, blue, yellow, green, nocolor =20 APP_NAME =3D sys.argv[0] -VERSION =3D '0.1-r2' +VERSION =3D '0.1-r3' =20 =20 __productname__ =3D "revdep-ng" @@ -342,14 +343,15 @@ def _match_str_in_list(lst, stri): return False =20 =20 -def prepare_checks(files_to_check, libraries): - ''' Calls scanelf for all files_to_check, then returns found librari= es and dependencies ''' +def prepare_checks(files_to_check, libraries, bits): + ''' Calls scanelf for all files_to_check, then returns found librari= es and dependencies + ''' =20 libs =3D [] # libs found by scanelf dependencies =3D [] # list of lists of files (from file_to_check) th= at uses # library (for dependencies[id] and libs[id] =3D> = id=3D=3Did) =20 - for line in call_program(['scanelf', '-nBF', '%F %n',]+files_to_chec= k).strip().split('\n'): + for line in call_program(['scanelf', '-M', str(bits), '-nBF', '%F %n= ',]+files_to_check).strip().split('\n'): r =3D line.strip().split(' ') if len(r) < 2: # no dependencies? continue @@ -368,6 +370,9 @@ def prepare_checks(files_to_check, libraries): def extract_dependencies_from_la(la, libraries, to_check): broken =3D [] for f in la: + if not os.path.exists(f): + continue + for line in open(f, 'r').readlines(): line =3D line.strip() if line.startswith('dependency_libs=3D'): @@ -417,7 +422,6 @@ def find_broken(found_libs, system_libraries, to_chec= k): for f in found_libs: if tc in f and f+'|' not in sl: broken.append(found_libs.index(f)) - #print broken =20 return broken =20 @@ -596,10 +600,32 @@ def analyse(output=3Dprint_v, libraries=3DNone, la_= libraries=3DNone, libraries_links=3DN output(2,'Search for ' + str(len(binaries)+len(libraries)) + ' withi= n ' + str(len(libraries)+len(libraries_links))) libs_and_bins =3D libraries+binaries =20 - found_libs, dependencies =3D prepare_checks(libs_and_bins, libraries= +libraries_links) + #l =3D [] + #for line in call_program(['scanelf', '-M', '64', '-BF', '%F',] + li= braries).strip().split('\n'): + #l.append(line) + #libraries =3D l + + found_libs =3D [] + dependencies =3D [] + + + _bits, linkg =3D platform.architecture() + if _bits.startswith('32'): + bits =3D 32 + elif _bits.startswith('64'): + bits =3D 64 + + for av_bits in glob.glob('/lib[0-9]*'): + bits =3D int(av_bits[4:]) + _libraries =3D call_program(['scanelf', '-M', str(bits), '-BF', = '%F',] + libraries+libraries_links).strip().split('\n') + + found_libs, dependencies =3D prepare_checks(libs_and_bins, _libr= aries, bits) + + broken =3D find_broken(found_libs, _libraries, _libs_to_check) + broken_la =3D extract_dependencies_from_la(la_libraries, _librar= ies, _libs_to_check) =20 - broken =3D find_broken(found_libs, libraries+libraries_links, _libs_= to_check) - broken_la =3D extract_dependencies_from_la(la_libraries, libraries+l= ibraries_links, _libs_to_check) + bits /=3D 2 + bits =3D int(bits) =20 broken_pathes =3D main_checks(found_libs, broken, dependencies) broken_pathes +=3D broken_la @@ -646,7 +672,7 @@ if __name__ =3D=3D "__main__": opts, args =3D getopt.getopt(sys.argv[1:], 'dehiklopqvCL:P', ['n= ocolor', 'debug', 'exact', 'help', 'ignore',\ 'keep-temp', 'library=3D', 'no-ld-path', 'no-order', 'preten= d', 'no-pretend', 'no-progress', 'quiet', 'verbose']) =20 - for key,val in opts: + for key, val in opts: if key in ('-h', '--help'): print_usage() sys.exit(0)