commit:     cd88eafe9567138fb8aaa2253df2160e40548d20
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Oct  8 22:39:12 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Oct  9 00:22:12 2015 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=cd88eafe

stagebase: fix path to snapshot hash file

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.

 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:

Reply via email to