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 415D0138247 for ; Fri, 3 Jan 2014 06:20:58 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D9718E0A93; Fri, 3 Jan 2014 06:20:55 +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 5906DE0A93 for ; Fri, 3 Jan 2014 06:20:54 +0000 (UTC) Received: from omta02.westchester.pa.mail.comcast.net ([76.96.62.19]) by qmta02.westchester.pa.mail.comcast.net with comcast id 9JKH1n0010QuhwU51JLul3; Fri, 03 Jan 2014 06:20:54 +0000 Received: from odin.tremily.us ([24.18.63.50]) by omta02.westchester.pa.mail.comcast.net with comcast id 9JLt1n00A152l3L3NJLufj; Fri, 03 Jan 2014 06:20:54 +0000 Received: by odin.tremily.us (Postfix, from userid 1000) id DB38FE62F93; Thu, 2 Jan 2014 22:20:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin; t=1388730052; bh=+HywJltQZYmoINwG4e11EMrJ+L8E4b/yWyfXRYDhf0Q=; h=Date:From:To:Subject:References:In-Reply-To; b=UYtFcUCpZe6fGelVB9lS6tXu7TCqnxm1bpzU0IOAG/NLBtYMCSWZryeKf0uvJXvQM aelGyQ0wbiImHK1pq7S9ffNSBA8q/o0T2U/awVlgEpRzz/LZUKtovlesbv4qU3O3xx 0ZOVdrbSq6kxfFykE4vu4l5BmORpW+Fjm421MJVk= Date: Thu, 2 Jan 2014 22:20:52 -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: <20140103062052.GJ4680@odin.tremily.us> References: <1388728844-2142-1-git-send-email-dolsen@gentoo.org> <1388728844-2142-2-git-send-email-dolsen@gentoo.org> 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="HSQ3hISbU3Um6hch" Content-Disposition: inline In-Reply-To: <1388728844-2142-2-git-send-email-dolsen@gentoo.org> 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=1388730054; bh=598QsP9nUHQmuqGJpL24LT6nLA5Lb+7wLc8ExfH3LqA=; h=Received:Received:Received:Date:From:To:Subject:Message-ID: MIME-Version:Content-Type; b=DfQbswKfO5A+dSxHJD6FMiZuAmxNZ5+yJ0JTM4yfVV9zmOvSCVqCY8m0F0CO/bb3V ATpoxInK+BlXHTiCBvNOrMDb9z6OSdQ6zUeKlzEbjas9H3dKcGNw5/0P9zOOT4gpyq vxCepwjS05/FD94W4hREavw5Wp6cpHGESl7XGW8nMStJ107/mskFcAP+518oKjYHG8 zbogYjC0eLQkphf33mbC0JurER4KwayJpPwwQpg/wetfKx2nh3+MjUo2AFdSV516IJ cLi32NpiW4ZPlF5yRXBpMISOy/q1M0ZdHGXNPpe7y2emNM3NkgefeYecsxL2nZhq1n S/viUcKYY1p5Q== X-Archives-Salt: 9ba7d195-b4d7-4896-a1d6-79ed589a6d20 X-Archives-Hash: e1d526d6ed2daf054282c97c8fc093cd --HSQ3hISbU3Um6hch Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I shift quoted lines around for easier comparison. 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"], > + ])) Why create dummy initial values and then blow them away? Wouldn't: SOURCE_MOUNTS_DEFAULTS =3D { =E2=80=A6 '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. > - if "SNAPCACHE" in self.settings: > - self.mounts =3D ["proc", "dev", "portdir", "distdir", "port_tmpdir"] > =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") I'd prefer: self.mounts =3D ["proc", "dev", "distdir", "port_tmpdir"] if "SNAPCACHE" in self.settings: self.mounts.append("portdir") 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 --HSQ3hISbU3Um6hch Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJSxlbCAAoJEKKfehoaNkbtutsP/0+I6ObapLqs6vge8ZS/Nt/j DWeyAgdWeVkVHb6i9dvhYIhwyzs0RVOW6H26SXIb5lhuDZot0ER/256rV467nQz8 qtPe94WFsPc76DCSpA52YID2Ii9DRmwKsqfMVE7iDshoKDf9Sz6q6ehjJaI7PcTI VoTpJD29q+CYDUnnN2S7PjCrCT9dEUyw7LkGC25SrOb9vV4pxU1Bl5ym4VEChjNF e6ZSvrvdqBI/C+LN4YqDN1Xv4i5fW7y4/vp2pL0iTE3Fy5oSl0dU6f9c4caa5CZ2 WUA5/hGOCqaDPNLDg+B3A92qV57kinNAU9PE4ENErlPUOnTthnKCcaTZ4QdbgA52 rbIieBokRmZdz0dShOwzmb1cvKx8wul1s9J+BhIfIHI/C81oypzGUIaEBSaTJwCs G1qrkin1+wCfiLmvAavD3ihHl1Q64mRyLVeDfBDLPKBnO4yGxK4KsXGl1YFDIcsA zJ7zmlM9a0e0zuEPBWaB6qyzGS5O/ROD5BtXPbu5HmkFa8GWofgszlIMcCZQ33Bu 0pc/uI0hhMmGMncMtRqoEqC/xC6pJ6T2g2DssXawdCOnGw+hj/8lmc5OTfDd3q7X eKEoOP5QLEc/YvrYCNV9Oxm0bbBeQmiN5AzaI5sJu8JB78xWjgGlXhrg289vK7wK A1ktvoXesHbkdMpNERlv =eAWw -----END PGP SIGNATURE----- --HSQ3hISbU3Um6hch--