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 C2B8313827E for ; Sat, 14 Dec 2013 15:03:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 50C18E0BBC; Sat, 14 Dec 2013 15:03:59 +0000 (UTC) Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A9760E0BBC for ; Sat, 14 Dec 2013 15:03:58 +0000 (UTC) Received: by mail-pd0-f174.google.com with SMTP id y13so3618498pdi.19 for ; Sat, 14 Dec 2013 07:03:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-type; bh=dpSzQRbLO/n7Qa/r1ahM0yE3lAiX4osT/bAzlVGoRiY=; b=yONTOU8OX3VTiufPKG/3xhuNVlOpprL503kcsbv1Y13a0MK+9q+F/Pus6hyKtILWJB nJnxN/RWMoC3nIh8o3rLqEMMxjHBIs/G7C9m2B7uz33vJ++v5+DBawO1t4In/0kMxM/+ kJUjea/K2h430ckPSTr44mBpsY4+h2DGIw7xoQTEiJv9ejkgNaCdO7IB2aklifzm+Vcf mRBiEupWzxEvbNBs3H3iVQnPBD/6NPT3xEH9yN7gp0Sh9r/q0WU6ygFGNctnoRI9xhFh gOV/DVdQsYUC+mRO8YIlhHLwA1tdjPp2jMCh4SCLuzm71aPrWwWOh7qQcOAVqmOVzxE7 dhsg== X-Received: by 10.66.192.74 with SMTP id he10mr9927553pac.126.1387033432386; Sat, 14 Dec 2013 07:03:52 -0800 (PST) Received: from moiraine.localnet ([50.126.105.238]) by mx.google.com with ESMTPSA id pe3sm12914356pbc.23.2013.12.14.07.03.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 Dec 2013 07:03:51 -0800 (PST) From: Dylan Baker To: gentoo-catalyst@lists.gentoo.org Cc: Brian Dolbec Subject: Re: [gentoo-catalyst] [PATCH 1/4] Add more configured defaults Date: Sat, 14 Dec 2013 06:33:43 -0800 Message-ID: <1535770.iBKyIEEe9T@moiraine> User-Agent: KMail/4.11.4 (Linux/3.12.5; KDE/4.11.4; x86_64; ; ) In-Reply-To: <1386990436-9198-2-git-send-email-dolsen@gentoo.org> References: <1386990436-9198-1-git-send-email-dolsen@gentoo.org> <1386990436-9198-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; boundary="nextPart2453724.RDzEBT1bQc"; micalg="pgp-sha1"; protocol="application/pgp-signature" X-Archives-Salt: c4839489-d4c2-4ed0-91ae-4b654d5141c7 X-Archives-Hash: 527b0243cceb98c5d01024f3ca8505a0 --nextPart2453724.RDzEBT1bQc Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" On Friday, December 13, 2013 07:07:13 PM Brian Dolbec wrote: > Use the new configured snapshot_name and portdir settings > Use the portdir setting rather than hard-coded path > --- > catalyst | 14 +++++++++----- > modules/generic_stage_target.py | 6 ++++-- > modules/snapshot_target.py | 14 +++++++++----- > modules/tinderbox_target.py | 4 ++-- > 4 files changed, 24 insertions(+), 14 deletions(-) > > diff --git a/catalyst b/catalyst > index ba26f3c..19ec77e 100755 > --- a/catalyst > +++ b/catalyst > @@ -61,11 +61,15 @@ def parse_config(myconfig): > myconf={} > config_file="" > > - confdefaults={ "storedir":"/var/tmp/catalyst",\ > - "sharedir":"/usr/share/catalyst","distdir":"/usr/portage/distfiles",\ > - "portdir":"/usr/portage","options":"",\ > - "snapshot_cache":"/var/tmp/catalyst/snapshot_cache",\ > - "hash_function":"crc32"} > + confdefaults={ > + "hash_function": "crc32", > + "portdir": "/usr/portage", > + "repo_name": "portage", > + "sharedir": "/usr/lib/catalyst", > + "snapshot_name": "portage-", > + "snapshot_cache": "/var/tmp/catalyst/snapshot_cache", > + "storedir": "/var/tmp/catalyst", > + } pleas keep the formatting style; no comma on the last element and closing brace on the same line > > # first, try the one passed (presumably from the cmdline) > if myconfig: > diff --git a/modules/generic_stage_target.py > b/modules/generic_stage_target.py index 848aca2..c2888b6 100644 > --- a/modules/generic_stage_target.py > +++ b/modules/generic_stage_target.py > @@ -410,7 +410,8 @@ class generic_stage_target(generic_target): > > def set_snapshot_path(self): > self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\ > - "/snapshots/portage-"+self.settings["snapshot"]+".tar.xz") > + "/snapshots/" + self.settings["snapshot_name"] + > + self.settings["snapshot"]+".tar.xz") please be consistent with spaces between operators; follow whatever PEP8 says to do this case :) I'd also suggest using the str.format() method instead of concatenating a large number of strings and variables, it's much more readable IMHO: self.settings["snapshot_path"] = os.path.normpath( "{0}/snapshots/{1}{2}.tar.xz".format( self.settings["storedir"], self.settings["snapshot_name"], self.settings["snapshot"])) > > if os.path.exists(self.settings["snapshot_path"]): > self.settings["snapshot_path_hash"]=\ > @@ -418,7 +419,8 @@ class generic_stage_target(generic_target): > hash_function=self.settings["hash_function"],verbose=False) > else: > self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\ > - "/snapshots/portage-"+self.settings["snapshot"]+".tar.bz2") > + "/snapshots/" + self.settings["snapshot_name"] + > + self.settings["snapshot"]+".tar.bz2") see my previous comment > > if os.path.exists(self.settings["snapshot_path"]): > self.settings["snapshot_path_hash"]=\ > diff --git a/modules/snapshot_target.py b/modules/snapshot_target.py > index e93a86a..29d6e87 100644 > --- a/modules/snapshot_target.py > +++ b/modules/snapshot_target.py > @@ -18,8 +18,9 @@ class snapshot_target(generic_stage_target): > self.settings=myspec > self.settings["target_subpath"]="portage" > st=self.settings["storedir"] > - self.settings["snapshot_path"]=normpath(st+"/snapshots/portage-"+self.set > tings["version_stamp"]\ - +".tar.bz2") > + self.settings["snapshot_path"]=normpath(st + "/snapshots/" > + + self.settings["snapshot_name"] > + + self.settings["version_stamp"] + ".tar.bz2") again > self.settings["tmp_path"]=normpath(st+"/tmp/"+self.settings["target_subpa > th"]) > > def setup(self): > @@ -46,11 +47,14 @@ class snapshot_target(generic_stage_target): > if not os.path.exists(mytmp): > os.makedirs(mytmp) > > - cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ > --exclude /local/ --exclude CVS/ --exclude .svn > --filter=H_**/files/digest-* "+\ - self.settings["portdir"]+"/ > "+mytmp+"/portage/","Snapshot failure",env=self.env) + cmd("rsync -a > --delete --exclude /packages/ --exclude /distfiles/ " + + "--exclude > /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* " + > + self.settings["portdir"] + "/ " + mytmp + "/%s/" % > self.settings["repo_name"], + "Snapshot failure",env=self.env) > > print "Compressing Portage snapshot tarball..." > - cmd("tar -I lbzip2 -cf "+self.settings["snapshot_path"]+" -C "+mytmp+" > portage",\ + cmd("tar -I lbzip2 -cf " + self.settings["snapshot_path"] + " > -C " + + mytmp + " %s" % self.settings["repo_name"], > "Snapshot creation failure",env=self.env) > > self.gen_contents_file(self.settings["snapshot_path"]) > diff --git a/modules/tinderbox_target.py b/modules/tinderbox_target.py > index 46fe082..d6d3ea3 100644 > --- a/modules/tinderbox_target.py > +++ b/modules/tinderbox_target.py > @@ -29,8 +29,8 @@ class tinderbox_target(generic_stage_target): > raise CatalystError,"Tinderbox aborting due to error." > > def set_cleanables(self): > - > self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*",\ > - "/usr/portage"] > + > self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*", > + self.settings['portdir']] spaces between the elements of a list pls. > > def set_action_sequence(self): > #Default action sequence for run method --nextPart2453724.RDzEBT1bQc 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) iQEcBAABAgAGBQJSrGxHAAoJEAieFpYUBojvedkIAIZYoHe5deEXUKkb5yGMxxA6 BWUJFdDZ4HidJBeQIzMELgt4lAzUFyrUfvEXe3XVPncZumb9joduzxM0Bq8ZAlxz GeLDtkh23rzIAy2aGYyFypxTMe2erABN60mXmrjrW2auhLdRPk585gENFfg74qgL zSyKsGiN/EVNpQXyNTQ2oqwSv+JJyhZVnUdRUuyEGfW4tJTFwlVBvCObgEo3M0lC KoeebrnWK2h1ufKGX/PTBtcKAiQPeX8D3ZXQTCAzMZqpvRiAM1SiAoj4PP7WqedR GD5atsaP3VmNlJw8zeLYpPQI+Gvn4+LL9Mv99vcSSvCSU+6XHexLYssb8ig5/Fs= =+Hip -----END PGP SIGNATURE----- --nextPart2453724.RDzEBT1bQc--