public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mike Frysinger" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/, catalyst/targets/, catalyst/base/
Date: Fri,  9 Oct 2015 21:06:46 +0000 (UTC)	[thread overview]
Message-ID: <1444397266.5048aad7bdfbfcc0e7e3562a80fc97a344818b55.vapier@gentoo> (raw)

commit:     5048aad7bdfbfcc0e7e3562a80fc97a344818b55
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  9 13:27:46 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Oct  9 13:27:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=5048aad7

hash_utils: convert to log module

This has the nice side-effect of not needing the verbose param anymore,
so the prototypes & callers all get updated to stop passing that around.

 catalyst/base/genbase.py   |  6 ++----
 catalyst/base/stagebase.py |  6 ++----
 catalyst/hash_utils.py     | 24 +++++++++---------------
 catalyst/targets/stage2.py |  3 +--
 4 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/catalyst/base/genbase.py b/catalyst/base/genbase.py
index 32459b4..a33f924 100644
--- a/catalyst/base/genbase.py
+++ b/catalyst/base/genbase.py
@@ -48,13 +48,11 @@ class GenBase(object):
 					if os.path.exists(f):
 						if "all" in array:
 							for k in list(hash_map.hash_map):
-								digest = hash_map.generate_hash(f,hash_=k,
-									verbose=self.settings["VERBOSE"])
+								digest = hash_map.generate_hash(f, hash_=k)
 								myf.write(digest)
 						else:
 							for j in array:
-								digest = hash_map.generate_hash(f,hash_=j,
-									verbose=self.settings["VERBOSE"])
+								digest = hash_map.generate_hash(f, hash_=j)
 								myf.write(digest)
 				myf.close()
 

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index bffafb7..88d71ba 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -435,8 +435,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 					self.settings["source_path_hash"] = \
 						self.settings["hash_map"].generate_hash(
 							self.settings["source_path"],
-							hash_ = self.settings["hash_function"],
-							verbose = False)
+							hash_=self.settings["hash_function"])
 		print "Source path set to "+self.settings["source_path"]
 		if os.path.isdir(self.settings["source_path"]):
 			print "\tIf this is not desired, remove this directory or turn off"
@@ -464,8 +463,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 		self.settings["snapshot_path_hash"] = \
 			self.settings["hash_map"].generate_hash(
 				self.settings["snapshot_path"],
-				hash_ = self.settings["hash_function"],
-				verbose = False)
+				hash_=self.settings["hash_function"])
 
 	def set_snapcache_path(self):
 		self.settings["snapshot_cache_path"]=\

diff --git a/catalyst/hash_utils.py b/catalyst/hash_utils.py
index 0262422..3db61f1 100644
--- a/catalyst/hash_utils.py
+++ b/catalyst/hash_utils.py
@@ -3,6 +3,7 @@ import os
 from collections import namedtuple
 from subprocess import Popen, PIPE
 
+from catalyst import log
 from catalyst.support import CatalystError
 
 
@@ -65,32 +66,28 @@ class HashMap(object):
 		del obj
 
 
-	def generate_hash(self, file_, hash_="crc32", verbose=False):
+	def generate_hash(self, file_, hash_="crc32"):
 		'''Prefered method of generating a hash for the passed in file_
 
 		@param file_: the file to generate the hash for
 		@param hash_: the hash algorythm to use
-		@param verbose: boolean
 		@returns the hash result
 		'''
 		try:
 			return getattr(self, self.hash_map[hash_].func)(
 				file_,
-				hash_,
-				verbose
-				)
+				hash_)
 		except:
 			raise CatalystError("Error generating hash, is appropriate " + \
 				"utility installed on your system?", traceback=True)
 
 
-	def calc_hash(self, file_, hash_, verbose=False):
+	def calc_hash(self, file_, hash_):
 		'''
 		Calculate the hash for "file_"
 
 		@param file_: the file to generate the hash for
 		@param hash_: the hash algorythm to use
-		@param verbose: boolean
 		@returns the hash result
 		'''
 		_hash = self.hash_map[hash_]
@@ -101,36 +98,33 @@ class HashMap(object):
 		mylines = source.communicate()[0]
 		mylines=mylines[0].split()
 		result=mylines[0]
-		if verbose:
-			print _hash.id + " (%s) = %s" % (file_, result)
+		log.info('%s (%s) = %s', _hash.id, file_, result)
 		return result
 
 
-	def calc_hash2(self, file_, hash_type, verbose=False):
+	def calc_hash2(self, file_, hash_type):
 		'''
 		Calculate the hash for "file_"
 
 		@param file_: the file to generate the hash for
 		@param hash_: the hash algorythm to use
-		@param verbose: boolean
 		@returns the hash result
 		'''
 		_hash = self.hash_map[hash_type]
 		args = [_hash.cmd]
 		args.extend(_hash.args)
 		args.append(file_)
-		#print("DEBUG: calc_hash2; args =", args)
+		log.debug('args = %r', args)
 		source = Popen(args, stdout=PIPE)
 		output = source.communicate()
 		lines = output[0].split('\n')
-		#print("DEBUG: calc_hash2; output =", output)
+		log.debug('output = %s', output)
 		header = lines[0]
 		h_f = lines[1].split()
 		hash_result = h_f[0]
 		short_file = os.path.split(h_f[1])[1]
 		result = header + "\n" + hash_result + "  " + short_file + "\n"
-		if verbose:
-			print header + " (%s) = %s" % (short_file, result)
+		log.info('%s (%s) = %s', header, short_file, result)
 		return result
 
 

diff --git a/catalyst/targets/stage2.py b/catalyst/targets/stage2.py
index e6965cc..786aaa4 100644
--- a/catalyst/targets/stage2.py
+++ b/catalyst/targets/stage2.py
@@ -29,8 +29,7 @@ class stage2(StageBase):
 					self.settings["source_path_hash"] = \
 						self.settings["hash_map"].generate_hash(
 							self.settings["source_path"],\
-							hash_=self.settings["hash_function"],
-							verbose=False)
+							hash_=self.settings["hash_function"])
 		print "Source path set to "+self.settings["source_path"]
 		if os.path.isdir(self.settings["source_path"]):
 			print "\tIf this is not desired, remove this directory or turn off seedcache in the options of catalyst.conf"


             reply	other threads:[~2015-10-09 21:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09 21:06 Mike Frysinger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-10-24  6:58 [gentoo-commits] proj/catalyst:master commit in: catalyst/, catalyst/targets/, catalyst/base/ Mike Frysinger
2016-03-23 20:31 Brian Dolbec
2016-05-20  4:06 Mike Frysinger
2016-05-20  4:06 Mike Frysinger
2016-05-22  3:34 Mike Frysinger
2021-01-28  2:09 [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/targets/, catalyst/, catalyst/base/ Matt Turner
2021-01-28  2:41 ` [gentoo-commits] proj/catalyst:master commit in: catalyst/, catalyst/targets/, catalyst/base/ Matt Turner

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=1444397266.5048aad7bdfbfcc0e7e3562a80fc97a344818b55.vapier@gentoo \
    --to=vapier@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