From: Brian Dolbec <dolsen@gentoo.org>
To: gentoo-catalyst@lists.gentoo.org
Subject: Re: [gentoo-catalyst] [PATCH 1/2] modules/generic_stage_target.py, Create SOURCE_MOUNTS_DEFAULTS
Date: Thu, 02 Jan 2014 22:52:00 -0800 [thread overview]
Message-ID: <1388731920.3753.14.camel@big_daddy.dol-sen.ca> (raw)
In-Reply-To: <20140103062052.GJ4680@odin.tremily.us>
[-- Attachment #1: Type: text/plain, Size: 2218 bytes --]
On Thu, 2014-01-02 at 22:20 -0800, W. Trevor King wrote:
> I shift quoted lines around for easier comparison.
>
> On Thu, Jan 02, 2014 at 10:00:43PM -0800, Brian Dolbec wrote:
> > +SOURCE_MOUNTS_DEFAULTS = {
> > …
> > + "distdir": "/usr/portage/distfiles",
> > + "portdir": "/usr/portage",
> > …
> > - "distdir": self.settings["distdir"],
> > - "portdir": normpath("/".join([
> > - self.settings["snapshot_cache_path"],
> > - self.settings["repo_name"],
> > - ])),
> > …
> > + # initialize our source mounts
> > + 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"],
> > + ]))
>
> Why create dummy initial values and then blow them away? Wouldn't:
>
> SOURCE_MOUNTS_DEFAULTS = {
> …
> 'distdir': None, # initialized from settings
> 'portdir': None, # initialized from settings
> }
>
> make more sense? We'll blow away this default dict once we're loading
> it via ConfigParser, so this doesn't have to be super elegant, but
> adding values just to clobber them seems misleading.
>
We probably could, they are defaulted in config_defaults. But at the
time I was just thinking that catalyst.conf or a spec file may not have
the value declared, so was better to give it a default here, just in
case.
> > - if "SNAPCACHE" in self.settings:
> > - self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"]
> > …
> > - else:
> > - self.mounts = ["proc", "dev", "distdir", "port_tmpdir"]
> > …
> > + self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"]
> > …
> > + if "SNAPCACHE" not in self.settings:
> > + self.mounts.remove("portdir")
>
> I'd prefer:
>
> self.mounts = ["proc", "dev", "distdir", "port_tmpdir"]
> if "SNAPCACHE" in self.settings:
> self.mounts.append("portdir")
>
> Cheers,
> Trevor
>
I didn't do that because I didn't know if the mount order was important,
so erred on the side of the current order.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 620 bytes --]
next prev parent reply other threads:[~2014-01-03 6:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-03 6:00 [gentoo-catalyst] Fix the recent python sem_open failure Brian Dolbec
2014-01-03 6:00 ` [gentoo-catalyst] [PATCH 1/2] modules/generic_stage_target.py, Create SOURCE_MOUNTS_DEFAULTS Brian Dolbec
2014-01-03 6:20 ` W. Trevor King
2014-01-03 6:52 ` Brian Dolbec [this message]
2014-01-03 16:11 ` W. Trevor King
2014-01-03 6:00 ` [gentoo-catalyst] [PATCH 2/2] catalyst/targets/generic_stage_target.py: mount /dev/shm on linux Brian Dolbec
2014-01-03 6:33 ` 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=1388731920.3753.14.camel@big_daddy.dol-sen.ca \
--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