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 7E10C13888F for ; Fri, 9 Oct 2015 02:40:40 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A7D4BE07E6; Fri, 9 Oct 2015 02:40:39 +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 46C7CE07E6 for ; Fri, 9 Oct 2015 02:40:39 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7F919340712 for ; Fri, 9 Oct 2015 02:40:38 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 080A4CC8 for ; Fri, 9 Oct 2015 02:40:34 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1444350229.08c84b0ad645c0166bbedf26d3972d8dee23db74.vapier@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/, catalyst/base/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/base/stagebase.py catalyst/support.py X-VCS-Directories: catalyst/ catalyst/base/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 08c84b0ad645c0166bbedf26d3972d8dee23db74 X-VCS-Branch: master Date: Fri, 9 Oct 2015 02:40:34 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: ae16aa05-5107-4b6b-8fcb-3ecf170a6604 X-Archives-Hash: 41bd4ba4dba1d50f4546cb0d548f3fcd commit: 08c84b0ad645c0166bbedf26d3972d8dee23db74 Author: Mike Frysinger gentoo org> AuthorDate: Wed Oct 7 04:26:38 2015 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Fri Oct 9 00:23:49 2015 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=08c84b0a stagebase: replace read_from_clst with snakeoil 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 | 5 ++--- catalyst/support.py | 15 --------------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 7d069fa..bffafb7 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 @@ -817,7 +816,7 @@ class StageBase(TargetBase, ClearBase, GenBase): if "snapcache" in self.settings["options"]: snapshot_cache_hash_path = pjoin( self.settings['snapshot_cache_path'], 'catalyst-hash') - snapshot_cache_hash = read_from_clst(snapshot_cache_hash_path) + snapshot_cache_hash = fileutils.readfile(snapshot_cache_hash_path, 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]