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 AF19113827E for ; Sat, 14 Dec 2013 11:15:57 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EC7F3E0B08; Sat, 14 Dec 2013 11:15:55 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 61D03E0B08 for ; Sat, 14 Dec 2013 11:15:55 +0000 (UTC) Received: from [192.168.1.210] (S010600222de111ff.vc.shawcable.net [96.49.5.156]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: dolsen) by smtp.gentoo.org (Postfix) with ESMTPSA id 588AA33EEE2; Sat, 14 Dec 2013 11:15:54 +0000 (UTC) Message-ID: <1387019742.3897.121.camel@big_daddy.dol-sen.ca> Subject: Re: [gentoo-catalyst] [PATCH 2/4] Remove self.mounts and self.mountmap's use of paths for keys and paths. From: Brian Dolbec To: Matt Turner Cc: gentoo-catalyst@lists.gentoo.org Date: Sat, 14 Dec 2013 03:15:42 -0800 In-Reply-To: References: <1386990436-9198-1-git-send-email-dolsen@gentoo.org> <1386990436-9198-3-git-send-email-dolsen@gentoo.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-r25H7bRqFKCOj3L7Xm7v" X-Mailer: Evolution 3.6.4 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 X-Archives-Salt: 59f81f51-bd1d-46f0-a33d-2aa16d7c9e90 X-Archives-Hash: 81ff617ba94940bb0f37818dd4d66c23 --=-r25H7bRqFKCOj3L7Xm7v Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, 2013-12-13 at 21:08 -0800, Matt Turner wrote: > On Fri, Dec 13, 2013 at 7:07 PM, Brian Dolbec wrote: > > Migrate more hardcoded paths to use settings variables instead. >=20 > I can't really make any sense of the commit title,=20 This is the full commit message in git: Remove self.mounts and self.mountmap's use of paths for keys and paths. Migrate more hardcoded paths to use settings variables instead. --------------- git send-email broke it up, using the first line as the subject, the other lines are included in the main text body. > and it'd be > preferable to do one path per patch. Re-coding that mounts and mountmap mess was hard enough and required lots of testing, fixing to get it correct and working. Splitting it up even more is an exercise in futility. >=20 > > --- > > catalyst | 3 ++ > > modules/generic_stage_target.py | 80 ++++++++++++++++++++-------------= -------- > > 2 files changed, 43 insertions(+), 40 deletions(-) > > > > diff --git a/catalyst b/catalyst > > index 19ec77e..60cea3e 100755 > > --- a/catalyst > > +++ b/catalyst > > @@ -62,8 +62,11 @@ def parse_config(myconfig): > > config_file=3D"" > > > > confdefaults=3D{ > > + "distdir": "/usr/portage/distfiles", > > "hash_function": "crc32", > > + "packagedir": "/usr/portage/packages", > > "portdir": "/usr/portage", > > + "port_tmpdir": "/var/tmp/portage", > > "repo_name": "portage", > > "sharedir": "/usr/lib/catalyst", > > "snapshot_name": "portage-", > > diff --git a/modules/generic_stage_target.py b/modules/generic_stage_ta= rget.py > > index c2888b6..342c65b 100644 > > --- a/modules/generic_stage_target.py > > +++ b/modules/generic_stage_target.py > > @@ -179,11 +179,11 @@ class generic_stage_target(generic_target): > > "/usr/portage":self.settings["snapshot_= cache_path"]+"/portage",\ > > "/usr/portage/distfiles":self.settings[= "distdir"],"/var/tmp/portage":"tmpfs"} > > else: > > - self.mounts=3D["/proc","/dev","/usr/portage/dis= tfiles","/var/tmp/portage"] > > - self.mountmap=3D{"/proc":"/proc","/dev":"/dev",= "/dev/pts":"/dev/pts",\ > > - "/usr/portage/distfiles":self.settings[= "distdir"],"/var/tmp/portage":"tmpfs"} > > + self.mounts=3D["proc","dev", "distdir", "port_t= mpdir"] > > + self.mountmap=3D{"proc":"/proc", "dev":"/dev", = "pts":"/dev/pts", > > + "distdir":self.settings["distdir"], "po= rt_tmpdir":"tmpfs"} > > if os.uname()[0] =3D=3D "Linux": > > - self.mounts.append("/dev/pts") > > + self.mounts.append("pts") > > > > self.set_mounts() > > > > @@ -195,16 +195,15 @@ class generic_stage_target(generic_target): > > self.set_pkgcache_path() > > print "Location of the package cache is "+\ > > self.settings["pkgcache_path"] > > - self.mounts.append("/usr/portage/packages") > > - self.mountmap["/usr/portage/packages"]=3D\ > > - self.settings["pkgcache_path"] > > + self.mounts.append("packagedir") > > + self.mountmap["packagedir"] =3D self.settings["= pkgcache_path"] > > > > if "KERNCACHE" in self.settings: > > self.set_kerncache_path() > > print "Location of the kerncache is "+\ > > self.settings["kerncache_path"] > > - self.mounts.append("/tmp/kerncache") > > - self.mountmap["/tmp/kerncache"]=3Dself.settings= ["kerncache_path"] > > + self.mounts.append("kerncache") > > + self.mountmap["kerncache"]=3Dself.settings["ker= ncache_path"] > > > > if "CCACHE" in self.settings: > > if "CCACHE_DIR" in os.environ: > > @@ -216,8 +215,8 @@ class generic_stage_target(generic_target): > > raise CatalystError,\ > > "Compiler cache support can't b= e enabled (can't find "+\ > > ccdir+")" > > - self.mounts.append("/var/tmp/ccache") > > - self.mountmap["/var/tmp/ccache"]=3Dccdir > > + self.mounts.append("ccache") > > + self.mountmap["ccache"]=3Dccdir > > """ for the chroot: """ > > self.env["CCACHE_DIR"]=3D"/var/tmp/ccache" > > > > @@ -406,7 +405,7 @@ class generic_stage_target(generic_target): > > > > def set_cleanables(self): > > self.settings["cleanables"]=3D["/etc/resolv.conf","/var= /tmp/*","/tmp/*",\ > > - "/root/*","/usr/portage"] > > + "/root/*", self.settings["portdir"]] > > > > def set_snapshot_path(self): > > self.settings["snapshot_path"]=3Dnormpath(self.settings= ["storedir"]+\ > > @@ -615,21 +614,21 @@ class generic_stage_target(generic_target): > > return > > > > for x in self.mounts: > > - if not os.path.exists(mypath+x): > > + if not os.path.exists(mypath + self.mountmap[x]= ): > > continue > > > > - if ismount(mypath+x): > > + if ismount(mypath +self.mountmap[x]): > > """ Something is still mounted "" """ > > try: > > - print x+" is still mounted; per= forming auto-bind-umount...", > > + print self.mountmap[x] + " is s= till mounted; performing auto-bind-umount...", > > """ Try to umount stuff ourselv= es """ > > self.unbind() > > - if ismount(mypath+x): > > - raise CatalystError, "A= uto-unbind failed for "+x > > + if ismount(mypath + self.mountm= ap[x]): > > + raise CatalystError, "A= uto-unbind failed for " + self.mountmap[x] > > else: > > print "Auto-unbind succ= essful..." > > except CatalystError: > > - raise CatalystError, "Unable to= auto-unbind "+x > > + raise CatalystError, "Unable to= auto-unbind " + self.mountmap[x] > > > > def unpack(self): > > unpack=3DTrue > > @@ -787,7 +786,7 @@ class generic_stage_target(generic_target): > > print "Valid snapshot cache, skipping u= npack of portage tree..." > > unpack=3DFalse > > else: > > - destdir=3Dnormpath(self.settings["chroot_path"]= +"/usr/portage") > > + destdir=3Dnormpath(self.settings["chroot_path"]= + self.settings["portdir"]) > > cleanup_errmsg=3D"Error removing existing snaps= hot directory." > > cleanup_msg=3D\ > > "Cleaning up existing portage tree (Thi= s can take a long time)..." > > @@ -801,7 +800,7 @@ class generic_stage_target(generic_target): > > > > if "AUTORESUME" in self.settings \ > > and os.path.exists(self.settings["chroo= t_path"]+\ > > - "/usr/portage/") \ > > + self.settings["portdir"]) \ > > and os.path.exists(self.settings["autor= esume_path"]\ > > +"unpack_portage") \ > > and self.settings["snapshot_path_hash"]= =3D=3D snapshot_hash: > > @@ -848,7 +847,7 @@ class generic_stage_target(generic_target): > > cmd("rm -f "+self.settings["chroot_path"]+"/etc= /portage/make.profile",\ > > "Error zapping profile link",en= v=3Dself.env) > > cmd("mkdir -p "+self.settings["chroot_path"]+"/= etc/portage/") > > - cmd("ln -sf ../../usr/portage/profiles/"+\ > > + cmd("ln -sf ../.." + self.settings["portdir"] += "/profiles/"+\ > > self.settings["target_profile"]+" "+\ > > self.settings["chroot_path"]+"/etc/port= age/make.profile",\ > > "Error creating profile link",env=3Dsel= f.env) > > @@ -874,10 +873,10 @@ class generic_stage_target(generic_target): > > if os.path.exists(x): > > print "Copying overlay dir " +x > > cmd("mkdir -p "+self.settings["= chroot_path"]+\ > > - "/usr/local/portage",\ > > + self.settings["local_ov= erlay"],\ > > "Could not make portage= _overlay dir",env=3Dself.env) > > cmd("cp -R "+x+"/* "+self.setti= ngs["chroot_path"]+\ > > - "/usr/local/portage",\ > > + self.settings["local_ov= erlay"],\ > > "Could not copy portage= _overlay",env=3Dself.env) > > > > def root_overlay(self): > > @@ -897,7 +896,7 @@ class generic_stage_target(generic_target): > > > > def bind(self): > > for x in self.mounts: > > - if not os.path.exists(self.settings["chroot_pat= h"]+x): > > + if not os.path.exists(self.settings["chroot_pat= h"] + self.mountmap[x]): > > os.makedirs(self.settings["chroot_path"= ]+x,0755) > > > > if not os.path.exists(self.mountmap[x]): > > @@ -909,11 +908,11 @@ class generic_stage_target(generic_target): > > self.snapshot_lock_object.read_lock() > > if os.uname()[0] =3D=3D "FreeBSD": > > if src =3D=3D "/dev": > > - retval=3Dos.system("mount -t de= vfs none "+\ > > - self.settings["chroot_p= ath"]+x) > > + retval=3Dos.system("mount -t de= vfs none " + > > + self.settings["chroot_p= ath"] + src) > > else: > > - retval=3Dos.system("mount_nullf= s "+src+" "+\ > > - self.settings["chroot_p= ath"]+x) > > + retval=3Dos.system("mount_nullf= s " + src + " " + > > + self.settings["chroot_p= ath"] + src) > > else: > > if src =3D=3D "tmpfs": > > if "var_tmpfs_portage" in self.= settings: > > @@ -921,11 +920,11 @@ class generic_stage_target(generic_target): > > self.settings["= var_tmpfs_portage"]+"G "+src+" "+\ > > self.settings["= chroot_path"]+x) > > else: > > - retval=3Dos.system("mount --bin= d "+src+" "+\ > > - self.settings["chroot_p= ath"]+x) > > + retval=3Dos.system("mount --bin= d " + src + " " + > > + self.settings["chroot_p= ath"] + src) > > if retval!=3D0: > > self.unbind() > > - raise CatalystError,"Couldn't bind moun= t "+src > > + raise CatalystError,"Couldn't bind moun= t " + src > > > > def unbind(self): > > ouch=3D0 > > @@ -934,25 +933,26 @@ class generic_stage_target(generic_target): > > myrevmounts.reverse() > > """ Unmount in reverse order for nested bind-mounts """ > > for x in myrevmounts: > > - if not os.path.exists(mypath+x): > > + if not os.path.exists(mypath + self.mountmap[x]= ): > > continue > > > > - if not ismount(mypath+x): > > + if not ismount(mypath + self.mountmap[x]): > > continue > > > > retval=3Dos.system("umount "+\ > > - os.path.join(mypath,x.lstrip(os.path.se= p))) > > + os.path.join(mypath, self.mountmap[x].l= strip(os.path.sep))) > > > > if retval!=3D0: > > - warn("First attempt to unmount: "+mypat= h+x+" failed.") > > + warn("First attempt to unmount: " + myp= ath + > > + self.mountmap[x] +" failed.") > > warn("Killing any pids still running in= the chroot") > > > > self.kill_chroot_pids() > > > > - retval2=3Dos.system("umount "+mypath+x) > > + retval2=3Dos.system("umount " + mypath = + self.mountmap[x]) > > if retval2!=3D0: > > ouch=3D1 > > - warn("Couldn't umount bind moun= t: "+mypath+x) > > + warn("Couldn't umount bind moun= t: " + mypath + self.mountmap[x]) > > > > if "SNAPCACHE" in self.settings and x =3D=3D "/= usr/portage": > > try: > > @@ -1118,9 +1118,9 @@ class generic_stage_target(generic_target): > > "Could not replace /etc/hosts",env=3Dse= lf.env) > > > > """ Remove our overlay """ > > - if os.path.exists(self.settings["chroot_path"]+"/usr/lo= cal/portage"): > > - cmd("rm -rf "+self.settings["chroot_path"]+"/us= r/local/portage",\ > > - "Could not remove /usr/local/portage",e= nv=3Dself.env) > > + if os.path.exists(self.settings["chroot_path"] + self.s= ettings["local_overlay"]): > > + cmd("rm -rf " + self.settings["chroot_path"] + = self.settings["local_overlay"], > > + "Could not remove " + self.settings["lo= cal_overlay"], env=3Dself.env) > > cmd("sed -i '/^PORTDIR_OVERLAY/d' "+self.settin= gs["chroot_path"]+\ > > "/etc/portage/make.conf",\ > > "Could not remove PORTDIR_OVERLAY from = make.conf",env=3Dself.env) > > -- > > 1.8.3.2 > > > > >=20 > There are piles of unrelated changes. :( Yes, there are 2 distinct commits in one, one is the mounts, mountmap changes, the other is the migrate more hard coded paths. The latter changes the "/usr/local/portage" hard coding to using a setting variable. It was done before I found the feature in gitg that lets me select individual lines to include in a commit. --=-r25H7bRqFKCOj3L7Xm7v Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQF8BAABCgBmBQJSrD3eXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ4Njg4RkQxQ0M3MUMxQzA0RUFFQTQyMzcy MjE0RDkwQTAxNEYxN0NCAAoJECIU2QoBTxfLbZkH/R8A9mB32ojjgNBaVALji73L GCxFlYpS4/bRH132pSCoCu7YJhHBs7+iuXMzaXpxZyyj27uO6U56luLYSDvIMdhJ MIE6T44s9y0CsRd9dSmxGrdPV/DEyeTSmATJEPE1PJD3F+ynPnM2J0YidiYmKDL7 i3DX0pYYZ99mOI9tbpc7y0gxmiAgzRhSbEqmAoAz7G3tml3u5ELpSoRHWt6TzVv1 7hh/xLzVDt2x5VNa3QKF7eb8p6/BNWNbitiqQU36NymoSQI5xnMFn+l6qORLdZrr u8q75inxaLlODkj5q1tiEyx21h8J9ELcKyrAg55fEuWUiP3b6tpizudC5XW0c+o= =VayR -----END PGP SIGNATURE----- --=-r25H7bRqFKCOj3L7Xm7v--