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:gentoolkit commit in: pym/gentoolkit/revdep_rebuild/
Date: Tue, 12 Jul 2011 21:45:26 +0000 (UTC)	[thread overview]
Message-ID: <4a02c44bbe7457249caeb07464e240b6bc035cc0.fuzzyray@gentoo> (raw)

commit:     4a02c44bbe7457249caeb07464e240b6bc035cc0
Author:     dol-sen <brian.dolbec <AT> gmail <DOT> com>
AuthorDate: Mon Apr 25 07:03:20 2011 +0000
Commit:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Jul 12 21:29:01 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=4a02c44b

more cleanup of importing logging.  Use the one defined or passed in to in main(). 

---
 pym/gentoolkit/revdep_rebuild/analyse.py |   11 ++++++++---
 pym/gentoolkit/revdep_rebuild/cache.py   |   14 +++++++++-----
 pym/gentoolkit/revdep_rebuild/collect.py |    5 +++--
 pym/gentoolkit/revdep_rebuild/rebuild.py |   17 ++++++++++++-----
 4 files changed, 32 insertions(+), 15 deletions(-)

diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py b/pym/gentoolkit/revdep_rebuild/analyse.py
index 5ee0c7b..521d8b9 100644
--- a/pym/gentoolkit/revdep_rebuild/analyse.py
+++ b/pym/gentoolkit/revdep_rebuild/analyse.py
@@ -3,8 +3,8 @@
 import os
 import re
 import platform
-import logging
 import glob
+
 from portage.output import bold, red, blue, yellow, green, nocolor
 
 from stuff import scan
@@ -114,7 +114,7 @@ def main_checks(found_libs, broken, dependencies, logger):
 	return broken_pathes
 
 
-def analyse(settings=None, logger=None, libraries=None, la_libraries=None,
+def analyse(settings, logger, libraries=None, la_libraries=None,
 		libraries_links=None, binaries=None, _libs_to_check=set()):
 	"""Main program body.  It will collect all info and determine the
 	pkgs needing rebuilding.
@@ -143,7 +143,12 @@ def analyse(settings=None, logger=None, libraries=None, la_libraries=None,
 		binaries = collect_binaries_from_dir(bin_dirs, masked_dirs, logger)
 
 		if settings['USE_TMP_FILES']:
-			save_cache(to_save={'libraries':libraries, 'la_libraries':la_libraries, 'libraries_links':libraries_links, 'binaries':binaries})
+			save_cache(logger=logger, 
+				to_save={'libraries':libraries, 'la_libraries':la_libraries,
+					'libraries_links':libraries_links, 'binaries':binaries
+				},
+			temp_path=settings['DEFAULT_TMP_DIR']
+			)
 
 
 	logger.debug('Found '+ str(len(libraries)) + ' libraries (+' + str(len(libraries_links)) + ' symlinks) and ' + str(len(binaries)) + ' binaries')

diff --git a/pym/gentoolkit/revdep_rebuild/cache.py b/pym/gentoolkit/revdep_rebuild/cache.py
index e1a8e11..8b1a8ed 100644
--- a/pym/gentoolkit/revdep_rebuild/cache.py
+++ b/pym/gentoolkit/revdep_rebuild/cache.py
@@ -2,7 +2,7 @@
 
 import os
 import time
-import logging
+
 from portage.output import red
 from settings import DEFAULTS
 
@@ -29,7 +29,7 @@ def read_cache(temp_path=DEFAULTS['DEFAULT_TMP_DIR']):
 	return (ret['libraries'], ret['la_libraries'], ret['libraries_links'], ret['binaries'])
 
 
-def save_cache(logger=logging, to_save={}, 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
@@ -87,6 +87,7 @@ if __name__ == '__main__':
 	print 'Preparing cache ... '
 
 	from collect import *
+	import logging
 
 	bin_dirs, lib_dirs = prepare_search_dirs()
 
@@ -95,9 +96,12 @@ if __name__ == '__main__':
 	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)
-	binaries = collect_binaries_from_dir(bin_dirs, masked_dirs)
+	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(to_save={'libraries':libraries, 'la_libraries':la_libraries, 'libraries_links':libraries_links, 'binaries':binaries})
+	save_cache(logger=logging, 
+		to_save={'libraries':libraries, 'la_libraries':la_libraries, 
+			'libraries_links':libraries_links, 'binaries':binaries}
+		)
 
 	print 'Done.'

diff --git a/pym/gentoolkit/revdep_rebuild/collect.py b/pym/gentoolkit/revdep_rebuild/collect.py
index 735857b..b408edc 100644
--- a/pym/gentoolkit/revdep_rebuild/collect.py
+++ b/pym/gentoolkit/revdep_rebuild/collect.py
@@ -4,7 +4,7 @@ import re
 import os
 import glob
 import stat
-import logging
+
 import portage
 from portage.output import bold, red, blue, yellow, green, nocolor
 
@@ -185,7 +185,7 @@ def collect_libraries_from_dir(dirs, mask, logger):
 	return (found_files, found_la_files, found_symlinks, symlink_pairs)
 
 
-def collect_binaries_from_dir(dirs, mask, logger=logging):
+def collect_binaries_from_dir(dirs, mask, logger):
 	''' Collects all binaries from specified list of directories.
 		mask is list of pathes, that are ommited in scanning, can be eighter single file or entire directory
 		Returns list of binaries
@@ -229,6 +229,7 @@ def collect_binaries_from_dir(dirs, mask, logger=logging):
 
 
 if __name__ == '__main__':
+	import logging
 	bin_dirs, lib_dirs = prepare_search_dirs(logging)
 
 	masked_dirs, masked_files, ld = parse_revdep_config()

diff --git a/pym/gentoolkit/revdep_rebuild/rebuild.py b/pym/gentoolkit/revdep_rebuild/rebuild.py
index 6185e0c..6c08f5b 100644
--- a/pym/gentoolkit/revdep_rebuild/rebuild.py
+++ b/pym/gentoolkit/revdep_rebuild/rebuild.py
@@ -169,13 +169,14 @@ def rebuild(logger, assigned, settings):
 
 
 # Runs from here
-def main(settings=None):
+def main(settings=None, logger=None):
 
 	if settings is None:
 		print("NO Input settings, using defaults...")
 		settings = DEFAULTS.copy()
 
-	logger = init_logger(settings)
+	if logger is None:
+		logger = init_logger(settings)
 
 	_libs_to_check = settings['library']
 
@@ -199,9 +200,15 @@ def main(settings=None):
 		settings['PRETEND'] = True
 
 	analyze_cache = {}
-	if settings['USE_TMP_FILES'] and check_temp_files():
-		libraries, la_libraries, libraries_links, binaries = read_cache()
-		assigned = analyse(libraries=libraries, la_libraries=la_libraries, 
+	if settings['USE_TMP_FILES'] \
+			and check_temp_files(settings['DEFAULT_TMP_DIR']):
+		libraries, la_libraries, libraries_links, binaries = read_cache(
+			settings['DEFAULT_TMP_DIR'])
+		assigned = analyse(
+			settings=settings,
+			logger=logger,
+			libraries=libraries,
+			la_libraries=la_libraries, 
 			libraries_links=libraries_links,
 			binaries=binaries,
 			_libs_to_check=_libs_to_check)



             reply	other threads:[~2011-07-12 21:47 UTC|newest]

Thread overview: 115+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-12 21:45 Paul Varner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-05-27 17:27 [gentoo-commits] proj/gentoolkit:gentoolkit commit in: pym/gentoolkit/revdep_rebuild/ Mike Gilbert
2014-11-12 21:29 Paul Varner
2014-11-12  7:16 Slawek Lis
2014-11-07 20:41 Slawek Lis
2014-11-07 20:41 Slawek Lis
2014-11-07 20:41 Slawek Lis
2014-11-07 20:41 Slawek Lis
2014-11-07 20:41 Slawek Lis
2014-11-07 20:41 Slawek Lis
2014-10-30 18:56 Paul Varner
2014-08-28  7:37 Slawek Lis
2014-03-27  6:59 Slawek Lis
2014-03-26  8:21 Slawek Lis
2014-03-24  7:17 Slawek Lis
2014-03-24  7:17 Slawek Lis
2014-03-17  6:50 Slawek Lis
2014-03-17  6:50 Slawek Lis
2014-03-11 21:43 Paul Varner
2014-03-11 21:22 Paul Varner
2014-02-19  5:01 Brian Dolbec
2014-02-19  4:33 Brian Dolbec
2014-02-19  4:33 Brian Dolbec
2014-02-19  3:14 Brian Dolbec
2014-02-19  3:14 Brian Dolbec
2014-02-19  3:14 Brian Dolbec
2014-02-19  3:14 Brian Dolbec
2014-02-19  3:14 Brian Dolbec
2014-02-19  3:14 Brian Dolbec
2014-02-19  3:14 Brian Dolbec
2014-02-19  3:14 Brian Dolbec
2014-02-18 18:51 Brian Dolbec
2014-02-18 18:51 Brian Dolbec
2014-02-18 17:59 Brian Dolbec
2014-02-18 17:23 Brian Dolbec
2014-02-18  7:30 Brian Dolbec
2014-02-18  6:15 Brian Dolbec
2014-02-17 10:31 Slawek Lis
2014-02-17  8:50 Slawek Lis
2014-02-16 20:55 Brian Dolbec
2014-02-13 22:08 Paul Varner
2014-02-12 21:12 Paul Varner
2014-02-12 16:20 Brian Dolbec
2014-02-12 16:20 Brian Dolbec
2014-02-12 10:42 Brian Dolbec
2014-02-12 10:22 Brian Dolbec
2014-02-12 10:22 Brian Dolbec
2014-02-12 10:22 Brian Dolbec
2014-02-12 10:22 Brian Dolbec
2014-02-11 19:39 Brian Dolbec
2014-02-11 18:49 Brian Dolbec
2014-02-11 18:49 Brian Dolbec
2014-02-11 18:49 Brian Dolbec
2014-02-11 18:49 Brian Dolbec
2014-02-11 18:49 Brian Dolbec
2014-02-11 18:49 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2014-02-11  8:40 Brian Dolbec
2012-11-09 14:16 Paul Varner
2012-03-19  6:50 Brian Dolbec
2012-03-04  7:41 Brian Dolbec
2012-03-02 17:47 Brian Dolbec
2011-10-10 17:36 Brian Dolbec
2011-10-10 16:09 Brian Dolbec
2011-07-14 18:29 Paul Varner
2011-07-14 18:29 Paul Varner
2011-07-14  2:32 Paul Varner
2011-07-14  1:44 Brian Dolbec
2011-07-14  1:44 Brian Dolbec
2011-07-13 20:06 Paul Varner
2011-07-13 16:01 Paul Varner
2011-07-13 15:35 Brian Dolbec
2011-07-13  5:53 Brian Dolbec
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner
2011-07-12 21:45 Paul Varner

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=4a02c44bbe7457249caeb07464e240b6bc035cc0.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