Exemplo n.º 1
0
def build_raw_disk(image_path):
    run(['qemu-img', 'create', image_path, '4G'])

    # install boot sector
    run(['dd', 'bs=440', 'conv=notrunc', 'count=1', 'if=/usr/lib/syslinux/bios/gptmbr.bin', 'of=' + image_path])

    build_partitions(image_path)
    loop_device = constants.LOOP_DEVICE_PATH

    sudo_run(['losetup', '-P', loop_device, image_path])
    try:
        loop_partition = loop_device + 'p1'
        sudo_run(['mkfs.ext4', loop_partition])
        sudo_run(['tune2fs', '-L', 'rootfs', loop_partition])

    finally:
        sudo_run(['losetup', '-d', loop_device])
Exemplo n.º 2
0
def build_partitions(image_path):
    # drop partition table, create gpt
    run(['sgdisk', '-og', image_path])

    # create partition #1 occupying the whole disk
    # leave space for boot sector, which occupies first 440 bytes
    run(['sgdisk', '-n', '1:2048:0', image_path])

    # set "legacy BIOS bootable" attribute for the new partition
    run(['sgdisk', '-A', '1:set:2', image_path])
Exemplo n.º 3
0
#!/usr/bin/env python

from lib.run import run

if __name__ == "__main__":
    run()
Exemplo n.º 4
0
import sys

from lib.datestring import formatted_date_time
from lib.get_test_files import get_test_files
from lib.run import run

path = sys.argv[0][0:-7]
out_file_name = 'output_{}.csv'.format(formatted_date_time)
file = open(path + out_file_name, "x")

bin_args = sys.argv[1:]
file.write(str(bin_args) + "\n")

test_files = get_test_files()

for file_name in test_files:
    elapsed_time = run(bin_args, file_name)

    file.write("{},{}\n".format(file_name, elapsed_time))

file.close()




Exemplo n.º 5
0
from lib.command_validation import is_valid, is_help
from lib.helpers import output_everything, separate_args_and_flags
from lib.constants import PATH_TO_DATA, PATH_TO_STDOUT, PATH_TO_TMP

if __name__ == "__main__":
    args, flags = separate_args_and_flags(sys.argv[1:])

    if not os.path.isdir(PATH_TO_DATA):
        os.mkdir(PATH_TO_DATA)

    if not os.path.isdir(PATH_TO_TMP):
        os.mkdir(PATH_TO_TMP)

    os.chdir(PATH_TO_DATA)

    sys.stdout = open(PATH_TO_STDOUT, 'w')

    # checks whether to display help or to run the script
    if not is_valid(args, flags) or is_help(args[0]):
        display_help()
    else:
        run(args[0], args[1:], flags)

    sys.stdout.close()
    sys.stdout = sys.__stdout__

    output_everything()

    os.remove(PATH_TO_STDOUT)
    os.rmdir(PATH_TO_TMP)
Exemplo n.º 6
0
#!/usr/bin/env python

from lib.run import run


if __name__ == "__main__":
    run()
Exemplo n.º 7
0
Arquivo: git.py Projeto: x-eye/anylint
def branches(path):
    code, out, err = run('git', 'branch', '-r', cwd=os.path.abspath(path))
    return parse_branches(out.decode('utf-8'))
Exemplo n.º 8
0
Arquivo: git.py Projeto: x-eye/anylint
def checkout(path, revision):
    """"""

    code, out, err = run('git', 'checkout', '--force', '--quiet', revision, cwd=path)

    return code
Exemplo n.º 9
0
Arquivo: git.py Projeto: x-eye/anylint
def clone(repo, path):
    """Clone git repository, checkout it's HEAD"""

    code, out, err = run('git', 'clone', '--quiet',  '--depth', '1', repo, path)

    return code