Gentoo Archives: gentoo-catalyst

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

Replies