]> rtime.felk.cvut.cz Git - linux-conf-perf.git/commitdiff
Revert "Add automatic git version and describe to database module" wkoci
authorKarel Kočí <cynerd@email.cz>
Fri, 26 Feb 2016 16:05:42 +0000 (17:05 +0100)
committerKarel Kočí <cynerd@email.cz>
Tue, 1 Mar 2016 09:52:21 +0000 (10:52 +0100)
This reverts commit 15178be3d5344ad3e547b7e3aba08866b2837395.
Automatic git version and describe to database module should not be
implemented in as part of database definition. So this commit removes
it.

scripts/lcp_django/database/models.py

index f964973f87d6bc792d6afadd17ff542d7b015a64..5a6fd4c209b947f915042f9913a44ec05b9ffd6c 100644 (file)
@@ -1,35 +1,13 @@
 import os
 import sys
-import subprocess
-from .settings import conf
-from .settings import sf
 from django.db import models
 
-__git_describe__ = 'git describe --always --tags --dirty'
-__git_commit__ = 'git rev-parse --verify HEAD'
-
 class ToolsGit(models.Model):
     id = models.AutoField(primary_key=True)
     git_describe = models.TextField()
     git_commit = models.TextField()
     class Meta:
         db_table = "toolsgit"
-    def get():
-        """Return ToolsGit object of current git. If no entry is in database, new
-        object is created.
-        """
-        ds = subprocess.check_output('cd ' + sf(conf.linux_sources) + ' && '
-            + __git_describe__, shell=True).decode(sys.getdefaultencoding()).strip()
-        cm = subprocess.check_output('cd ' + sf(conf.linux_sources) + ' && '
-            + __git_commit__, shell=True).decode(sys.getdefaultencoding()).strip()
-        lg = LinuxGit.objects.filter(git_describe=ds, git_commit=cm)
-        if not lg:
-            nlg = LinuxGit()
-            nlg.git_commit = cm
-            nlg.git_describe = ds
-            return nlg
-        else:
-            return lg[0]
 
 class LinuxGit(models.Model):
     id = models.AutoField(primary_key=True)
@@ -37,23 +15,6 @@ class LinuxGit(models.Model):
     git_commit = models.TextField()
     class Meta:
         db_table = "linuxgit"
-    def get():
-        """Return LinuxGIt object of current linux tree git. If no entry is in
-        database, new object is created.
-        """
-        ds = subprocess.check_output('cd ' + sf(conf.linux_sources) + ' && '
-            + __git_describe__, shell=True).decode(sys.getdefaultencoding()).strip()
-        cm = subprocess.check_output('cd ' + sf(conf.linux_sources) + ' && '
-            + __git_commit__, shell=True).decode(sys.getdefaultencoding()).strip()
-        lg = LinuxGit.objects.filter(git_describe=ds, git_commit=cm)
-        if not lg:
-            nlg = LinuxGit()
-            nlg.git_commit = cm
-            nlg.git_describe = ds
-            return nlg
-        else:
-            return lg[0]
-
 
 class Configurations(models.Model):
     id = models.AutoField(primary_key=True)