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 5F57413888F for ; Fri, 9 Oct 2015 00:23:13 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CE0A8E07F9; Fri, 9 Oct 2015 00:23:09 +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 858D3E07F9 for ; Fri, 9 Oct 2015 00:23:09 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 4023A34072E for ; Fri, 9 Oct 2015 00:23:07 +0000 (UTC) From: Mike Frysinger To: gentoo-catalyst@lists.gentoo.org Subject: [gentoo-catalyst] [PATCH v2] stagebase: fix path to snapshot hash file Date: Thu, 8 Oct 2015 20:23:05 -0400 Message-Id: <1444350185-29720-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: b2873c85-65a8-44b7-9024-0e5bfabac510 X-Archives-Hash: 63c6acc65fcfbb1a5b421c641b66fd3f When we write the hash, we do so by using: snapshot_cache_path + / + catalyst-hash But when we read it, we do so by: snapshot_cache_path + catalyst-hash If the path lacks a trailing /, then we never read the correct hash file. The current helper returns -1 on missing file errors which is compared against the existing hash. In essence, we always trigger a cache miss. Clean up the code to properly create the path and use that var in both places to prevent future breakage. --- v2 - do it better like an all star catalyst/base/stagebase.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index f81c51b..7d069fa 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -815,9 +815,9 @@ class StageBase(TargetBase, ClearBase, GenBase): print self.settings["chroot_path"] 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") + snapshot_cache_hash_path = pjoin( + self.settings['snapshot_cache_path'], 'catalyst-hash') + snapshot_cache_hash = read_from_clst(snapshot_cache_hash_path) unpack_info['mode'] = self.decompressor.determine_mode( unpack_info['source']) @@ -862,8 +862,7 @@ class StageBase(TargetBase, ClearBase, GenBase): print unpack_errmsg %(unpack_info) if "snapcache" in self.settings["options"]: - myf=open(self.settings["snapshot_cache_path"] + - "/" + "catalyst-hash","w") + myf = open(snapshot_cache_hash_path, 'w') myf.write(self.settings["snapshot_path_hash"]) myf.close() else: -- 2.5.2