# Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.418 2005/12/02 19:37:01 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.419 2005/12/02 20:09:03 wolf31o2 Exp $
+
+ 02 Dec 2005; Chris Gianelloni <wolf31o2@gentoo.org>
+ modules/catalyst_lock.py, modules/catalyst_support.py,
+ modules/embedded_target.py, modules/generic_stage_target.py,
+ modules/grp_target.py, modules/livecd_stage1_target.py,
+ modules/livecd_stage2_target.py, modules/netboot_target.py,
+ modules/stage1_target.py, modules/stage4_target.py,
+ modules/tinderbox_target.py:
+ So I was just kidding on that last commit. This one is 2.0_rc4.
02 Dec 2005; Chris Gianelloni <wolf31o2@gentoo.org> catalyst,
modules/catalyst_lock.py, modules/catalyst_support.py,
#!/usr/bin/python
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_lock.py,v 1.5 2005/12/02 19:37:02 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_lock.py,v 1.6 2005/12/02 20:09:03 wolf31o2 Exp $
import os
import fcntl
import errno
from catalyst_support import *
def writemsg(mystr):
- sys.stderr.write(mystr)
- sys.stderr.flush()
+ sys.stderr.write(mystr)
+ sys.stderr.flush()
#def normpath(mypath):
#newpath = os.path.normpath(mypath)
self.clean_my_hardlocks()
self.delete_lock_from_path_list()
if self.islocked():
- self.fcntl_unlock()
- def __init__(self,lockdir):
+ self.fcntl_unlock()
+ def __init__(self,lockdir):
self.locked=False
self.myfd=None
self.set_gid(250)
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.61 2005/12/02 19:37:02 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/catalyst_support.py,v 1.62 2005/12/02 20:09:03 wolf31o2 Exp $
import sys,string,os,types,re,signal,traceback,md5,sha,time
selinux_capable = False
# a function to turn a string of non-printable characters into a string of
# hex characters
def hexify(str):
- hexStr = string.hexdigits
- r = ''
- for ch in str:
+ hexStr = string.hexdigits
+ r = ''
+ for ch in str:
i = ord(ch)
r = r + hexStr[(i >> 4) & 0xF] + hexStr[i & 0xF]
- return r
+ return r
# hexify()
# A function to calculate the md5 sum of a file
def find_binary(myc):
- """look through the environmental path for an executable file named whatever myc is"""
+ """look through the environmental path for an executable file named whatever myc is"""
# this sucks. badly.
p=os.getenv("PATH")
if p == None:
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/embedded_target.py,v 1.17 2005/12/02 19:37:02 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/embedded_target.py,v 1.18 2005/12/02 20:09:03 wolf31o2 Exp $
"""
This class works like a 'stage3'. A stage2 tarball is unpacked, but instead
class embedded_target(generic_stage_target):
- def __init__(self,spec,addlargs):
+ def __init__(self,spec,addlargs):
self.required_values=[]
self.valid_values=[]
self.valid_values.extend(["embedded/empty","embedded/rm","embedded/unmerge","embedded/fs-prepare","embedded/fs-finish","embedded/mergeroot","embedded/packages","embedded/fs-type","embedded/runscript","boot/kernel"])
self.settings["destpath"]=normpath(self.settings["chroot_path"]+self.settings["root_path"])
def register(foo):
- foo.update({"embedded":embedded_target})
- return foo
+ foo.update({"embedded":embedded_target})
+ return foo
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.86 2005/12/02 19:37:02 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/generic_stage_target.py,v 1.87 2005/12/02 20:09:03 wolf31o2 Exp $
"""
This class does all of the chroot setup, copying of files, etc. It is
msg("Can't find "+x+".py plugin in "+self.settings["sharedir"]+"/arch/")
# call arch constructor, pass our settings
- try:
+ try:
self.arch=self.subarchmap[self.settings["subarch"]](self.settings)
except:
print "Invalid subarch: "+self.settings["subarch"]
def override_chost(self):
if os.environ.has_key("CHOST"):
- self.settings["CHOST"] = os.environ["CHOST"]
+ self.settings["CHOST"] = os.environ["CHOST"]
if self.settings.has_key("chost"):
self.settings["CHOST"]=list_to_string(self.settings["chost"])
if self.makeconf.has_key("CHOST"):
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/grp_target.py,v 1.20 2005/12/02 19:37:02 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/grp_target.py,v 1.21 2005/12/02 20:09:03 wolf31o2 Exp $
"""
The builder class for GRP (Gentoo Reference Platform) builds.
addlargs["grp"]=[addlargs["grp"]]
if addlargs.has_key("grp/use"):
- if type(addlargs["grp/use"])==types.StringType:
- addlargs["grp/use"]=[addlargs["grp/use"]]
+ if type(addlargs["grp/use"])==types.StringType:
+ addlargs["grp/use"]=[addlargs["grp/use"]]
for x in addlargs["grp"]:
self.required_values.append("grp/"+x+"/packages")
generic_stage_target.__init__(self,spec,addlargs)
- def set_target_path(self):
+ def set_target_path(self):
self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"]+"/")
if self.settings.has_key("AUTORESUME") \
and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"):
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage1_target.py,v 1.22 2005/12/02 19:37:02 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage1_target.py,v 1.23 2005/12/02 20:09:03 wolf31o2 Exp $
"""
Builder class for LiveCD stage1.
"config_profile_link","setup_confdir","portage_overlay",\
"bind","chroot_setup","setup_environment","build_packages",\
"unbind", "clean","clear_autoresume"]
- def set_target_path(self):
+ def set_target_path(self):
self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"])
if self.settings.has_key("AUTORESUME") \
and os.path.exists(self.settings["autoresume_path"]+"setup_target_path"):
self.settings["spec_prefix"]="livecd"
def set_use(self):
- generic_stage_target.set_use(self)
- self.settings["use"].append("livecd")
+ generic_stage_target.set_use(self)
+ self.settings["use"].append("livecd")
def set_packages(self):
generic_stage_target.set_packages(self)
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage2_target.py,v 1.53 2005/12/02 19:37:02 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/livecd_stage2_target.py,v 1.54 2005/12/02 20:09:03 wolf31o2 Exp $
"""
Builder class for a LiveCD stage2 build.
generic_stage_target.__init__(self,spec,addlargs)
if not self.settings.has_key("livecd/type"):
- self.settings["livecd/type"] = "generic-livecd"
+ self.settings["livecd/type"] = "generic-livecd"
file_locate(self.settings, ["cdtar","controller_file"])
for x in self.settings["livecd/modblacklist"]:
myf.write("\n"+x)
myf.close()
- def unpack(self):
+ def unpack(self):
unpack=True
clst_unpack_md5sum=read_from_clst(self.settings["autoresume_path"]+"unpack")
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/netboot_target.py,v 1.8 2005/12/02 19:37:02 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/netboot_target.py,v 1.9 2005/12/02 20:09:03 wolf31o2 Exp $
"""
Builder class for a netboot build.
self.settings[envvar] = "-Os -pipe"
-# def set_root_path(self):
+# def set_root_path(self):
# # ROOT= variable for emerges
# self.settings["root_path"]="/tmp/image"
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/stage1_target.py,v 1.14 2005/12/02 19:37:02 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/stage1_target.py,v 1.15 2005/12/02 20:09:03 wolf31o2 Exp $
"""
-Builder class for a stage1 installation tarball build.
+Builder class for a stage2 installation tarball build.
"""
from catalyst_support import *
from generic_stage_target import *
-class stage1_target(generic_stage_target):
+class stage2_target(generic_stage_target):
def __init__(self,spec,addlargs):
self.required_values=[]
self.valid_values=[]
generic_stage_target.__init__(self,spec,addlargs)
-
- def set_stage_path(self):
- self.settings["stage_path"]=normpath(self.settings["chroot_path"]+self.settings["root_path"])
- print "stage1 stage path is "+self.settings["stage_path"]
def set_root_path(self):
# ROOT= variable for emerges
- self.settings["root_path"]=normpath("/tmp/stage1root")
- print "stage1 root path is "+self.settings["root_path"]
- def set_dest_path(self):
- self.settings["destpath"]=normpath(self.settings["chroot_path"]+self.settings["root_path"])
- def set_cleanables(self):
- generic_stage_target.set_cleanables(self)
- self.settings["cleanables"].extend(["/usr/share/gettext","/usr/lib/python2.2/test", "/usr/lib/python2.2/encodings","/usr/lib/python2.2/email", "/usr/lib/python2.2/lib-tk","/usr/share/zoneinfo"])
-
- def override_chost(self):
- if os.environ.has_key("CHOST"):
- self.settings["CHOST"] = os.environ["CHOST"]
- if self.settings.has_key("chost"):
- self.settings["CHOST"]=list_to_string(self.settings["chost"])
-
- def override_cflags(self):
- if os.environ.has_key("CFLAGS"):
- self.settings["CFLAGS"] = os.environ["CFLAGS"]
- if self.settings.has_key("cflags"):
- self.settings["CFLAGS"]=list_to_string(self.settings["cflags"])
-
- def override_cxxflags(self):
- if os.environ.has_key("CXXFLAGS"):
- self.settings["CXXFLAGS"] = os.environ["CXXFLAGS"]
- if self.settings.has_key("cxxflags"):
- self.settings["CXXFLAGS"]=list_to_string(self.settings["cxxflags"])
-
- def override_ldflags(self):
- if os.environ.has_key("LDFLAGS"):
- self.settings["LDFLAGS"] = os.environ["LDFLAGS"]
- if self.settings.has_key("ldflags"):
- self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
+ self.settings["root_path"]=normpath("/tmp/stage1root")
+
+ def set_source_path(self):
+ self.settings["source_path"]=normpath(self.settings["storedir"]+"/tmp/"+self.settings["source_subpath"]+"/"+self.settings["root_path"]+"/")
+
+ # reset the root path so the preclean doesnt fail
+ generic_stage_target.set_root_path(self)
+
+ if os.path.isdir(self.settings["source_path"]):
+ print "\nUsing seed-stage from "+self.settings["source_path"]
+ print "Delete this folder if you wish to use a seed stage tarball instead\n"
+ else:
+ self.settings["source_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["source_subpath"]+".tar.bz2")
+ if os.path.isfile(self.settings["source_path"]):
+ if os.path.exists(self.settings["source_path"]):
+ self.settings["source_path_md5sum"]=calc_md5(self.settings["source_path"])
def register(foo):
- foo.update({"stage1":stage1_target})
+ foo.update({"stage2":stage2_target})
return foo
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/stage4_target.py,v 1.11 2005/12/02 19:37:02 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/stage4_target.py,v 1.12 2005/12/02 20:09:03 wolf31o2 Exp $
"""
Builder class for LiveCD stage1.
generic_stage_target.__init__(self,spec,addlargs)
def set_pkgcache_path(self):
- if self.settings.has_key("pkgcache_path"):
+ if self.settings.has_key("pkgcache_path"):
if type(self.settings["pkgcache_path"]) != types.StringType:
- self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))
- else:
+ self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))
+ else:
generic_stage_target.set_pkgcache_path(self)
def set_cleanables(self):
def register(foo):
foo.update({"stage4":stage4_target})
return foo
+
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo/src/catalyst/modules/tinderbox_target.py,v 1.16 2005/12/02 19:37:02 wolf31o2 Exp $
+# $Header: /var/cvsroot/gentoo/src/catalyst/modules/tinderbox_target.py,v 1.17 2005/12/02 20:09:03 wolf31o2 Exp $
"""
builder class for the tinderbox target
# example call: "grp.sh run xmms vim sys-apps/gleep"
try:
if os.path.exists(self.settings["controller_file"]):
- cmd("/bin/bash "+self.settings["controller_file"]+" run "+\
+ cmd("/bin/bash "+self.settings["controller_file"]+" run "+\
list_bashify(self.settings["tinderbox/packages"]),"run script failed.")
except CatalystError:
self.unbind()
raise CatalystError,"Tinderbox aborting due to error."
- def set_pkgcache_path(self):
+ def set_pkgcache_path(self):
if self.settings.has_key("pkgcache_path"):
if type(self.settings["pkgcache_path"]) != types.StringType:
self.settings["pkgcache_path"]=normpath(string.join(self.settings["pkgcache_path"]))