Skip to content
This repository has been archived by the owner on Aug 31, 2020. It is now read-only.

Commit

Permalink
#1 The automatic checking of RunFor in MakeFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Korbel committed Feb 25, 2015
1 parent f173b64 commit 2c93813
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions apps/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class Git(models.Model):
path_absolute = None
cmd = None
log = None
groups = None

def __unicode__(self):
return self.name
Expand Down Expand Up @@ -205,6 +206,8 @@ def updateInformationsAboutTests(self):
test.time = info.get('TestTime')
if 'Type' in info and test.type != info.get('Type'):
test.type = info.get('Type')
if 'RunFor' in info:
self.__updateGroups(test, info.get('RunFor'))
self.__updateDependences(test, info.get('RhtsRequires'))
test.save()

Expand Down Expand Up @@ -283,6 +286,32 @@ def __parseMakefile(self, mkfile):
rows = fd.readlines()
return self.__getMakefileInfo(rows, self.__getVariables(rows))

def __updateGroups(self, test, row):
if not self.groups:
self.groups = list()
for it in GroupOwner.objects.all():
self.groups.append(it)
res = list()
if isinstance(row, list):
row = " ".join(row)
for it in self.groups:
if row.find(it.name) >= 0:
res.append(it)
if len(res) > 0:
# Remove unsupported groups
for group in test.groups.all():
if group not in res:
print "del %s - %s" % (test.name, group.name)
test.groups.remove(group)
else:
print "- %s - %s" % (test.name, group.name)
res.remove(group)
# Add new groups
for group in res:
print "add %s - %s" % (test.name, group.name)
test.groups.add(group)


def __updateDependences(self, test, rows):
if not rows:
rows = list()
Expand Down

1 comment on commit 2c93813

@Ichimonji10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.