From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 4503013888F for ; Thu, 8 Oct 2015 22:58:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 27EE1E07F9; Thu, 8 Oct 2015 22:57:59 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CB99EE07F9 for ; Thu, 8 Oct 2015 22:57:58 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 9587D34074D for ; Thu, 8 Oct 2015 22:57:57 +0000 (UTC) From: Mike Frysinger 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 Message-Id: <1444345074-13096-1-git-send-email-vapier@gentoo.org> X-Mailer: git-send-email 2.5.2 In-Reply-To: <1444344777-32497-1-git-send-email-vapier@gentoo.org> References: <1444344777-32497-1-git-send-email-vapier@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org X-Archives-Salt: 3b39d864-7b63-4b3c-8c60-b9ab617f2400 X-Archives-Hash: 44f4428f11fef5a0198fca5dce974770 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