public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
From: "W. Trevor King" <wking@tremily.us>
To: Catalyst <gentoo-catalyst@lists.gentoo.org>
Cc: "W. Trevor King" <wking@tremily.us>
Subject: [gentoo-catalyst] [PATCH] generic_stage_target: Don't set mountmap['portdir'] without SNAPCACHE
Date: Sat,  8 Mar 2014 10:25:09 -0800	[thread overview]
Message-ID: <e646ca561fd1d74d75188e62d4e469846337e316.1394302943.git.wking@tremily.us> (raw)
In-Reply-To: <20140304212508.68861936.dolsen@gentoo.org>

The default portdir path uses the snapshot_cache_path setting, but we
only set a default for that (in
generic_stage_target.set_snapcache_path) if SNAPCACHE is enabled.  By
shifting the portdir calculation into the SNAPCACHE-only block here,
we avoid running into key-errors when the user has SNAPCACHE disabled
and (unsurprisingly) doesn't specify an explicit snapshot_cache_path.
---
On Tue, Mar 04, 2014 at 09:25:08PM -0800, Brian Dolbec wrote:
> On Tue, 4 Mar 2014 20:47:47 -0800, W. Trevor King wrote:
> > There are not particularly many snapshot_cache_path references in
> > catalyst.  Grepping through them, the following looks suspicious:
> >
> > catalyst/targets/generic_stage_target.py-215- self.mountmap["portdir"] = normpath("/".join([
> > catalyst/targets/generic_stage_target.py:216:  self.settings["snapshot_cache_path"],
> > catalyst/targets/generic_stage_target.py-217-  self.settings["repo_name"],
> > catalyst/targets/generic_stage_target.py-218-  ]))
> > catalyst/targets/generic_stage_target.py-219- if "SNAPCACHE" not in self.settings:
> >
> > Everything else looks fine.  So what should portdir be if
> > SNAPCACHE isn't set?
>
> Yeah, that's where it was failing.  …
>
> I'm open to a better alternative.  I think the potential is there
> for more of these types of errors which depend on options selected.

This patch should fix it.  Analysis in the commit message itself.

Cheers,
Trevor

 catalyst/targets/generic_stage_target.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/catalyst/targets/generic_stage_target.py b/catalyst/targets/generic_stage_target.py
index 2b3d7ce..1412ed5 100644
--- a/catalyst/targets/generic_stage_target.py
+++ b/catalyst/targets/generic_stage_target.py
@@ -212,11 +212,11 @@ class generic_stage_target(generic_target):
 		self.mountmap = SOURCE_MOUNTS_DEFAULTS.copy()
 		# update them from settings
 		self.mountmap["distdir"] = self.settings["distdir"]
-		self.mountmap["portdir"] = normpath("/".join([
-			self.settings["snapshot_cache_path"],
-			self.settings["repo_name"],
-			]))
 		if "SNAPCACHE" not in self.settings:
+			self.mountmap["portdir"] = normpath("/".join([
+				self.settings["snapshot_cache_path"],
+				self.settings["repo_name"],
+				]))
 			self.mounts.remove("portdir")
 			#self.mountmap["portdir"] = None
 		if os.uname()[0] == "Linux":
-- 
1.8.5.2.8.g0f6c0d1



  reply	other threads:[~2014-03-08 18:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-02 23:00 [gentoo-catalyst] [PATCH 2/5] generic_stage_target.py: Fix an intermittent snapshot_cache_path keyerror Brian Dolbec
2014-03-02 23:01 ` [gentoo-catalyst] [PATCH 3/5] Add more working files, directories to .gitignore Brian Dolbec
2014-03-03  3:07   ` Brian Dolbec
2014-03-05  4:50   ` [gentoo-catalyst] " W. Trevor King
2014-03-05  5:17     ` Brian Dolbec
2014-03-05 15:32       ` W. Trevor King
2014-03-22 17:47         ` Brian Dolbec
2014-03-02 23:01 ` [gentoo-catalyst] [PATCH 4/5] catalyst/targets/generic_target.py: Pass TERM through to the chroot Brian Dolbec
2014-03-08 18:38   ` W. Trevor King
2014-03-02 23:01 ` [gentoo-catalyst] [PATCH 5/5] Add arm64 support Brian Dolbec
2014-03-03  3:05   ` Brian Dolbec
2014-03-05  4:47 ` [gentoo-catalyst] Re: [PATCH 2/5] generic_stage_target.py: Fix an intermittent snapshot_cache_path keyerror W. Trevor King
2014-03-05  5:25   ` Brian Dolbec
2014-03-08 18:25     ` W. Trevor King [this message]
2014-03-22 22:39       ` [gentoo-catalyst] [PATCH] generic_stage_target: Don't set mountmap['portdir'] without SNAPCACHE Brian Dolbec
2014-03-24  5:08         ` W. Trevor King

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=e646ca561fd1d74d75188e62d4e469846337e316.1394302943.git.wking@tremily.us \
    --to=wking@tremily.us \
    --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