From: Brian Dolbec <dolsen@gentoo.org>
To: gentoo-catalyst@lists.gentoo.org
Subject: Re: [gentoo-catalyst] [PATCH v2] stagebase: fix path to snapshot hash file
Date: Thu, 8 Oct 2015 18:38:36 -0700 [thread overview]
Message-ID: <20151008183836.71f5cf96.dolsen@gentoo.org> (raw)
In-Reply-To: <1444350185-29720-1-git-send-email-vapier@gentoo.org>
On Thu, 8 Oct 2015 20:23:05 -0400
Mike Frysinger <vapier@gentoo.org> wrote:
> 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:
looks good. There shouldn't be too many like this left now. I did as
many as I could when changing the related code. But I know there was
still more.
--
Brian Dolbec <dolsen>
next prev parent reply other threads:[~2015-10-09 1:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-08 22:52 [gentoo-catalyst] [PATCH] stagebase: fix path to snapshot hash file Mike Frysinger
2015-10-08 22:57 ` [gentoo-catalyst] [PATCH] stagebase: replace read_from_clst with snakeoil Mike Frysinger
2015-10-09 0:23 ` [gentoo-catalyst] [PATCH v2] stagebase: fix path to snapshot hash file Mike Frysinger
2015-10-09 1:38 ` Brian Dolbec [this message]
2015-10-09 1:33 ` [gentoo-catalyst] [PATCH] " Brian Dolbec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151008183836.71f5cf96.dolsen@gentoo.org \
--to=dolsen@gentoo.org \
--cc=gentoo-catalyst@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox