Oops, I meant to include a diff from v1 in the v2 cover letter. Here it is now: diff --git a/catalyst b/catalyst index a68a2ba..3983155 100755 --- a/catalyst +++ b/catalyst @@ -63,14 +63,15 @@ def parse_config(myconfig): myconf={} config_file="" - confdefaults={ + confdefaults = { "distdir": "/usr/portage/distfiles", "hash_function": "crc32", + "options": "", "packagedir": "/usr/portage/packages", "portdir": "/usr/portage", "port_tmpdir": "/var/tmp/portage", "repo_name": "portage", - "sharedir": "/usr/lib/catalyst", + "sharedir": "/usr/share/catalyst", "snapshot_name": "portage-", "snapshot_cache": "/var/tmp/catalyst/snapshot_cache", "storedir": "/var/tmp/catalyst", @@ -79,7 +80,7 @@ def parse_config(myconfig): # first, try the one passed (presumably from the cmdline) if myconfig: if os.path.exists(myconfig): - print "Using command line specified Catalyst configuration file, "+\ + print "Using command line specified Catalyst configuration file, " + \ myconfig config_file=myconfig @@ -195,7 +196,7 @@ def import_modules(): for x in required_build_targets: try: fh=open(conf_values["sharedir"]+"/modules/"+x+".py") - module=imp.load_module(x,fh,"modules/"+x+".py", + module = imp.load_module(x,fh,"modules/" + x + ".py", (".py","r",imp.PY_SOURCE)) fh.close() @@ -206,7 +207,7 @@ def import_modules(): for x in valid_build_targets: try: fh=open(conf_values["sharedir"]+"/modules/"+x+".py") - module=imp.load_module(x,fh,"modules/"+x+".py", + module = imp.load_module(x,fh,"modules/" + x + ".py", (".py","r",imp.PY_SOURCE)) module.register(targetmap) fh.close() diff --git a/modules/generic_stage_target.py b/modules/generic_stage_target.py index 1fbc733..8c983e1 100644 --- a/modules/generic_stage_target.py +++ b/modules/generic_stage_target.py @@ -179,11 +179,11 @@ class generic_stage_target(generic_target): "/usr/portage":self.settings["snapshot_cache_path"]+"/portage",\ "/usr/portage/distfiles":self.settings["distdir"],"/var/tmp/portage":"tmpfs"} else: - self.mounts=["proc","dev", "distdir", "port_tmpdir"] - self.mountmap={"proc":"/proc", "dev":"/dev", "pts":"/dev/pts", + self.mounts = ["proc", "dev", "distdir", "port_tmpdir"] + self.mountmap = {"proc":"/proc", "dev":"/dev", "devpts":"/dev/pts", "distdir":self.settings["distdir"], "port_tmpdir":"tmpfs"} if os.uname()[0] == "Linux": - self.mounts.append("pts") + self.mounts.append("devpts") self.set_mounts() @@ -203,7 +203,7 @@ class generic_stage_target(generic_target): print "Location of the kerncache is "+\ self.settings["kerncache_path"] self.mounts.append("kerncache") - self.mountmap["kerncache"]=self.settings["kerncache_path"] + self.mountmap["kerncache"] = self.settings["kerncache_path"] if "CCACHE" in self.settings: if "CCACHE_DIR" in os.environ: @@ -216,7 +216,7 @@ class generic_stage_target(generic_target): "Compiler cache support can't be enabled (can't find "+\ ccdir+")" self.mounts.append("ccache") - self.mountmap["ccache"]=ccdir + self.mountmap["ccache"] = ccdir """ for the chroot: """ self.env["CCACHE_DIR"]="/var/tmp/ccache" @@ -410,7 +410,7 @@ class generic_stage_target(generic_target): def set_snapshot_path(self): self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\ "/snapshots/" + self.settings["snapshot_name"] + - self.settings["snapshot"]+".tar.xz") + self.settings["snapshot"] + ".tar.xz") if os.path.exists(self.settings["snapshot_path"]): self.settings["snapshot_path_hash"]=\ @@ -419,7 +419,7 @@ class generic_stage_target(generic_target): else: self.settings["snapshot_path"]=normpath(self.settings["storedir"]+\ "/snapshots/" + self.settings["snapshot_name"] + - self.settings["snapshot"]+".tar.bz2") + self.settings["snapshot"] + ".tar.bz2") if os.path.exists(self.settings["snapshot_path"]): self.settings["snapshot_path_hash"]=\ @@ -617,7 +617,7 @@ class generic_stage_target(generic_target): if not os.path.exists(mypath + self.mountmap[x]): continue - if ismount(mypath +self.mountmap[x]): + if ismount(mypath + self.mountmap[x]): """ Something is still mounted "" """ try: print self.mountmap[x] + " is still mounted; performing auto-bind-umount...", @@ -786,7 +786,7 @@ class generic_stage_target(generic_target): print "Valid snapshot cache, skipping unpack of portage tree..." unpack=False else: - destdir=normpath(self.settings["chroot_path"] + self.settings["portdir"]) + destdir = normpath(self.settings["chroot_path"] + self.settings["portdir"]) cleanup_errmsg="Error removing existing snapshot directory." cleanup_msg=\ "Cleaning up existing portage tree (This can take a long time)..." @@ -847,7 +847,7 @@ class generic_stage_target(generic_target): cmd("rm -f "+self.settings["chroot_path"]+"/etc/portage/make.profile",\ "Error zapping profile link",env=self.env) cmd("mkdir -p "+self.settings["chroot_path"]+"/etc/portage/") - cmd("ln -sf ../.." + self.settings["portdir"] + "/profiles/"+\ + cmd("ln -sf ../.." + self.settings["portdir"] + "/profiles/" + \ self.settings["target_profile"]+" "+\ self.settings["chroot_path"]+"/etc/portage/make.profile",\ "Error creating profile link",env=self.env) @@ -908,10 +908,10 @@ class generic_stage_target(generic_target): self.snapshot_lock_object.read_lock() if os.uname()[0] == "FreeBSD": if src == "/dev": - retval=os.system("mount -t devfs none " + + retval = os.system("mount -t devfs none " + self.settings["chroot_path"] + src) else: - retval=os.system("mount_nullfs " + src + " " + + retval = os.system("mount_nullfs " + src + " " + self.settings["chroot_path"] + src) else: if src == "tmpfs": @@ -920,7 +920,7 @@ class generic_stage_target(generic_target): self.settings["var_tmpfs_portage"]+"G "+src+" "+\ self.settings["chroot_path"]+x) else: - retval=os.system("mount --bind " + src + " " + + retval = os.system("mount --bind " + src + " " + self.settings["chroot_path"] + src) if retval!=0: self.unbind() @@ -949,7 +949,7 @@ class generic_stage_target(generic_target): self.kill_chroot_pids() - retval2=os.system("umount " + mypath + self.mountmap[x]) + retval2 = os.system("umount " + mypath + self.mountmap[x]) if retval2!=0: ouch=1 warn("Couldn't umount bind mount: " + mypath + self.mountmap[x]) diff --git a/modules/snapshot_target.py b/modules/snapshot_target.py index 29d6e87..ba1bab5 100644 --- a/modules/snapshot_target.py +++ b/modules/snapshot_target.py @@ -18,7 +18,7 @@ class snapshot_target(generic_stage_target): self.settings=myspec self.settings["target_subpath"]="portage" st=self.settings["storedir"] - self.settings["snapshot_path"]=normpath(st + "/snapshots/" + self.settings["snapshot_path"] = normpath(st + "/snapshots/" + self.settings["snapshot_name"] + self.settings["version_stamp"] + ".tar.bz2") self.settings["tmp_path"]=normpath(st+"/tmp/"+self.settings["target_subpath"]) @@ -50,11 +50,11 @@ class snapshot_target(generic_stage_target): cmd("rsync -a --delete --exclude /packages/ --exclude /distfiles/ " + "--exclude /local/ --exclude CVS/ --exclude .svn --filter=H_**/files/digest-* " + self.settings["portdir"] + "/ " + mytmp + "/%s/" % self.settings["repo_name"], - "Snapshot failure",env=self.env) + "Snapshot failure", env=self.env) print "Compressing Portage snapshot tarball..." cmd("tar -I lbzip2 -cf " + self.settings["snapshot_path"] + " -C " + - mytmp + " %s" % self.settings["repo_name"], + mytmp + " " + self.settings["repo_name"], "Snapshot creation failure",env=self.env) self.gen_contents_file(self.settings["snapshot_path"]) diff --git a/modules/tinderbox_target.py b/modules/tinderbox_target.py index d6d3ea3..ca55610 100644 --- a/modules/tinderbox_target.py +++ b/modules/tinderbox_target.py @@ -29,8 +29,12 @@ class tinderbox_target(generic_stage_target): raise CatalystError,"Tinderbox aborting due to error." def set_cleanables(self): - self.settings["cleanables"]=["/etc/resolv.conf","/var/tmp/*","/root/*", - self.settings['portdir']] + self.settings['cleanables'] = [ + '/etc/resolv.conf', + '/var/tmp/*', + '/root/*', + self.settings['portdir'], + ] def set_action_sequence(self): #Default action sequence for run method -- This email may be signed or encrypted with GnuPG (http://www.gnupg.org). For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy