From 369569a6a36a176b92195744d65afe9cf52da0a8 Mon Sep 17 00:00:00 2001 From: Andrew Gaffney Date: Sun, 11 Jan 2009 17:05:44 -0600 Subject: [PATCH] Add catalyst.spawn import where needed and move more spawn-related stuff from catalyst.support to catalyst.spawn --- ChangeLog | 10 ++++++++++ modules/catalyst/spawn.py | 15 +++++++++++++++ modules/catalyst/support.py | 14 -------------- modules/catalyst/target/generic_stage.py | 1 + modules/catalyst/target/grp.py | 1 + modules/catalyst/target/livecd_stage1.py | 1 + modules/catalyst/target/livecd_stage2.py | 1 + modules/catalyst/target/netboot.py | 1 + modules/catalyst/target/netboot2.py | 1 + modules/catalyst/target/snapshot.py | 1 + modules/catalyst/target/tinderbox.py | 1 + 11 files changed, 33 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index a0ff5b87..702dac86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,16 @@ # Copyright 2002-2009 Gentoo Foundation; 2008-2009 Various authors (see AUTHORS) # Distributed under the GPL v2 + 11 Jan 2009; Andrew Gaffney + modules/catalyst/spawn.py, modules/catalyst/support.py, + modules/catalyst/target/generic_stage.py, modules/catalyst/target/grp.py, + modules/catalyst/target/livecd_stage1.py, + modules/catalyst/target/livecd_stage2.py, + modules/catalyst/target/netboot.py, modules/catalyst/target/netboot2.py, + modules/catalyst/target/snapshot.py, modules/catalyst/target/tinderbox.py: + Add catalyst.spawn import where needed and move more spawn-related stuff + from catalyst.support to catalyst.spawn + 11 Jan 2009; Andrew Gaffney catalyst, modules/catalyst/arch/powerpc.py, modules/catalyst/arch/sparc.py, modules/catalyst/arch/x86.py, modules/catalyst/config.py, diff --git a/modules/catalyst/spawn.py b/modules/catalyst/spawn.py index 9e4a2e91..bfd76612 100644 --- a/modules/catalyst/spawn.py +++ b/modules/catalyst/spawn.py @@ -6,6 +6,21 @@ import sys, os, types import catalyst.util from catalyst.error import * +BASH_BINARY = "/bin/bash" + +selinux_capable = False +#userpriv_capable = (os.getuid() == 0) +#fakeroot_capable = False + +try: + import resource + max_fd_limit=resource.getrlimit(RLIMIT_NOFILE) +except SystemExit, e: + raise +except: + # hokay, no resource module. + max_fd_limit=256 + # XXX We need to change this to a singleton class to track it all properly # pids this process knows of. spawned_pids = [] diff --git a/modules/catalyst/support.py b/modules/catalyst/support.py index 35d0bb6d..84bb5043 100644 --- a/modules/catalyst/support.py +++ b/modules/catalyst/support.py @@ -4,20 +4,6 @@ from catalyst.output import warn import catalyst.util from catalyst.error import * -selinux_capable = False -#userpriv_capable = (os.getuid() == 0) -#fakeroot_capable = False -BASH_BINARY = "/bin/bash" - -try: - import resource - max_fd_limit=resource.getrlimit(RLIMIT_NOFILE) -except SystemExit, e: - raise -except: - # hokay, no resource module. - max_fd_limit=256 - required_config_file_values=["storedir","sharedir","distdir","portdir"] valid_config_file_values=required_config_file_values[:] valid_config_file_values.append("PKGCACHE") diff --git a/modules/catalyst/target/generic_stage.py b/modules/catalyst/target/generic_stage.py index aa90dd02..1b1f2dd5 100644 --- a/modules/catalyst/target/generic_stage.py +++ b/modules/catalyst/target/generic_stage.py @@ -14,6 +14,7 @@ from catalyst.output import warn import catalyst.util import catalyst.hash from catalyst.error import * +from catalyst.spawn import * class generic_stage_target(generic_target): diff --git a/modules/catalyst/target/grp.py b/modules/catalyst/target/grp.py index a98bff9e..6cf15d10 100644 --- a/modules/catalyst/target/grp.py +++ b/modules/catalyst/target/grp.py @@ -8,6 +8,7 @@ from catalyst.support import * from generic_stage import * import catalyst.util from catalyst.error import * +from catalyst.spawn import * class grp_target(generic_stage_target): def __init__(self,spec,addlargs): diff --git a/modules/catalyst/target/livecd_stage1.py b/modules/catalyst/target/livecd_stage1.py index f7e81b97..65d73b97 100644 --- a/modules/catalyst/target/livecd_stage1.py +++ b/modules/catalyst/target/livecd_stage1.py @@ -6,6 +6,7 @@ Builder class for LiveCD stage1. from catalyst.support import * from generic_stage import * import catalyst.util +from catalyst.spawn import * class livecd_stage1_target(generic_stage_target): def __init__(self,spec,addlargs): diff --git a/modules/catalyst/target/livecd_stage2.py b/modules/catalyst/target/livecd_stage2.py index 74c865fc..de47f31a 100644 --- a/modules/catalyst/target/livecd_stage2.py +++ b/modules/catalyst/target/livecd_stage2.py @@ -9,6 +9,7 @@ from generic_stage import * import catalyst.util import catalyst.hash from catalyst.error import * +from catalyst.spawn import * class livecd_stage2_target(generic_stage_target): def __init__(self,spec,addlargs): diff --git a/modules/catalyst/target/netboot.py b/modules/catalyst/target/netboot.py index 970f7063..6bbca71e 100644 --- a/modules/catalyst/target/netboot.py +++ b/modules/catalyst/target/netboot.py @@ -8,6 +8,7 @@ from catalyst.support import * from generic_stage import * import catalyst.util from catalyst.error import * +from catalyst.spawn import * class netboot_target(generic_stage_target): def __init__(self,spec,addlargs): diff --git a/modules/catalyst/target/netboot2.py b/modules/catalyst/target/netboot2.py index eaaf3459..bf8e9390 100644 --- a/modules/catalyst/target/netboot2.py +++ b/modules/catalyst/target/netboot2.py @@ -8,6 +8,7 @@ from catalyst.support import * from generic_stage import * import catalyst.util from catalyst.error import * +from catalyst.spawn import * class netboot2_target(generic_stage_target): def __init__(self,spec,addlargs): diff --git a/modules/catalyst/target/snapshot.py b/modules/catalyst/target/snapshot.py index d46963c2..b5de4d55 100644 --- a/modules/catalyst/target/snapshot.py +++ b/modules/catalyst/target/snapshot.py @@ -7,6 +7,7 @@ import os from catalyst.support import * from generic_stage import * import catalyst.util +from catalyst.spawn import * class snapshot_target(generic_stage_target): def __init__(self,myspec,addlargs): diff --git a/modules/catalyst/target/tinderbox.py b/modules/catalyst/target/tinderbox.py index 0dbe0a82..0eb29737 100644 --- a/modules/catalyst/target/tinderbox.py +++ b/modules/catalyst/target/tinderbox.py @@ -7,6 +7,7 @@ from catalyst.support import * from generic_stage import * import catalyst.util from catalyst.error import * +from catalyst.spawn import * class tinderbox_target(generic_stage_target): def __init__(self,spec,addlargs): -- 2.26.2