build.py 613 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3

import os
import subprocess as sp
import tempfile
import yaml


def load_config():
    with open("packages.yml", "r") as config_file:
        return yaml.load(config_file)


def build_package(repo_dir, name, patch_dir=None):
    with tempfile.TemporaryDirectory() as tempdir:
        os.chdir(tempdir)
        result = sp.run(
            ["apt-get", "source", name],
            check=True)
    

def main():
    repo_dir = os.getcwd()
    for package in load_config():
        build_package(repo_dir=repo_dir, **package)
        os.cwd(repo_dir)


if __name__ == "__main__":
    main()