aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/exceptions.py6
-rwxr-xr-xscripts/initialize.py4
-rwxr-xr-xscripts/loop.py1
-rwxr-xr-xscripts/test.py5
-rw-r--r--scripts/utils.py11
5 files changed, 27 insertions, 0 deletions
diff --git a/scripts/exceptions.py b/scripts/exceptions.py
index ac7f093..649c235 100644
--- a/scripts/exceptions.py
+++ b/scripts/exceptions.py
@@ -42,3 +42,9 @@ class ProcessFailed(Exception):
class DatabaseUninitialized(Exception):
def __str__(self):
return "Database seems to be uninitialized."
+
+class DirtyRepository(Exception):
+ def __init__(self, repo):
+ self.repo = repo
+ def __str__(self):
+ return "Detected dirty repository: " + self.repo
diff --git a/scripts/initialize.py b/scripts/initialize.py
index ff891f8..745f822 100755
--- a/scripts/initialize.py
+++ b/scripts/initialize.py
@@ -11,6 +11,10 @@ from conf import sf
import exceptions
def all():
+ try:
+ utils.dirtycheck()
+ except exceptions.DirtyRepository as e:
+ print("Warning: " + str(e))
base()
parse_kconfig()
gen_fixed()
diff --git a/scripts/loop.py b/scripts/loop.py
index 380f191..0f0aa8c 100755
--- a/scripts/loop.py
+++ b/scripts/loop.py
@@ -102,6 +102,7 @@ def sigterm_handler(_signo, _stack_frame):
__terminate__ = True
def loop():
+ utils.dirtycheck()
initialize.all()
global thr
thr = mainThread()
diff --git a/scripts/test.py b/scripts/test.py
index f0eee8e..ce0b698 100755
--- a/scripts/test.py
+++ b/scripts/test.py
@@ -8,8 +8,13 @@ import initialize
import kernel
import boot
import database
+import exceptions
def test():
+ try:
+ utils.dirtycheck()
+ except exceptions.DirtyRepository as e:
+ print("Warning: " + str(e))
initialize.base()
print("-- Make --")
conf.kernel_make_output = True
diff --git a/scripts/utils.py b/scripts/utils.py
index af98fce..4260cc9 100644
--- a/scripts/utils.py
+++ b/scripts/utils.py
@@ -67,3 +67,14 @@ def get_kernel_env():
env = dict(os.environ)
env.update(conf.kernel_env)
return env
+
+def __dirty_repo__(path):
+ cwd = os.getcwd()
+ os.chdir(conf.absroot)
+ out = subprocess.check_output(conf.git_describe_cmd)
+ if re.search('dirty', out.decode(sys.getdefaultencoding())):
+ raise exceptions.DirtyRepository(path)
+
+def dirtycheck():
+ __dirty_repo__(conf.absroot)
+ __dirty_repo__(conf.linux_sources)