Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/base/
Date: Fri, 09 Oct 2015 02:40:39
Message-Id: 1444350132.cd88eafe9567138fb8aaa2253df2160e40548d20.vapier@gentoo
1 commit: cd88eafe9567138fb8aaa2253df2160e40548d20
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 8 22:39:12 2015 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Fri Oct 9 00:22:12 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=cd88eafe
7
8 stagebase: fix path to snapshot hash file
9
10 When we write the hash, we do so by using:
11 snapshot_cache_path + / + catalyst-hash
12
13 But when we read it, we do so by:
14 snapshot_cache_path + catalyst-hash
15
16 If the path lacks a trailing /, then we never read the correct hash
17 file. The current helper returns -1 on missing file errors which is
18 compared against the existing hash. In essence, we always trigger a
19 cache miss.
20
21 Clean up the code to properly create the path and use that var in both
22 places to prevent future breakage.
23
24 catalyst/base/stagebase.py | 9 ++++-----
25 1 file changed, 4 insertions(+), 5 deletions(-)
26
27 diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
28 index f81c51b..7d069fa 100644
29 --- a/catalyst/base/stagebase.py
30 +++ b/catalyst/base/stagebase.py
31 @@ -815,9 +815,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
32 print self.settings["chroot_path"]
33 print "unpack(), target_portdir = " + target_portdir
34 if "snapcache" in self.settings["options"]:
35 - snapshot_cache_hash=\
36 - read_from_clst(self.settings["snapshot_cache_path"]+\
37 - "catalyst-hash")
38 + snapshot_cache_hash_path = pjoin(
39 + self.settings['snapshot_cache_path'], 'catalyst-hash')
40 + snapshot_cache_hash = read_from_clst(snapshot_cache_hash_path)
41 unpack_info['mode'] = self.decompressor.determine_mode(
42 unpack_info['source'])
43
44 @@ -862,8 +862,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
45 print unpack_errmsg %(unpack_info)
46
47 if "snapcache" in self.settings["options"]:
48 - myf=open(self.settings["snapshot_cache_path"] +
49 - "/" + "catalyst-hash","w")
50 + myf = open(snapshot_cache_hash_path, 'w')
51 myf.write(self.settings["snapshot_path_hash"])
52 myf.close()
53 else: