# Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS)
# Distributed under the GPL v2
+ 11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org>
+ modules/catalyst/support.py, modules/catalyst/target/generic_stage.py,
+ modules/catalyst/target/livecd_stage2.py, modules/catalyst/util.py:
+ Replace catalyst.support.read_from_clst() with catalyst.util.readfile()
+ and update references
+
11 Jan 2009; Andrew Gaffney <agaffney@gentoo.org> catalyst,
modules/catalyst/util.py:
Modify global import from catalyst.support to just import what's needed
"whirlpool":[calc_hash2,"shash","-a WHIRLPOOL","WHIRLPOOL"],\
}
-def read_from_clst(file):
- line = ''
- myline = ''
- try:
- myf=open(file,"r")
- except:
- return -1
- #raise CatalystError, "Could not open file "+file
- for line in myf.readlines():
- #line = string.replace(line, "\n", "") # drop newline
- myline = myline + line
- myf.close()
- return myline
-# read_from_clst
-
required_config_file_values=["storedir","sharedir","distdir","portdir"]
valid_config_file_values=required_config_file_values[:]
valid_config_file_values.append("PKGCACHE")
import catalyst.lock
import catalyst.arch
from catalyst.output import warn
+import catalyst.util
class generic_stage_target(generic_target):
def unpack(self):
unpack=True
- clst_unpack_hash=read_from_clst(self.settings["autoresume_path"]+\
+ clst_unpack_hash = catalyst.util.readfile(self.settings["autoresume_path"]+\
"unpack")
if "SEEDCACHE" in self.settings:
def unpack_snapshot(self):
unpack=True
- snapshot_hash=read_from_clst(self.settings["autoresume_path"]+\
+ snapshot_hash = catalyst.util.readfile(self.settings["autoresume_path"]+\
"unpack_portage")
if "SNAPCACHE" in self.settings:
- snapshot_cache_hash=\
- read_from_clst(self.settings["snapshot_cache_path"]+\
+ snapshot_cache_hash = \
+ catalyst.util.readfile(self.settings["snapshot_cache_path"]+\
"catalyst-hash")
destdir=self.settings["snapshot_cache_path"]
unpack_cmd="tar xjpf "+self.settings["snapshot_path"]+" -C "+destdir
import os,string,types,stat,shutil
from catalyst.support import *
from generic_stage import *
+import catalyst.util
class livecd_stage2_target(generic_stage_target):
def __init__(self,spec,addlargs):
unpack=True
display_msg=None
- clst_unpack_hash=read_from_clst(self.settings["autoresume_path"]+"unpack")
+ clst_unpack_hash = catalyst.util.readfile(self.settings["autoresume_path"]+"unpack")
if os.path.isdir(self.settings["source_path"]):
unpack_cmd="rsync -a --delete "+self.settings["source_path"]+" "+self.settings["chroot_path"]
return "%s/%s" % (x,myc)
return None
+def readfile(file):
+ file_contents = ""
+ try:
+ myf = open(file, "r")
+ file_contents = "".join(myf.readlines())
+ myf.close()
+ return file_contents
+ except:
+ return None
+ #raise CatalystError, "Could not read file " + file
+