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 0A0901381F3 for ; Wed, 29 May 2013 02:59:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A3B99E0AE2; Wed, 29 May 2013 02:59:05 +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 1B76AE0AE2 for ; Wed, 29 May 2013 02:59:05 +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 E3CAE33DE10 for ; Wed, 29 May 2013 02:59:03 +0000 (UTC) Message-ID: <1369796341.3446.103.camel@big_daddy.dol-sen.ca> Subject: Re: [gentoo-catalyst] PKGCACHE_PATH and os.makedirs() usage From: Brian Dolbec To: gentoo-catalyst@lists.gentoo.org Date: Tue, 28 May 2013 19:59:01 -0700 In-Reply-To: <1369793318.3446.100.camel@big_daddy.dol-sen.ca> References: <1369793318.3446.100.camel@big_daddy.dol-sen.ca> Content-Type: text/plain; charset="UTF-8" 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 Content-Transfer-Encoding: 7bit X-Archives-Salt: 418a701b-1cd6-4dc3-9f19-1fea1a5446a7 X-Archives-Hash: a6034758d31ad6c6d875f578ef6b06be On Tue, 2013-05-28 at 19:08 -0700, Brian Dolbec wrote: > While investigating why the stage1 build was not creating or using > binpkgs as expected. I discovered that the PKGCACHE-PATH dir was not > being checked for existence nor being created if it didn't. > > I did however discover that it was indeed checked and/or created in > livecd_stage2.py. It should be done in the StageBase class (my rewrite) > where it it set upon the class's initialization. This will centralize > the operation to one common location. This portion is something easily > done in the current master and probably desirable for the next release. > OK, turns out it is in the base class, so the one in livecd_stage2.py is a duplicate. Ignore this first part. This next section below still applies. > Further investigation of the use of os.makedirs() reveals that none of > it's frequent use does any error checking or exception escaping. > I propose to move this common code to either a utility function or > possibly a FileOps class that the main classes can then subclass or > create an instance of. I need to investigate what method will be best. > That way, exceptions can be controlled for the type of failure desired. > As well as proper shutdown procedures to run for a failure. > > If it is moved into a class, I may also move the pack/unpack operations > into it, removing some of the complexity from the currently overloaded > base stage classes. They are after all file operations. Again, > something to be determined. > > > What say everyone? > > > > >