Gentoo Archives: gentoo-catalyst

From: Brian Dolbec <dolsen@g.o>
To: gentoo-catalyst@l.g.o
Subject: Re: [gentoo-catalyst] PKGCACHE_PATH and os.makedirs() usage
Date: Wed, 29 May 2013 02:59:11
Message-Id: 1369796341.3446.103.camel@big_daddy.dol-sen.ca
In Reply to: [gentoo-catalyst] PKGCACHE_PATH and os.makedirs() usage by Brian Dolbec
1 On Tue, 2013-05-28 at 19:08 -0700, Brian Dolbec wrote:
2 > While investigating why the stage1 build was not creating or using
3 > binpkgs as expected. I discovered that the PKGCACHE-PATH dir was not
4 > being checked for existence nor being created if it didn't.
5 >
6 > I did however discover that it was indeed checked and/or created in
7 > livecd_stage2.py. It should be done in the StageBase class (my rewrite)
8 > where it it set upon the class's initialization. This will centralize
9 > the operation to one common location. This portion is something easily
10 > done in the current master and probably desirable for the next release.
11 >
12
13 OK, turns out it is in the base class, so the one in livecd_stage2.py is
14 a duplicate. Ignore this first part.
15
16 This next section below still applies.
17 > Further investigation of the use of os.makedirs() reveals that none of
18 > it's frequent use does any error checking or exception escaping.
19 > I propose to move this common code to either a utility function or
20 > possibly a FileOps class that the main classes can then subclass or
21 > create an instance of. I need to investigate what method will be best.
22 > That way, exceptions can be controlled for the type of failure desired.
23 > As well as proper shutdown procedures to run for a failure.
24 >
25 > If it is moved into a class, I may also move the pack/unpack operations
26 > into it, removing some of the complexity from the currently overloaded
27 > base stage classes. They are after all file operations. Again,
28 > something to be determined.
29 >
30 >
31 > What say everyone?
32 >
33 >
34 >
35 >
36 >