public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: gentoo-catalyst@lists.gentoo.org
Subject: [gentoo-catalyst] [PATCH] stagebase: replace read_from_clst with snakeoil
Date: Thu,  8 Oct 2015 18:57:54 -0400	[thread overview]
Message-ID: <1444345074-13096-1-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <1444344777-32497-1-git-send-email-vapier@gentoo.org>

The read_from_clst function is used in one place, and this function is
an overwrought "read all the data from a file" function.  Replace it
with a snakeoil function.
---
 catalyst/base/stagebase.py |  7 +++----
 catalyst/support.py        | 15 ---------------
 2 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index a2a8520..652dd9d 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -16,8 +16,7 @@ from DeComp.compress import CompressMap
 from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
 	PORT_LOGDIR_CLEAN)
 from catalyst.support import (CatalystError, msg, file_locate, normpath,
-	cmd, warn, list_bashify, read_makeconf, read_from_clst, ismount,
-	file_check)
+	cmd, warn, list_bashify, read_makeconf, ismount, file_check)
 from catalyst.base.targetbase import TargetBase
 from catalyst.base.clearbase import ClearBase
 from catalyst.base.genbase import GenBase
@@ -816,8 +815,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
 		print "unpack(), target_portdir = " + target_portdir
 		if "snapcache" in self.settings["options"]:
 			snapshot_cache_hash=\
-				read_from_clst(self.settings["snapshot_cache_path"]+\
-				"/" + "catalyst-hash")
+				fileutils.readfile(self.settings["snapshot_cache_path"]+\
+				"/" + "catalyst-hash", True)
 			unpack_info['mode'] = self.decompressor.determine_mode(
 				unpack_info['source'])
 
diff --git a/catalyst/support.py b/catalyst/support.py
index 960a91d..c629025 100644
--- a/catalyst/support.py
+++ b/catalyst/support.py
@@ -13,21 +13,6 @@ from catalyst.defaults import verbosity, valid_config_file_values
 BASH_BINARY             = "/bin/bash"
 
 
-def read_from_clst(path):
-	line = ''
-	myline = ''
-	try:
-		myf = open(path, "r")
-	except Exception:
-		return -1
-		#raise CatalystError("Could not open file " + path)
-	for line in myf.readlines():
-		#line = line.replace("\n", "") # drop newline
-		myline = myline + line
-	myf.close()
-	return myline
-
-
 def list_bashify(mylist):
 	if type(mylist)==types.StringType:
 		mypack=[mylist]
-- 
2.5.2



  reply	other threads:[~2015-10-08 22:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-08 22:52 [gentoo-catalyst] [PATCH] stagebase: fix path to snapshot hash file Mike Frysinger
2015-10-08 22:57 ` Mike Frysinger [this message]
2015-10-09  0:23 ` [gentoo-catalyst] [PATCH v2] " Mike Frysinger
2015-10-09  1:38   ` Brian Dolbec
2015-10-09  1:33 ` [gentoo-catalyst] [PATCH] " Brian Dolbec

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=1444345074-13096-1-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=gentoo-catalyst@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