示例#1
0
    "env PKG_PATH=http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/%s/%s/All/ pkg_add clang cmake"
    % (arch, release),

    # Remove the /tmp entry, because it's mounted as tmpfs -s=ram%25 by default, which isn't enough disk space.
    """ed /etc/fstab << EOF
H
/\\/tmp/d
wq
EOF""",
    "echo sshd=yes >> /etc/rc.conf",
    "echo PermitRootLogin without-password >> /etc/ssh/sshd_config",
    "/etc/rc.d/sshd restart",
    "sync; shutdown -hp now",
]

a = anita.Anita(anita.URL('https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/%s/' %
                          arch),
                workdir="work-NetBSD-%s" % arch,
                disk_size="16G",
                memory_size="2G",
                persist=True)
child = a.boot()
anita.login(child)

for cmd in commands:
    anita.shell_cmd(child, cmd, 3600)

# Sometimes, the halt command times out, even though it has completed
# successfully.
try:
    a.halt()
except:
示例#2
0
arch = 'amd64'
branch = 'netbsd-8'
disk_size = '24G'
version = '8.1'
pkg_path = f"http://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/{arch}/{version}/All/"
pkgs = "cmake swig3 curl python37 python27 vim ccache ninja-build mozilla-rootcerts git py37-pip py27-pip"
workdir = f"work-{branch}-{arch}"

if args.google_compute_engine:
    out = subprocess.run(['tar', '--version'], stdout=subprocess.PIPE).stdout
    if b'GNU tar' in out:
        tar = 'tar'
    else:
        tar = 'gtar'

a = anita.Anita(anita.URL(find_latest_release(branch, arch)),
                workdir=workdir,
                disk_size=disk_size,
                memory_size="16G",
                persist=True)


def boot_and_run(commands, timeout=1200):
    child = a.boot()
    anita.login(child)
    for cmd in commands:
        rc = anita.shell_cmd(child, cmd, timeout)
        if rc != 0:
            raise Exception("command failed")
    anita.shell_cmd(child, "sync; shutdown -hp now", 1200)
    try:
示例#3
0
import sys
import anita

arch = sys.argv[1]
release = sys.argv[2]
workdir = sys.argv[3]
disk_size = sys.argv[4]

commands = [
    # See https://code.google.com/p/google-compute-engine/issues/detail?id=77
    "echo 'ignore classless-static-routes;' >> /etc/dhclient.conf",
    "echo 'dhclient=YES' >> /etc/rc.conf",
    "sh /etc/rc.d/dhclient start",
    "env PKG_PATH=http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/%s/%s/All/ pkg_add curl git zsh sudo tmux" % (arch, release)
]


a = anita.Anita(
    anita.URL("http://ftp.netbsd.org/pub/NetBSD/NetBSD-%s/%s/" % (release, arch)),
    workdir = workdir,
    disk_size = disk_size,
    memory_size = "512M",
    persist = True)
child = a.boot()
anita.login(child)

for cmd in commands:
  anita.shell_cmd(child, cmd, 3600)

示例#4
0
    % (arch, release),
    "env PKG_PATH=http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/%s/%s/All/ pkg_add mozilla-rootcerts go14"
    % (arch, release),
    """ed /etc/fstab << EOF
H
%s/wd0/sd0/
wq
EOF""",
    "touch /etc/openssl/openssl.cnf",
    "/usr/pkg/sbin/mozilla-rootcerts install",
    "sync; shutdown -hp now",
]

a = anita.Anita(
    # TODO(bsiegert) use latest
    anita.URL(find_latest_release("netbsd-8", arch)),
    workdir="work-NetBSD-%s" % arch,
    disk_size="4G",
    memory_size="1G",
    persist=True)
child = a.boot()
anita.login(child)

for cmd in commands:
    anita.shell_cmd(child, cmd, 3600)

# Sometimes, the halt command times out, even though it has completed
# successfully.
try:
    a.halt()
except:
示例#5
0
    % (arch, release),
    "env PKG_PATH=https://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/%s/%s/All/ pkg_add mozilla-rootcerts go14"
    % (arch, release),
    """ed /etc/fstab << EOF
H
%s/wd0/sd0/
wq
EOF""",
    "touch /etc/openssl/openssl.cnf",
    "/usr/pkg/sbin/mozilla-rootcerts install",
    "sync; shutdown -hp now",
]

a = anita.Anita(
    # TODO(bsiegert) use latest
    anita.URL("https://cdn.NetBSD.org/pub/NetBSD/NetBSD-7.1_RC1/%s/" % arch),
    workdir="work-NetBSD-%s" % arch,
    disk_size="4G",
    memory_size="1G",
    persist=True)
child = a.boot()
anita.login(child)

for cmd in commands:
    anita.shell_cmd(child, cmd, 1200)

# Sometimes, the halt command times out, even though it has completed
# successfully.
try:
    a.halt()
except:
示例#6
0
文件: mkvm.py 项目: jakedsouza/build
    """ed /etc/fstab << EOF
H
%s/wd0/sd0/
wq
EOF""",
    "env PKG_PATH=http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/%s/%s/All/ pkg_add bash curl git-base mozilla-rootcerts go14" % (arch, release),
    "touch /etc/openssl/openssl.cnf",
    "/usr/pkg/sbin/mozilla-rootcerts install",
    "sync",
    #"shutdown -hp now",
]


a = anita.Anita(
    # TODO(bsiegert) use latest
    anita.URL(find_latest_release(arch)),
    workdir = "work-NetBSD-%s" % arch,
    disk_size = "4G",
    memory_size = "1G",
    persist = True)
child = a.boot()
anita.login(child)

for cmd in commands:
  anita.shell_cmd(child, cmd, 600)

# Sometimes, the halt command times out, even though it has completed
# successfully.
try:
    a.halt()
except: