aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-08-19 14:58:36 +0200
committerKarel Kočí <cynerd@email.cz>2015-08-19 16:56:54 +0200
commitd64eca6379dda83560044b5d949d60b54b908411 (patch)
tree5edf7d39efff2da7f7db6c8d2b49a3bcab8336df /scripts
parent102188ea18cc440e11a122a3286237026c4cad23 (diff)
downloadlinux-conf-perf-d64eca6379dda83560044b5d949d60b54b908411.tar.gz
linux-conf-perf-d64eca6379dda83560044b5d949d60b54b908411.tar.bz2
linux-conf-perf-d64eca6379dda83560044b5d949d60b54b908411.zip
Added dirty repository check
Test run and initialization now shows warning about dirty repository and loop can't be executed if linux or root repository is dirty.
Diffstat (limited to 'scripts')
-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)