Coding style.
- Removed dead code.
This commit is contained in:
parent
04e35c6274
commit
170597d6d2
2 changed files with 20 additions and 156 deletions
|
|
@ -3,14 +3,16 @@
|
|||
|
||||
import os
|
||||
import pickle
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import test_distributions
|
||||
|
||||
|
||||
ERIS_PATH = os.path.realpath(os.path.dirname(__file__))
|
||||
cmd = test_distributions.cmd
|
||||
|
||||
|
||||
def cmd(command):
|
||||
subprocess.run(command, shell=True, check=True)
|
||||
|
||||
|
||||
def all_paths(path):
|
||||
|
|
@ -39,12 +41,26 @@ def filter_paths(paths, exclusions):
|
|||
if all(excluded not in path for excluded in exclusions)]
|
||||
|
||||
|
||||
def run_in_container(container, command):
|
||||
option = "--directory" if os.path.isdir(container) else "--image"
|
||||
cmd(f"sudo systemd-nspawn --quiet --chdir=/eris --overlay={ERIS_PATH}:"
|
||||
f'/eris {option}={container} /bin/bash --login -c "{command}"')
|
||||
|
||||
|
||||
def build_ubuntu():
|
||||
cmd("sudo debootstrap --components=main,restricted,universe,multiverse "
|
||||
"impish ubuntu.part http://au.archive.ubuntu.com/ubuntu/")
|
||||
run_in_container("ubuntu.part",
|
||||
"ln -sf /lib/systemd/resolv.conf /etc/resolv.conf")
|
||||
os.rename("ubuntu.part", "ubuntu")
|
||||
|
||||
|
||||
def make_ubuntu_base():
|
||||
if os.path.exists("base_paths"):
|
||||
with open("base_paths", "rb") as file_:
|
||||
base_paths = pickle.load(file_)
|
||||
else:
|
||||
test_distributions.build_ubuntu()
|
||||
build_ubuntu()
|
||||
base_paths = relative_paths("ubuntu", all_paths("ubuntu"))
|
||||
base_paths = filter_paths(base_paths, ["python3"])
|
||||
with open("base_paths", "wb") as file_:
|
||||
|
|
@ -53,7 +69,6 @@ def make_ubuntu_base():
|
|||
|
||||
|
||||
def install_eris():
|
||||
run_in_container = test_distributions.run_in_container
|
||||
run_in_container("ubuntu", "./install-dependencies")
|
||||
run_in_container("ubuntu", "pip3 install -I .")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue