summaryrefslogtreecommitdiff
path: root/src/backend/checkenv.py
blob: c90d460fe0ea8446a9f01861b9ea0e5b9ea90826 (plain)
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
#!/usr/bin/python3

import os
import subprocess
import sisyphus.getenv


def root():
    return True if os.getuid() == 0 else False


def sanity():
    activeBranch = sisyphus.getenv.systemBranch()
    bhaddr = sisyphus.getenv.bhaddr()
    isSane = int()

    if "packages-next" in bhaddr:
        if activeBranch == "next":
            isSane = int(1)
        else:
            isSane = int(0)
    else:
        if activeBranch == "master":
            isSane = int(1)
        else:
            isSane = int(0)

    return isSane