Browse Source

Remove CONST.namervers[]. To be provided by grs repo.

master
Anthony G. Basile 7 years ago
parent
commit
5abaa600ab
5 changed files with 5 additions and 21 deletions
  1. +0
    -4
      conf/systems.conf
  2. +3
    -4
      grs/Constants.py
  3. +1
    -2
      grs/Interpret.py
  4. +1
    -10
      grs/Populate.py
  5. +0
    -1
      tests/test-constants.py

+ 0
- 4
conf/systems.conf View File

@ -1,19 +1,15 @@
[desktop-amd64-uclibc-hardened]
nameserver : 8.8.8.8
repo_uri : git://anongit.gentoo.org/proj/grs.git
stage_uri : http://distfiles.gentoo.org/pub/gentoo/releases/amd64/autobuilds/current-stage3-amd64-uclibc-hardened/stage3-amd64-uclibc-hardened-20150705.tar.bz2
[desktop-amd64-musl-hardened]
nameserver : 8.8.8.8
repo_uri : git://anongit.gentoo.org/proj/grs.git
stage_uri : http://distfiles.gentoo.org/experimental/amd64/musl/stage3-amd64-musl-hardened-20150609.tar.bz2
[desktop-amd64-hardened]
nameserver : 8.8.8.8
repo_uri : git://anongit.gentoo.org/proj/grs.git
stage_uri : http://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-hardened+nomultilib/stage3-amd64-hardened+nomultilib-20150723.tar.bz2
[stages-amd64-hardened]
nameserver : 8.8.8.8
repo_uri : git://anongit.gentoo.org/proj/grs.git
stage_uri : http://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-hardened/stage3-amd64-hardened-20150702.tar.bz2

+ 3
- 4
grs/Constants.py View File

@ -26,7 +26,6 @@ class Constants():
""" Read a global configuration file and set/override constants for
each GRS spec. These constants are exported in the form:
CONST.nameservers[x] contains the namserver for the xth GRS spec
CONST.repo_uris[x] contains the repo_uri for the xth GRS spec
etc.
@ -44,13 +43,14 @@ class Constants():
kernelroot : /tmp/kernel_src_tree
[my-cool-server]
nameserver : 192.168.100.1
package : /var/tmp/my-packages
Then CONST.kernelroots[0] is '/tmp/kernel_src_tree' rather than the
default value '/var/tmp/grs/my-cool-desktop/kernel'. The remainder
of the constants default as delineated in the space[] dictionary with
%s replaced by 'my-cool-desktop'. Similarly CONST.my-cool-servers[1]
is 192.168.100.1 rather than 8.8.8.8.
has package directory '/var/tmp/my-package' rather than the default
value '/var/tmp/grs/my-cool-server/packages',
Finally, the that class overrides __setattr__, __gettattr__ and
__delattr__ so that you cannot add/change/delete constants in
@ -75,7 +75,6 @@ class Constants():
# This is the space of all possible constants for any given GRS namespace
space = {
'nameserver' : '8.8.8.8',
'repo_uri' : 'git://anongit.gentoo.org/proj/grs.git',
'stage_uri' : default_stage_uri,
'libdir' : '/var/lib/grs/%s',


+ 1
- 2
grs/Interpret.py View File

@ -106,7 +106,6 @@ class Interpret(Daemon):
signal.signal(signal.SIGTERM, handler)
# Grab all the GRS namespace variables
nameserver = CONST.nameservers[self.run_number]
repo_uri = CONST.repo_uris[self.run_number]
stage_uri = CONST.stage_uris[self.run_number]
@ -126,7 +125,7 @@ class Interpret(Daemon):
sy = Synchronize(repo_uri, name, libdir, logfile)
se = Seed(stage_uri, tmpdir, portage_configroot, package, logfile)
md = MountDirectories(portage_configroot, package, logfile)
po = Populate(nameserver, libdir, workdir, portage_configroot, logfile)
po = Populate(libdir, workdir, portage_configroot, logfile)
ru = RunScript(libdir, portage_configroot, logfile)
pc = PivotChroot(tmpdir, portage_configroot, logfile)
ke = Kernel(libdir, portage_configroot, kernelroot, package, logfile)


+ 1
- 10
grs/Populate.py View File

@ -27,16 +27,12 @@ class Populate():
for a particular cycle number.
"""
def __init__(self, nameserver, libdir = CONST.LIBDIR, workdir = CONST.WORKDIR, \
def __init__(self, libdir = CONST.LIBDIR, workdir = CONST.WORKDIR, \
portage_configroot = CONST.PORTAGE_CONFIGROOT, logfile = CONST.LOGFILE):
self.nameserver = nameserver
self.libdir = libdir
self.workdir = workdir
self.portage_configroot = portage_configroot
self.logfile = logfile
# We need /etc and /etc/resolv.conf for the system's portage configroot.
self.etc = os.path.join(self.portage_configroot, 'etc')
self.resolv_conf = os.path.join(self.etc, 'resolv.conf')
def populate(self, cycle = True):
@ -55,11 +51,6 @@ class Populate():
cmd = 'rsync -av %s/ %s' % (self.workdir, self.portage_configroot)
Execute(cmd, timeout=60, logfile = self. logfile)
# Add /etc/resolv.conf. We need this when we emerge within the chroot.
os.makedirs(self.etc, mode=0o755, exist_ok=True)
with open(self.resolv_conf, 'w') as f:
f.write('nameserver %s' % self.nameserver)
def select_cycle(self, cycle):
""" Select files with the matching cycle number. If a file has form


+ 0
- 1
tests/test-constants.py View File

@ -42,7 +42,6 @@ if __name__ == "__main__":
del CONST.I_AM_NEW
assert CONST.I_AM_NEW == original
print(CONST.nameservers)
print(CONST.repo_uris)
print(CONST.stage_uris)
print(CONST.names)


Loading…
Cancel
Save