public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Paul Varner" <fuzzyray@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoolkit:master commit in: /
Date: Thu, 15 Oct 2015 16:44:17 +0000 (UTC)	[thread overview]
Message-ID: <1390301312.4335bf979f374300ac6678765f490f92ee805ab4.fuzzyray@gentoo> (raw)

commit:     4335bf979f374300ac6678765f490f92ee805ab4
Author:     slis <lis.slawek <AT> gmail <DOT> com>
AuthorDate: Tue Jan 21 10:48:32 2014 +0000
Commit:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Jan 21 10:48:32 2014 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=4335bf97

Merged revdep-rebuild branch

 bin/{enalyze => revdep-ng}                      |   9 +-
 pym/gentoolkit/revdep_rebuild/analyse.py        | 200 +++++++++++++++++-------
 pym/gentoolkit/revdep_rebuild/assign.py         |  23 ++-
 pym/gentoolkit/revdep_rebuild/cache.py          |  50 +++---
 pym/gentoolkit/revdep_rebuild/collect.py        |  33 ++--
 pym/gentoolkit/revdep_rebuild/rebuild.py        |  30 ++--
 pym/gentoolkit/revdep_rebuild/revdep-rebuild.py |  17 ++
 pym/gentoolkit/revdep_rebuild/runner.py         | 114 ++++++++++++++
 pym/gentoolkit/revdep_rebuild/stuff.py          |   4 +
 9 files changed, 364 insertions(+), 116 deletions(-)

diff --cc pym/gentoolkit/revdep_rebuild/analyse.py
index aad8f81,e630bc9..7b17517
--- a/pym/gentoolkit/revdep_rebuild/analyse.py
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py
@@@ -19,33 -14,35 +19,39 @@@ from .cache import save_cach
  
  
  def prepare_checks(files_to_check, libraries, bits, cmd_max_args):
 -	''' Calls scanelf for all files_to_check, then returns found libraries and dependencies
 +	''' Calls scanelf for all files_to_check,
 +	then returns found libraries and dependencies
  	'''
  
 -	libs = [] # libs found by scanelf
 -	dependencies = [] # list of lists of files (from file_to_check) that uses
 -					  # library (for dependencies[id] and libs[id] => id==id)
 +	# libs found by scanelf
 +	libs = []
 +	# list of lists of files (from file_to_check) that uses
 +	# library (for dependencies[id] and libs[id] => id==id)
 +	dependencies = []
- 	for line in scan(
- 		['-M', str(bits), '-nBF', '%F %n'],
- 		files_to_check, cmd_max_args
- 		):
 +
- 		parts = line.strip().split(' ')
- 		if len(parts) < 2: # no dependencies?
+ 	bits = []
+ 
+ 
+ #	from runner import ScanRunner
+ #	sr = ScanRunner(['-M', str(bits), '-nBF', '%F %n'], files_to_check, cmd_max_args)
+ #	sr.wait()
+ 
+ 	for line in scan(['-M', str(bits), '-nBF', '%F %n %M'], files_to_check, cmd_max_args):
+ 	#call_program(['scanelf', '-M', str(bits), '-nBF', '%F %n',]+files_to_check).strip().split('\n'):
+ 		r = line.strip().split(' ')
+ 		if len(r) < 2: # no dependencies?
  			continue
  
- 		deps = parts[1].split(',')
- 		for dep in deps:
- 			if dep in libs:
- 				index = libs.index(dep)
- 				dependencies[index].append(parts[0])
+ 		deps = r[1].split(',')
+ 		for d in deps:
+ 			if d in libs:
+ 				i = libs.index(d)
+ 				dependencies[i].append(r[0])
  			else:
- 				libs.append(dep)
- 				dependencies.append([parts[0],])
- 
+ 				#print d, 'bits:', r[2][8:] # 8: -> strlen('ELFCLASS')
+ 				libs.append(d)
+ 				dependencies.append([r[0],])
+ 	
  	return (libs, dependencies)
  
  
@@@ -122,21 -136,40 +149,40 @@@ def find_broken(found_libs, system_libr
  	return broken
  
  
+ def find_broken2(scanned_files, logger):
+ 	broken_libs = {}
+ 	for bits, libs in scanned_files.items():
+ 		logger.debug('Checking for bits: %s' % bits)
+ 		alllibs = '|'.join(libs.keys()) + '|'
+ 		for soname, needed in libs.items():
+ 			for l in needed[1]:
+ 				if not l+'|' in alllibs:
+ 					try:
+ 						broken_libs[bits][l].add(soname)
+ 					except KeyError:
+ 						try:
+ 							broken_libs[bits][l] = set([soname])
+ 						except KeyError:
+ 							broken_libs = {bits: {l: set([soname])}}
+ 
+ 	return broken_libs
+ 
+ 
 -def main_checks(found_libs, broken, dependencies, logger):
 +def main_checks(found_libs, broken_list, dependencies, logger):
  	''' Checks for broken dependencies.
  		found_libs have to be the same as returned by prepare_checks
 -		broken is list of libraries found by scanelf
 +		broken_list is list of libraries found by scanelf
  		dependencies is the value returned by prepare_checks
  	'''
  
  	broken_pathes = []
  
 -	for b in broken:
 -		f = found_libs[b]
 +	for broken in broken_list:
 +		found = found_libs[broken]
- 		logger.info('Broken files that requires: ' + bold(found))
+ 		logger.info('Broken files that requires: ' + bold(f))
 -		for d in dependencies[b]:
 -			logger.info(yellow(' * ') + d)
 -			broken_pathes.append(d)
 +		for dep_path in dependencies[broken]:
 +			logger.info(yellow(' * ') + dep_path)
 +			broken_pathes.append(dep_path)
  	return broken_pathes
  
  
@@@ -152,31 -197,20 +210,32 @@@ def analyse(settings, logger, libraries
  	"""
  
  	if libraries and la_libraries and libraries_links and binaries:
 -		logger.info(blue(' * ') + bold('Found a valid cache, skipping collecting phase'))
 +		logger.info(blue(' * ') +
 +			bold('Found a valid cache, skipping collecting phase'))
  	else:
 -		#TODO: add partial cache (for ex. only libraries) when found for some reason
 +		#TODO: add partial cache (for ex. only libraries)
 +		# when found for some reason
  
 -		logger.warn(green(' * ') + bold('Collecting system binaries and libraries'))
 +		logger.warn(green(' * ') +
 +			bold('Collecting system binaries and libraries'))
  		bin_dirs, lib_dirs = prepare_search_dirs(logger, settings)
  
 -		masked_dirs, masked_files, ld = parse_revdep_config(settings['REVDEP_CONFDIR'])
 +		masked_dirs, masked_files, ld = \
 +			parse_revdep_config(settings['REVDEP_CONFDIR'])
- 		lib_dirs.update(ld)
- 		bin_dirs.update(ld)
- 		masked_dirs.update([
- 			'/lib/modules',
- 			'/lib32/modules',
- 			'/lib64/modules'
- 			]
- 			)
+ 		lib_dirs = lib_dirs.union(ld)
+ 		bin_dirs = bin_dirs.union(ld)
 -		masked_dirs = masked_dirs.union(set(['/lib/modules', '/lib32/modules', '/lib64/modules',]))
 -
 -		logger.info(green(' * ') + bold('Collecting dynamic linking informations'))
 -		libraries, la_libraries, libraries_links, symlink_pairs = collect_libraries_from_dir(lib_dirs, masked_dirs, logger)
++		masked_dirs = masked_dirs.union(
++			set([
++				'/lib/modules',
++				'/lib32/modules',
++				'/lib64/modules',
++			])
++		)
 +
 +		logger.info(green(' * ') +
 +			bold('Collecting dynamic linking informations'))
 +		libraries, la_libraries, libraries_links, symlink_pairs = \
 +			collect_libraries_from_dir(lib_dirs, masked_dirs, logger)
  		binaries = collect_binaries_from_dir(bin_dirs, masked_dirs, logger)
  
  		if settings['USE_TMP_FILES']:
@@@ -188,56 -222,75 +247,79 @@@
  			)
  
  
- 	logger.debug('Found '+ str(len(libraries)) +
- 		' libraries (+' + str(len(libraries_links)) +
- 		' symlinks) and ' + str(len(binaries)) +
- 		' binaries')
 -	logger.debug('Found '+ str(len(libraries)) + ' libraries (+' + str(len(libraries_links)) + ' symlinks) and ' + str(len(binaries)) + ' binaries')
++	logger.debug('Found %i libraries (+%i symlinks) and %i binaries' % 
++		(len(libraries), len(libraries_links), len(binaries))
++	)
+ 	logger.info(green(' * ') + bold('Scanning files'))
+ 	
+ 	libs_and_bins = libraries+binaries
  
+ 	scanned_files = scan_files(libs_and_bins, settings['CMD_MAX_ARGS'])
+ 	
  	logger.warn(green(' * ') + bold('Checking dynamic linking consistency'))
- 	logger.debug('Search for ' + str(len(binaries)+len(libraries)) +
- 		' within ' + str(len(libraries)+len(libraries_links)))
- 	libs_and_bins = libraries+binaries
 -	logger.debug('Search for ' + str(len(binaries)+len(libraries)) + ' within ' + str(len(libraries)+len(libraries_links)))
++	logger.debug('Search for %i within %i' % 
++		(len(binaries)+len(libraries), len(libraries)+len(libraries_links))
++	)
+ 	
+ 	broken = find_broken2(scanned_files, logger)
+ 	broken_pathes = main_checks2(broken, scanned_files, logger)
+ 	
+ 	broken_la = extract_dependencies_from_la(la_libraries, libraries+libraries_links, _libs_to_check, logger)
+ 	broken_pathes += broken_la
  
- 	found_libs = []
- 	dependencies = []
+ 	logger.warn(green(' * ') + bold('Assign files to packages'))
+ 
+ 	return assign_packages(broken_pathes, logger, settings)
  
- 	if _libs_to_check:
- 		nltc = []
- 		for ltc in _libs_to_check:
- 			if os.path.isfile(ltc):
- 				ltc = scan(['-nBSF', '%S'], [ltc,], settings['CMD_MAX_ARGS'])[0].split()[0]
- 			nltc += [ltc,]
- 		_libs_to_check = nltc
+ 	import sys
+ 	sys.exit()
+ 	
+ 	#l = []
+ 	#for line in call_program(['scanelf', '-M', '64', '-BF', '%F',] + libraries).strip().split('\n'):
+ 		#l.append(line)
+ 	#libraries = l
  
- 	_bits, linkg = platform.architecture()
- 	if _bits.startswith('32'):
- 		bits = 32
- 	elif _bits.startswith('64'):
- 		bits = 64
+ 	## old version from here
+ 	#found_libs = []
+ 	#dependencies = []
  
- 	broken = []
- 	for av_bits in glob.glob('/lib[0-9]*') or ('/lib32',):
- 		bits = int(av_bits[4:])
+ 	#if _libs_to_check:
+ 		#nltc = []
+ 		#for ltc in _libs_to_check:
+ 			#if os.path.isfile(ltc):
+ 				#ltc = scan(['-nBSF', '%S'], [ltc,], settings['CMD_MAX_ARGS'])[0].split()[0]
+ 			#nltc += [ltc,]
+ 		#_libs_to_check = nltc
  
- 		_libraries = libraries+libraries_links
+ 	#_bits, linkg = platform.architecture()
+ 	#if _bits.startswith('32'):
+ 		#bits = 32
+ 	#elif _bits.startswith('64'):
+ 		#bits = 64
  
- 		found_libs, dependencies = prepare_checks(libs_and_bins,
- 			_libraries, bits, settings['CMD_MAX_ARGS'])
- 		broken = find_broken(found_libs, _libraries, _libs_to_check)
+ 	#import time
+ 	#broken = []
+ 	#for av_bits in glob.glob('/lib[0-9]*') or ('/lib32',):
+ 		#bits = int(av_bits[4:])
  
- 		bits /= 2
- 		bits = int(bits)
+ 		##_libraries = scan(['-M', str(bits), '-BF', '%F'], libraries+libraries_links, settings['CMD_MAX_ARGS'])
+ 		#_libraries = libraries+libraries_links
  
- 	broken_la = extract_dependencies_from_la(la_libraries,
- 		libraries+libraries_links, _libs_to_check, logger)
+ 		#found_libs, dependencies = prepare_checks(libs_and_bins, _libraries, bits, settings['CMD_MAX_ARGS'])
+ 		#broken = find_broken(found_libs, _libraries, _libs_to_check)
  
+ 		#bits /= 2
+ 		#bits = int(bits)
  
- 	broken_pathes = main_checks(found_libs, broken, dependencies, logger)
- 	broken_pathes += broken_la
+ 	#broken_la = extract_dependencies_from_la(la_libraries, libraries+libraries_links, _libs_to_check, logger)
  
- 	logger.warn(green(' * ') + bold('Assign files to packages'))
  
- 	return assign_packages(broken_pathes, logger, settings)
+ 	#broken_pathes = main_checks(found_libs, broken, dependencies, logger)
+ 	#broken_pathes += broken_la
+ 
+ 	#logger.warn(green(' * ') + bold('Assign files to packages'))
+ 
+ 	#return assign_packages(broken_pathes, logger, settings)
  
  
  
diff --cc pym/gentoolkit/revdep_rebuild/assign.py
index e8e87b3,bb9ec1f..2a93fe1
--- a/pym/gentoolkit/revdep_rebuild/assign.py
+++ b/pym/gentoolkit/revdep_rebuild/assign.py
@@@ -27,34 -13,26 +27,49 @@@ def assign_packages(broken, logger, set
  		Broken is list of files
  	'''
  	assigned = set()
- 	if not broken:
- 		return assigned
+ 	for group in os.listdir(settings['PKG_DIR']):
+ 		for pkg in os.listdir(settings['PKG_DIR'] + group):
+ 			f = settings['PKG_DIR'] + group + '/' + pkg + '/CONTENTS'
+ 			if os.path.exists(f):
+ 				try:
+ 					with open(f, 'r') as cnt:
+ 						for line in cnt.readlines():
+ 							m = re.match('^obj (/[^ ]+)', line)
+ 							if m is not None:
+ 								m = m.group(1)
+ 								if m in broken:
+ 									found = group+'/'+pkg
+ 									if found not in assigned:
+ 										assigned.add(found)
+ 									logger.info('\t' + m + ' -> ' + bold(found))
+ 				except Exception as e:
+ 					logger.warn(red(' !! Failed to read ' + f))
  
- 	pkgset = set(get_installed_cpvs())
+ 	return assigned
  
 +	# Map all files in CONTENTS database to package names
 +	fname_pkg_dict = {}
 +	for pkg in pkgset:
 +		contents = Package(pkg).parsed_contents()
 +		for fname in contents.keys():
 +			if contents[fname][0] == "obj":
 +				fname_pkg_dict[fname] = str(pkg)
 +
 +	for fname in broken:
 +		realname = os.path.realpath(fname)
 +		if realname in fname_pkg_dict.keys():
 +			pkgname = fname_pkg_dict[realname]
 +		elif fname in fname_pkg_dict.keys():
 +			pkgname = fname_pkg_dict[fname]
 +		else:
 +			pkgname = None
 +		if pkgname and pkgname not in assigned:
 +			assigned.add(pkgname)
 +		if not pkgname:
 +			pkgname = "(none)"
 +		logger.info('\t' + fname + ' -> ' + bold(pkgname))
 +
 +	return assigned
  
  def get_best_match(cpv, cp, logger):
  	"""Tries to find another version of the pkg with the same slot
diff --cc pym/gentoolkit/revdep_rebuild/cache.py
index d6ef7ce,8b1a8ed..1be8cb0
--- a/pym/gentoolkit/revdep_rebuild/cache.py
+++ b/pym/gentoolkit/revdep_rebuild/cache.py
@@@ -18,54 -12,42 +18,50 @@@ def read_cache(temp_path=DEFAULTS['DEFA
  		This function does not checks if files exists nor timestamps,
  		check_temp_files should be called first
  		@param temp_path: directory where all temp files should reside
 -		@return tuple with values of: libraries, la_libraries, libraries_links, symlink_pairs, binaries
 +		@return tuple with values of:
 +			libraries, la_libraries, libraries_links, symlink_pairs, binaries
  	'''
  
 -	ret = {'libraries':[], 'la_libraries':[], 'libraries_links':[], 'binaries':[]}
 +	ret = {
 +		'libraries':[],
 +		'la_libraries':[],
 +		'libraries_links':[],
 +		'binaries':[]
 +		}
  	try:
- 		for key, val in list(ret.items()):
- 			_file  = open(os.path.join(temp_path, key))
- 			for line in _file .readlines():
+ 		for key,val in ret.iteritems():
 -			f = open(os.path.join(temp_path, key))
 -			for line in f.readlines():
++			_file = open(os.path.join(temp_path, key))
++			for line in _file.readlines():
  				val.append(line.strip())
  			#libraries.remove('\n')
 -			f.close()
 +			_file .close()
  	except EnvironmentError:
  		pass
  
 -	return (ret['libraries'], ret['la_libraries'], ret['libraries_links'], ret['binaries'])
 +	return (ret['libraries'], ret['la_libraries'],
 +		ret['libraries_links'], ret['binaries'])
  
  
- def save_cache(logger, to_save=None, temp_path=DEFAULTS['DEFAULT_TMP_DIR']):
+ def save_cache(logger, to_save={}, temp_path=DEFAULTS['DEFAULT_TMP_DIR']):
  	''' Tries to store caching information.
  		@param logger
 -		@param to_save have to be dict with keys: libraries, la_libraries, libraries_links and binaries
 +		@param to_save have to be dict with keys:
 +			libraries, la_libraries, libraries_links and binaries
  	'''
  
- 	if to_save is None:
- 		to_save = {}
- 
- # TODO: Don't blindly make the cache directory, see Bug 203414
- #	if not os.path.exists(temp_path):
- #		os.makedirs(temp_path)
+ 	if not os.path.exists(temp_path):
+ 		os.makedirs(temp_path)
  
  	try:
 -		f = open(os.path.join(temp_path, 'timestamp'), 'w')
 -		f.write(str(int(time.time())))
 -		f.close()
 +		_file = open(os.path.join(temp_path, 'timestamp'), 'w')
 +		_file.write(str(int(time.time())))
 +		_file.close()
  
- 		for key, val in list(to_save.items()):
+ 		for key,val in to_save.iteritems():
 -			f = open(os.path.join(temp_path, key), 'w')
 +			_file = open(os.path.join(temp_path, key), 'w')
  			for line in val:
 -				f.write(line + '\n')
 -			f.close()
 +				_file.write(line + '\n')
 +			_file.close()
  	except Exception as ex:
  		logger.warn(red('Could not save cache: %s' %str(ex)))
  
@@@ -106,31 -84,23 +101,30 @@@ def check_temp_files(temp_path=DEFAULTS
  
  
  if __name__ == '__main__':
 -	print 'Preparing cache ... '
 +	print('Preparing cache ... ')
  
 -	from collect import *
 +	from .collect import (prepare_search_dirs, parse_revdep_config,
 +		collect_libraries_from_dir, collect_binaries_from_dir)
- 
  	import logging
  
- 	bin_dirs, lib_dirs = prepare_search_dirs(logging, DEFAULTS)
+ 	bin_dirs, lib_dirs = prepare_search_dirs()
  
- 	masked_dirs, masked_files, ld = parse_revdep_config("/etc/revdep-rebuild/")
- 	lib_dirs.update(ld)
- 	bin_dirs.update(ld)
- 	masked_dirs = masked_dirs.update([
- 			'/lib/modules',
- 			'/lib32/modules',
- 			'/lib64/modules'
- 			]
- 		)
+ 	masked_dirs, masked_files, ld = parse_revdep_config()
+ 	lib_dirs = lib_dirs.union(ld)
+ 	bin_dirs = bin_dirs.union(ld)
 -	masked_dirs = masked_dirs.union(set(['/lib/modules', '/lib32/modules', '/lib64/modules',]))
++	masked_dirs = masked_dirs.union(
++		set([
++			'/lib/modules', 
++			'/lib32/modules', 
++			'/lib64/modules',
++		])
++	)
  
- 	libraries, la_libraries, libraries_links, symlink_pairs = \
- 		collect_libraries_from_dir(lib_dirs, masked_dirs, logging)
+ 	libraries, la_libraries, libraries_links, symlink_pairs = collect_libraries_from_dir(lib_dirs, masked_dirs, logging)
  	binaries = collect_binaries_from_dir(bin_dirs, masked_dirs, logging)
  
- 	save_cache(logger=logging,
- 		to_save={'libraries':libraries, 'la_libraries':la_libraries,
+ 	save_cache(logger=logging, 
+ 		to_save={'libraries':libraries, 'la_libraries':la_libraries, 
  			'libraries_links':libraries_links, 'binaries':binaries}
  		)
  
diff --cc pym/gentoolkit/revdep_rebuild/collect.py
index 740ae32,b7ed469..f8ee60d
--- a/pym/gentoolkit/revdep_rebuild/collect.py
+++ b/pym/gentoolkit/revdep_rebuild/collect.py
@@@ -26,8 -22,8 +26,8 @@@ def parse_conf(conf_file, visited=None
  
  	for conf in conf_file:
  		try:
 -			with open(conf) as f:
 -				for line in f.readlines():
 +			with open(conf) as _file:
- 				for line in _file:
++				for line in _file.readlines():
  					line = line.strip()
  					if line.startswith('#'):
  						continue
@@@ -66,13 -62,12 +66,13 @@@ def prepare_search_dirs(logger, setting
  	lib_dirs = set(['/lib', '/usr/lib', ])
  
  	#try:
 -	with open(os.path.join(portage.root, settings['DEFAULT_ENV_FILE']), 'r') as f:
 -		for line in f.readlines():
 +	with open(os.path.join(
 +		portage.root, settings['DEFAULT_ENV_FILE']), 'r') as _file:
- 		for line in _file:
++		for line in _file.readlines():
  			line = line.strip()
 -			m = re.match("^export (ROOT)?PATH='([^']+)'", line)
 -			if m is not None:
 -				bin_dirs = bin_dirs.union(set(m.group(2).split(':')))
 +			match = re.match("^export (ROOT)?PATH='([^']+)'", line)
 +			if match is not None:
 +				bin_dirs.update(set(match.group(2).split(':')))
  	#except EnvironmentError:
  		#logger.debug(yellow('Could not open file %s' % f))
  
@@@ -250,21 -230,17 +250,26 @@@ def collect_binaries_from_dir(dirs, mas
  
  if __name__ == '__main__':
  	import logging
- 	from .settings import DEFAULTS
- 	mbin_dirs, mlib_dirs = prepare_search_dirs(logging, DEFAULTS)
- 
- 	mmasked_dirs, mmasked_files, mld = parse_revdep_config("/etc/revdep-rebuild/")
- 	mlib_dirs.update(mld)
- 	mbin_dirs.update(mld)
- 	mmasked_dirs.update(['/lib/modules', '/lib32/modules', '/lib64/modules'])
+ 	bin_dirs, lib_dirs = prepare_search_dirs(logging)
+ 
+ 	masked_dirs, masked_files, ld = parse_revdep_config()
+ 	lib_dirs = lib_dirs.union(ld)
+ 	bin_dirs = bin_dirs.union(ld)
 -	masked_dirs = masked_dirs.union(set(['/lib/modules', '/lib32/modules', '/lib64/modules',]))
 -
 -	libraries, la_libraries, libraries_links, symlink_pairs = collect_libraries_from_dir(lib_dirs, masked_dirs, logging)
 -	binaries = collect_binaries_from_dir(bin_dirs, masked_dirs, logging)
 -
 -	logging.debug('Found: %i binaries and %i libraries.' %(len(binaries), len(libraries)))
++	masked_dirs = masked_dirs.union(
++		set([
++			'/lib/modules',
++			'/lib32/modules',
++			'/lib64/modules',
++		])
++	)
 +
 +	libraries, la_libraries, libraries_links, msymlink_pairs = \
 +		collect_libraries_from_dir(mlib_dirs, mmasked_dirs, logging)
 +	binaries = collect_binaries_from_dir(mbin_dirs, mmasked_dirs, logging)
 +
 +	logging.debug(
 +		'Found: %i binaries and %i libraries.' %(
 +		len(binaries), len(libraries)))
  
  
  
diff --cc pym/gentoolkit/revdep_rebuild/rebuild.py
index 8d21b76,a943902..386ac33
--- a/pym/gentoolkit/revdep_rebuild/rebuild.py
+++ b/pym/gentoolkit/revdep_rebuild/rebuild.py
@@@ -103,10 -103,10 +103,11 @@@ def parse_options()
  			'keep-temp', 'library=', 'no-ld-path', 'no-order',
  			'pretend', 'no-pretend', 'no-progress', 'quiet', 'verbose'])
  
 +		do_help = False
  		for key, val in opts:
  			if key in ('-h', '--help'):
- 				do_help = True
+ 				print_usage()
+ 				sys.exit(0)
  			elif key in ('-q', '--quiet'):
  				settings['quiet'] = True
  				settings['VERBOSITY'] = 0
@@@ -134,9 -134,6 +135,7 @@@
  		print(red('Unrecognized option\n'))
  		print_usage()
  		sys.exit(2)
- 	if do_help:
- 		print_usage()
- 		sys.exit(0)
++
  	return settings
  
  
@@@ -195,25 -181,25 +194,33 @@@ def main(settings=None, logger=None)
  	if not settings['stdout'].isatty() or settings['nocolor']:
  		nocolor()
  
 +	#TODO: Development warning
 +	logger.warn(blue(' * ') +
 +		yellow('This is a development version, '
 +			'so it may not work correctly'))
 +	logger.warn(blue(' * ') +
 +		yellow('The original revdep-rebuild script is '
 +			'installed as revdep-rebuild.sh'))
 +
  	if os.getuid() != 0 and not settings['PRETEND']:
 -		logger.warn(blue(' * ') + 
 +		logger.warn(blue(' * ') +
  			yellow('You are not root, adding --pretend to portage options'))
  		settings['PRETEND'] = True
+ 	elif not settings['PRETEND'] \
+ 			and settings['IS_DEV'] \
+ 			and not settings['NO_PRETEND']:
+ 		logger.warn(blue(' * ') + 
+ 			yellow('This is a development version, '
+ 				'so it may not work correctly'))
+ 		logger.warn(blue(' * ') + 
+ 			yellow('Adding --pretend to portage options anyway'))
+ 		logger.info(blue(' * ') + 
+ 			'If you\'re sure, you can add --no-pretend to revdep options')
+ 		settings['PRETEND'] = True
  
- 	if settings['library']:
- 		logger.warn(green(' * ') +
- 			"Looking for libraries: %s" % (bold(', '.join(settings['library']))))
- 
+ 	analyze_cache = {}
  	if settings['USE_TMP_FILES'] \
- 			and check_temp_files(settings['DEFAULT_TMP_DIR'], logger=logger):
+ 			and check_temp_files(settings['DEFAULT_TMP_DIR']):
  		libraries, la_libraries, libraries_links, binaries = read_cache(
  			settings['DEFAULT_TMP_DIR'])
  		assigned = analyse(
diff --cc pym/gentoolkit/revdep_rebuild/stuff.py
index e78748c,7b287b1..0bebce2
--- a/pym/gentoolkit/revdep_rebuild/stuff.py
+++ b/pym/gentoolkit/revdep_rebuild/stuff.py
@@@ -43,12 -31,11 +43,16 @@@ def scan(params, files, max_args)
  	return out
  
  
+ def exithandler(signum, frame):
+ 	sys.exit(1)
+ 
+ 
  def get_masking_status(ebuild):
 +	"""returns the masking status of an ebuild
 +
 +	@param ebuild: str
 +	@return list
 +	"""
  	try:
  		status = portage.getmaskingstatus(ebuild)
  	except KeyError:


             reply	other threads:[~2015-10-15 16:44 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15 16:44 Paul Varner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-09-10  2:28 [gentoo-commits] proj/gentoolkit:master commit in: / Matt Turner
2024-05-08 21:43 Sam James
2024-04-25 20:37 Sam James
2024-03-12 21:43 Sam James
2024-03-12 21:43 Sam James
2024-03-12 21:43 Sam James
2024-02-16 20:39 Sam James
2024-01-19  6:37 Sam James
2024-01-19  4:54 Sam James
2024-01-18 20:57 Matt Turner
2024-01-18 20:57 Matt Turner
2023-12-03  7:51 Sam James
2023-03-24  2:50 Sam James
2023-03-20  4:41 Sam James
2022-07-10 20:49 Brian Dolbec
2022-07-10 18:59 Brian Dolbec
2022-07-10 18:41 Brian Dolbec
2022-07-10 17:20 Brian Dolbec
2022-03-16 18:19 Matt Turner
2022-03-16 18:19 Matt Turner
2022-02-09 10:48 Sam James
2021-09-21 21:01 Matt Turner
2021-09-20 23:02 Matt Turner
2021-09-20 22:57 Matt Turner
2021-09-20 22:57 Matt Turner
2021-09-20 22:57 Matt Turner
2021-03-02  3:31 Matt Turner
2020-04-24  8:34 Michał Górny
2020-04-24  8:06 Michał Górny
2020-03-12 16:51 Matt Turner
2020-02-19  5:44 Michał Górny
2020-01-26 15:20 Michał Górny
2019-08-19  3:51 Zac Medico
2019-05-11 23:09 Virgil Dupras
2019-04-01  1:51 Virgil Dupras
2018-08-14 16:01 Virgil Dupras
2017-03-23  1:40 Mike Frysinger
2017-03-22 20:54 Brian Dolbec
2017-03-22 20:13 Brian Dolbec
2017-03-22 12:51 Brian Dolbec
2016-08-01  4:10 Brian Dolbec
2016-08-01  4:10 Brian Dolbec
2016-03-13 15:11 Mike Gilbert
2015-12-20 20:33 Mike Gilbert
2015-11-24 18:14 Paul Varner
2015-11-24 18:12 Paul Varner
2015-10-15 16:44 Paul Varner
2015-10-15 16:44 Paul Varner
2015-10-15 16:44 Paul Varner
2015-10-15 16:44 Paul Varner
2015-10-15 16:44 Paul Varner
2015-10-15 16:44 Paul Varner
2015-10-15 16:44 Paul Varner
2015-10-15 16:44 Paul Varner
2014-11-03 22:59 Mike Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1390301312.4335bf979f374300ac6678765f490f92ee805ab4.fuzzyray@gentoo \
    --to=fuzzyray@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox