From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id C562C138247 for ; Fri, 3 Jan 2014 16:11:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 27B3CE07D1; Fri, 3 Jan 2014 16:11:57 +0000 (UTC) Received: from qmta02.westchester.pa.mail.comcast.net (qmta02.westchester.pa.mail.comcast.net [76.96.62.24]) by pigeon.gentoo.org (Postfix) with ESMTP id A5E52E07D1 for ; Fri, 3 Jan 2014 16:11:56 +0000 (UTC) Received: from omta01.westchester.pa.mail.comcast.net ([76.96.62.11]) by qmta02.westchester.pa.mail.comcast.net with comcast id 9Ss81n0050EZKEL51UBwZC; Fri, 03 Jan 2014 16:11:56 +0000 Received: from odin.tremily.us ([24.18.63.50]) by omta01.westchester.pa.mail.comcast.net with comcast id 9UBu1n00D152l3L3MUBvmm; Fri, 03 Jan 2014 16:11:56 +0000 Received: by odin.tremily.us (Postfix, from userid 1000) id 16E4CE662A4; Fri, 3 Jan 2014 08:11:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin; t=1388765514; bh=fVRWQFfSrO+oB0SqGgRrEjsyOQWBe7T2M3hpoT1wY10=; h=Date:From:To:Subject:References:In-Reply-To; b=RDXz2OUZGn/zZvLkqIeXrWqQODbqzCO5dFc2BIiWK8na4f2sSpAwqQnqhytb3Jjb8 giEmDOus455/J4rZHJuUMHo58LckSIB5ucXdCCHJOXHzdkw+tZpWq568/UXHl8mYj4 FnwY/ucTEGRPOoeNdMnOz/tLK8xNuSuFH8l1LjC8= Date: Fri, 3 Jan 2014 08:11:53 -0800 From: "W. Trevor King" To: gentoo-catalyst@lists.gentoo.org Subject: Re: [gentoo-catalyst] [PATCH 1/2] modules/generic_stage_target.py, Create SOURCE_MOUNTS_DEFAULTS Message-ID: <20140103161153.GL4680@odin.tremily.us> References: <1388728844-2142-1-git-send-email-dolsen@gentoo.org> <1388728844-2142-2-git-send-email-dolsen@gentoo.org> <20140103062052.GJ4680@odin.tremily.us> <1388731920.3753.14.camel@big_daddy.dol-sen.ca> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DN8g+DOX2TxGxleI" Content-Disposition: inline In-Reply-To: <1388731920.3753.14.camel@big_daddy.dol-sen.ca> OpenPGP: id=39A2F3FA2AB17E5D8764F388FC29BDCDF15F5BE8; url=http://tremily.us/pubkey.txt User-Agent: Mutt/1.5.22 (2013-10-16) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1388765516; bh=b2PiV7yptyFpzkOJK20asjuF/gwASFJUJyaNaR+9PW4=; h=Received:Received:Received:Date:From:To:Subject:Message-ID: MIME-Version:Content-Type; b=AxtVlW5tgFk/yF3j0BbvqGchYciyJLiQmCuBE50C+K3I0sBT/W2dTdWxlBs2Woq12 1EdpJxyf74gZatpIXvqcpsGosBpS7Yz+QYrxz0pnXstr3DjsE25LimPc2QDDQE6UYy tHP/X1tACo63oYHPOBbefZgkvWsmmRsJlLHEiuowUgfgEQlKBHJOI7PsPxaygXNLO1 zrxvbFTTR9vNEGa0X9LVXi85CaAHDCRXhE/NJhiuGBrawwVJUBGguh2SYuF8oZy2ij H+uyLJJa67J82/C11LpFVLGcADVqbgKev8xlfu8PUYmzkNeSbVF0zuyYShFUqbHhQe YQQHf5a2sdjiQ== X-Archives-Salt: 498bfe3a-24ce-4b8e-8d01-a79abdea7363 X-Archives-Hash: 9e5a06129a6131e81cfb57ae736ce257 --DN8g+DOX2TxGxleI Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 02, 2014 at 10:52:00PM -0800, Brian Dolbec wrote: > On Thu, 2014-01-02 at 22:20 -0800, W. Trevor King wrote: > > On Thu, Jan 02, 2014 at 10:00:43PM -0800, Brian Dolbec wrote: > > > +SOURCE_MOUNTS_DEFAULTS =3D { > > > =E2=80=A6 > > > + "distdir": "/usr/portage/distfiles", > > > + "portdir": "/usr/portage", > > > =E2=80=A6 > > > - "distdir": self.settings["distdir"], > > > - "portdir": normpath("/".join([ > > > - self.settings["snapshot_cache_path"], > > > - self.settings["repo_name"], > > > - ])), > > > =E2=80=A6 > > > + # initialize our source mounts > > > + self.mountmap =3D SOURCE_MOUNTS_DEFAULTS.copy() > > > + # update them from settings > > > + self.mountmap["distdir"] =3D self.settings["distdir"] > > > + self.mountmap["portdir"] =3D normpath("/".join([ > > > + self.settings["snapshot_cache_path"], > > > + self.settings["repo_name"], > > > + ])) > >=20 > > Why create dummy initial values and then blow them away? Wouldn't: > >=20 > > SOURCE_MOUNTS_DEFAULTS =3D { > > =E2=80=A6 > > 'distdir': None, # initialized from settings > > 'portdir': None, # initialized from settings > > } > >=20 > > 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. >=20 > 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. I'm fine with that, but then we should either use this to setup settings' defaults, or check to make sure the key is in settings before clobbering the version from SOURCE_MOUNTS_DEFAULTS. > > > - if "SNAPCACHE" in self.settings: > > > - self.mounts =3D ["proc", "dev", "portdir", "distdir", "port_tmpdi= r"] > > > =E2=80=A6 > > > - else: > > > - self.mounts =3D ["proc", "dev", "distdir", "port_tmpdir"] > > > =E2=80=A6 > > > + self.mounts =3D ["proc", "dev", "portdir", "distdir", "port_tmpdir= "] > > > =E2=80=A6 > > > + if "SNAPCACHE" not in self.settings: > > > + self.mounts.remove("portdir") > >=20 > > I'd prefer: > >=20 > > self.mounts =3D ["proc", "dev", "distdir", "port_tmpdir"] > > if "SNAPCACHE" in self.settings: > > self.mounts.append("portdir") >=20 > 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. Ah, good point. Mounting portdir after distdir would probably not work well ;). I now think the preloaded mounts is a good idea, and that we should fill in the missing keys here too for consistency ('devpts', 'ccache', 'icecream', =E2=80=A6). Then remove entries as appropriate for the OS/settings. Cheers, Trevor --=20 This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy --DN8g+DOX2TxGxleI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJSxt/0AAoJEKKfehoaNkbtOREP/3Rc+dzlqloh5AziksmsTtyl ovbQz+5mV8boZAzSkBV6IzlDiA/Nbwx3BR/vWcbowH1h6DYxwDpO+GljlDI71Jh4 kf1IinJebrcwWl2rCTHM+6OBxZMQnd722Px+XgI1fim/GpMAXrRBoukcZL1/C4Vv UnBqIfXAp7ZBb36QEu6xQNK+vcYru0AWIhyPrkS6aUkeh8s8Sdkn+LBpgwzaeoX4 I3s3RvCqKQPz2i37qjqMou4JFJYQqvPhi6j1aXwxyzfmCCjVKNcskckwDu9Ao5Fo OuqnkuYSD7K+Kbo7wk+vWR0XOg4BhKEVhzzc0PrUBt/2hYTPUHtd4UWy9JIE7rV/ qQ5eIDqKR1MwtQB3J4/Q6+lWyPPJQafsC3emplX+Ao2aAYlrLhXT2zkDB9MIexFT v+rL0xqVqDp85ZZjiWtXU6ChoqeMmK+a3nuJCs3QwJrF/l6JBgtYi7fxSGG6ZY2h /1qa+os7/QWrpuoeT7rx4RyDIreUAPpATALObMAtNh9Qh/T6O9eIyODhJ1qyzbne gHzWA1hKl0z383pdIype46fPU9oU6gziUGxotJCBwuzHrbjnlpDWiRd6yM/Aoez9 oQznrmsCs69LHNYtKf5st3enrTpDKlZgXqL1G9b0amoinO9jPBTGT/3+Dq6WPa69 5f4M5z6r5mTXCqCJ5YHK =QGcF -----END PGP SIGNATURE----- --DN8g+DOX2TxGxleI--