Browse Source

model designed for install_workspace

refactor
Ulrich 2 years ago
parent
commit
a079a47875
  1. 25
      basic/Testserver.py
  2. 9
      basic/constants.py
  3. 6
      basic/program.py
  4. 0
      basic/xxDATASTRUCTURE.yxml
  5. 1
      catalog/programs.csv
  6. 88
      install_workspace.py
  7. 4
      model/ap_application.csv
  8. 5
      model/ap_component.csv
  9. 6
      model/ap_project.csv
  10. 13
      model/application.csv
  11. 14
      model/artifact.csv
  12. 7
      model/co_artifact.csv
  13. 7
      model/co_step.csv
  14. 7
      model/co_table.csv
  15. 15
      model/component.csv
  16. 13
      model/en_component.csv
  17. 4
      model/en_project.csv
  18. 13
      model/environment.csv
  19. 12
      model/job.csv
  20. 15
      model/release.csv
  21. 13
      model/step.csv
  22. 15
      model/story.csv
  23. 13
      model/table.csv
  24. 5
      model/tc_step.csv
  25. 7
      model/tc_story.csv
  26. 5
      model/tc_table.csv
  27. 15
      model/testcase.csv
  28. 16
      model/testplan.csv
  29. 22
      model/testreport.csv
  30. 15
      model/testsuite.csv
  31. 5
      model/tp_testsuite.csv
  32. 6
      model/tr_artifact.csv
  33. 5
      model/ts_testcase.csv
  34. 5
      model/ts_usecase.csv
  35. 15
      model/usecase.csv
  36. 16
      tools/config_tool.py
  37. 2
      tools/conn_tool.py
  38. 13
      tools/data_const.py
  39. 8
      tools/dbmysql_tool.py
  40. 2
      tools/dbrel_tool.py
  41. 2
      tools/file_tool.py
  42. 54
      tools/git_tool.py

25
basic/Testserver.py

@ -1,9 +1,13 @@
import os.path
import re
import basic.component
import basic.constants as B
import basic.toolHandling
import tools.config_tool
import tools.data_const as D
import tools.file_tool
import tools.filecsv_fcts
import model.table
COMP_NAME = "testserver"
@ -27,6 +31,8 @@ class Testserver(basic.component.Component):
for table in COMP_TABLES:
if table in B.LIST_DB_ATTR:
continue
else:
continue
ddl = tools.config_tool.getConfig(job, D.DDL_FILENAME, COMP_NAME, table)
tableDdl = model.table.Table(job, component=COMP_NAME, name=table)
self.tables[table] = tableDdl
@ -50,14 +56,24 @@ class Testserver(basic.component.Component):
self.conf[B.DATA_NODE_DDL][table] = ddl
def createDBTables(self, job):
tables = {}
if B.TOPIC_NODE_DB in job.conf:
dbi = basic.toolHandling.getDbTool(job, self, job.conf[B.TOPIC_NODE_DB][B.ATTR_TYPE])
else:
return "No DB in job-config"
for t in self.tables:
sql = self.tables[t].get_schema(tableName=t, tableObject=self.tables[t])
#for t in COMP_TABLES:
#sql = self.getDBSchema(job, dbi, t)
path = os.path.join(job.conf[B.SUBJECT_PATH][B.ATTR_PATH_PROGRAM], "model")
fct = basic.toolHandling.getFileTool(job, None, "csv")
for m in sorted(os.listdir(path)):
if not re.match(r".*?\.csv", m):
print("sonstig "+m)
continue
print("model "+m)
modelPath = os.path.join(path, m)
modelDoc = fct.load_file(modelPath, D.CSV_SPECTYPE_DATA)
table = model.table.Table(job, project="", application="", component="Testserver", name=m[:-4])
sql = table.get_schema(tableName=m[:-4], tableObject=table) # [B.DATA_NODE_TABLES][m[:-4]]
job.m.logInfo(sql)
tables[m[:-4]] = modelDoc
for s in sql.split(";\n"):
if len(s) < 3:
continue
@ -66,4 +82,3 @@ class Testserver(basic.component.Component):
print("SQL executed: "+s)
except Exception as e:
raise Exception("Fehler bei createSchema "+s)
pass

9
basic/constants.py

@ -119,7 +119,8 @@ DATA_NODE_COMP = "comp"
DATA_NODE_PAR = "par"
DATA_NODE_CATALOG = "_catalog"
DATA_NODE_ROW = "_row"
LIST_DATA_NODE = [DATA_NODE_HEADER, DATA_NODE_DATA, DATA_NODE_DDL,
DATA_NODE_TABLES, DATA_NODE_STEPS, DATA_NODE_OPTION, DATA_NODE_ROW]
ATTR_ARTS_TYPE = "type"
""" must attribute for the type of the technique """
@ -227,9 +228,6 @@ SUBJECT_COMPS = "components"
ATTR_INST_SUBCOMP = SUBJECT_COMPS
#SUBJECT_FCT = "function" # | | | | x | main-programs
SUBJECT_ARTS = "artifact" # | | | | x | Component
"""
in this subject-node are each kind of result of any component with the structure:
* topic (db, cli, api, ...)
@ -237,6 +235,9 @@ in this subject-node are each kind of result of any component with the structure
* * partial-component - to-know: the existence of db-tables can be defined in the ddl-tree
* * * specific attributes - it overrides the general attributes
"""
SUBJECT_ARTS = "artifact" # | | | | x | Component
SUBJECT_VARIANTS = "variants"
#ATTR_ARTS_DB = "db"
ATTR_ARTS_LOG = "log"
ATTR_ARTS_LOB = "lob"

6
basic/program.py

@ -154,8 +154,10 @@ class Job:
exit(3)
if args is not None:
self.setParameter(args)
self.m = basic.message.Message(self, self.programDef[CTLG_LOGLEVEL], logTime, None)
if isinstance(self.programDef, dict):
self.m = basic.message.Message(self, self.programDef[CTLG_LOGLEVEL], logTime, None)
else:
self.m = basic.message.Message(self, basic.message.LIMIT_DEBUG, logTime, None)
def getLogpath(self):
path = tools.path_tool.compose_path(self, self.programDef[CTLG_LOGPATH], None)
return path

0
basic/DATASTRUCTURE.yml → basic/xxDATASTRUCTURE.yxml

1
catalog/programs.csv

@ -1,3 +1,4 @@
_type;ctlg;;;;;;;;;;;;;
_key;name;;;;;;;;;;;;;
table:programs;name;objtype;objname;time;env;app;variant;pardef;pfilesource;pfiletarget;dirname;basedir;loglevel;logpath
;test_executer;tp,ts,tc;m;m;m;m;o;"{""gran"":""args"",""application"":""args"",""environment"":""args"",""testelem"":""args"",""variant"":""args""}";;;{objtype}dir;{objtype}base;info;{job.par.wsdir}/{log}/log_{job.start}.txt

1 _key _type name ctlg
1 _type ctlg
2 _key _key name name
3 table:programs table:programs name name objtype objname time env app variant pardef pfilesource pfiletarget dirname basedir loglevel logpath
4 test_executer test_executer tp,ts,tc m m m m o {"gran":"args","application":"args","environment":"args","testelem":"args","variant":"args"} {objtype}dir {objtype}base info {job.par.wsdir}/{log}/log_{job.start}.txt

88
install_workspace.py

@ -7,7 +7,9 @@
import json
import os
import datetime
import re
import subprocess
import traceback
import yaml
@ -22,6 +24,11 @@ PROGRAM_NAME = "install_workspace"
CONFIG_FORMAT = "yml"
BASIS_FORMAT = "json"
REPO_NAME = "_name"
REPO_URL = "url"
REPO_BRANCH = "_branch"
job = None
# -----------------------------------------------------------------------------------------
# Miniimplementierung des Programmeahmens
@ -48,6 +55,8 @@ class Logger:
def logInfo(self, text):
self.logfile.write(text + "\n")
def setMsg(self, text):
self.logfile.write(text + "\n")
def logError(self, text):
self.logfile.write("ERROR:" + text + "\n")
print("ERROR:" + text)
@ -66,6 +75,8 @@ class ActJob:
self.program = program
self.start = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
self.jobid = 100000
self.conf = {}
self.par = {}
def startJob(self):
self.m = Logger(self, "info", self.start, None) # job, level, logTime, componente
@ -80,10 +91,17 @@ class ActJob:
self.m.closeLog()
print(text)
def getDebugLevel(self, tool):
return 0
def debug(self, verify, text):
self.m.logInfo(text)
def setParameter(self, args):
for k in args:
setattr(self, k, args[k])
# -----------------------------------------------------------------------------------------
# Standardsteuerung Hauptverarbeitung
def startPyJob(job):
@ -99,8 +117,13 @@ def startPyJob(job):
createFolders(job)
createGit(job)
createBasisConfig(job)
createDb(job)
except Exception as e:
job.m.logError("+++++++++++++++++++++++++++++++++++++++++++++")
job.m.logError(str(e))
job.m.logError("+++++++++++++++++++++++++++++++++++++++++++++")
job.m.logError("execpt "+traceback.format_exc())
job.m.logError("+++++++++++++++++++++++++++++++++++++++++++++")
# -----------------------------------------------------------------------------------------
# konkrete Verarbeitungsroutinen
@ -125,6 +148,10 @@ def readConfig(job):
file.close()
for k in doc:
args[k] = doc[k]
job.conf[k] = doc[k]
home = getHome()
for k in job.conf["paths"]:
job.conf["paths"][k] = os.path.join(home, job.conf["paths"][k])
job.setParameter(args)
def createFolders(job):
@ -142,13 +169,17 @@ def createFolder(job, path):
else:
job.m.logInfo("Verzeichnis existiert: " + path)
# --------------------------------------------------------------------------------------
# git_tool
# --------------------------------------------------------------------------------------
def createGit(job):
job.m.logInfo("--- erstelle und aktualisiere git-Repos ")
repos = {}
local = {}
attr = {
"_name": "",
"_branch": ""
REPO_NAME: "",
REPO_BRANCH: ""
}
# erstelle Repoliste mit den Attributen: name, branch, url
for r in job.repos:
@ -160,7 +191,7 @@ def createGit(job):
repo[a] = job.repos[r][a]
repos[r] = repo
for k in attr:
a = k[1:]
a = k
for r in repos:
if a not in repos[r]:
repos[r][a] = attr[k]
@ -168,9 +199,10 @@ def createGit(job):
repo = repos[r]
path = os.path.join(job.home, job.paths[r])
if os.path.exists(path):
local["url"] = os.path.join(job.home, job.paths[r])
local["branch"] = repo["branch"]
rpath = os.path.join(local["url"], ".git")
local[REPO_URL] = os.path.join(job.home, job.paths[r])
local[REPO_BRANCH] = repo[REPO_BRANCH]
local[REPO_NAME] = repo[REPO_NAME]
rpath = os.path.join(local[REPO_URL], ".git")
if os.path.exists(rpath):
job.m.logInfo("Repo existiert bereits "+r)
else:
@ -182,42 +214,52 @@ def createGit(job):
def initGit(job, local, repo, bare=False):
job.m.logInfo("--- initialisiere git-Repo "+str(repo)+","+str(local))
os.chdir(local["url"])
os.chdir(local[REPO_URL])
cmd = "git init "
if bare:
cmd += " --bare"
execCmd(job, cmd)
cmd = "git checkout " + local["branch"]
cmd = "git checkout " + local[REPO_BRANCH]
execCmd(job, cmd)
cmd = "git remote add " + repo["name"] + " " + repo["url"]
cmd = "git remote add " + repo[REPO_NAME] + " " + repo[REPO_URL]
execCmd(job, cmd)
os.chdir(job.home)
def execCmd(job, cmd):
job.m.logInfo(cmd)
text = ""
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
btext = process.communicate()[0]
text = btext.decode('utf-8')
job.m.logInfo(text)
return text
def switchLocal(job, local):
os.chdir(local["url"])
cmd = "git checkout " + local["branch"]
execCmd(job, cmd)
def checkoutLocal(job, local):
os.chdir(local[REPO_URL])
cmd = "git checkout " + local[REPO_BRANCH]
text = execCmd(job, cmd)
return text
def updateLocal(job, local, repo):
job.m.logInfo("--- aktualisiere git-Repo "+str(repo)+","+str(local))
switchLocal(job, local)
cmd = "git pull " + repo["name"] + " " + repo["branch"]
execCmd(job, cmd)
text = checkoutLocal(job, local)
# if len(text) > 0 and re.match(r"[MA]\s\w+", text):
match = re.search(r"([DMA])\s(\S+)", text)
if match is not None:
os.chdir(job.home)
job.m.logError("ERROR: lokales Repo " + local[REPO_URL] + ", " + local[REPO_BRANCH] + " hat uncommited Aenderungen")
print("regex gefunden")
return
cmd = "git pull " + repo[REPO_NAME] + " " + repo[REPO_BRANCH]
text = execCmd(job, cmd)
job.m.logInfo(text)
os.chdir(job.home)
def updateRemote(job, local, repo):
job.m.logInfo("--- aktualisiere git-Repo "+str(repo)+","+str(local))
switchLocal(job, local)
cmd = "git push " + repo["name"] + " " + repo["branch"]
execCmd(job, cmd)
text = checkoutLocal(job, local)
cmd = "git push " + repo[REPO_NAME] + " " + repo[REPO_BRANCH]
text = execCmd(job, cmd)
os.chdir(job.home)
def createBasisConfig(job):
@ -246,6 +288,13 @@ def createBasisConfig(job):
file.write(doc)
file.close()
def createDb(job):
if "db" in job.conf:
import basic.connection
import basic.Testserver
testserver = basic.Testserver.Testserver(job)
testserver.createDBTables(job)
def getHome():
home = os.getcwd()
@ -253,6 +302,7 @@ def getHome():
home = home[0:-8]
return home
# -----------------------------------------------------------------------------------------
# Pythonstandard Programmaufruf
# Job-Objekt erzeugen und beenden

4
model/ap_application.csv

@ -0,0 +1,4 @@
table:ap_application;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;apappid;pk;vchar(256);N;;;;;;
;apid;int;vchar(256);I;;;;;;
;component;str;vchar(256);I;;;;;;
1 table:ap_application _field type format index generic aggregat key acceptance alias description
2 apappid pk vchar(256) N
3 apid int vchar(256) I
4 component str vchar(256) I

5
model/ap_component.csv

@ -0,0 +1,5 @@
table:ap_component;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;apcomid;pk;int;N;;;;;;
;apid;int;int;I;;;;;;
;coid;int;int;I;;;;;;
;component;str;vchar(256);N;;;;;;
1 table:ap_component _field type format index generic aggregat key acceptance alias description
2 apcomid pk int N
3 apid int int I
4 coid int int I
5 component str vchar(256) N

6
model/ap_project.csv

@ -0,0 +1,6 @@
table:ap_project;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;pjid;pk;int;N;;;;;;
;apid;int;int;I;;;;;;
;project;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
1 table:ap_project _field type format index generic aggregat key acceptance alias description
2 pjid pk int N
3 apid int int I
4 project str vchar(256) I
5 description string vchar(256) N
6 reference str vchar(256) N

13
model/application.csv

@ -0,0 +1,13 @@
table:application;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;apid;pk;int;N;;;;;;
;name;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;attributes;string;jlob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;vchar(256);N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;vchar(256);N;;;;;;
;actual;int;vchar(256);I;;;;;;
1 table:application _field type format index generic aggregat key acceptance alias description
2 apid pk int N
3 name str vchar(256) I
4 description string vchar(256) N
5 reference str vchar(256) N
6 attributes string jlob N
7 insauthor str vchar(256) N
8 inscommit str vchar(256) N
9 instime time vchar(256) N
10 updauthor str vchar(256) N
11 updcommit str vchar(256) N
12 updtime time vchar(256) N
13 actual int vchar(256) I

14
model/artifact.csv

@ -0,0 +1,14 @@
table:artifact;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;afid;pk;int;N;;;;;;
;name;str;vchar(256);I;;;;;;
;aftype;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;attributes;string;jlob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;vchar(256);N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;vchar(256);N;;;;;;
;actual;int;vchar(256);I;;;;;;
1 table:artifact _field type format index generic aggregat key acceptance alias description
2 afid pk int N
3 name str vchar(256) I
4 aftype str vchar(256) I
5 description string vchar(256) N
6 reference str vchar(256) N
7 attributes string jlob N
8 insauthor str vchar(256) N
9 inscommit str vchar(256) N
10 instime time vchar(256) N
11 updauthor str vchar(256) N
12 updcommit str vchar(256) N
13 updtime time vchar(256) N
14 actual int vchar(256) I

7
model/co_artifact.csv

@ -0,0 +1,7 @@
table:tc_story;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tcid;int;integer;I;;;T:1;;;
;stid;int;integer;I;;;T:2;;;
;story;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;acceptcriteria;str;clob;N;;;;;;
1 table:tc_story _field type format index generic aggregat key acceptance alias description
2 tcid int integer I T:1
3 stid int integer I T:2
4 story str vchar(256) I
5 description string vchar(256) N
6 reference str vchar(256) N
7 acceptcriteria str clob N

7
model/co_step.csv

@ -0,0 +1,7 @@
table:tc_story;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tcid;int;integer;I;;;T:1;;;
;stid;int;integer;I;;;T:2;;;
;story;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;acceptcriteria;str;clob;N;;;;;;
1 table:tc_story _field type format index generic aggregat key acceptance alias description
2 tcid int integer I T:1
3 stid int integer I T:2
4 story str vchar(256) I
5 description string vchar(256) N
6 reference str vchar(256) N
7 acceptcriteria str clob N

7
model/co_table.csv

@ -0,0 +1,7 @@
table:tc_story;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tcid;int;integer;I;;;T:1;;;
;stid;int;integer;I;;;T:2;;;
;story;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;acceptcriteria;str;clob;N;;;;;;
1 table:tc_story _field type format index generic aggregat key acceptance alias description
2 tcid int integer I T:1
3 stid int integer I T:2
4 story str vchar(256) I
5 description string vchar(256) N
6 reference str vchar(256) N
7 acceptcriteria str clob N

15
model/component.csv

@ -0,0 +1,15 @@
table:component;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;coid;pk;int;N;;;;;;
;name;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;project;string;vchar(256);I;;;;;;
;application;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;attributes;string;jlob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;vchar(256);N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;vchar(256);N;;;;;;
;actual;int;vchar(256);I;;;;;;
1 table:component _field type format index generic aggregat key acceptance alias description
2 coid pk int N
3 name str vchar(256) I
4 description string vchar(256) N
5 project string vchar(256) I
6 application string vchar(256) N
7 reference str vchar(256) N
8 attributes string jlob N
9 insauthor str vchar(256) N
10 inscommit str vchar(256) N
11 instime time vchar(256) N
12 updauthor str vchar(256) N
13 updcommit str vchar(256) N
14 updtime time vchar(256) N
15 actual int vchar(256) I

13
model/en_component.csv

@ -0,0 +1,13 @@
table:en_component;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;encomid;pk;vchar(256);N;;;;;;
;enid;int;vchar(256);I;;;;;;
;component;str;vchar(256);I;;;;;;
;instance;int;vchar(256);N;;;;;;
;type;str;vchar(256);N;;;;;;
;ip;str;vchar(256);N;;;;;;
;port;str;vchar(256);N;;;;;;
;hostname;str;vchar(256);N;;;;;;
;dompath;str;vchar(256);N;;;;;;
;user;str;vchar(256);N;;;;;;
;password;str;vchar(256);N;;;;;;
;attributes;string;vchar(256);N;;;;;;
1 table:en_component _field type format index generic aggregat key acceptance alias description
2 encomid pk vchar(256) N
3 enid int vchar(256) I
4 component str vchar(256) I
5 instance int vchar(256) N
6 type str vchar(256) N
7 ip str vchar(256) N
8 port str vchar(256) N
9 hostname str vchar(256) N
10 dompath str vchar(256) N
11 user str vchar(256) N
12 password str vchar(256) N
13 attributes string vchar(256) N

4
model/en_project.csv

@ -0,0 +1,4 @@
table:en_project;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;enproid;pk;vchar(256);N;;;;;;
;enid;int;vchar(256);I;;;;;;
;project;str;vchar(256);I;;;;;;
1 table:en_project _field type format index generic aggregat key acceptance alias description
2 enproid pk vchar(256) N
3 enid int vchar(256) I
4 project str vchar(256) I

13
model/environment.csv

@ -0,0 +1,13 @@
table:environment;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;enid;pk;int;N;;;;;;
;name;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;attributes;string;jlob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;vchar(256);N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;vchar(256);N;;;;;;
;actual;int;vchar(256);I;;;;;;
1 table:environment _field type format index generic aggregat key acceptance alias description
2 enid pk int N
3 name str vchar(256) I
4 description string vchar(256) N
5 reference str vchar(256) N
6 attributes string jlob N
7 insauthor str vchar(256) N
8 inscommit str vchar(256) N
9 instime time vchar(256) N
10 updauthor str vchar(256) N
11 updcommit str vchar(256) N
12 updtime time vchar(256) N
13 actual int vchar(256) I

12
model/job.csv

@ -0,0 +1,12 @@
table:job;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;jbid;pk;integer;N;;;T:1;;;
;name;str;vchar(256);I;;;F:1;;;
;description;string;vchar(256);N;;;;;;
;project;string;vchar(256);I;;;;;;
;application;string;vchar(256);N;;;;;;
;release;str;vchar(256);I;;;;;;
;environment;str;vchar(256);N;;;;;;
;status;str;vchar(256);I;;;;;;
;attributes;jlob;clob;N;;;;;;
;starttime;time;datetime;N;;;;;;
;endtime;time;datetime;N;;;;;;
1 table:job _field type format index generic aggregat key acceptance alias description
2 jbid pk integer N T:1
3 name str vchar(256) I F:1
4 description string vchar(256) N
5 project string vchar(256) I
6 application string vchar(256) N
7 release str vchar(256) I
8 environment str vchar(256) N
9 status str vchar(256) I
10 attributes jlob clob N
11 starttime time datetime N
12 endtime time datetime N

15
model/release.csv

@ -0,0 +1,15 @@
table:release;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;rlid;pk;int;N;;;;;;
;name;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;project;string;vchar(256);I;;;;;;
;application;string;vchar(256);N;;;;;;
;attributes;string;jlob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;vchar(256);N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;vchar(256);N;;;;;;
;actual;int;vchar(256);I;;;;;;
1 table:release _field type format index generic aggregat key acceptance alias description
2 rlid pk int N
3 name str vchar(256) I
4 description string vchar(256) N
5 reference str vchar(256) N
6 project string vchar(256) I
7 application string vchar(256) N
8 attributes string jlob N
9 insauthor str vchar(256) N
10 inscommit str vchar(256) N
11 instime time vchar(256) N
12 updauthor str vchar(256) N
13 updcommit str vchar(256) N
14 updtime time vchar(256) N
15 actual int vchar(256) I

13
model/step.csv

@ -0,0 +1,13 @@
table:step;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;spid;pk;int;N;;;;;;
;name;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;attributes;string;jlob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;vchar(256);N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;vchar(256);N;;;;;;
;actual;int;vchar(256);I;;;;;;
1 table:step _field type format index generic aggregat key acceptance alias description
2 spid pk int N
3 name str vchar(256) I
4 description string vchar(256) N
5 reference str vchar(256) N
6 attributes string jlob N
7 insauthor str vchar(256) N
8 inscommit str vchar(256) N
9 instime time vchar(256) N
10 updauthor str vchar(256) N
11 updcommit str vchar(256) N
12 updtime time vchar(256) N
13 actual int vchar(256) I

15
model/story.csv

@ -0,0 +1,15 @@
table:story;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;stid;pk;int;N;;;;;;
;name;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;project;string;vchar(256);I;;;;;;
;application;string;vchar(256);N;;;;;;
;attributes;string;jlob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;vchar(256);N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;vchar(256);N;;;;;;
;actual;int;vchar(256);I;;;;;;
1 table:story _field type format index generic aggregat key acceptance alias description
2 stid pk int N
3 name str vchar(256) I
4 description string vchar(256) N
5 reference str vchar(256) N
6 project string vchar(256) I
7 application string vchar(256) N
8 attributes string jlob N
9 insauthor str vchar(256) N
10 inscommit str vchar(256) N
11 instime time vchar(256) N
12 updauthor str vchar(256) N
13 updcommit str vchar(256) N
14 updtime time vchar(256) N
15 actual int vchar(256) I

13
model/table.csv

@ -0,0 +1,13 @@
table:table;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tbid;pk;integer;N;;;T:1;;;
;name;str;vchar(256);I;;;F:1;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;story
;attributes;jlob;clob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;datetime;N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;datetime;N;;;;;;
;actual;int;integer;I;;;;;;
1 table:table _field type format index generic aggregat key acceptance alias description
2 tbid pk integer N T:1
3 name str vchar(256) I F:1
4 description string vchar(256) N
5 reference str vchar(256) N story
6 attributes jlob clob N
7 insauthor str vchar(256) N
8 inscommit str vchar(256) N
9 instime time datetime N
10 updauthor str vchar(256) N
11 updcommit str vchar(256) N
12 updtime time datetime N
13 actual int integer I

5
model/tc_step.csv

@ -0,0 +1,5 @@
table:tc_step;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tcid;int;integer;I;;;T:1;;;
;spid;int;integer;I;;;T:2;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
1 table:tc_step _field type format index generic aggregat key acceptance alias description
2 tcid int integer I T:1
3 spid int integer I T:2
4 description string vchar(256) N
5 reference str vchar(256) N

7
model/tc_story.csv

@ -0,0 +1,7 @@
table:tc_story;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tcid;int;integer;I;;;T:1;;;
;stid;int;integer;I;;;T:2;;;
;story;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;acceptcriteria;str;clob;N;;;;;;
1 table:tc_story _field type format index generic aggregat key acceptance alias description
2 tcid int integer I T:1
3 stid int integer I T:2
4 story str vchar(256) I
5 description string vchar(256) N
6 reference str vchar(256) N
7 acceptcriteria str clob N

5
model/tc_table.csv

@ -0,0 +1,5 @@
table:tc_table;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tcid;int;integer;I;;;T:1;;;
;tbid;int;integer;I;;;T:2;;;
;count;int;int;N;;;;;;
;refdate;date;date;N;;;;;;
1 table:tc_table _field type format index generic aggregat key acceptance alias description
2 tcid int integer I T:1
3 tbid int integer I T:2
4 count int int N
5 refdate date date N

15
model/testcase.csv

@ -0,0 +1,15 @@
table:testcase;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tcid;pk;integer;N;;;T:1;;;
;name;str;vchar(256);I;;;F:1;;;
;description;string;vchar(256);N;;;;;;
;project;string;vchar(256);I;;;;;;
;application;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;story
;attributes;jlob;clob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;datetime;N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;datetime;N;;;;;;
;actual;int;integer;I;;;;;;
1 table:testcase _field type format index generic aggregat key acceptance alias description
2 tcid pk integer N T:1
3 name str vchar(256) I F:1
4 description string vchar(256) N
5 project string vchar(256) I
6 application string vchar(256) N
7 reference str vchar(256) N story
8 attributes jlob clob N
9 insauthor str vchar(256) N
10 inscommit str vchar(256) N
11 instime time datetime N
12 updauthor str vchar(256) N
13 updcommit str vchar(256) N
14 updtime time datetime N
15 actual int integer I

16
model/testplan.csv

@ -0,0 +1,16 @@
table:testplan;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tpid;pk;integer;N;;;T:1;;;
;name;str;vchar(256);I;;;F:1;;;
;description;string;vchar(256);N;;;;;;
;project;string;vchar(256);I;;;;;;
;application;string;vchar(256);N;;;;;;
;release;string;vchar(256);I;;;;;;
;reference;str;vchar(256);N;;;;;;story
;attributes;jlob;clob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;datetime;N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;datetime;N;;;;;;
;actual;int;integer;I;;;;;;
1 table:testplan _field type format index generic aggregat key acceptance alias description
2 tpid pk integer N T:1
3 name str vchar(256) I F:1
4 description string vchar(256) N
5 project string vchar(256) I
6 application string vchar(256) N
7 release string vchar(256) I
8 reference str vchar(256) N story
9 attributes jlob clob N
10 insauthor str vchar(256) N
11 inscommit str vchar(256) N
12 instime time datetime N
13 updauthor str vchar(256) N
14 updcommit str vchar(256) N
15 updtime time datetime N
16 actual int integer I

22
model/testreport.csv

@ -0,0 +1,22 @@
table:testreport;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tcid;pk;integer;N;;;T:1;;;
;name;str;vchar(256);I;;;F:1;;;
;description;string;vchar(256);N;;;;;;
;project;string;vchar(256);I;;;;;;
;application;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;release;str;vchar(256);I;;;;;;
;environment;str;vchar(256);N;;;;;;
;testplan;str;vchar(256);N;;;;;;
;testsuite;str;vchar(256);N;;;;;;
;testcase;str;vchar(256);N;;;;;;
;artifact;str;vchar(256);N;;;;;;
;result;str;vchar(256);I;;;;;;
;attributes;jlob;clob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;datetime;N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;datetime;N;;;;;;
;actual;int;integer;I;;;;;;
1 table:testreport _field type format index generic aggregat key acceptance alias description
2 tcid pk integer N T:1
3 name str vchar(256) I F:1
4 description string vchar(256) N
5 project string vchar(256) I
6 application string vchar(256) N
7 reference str vchar(256) N
8 release str vchar(256) I
9 environment str vchar(256) N
10 testplan str vchar(256) N
11 testsuite str vchar(256) N
12 testcase str vchar(256) N
13 artifact str vchar(256) N
14 result str vchar(256) I
15 attributes jlob clob N
16 insauthor str vchar(256) N
17 inscommit str vchar(256) N
18 instime time datetime N
19 updauthor str vchar(256) N
20 updcommit str vchar(256) N
21 updtime time datetime N
22 actual int integer I

15
model/testsuite.csv

@ -0,0 +1,15 @@
table:testsuite;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tsid;pk;integer;N;;;T:1;;;
;name;str;vchar(256);I;;;F:1;;;
;description;string;vchar(256);N;;;;;;
;project;string;vchar(256);I;;;;;;
;application;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;story
;attributes;jlob;clob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;datetime;N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;datetime;N;;;;;;
;actual;int;integer;I;;;;;;
1 table:testsuite _field type format index generic aggregat key acceptance alias description
2 tsid pk integer N T:1
3 name str vchar(256) I F:1
4 description string vchar(256) N
5 project string vchar(256) I
6 application string vchar(256) N
7 reference str vchar(256) N story
8 attributes jlob clob N
9 insauthor str vchar(256) N
10 inscommit str vchar(256) N
11 instime time datetime N
12 updauthor str vchar(256) N
13 updcommit str vchar(256) N
14 updtime time datetime N
15 actual int integer I

5
model/tp_testsuite.csv

@ -0,0 +1,5 @@
table:tp_testsuite;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tpid;int;integer;I;;;T:1;;;
;tsid;int;integer;I;;;T:2;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
1 table:tp_testsuite _field type format index generic aggregat key acceptance alias description
2 tpid int integer I T:1
3 tsid int integer I T:2
4 description string vchar(256) N
5 reference str vchar(256) N

6
model/tr_artifact.csv

@ -0,0 +1,6 @@
table:tr_artifact;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;trid;int;integer;I;;;T:1;;;
;afid;int;integer;I;;;T:2;;;
;result;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
1 table:tr_artifact _field type format index generic aggregat key acceptance alias description
2 trid int integer I T:1
3 afid int integer I T:2
4 result str vchar(256) I
5 description string vchar(256) N
6 reference str vchar(256) N

5
model/ts_testcase.csv

@ -0,0 +1,5 @@
table:ts_testcase;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tsid;int;integer;I;;;T:1;;;
;tcid;int;integer;I;;;T:2;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
1 table:ts_testcase _field type format index generic aggregat key acceptance alias description
2 tsid int integer I T:1
3 tcid int integer I T:2
4 description string vchar(256) N
5 reference str vchar(256) N

5
model/ts_usecase.csv

@ -0,0 +1,5 @@
table:ts_usecase;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;tsid;int;integer;I;;;T:1;;;
;ucid;int;integer;I;;;T:2;;;
;description;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
1 table:ts_usecase _field type format index generic aggregat key acceptance alias description
2 tsid int integer I T:1
3 ucid int integer I T:2
4 description string vchar(256) N
5 reference str vchar(256) N

15
model/usecase.csv

@ -0,0 +1,15 @@
table:usecase;_field;type;format;index;generic;aggregat;key;acceptance;alias;description
;ucid;pk;int;N;;;;;;
;name;str;vchar(256);I;;;;;;
;description;string;vchar(256);N;;;;;;
;project;string;vchar(256);I;;;;;;
;application;string;vchar(256);N;;;;;;
;reference;str;vchar(256);N;;;;;;
;attributes;string;jlob;N;;;;;;
;insauthor;str;vchar(256);N;;;;;;
;inscommit;str;vchar(256);N;;;;;;
;instime;time;vchar(256);N;;;;;;
;updauthor;str;vchar(256);N;;;;;;
;updcommit;str;vchar(256);N;;;;;;
;updtime;time;vchar(256);N;;;;;;
;actual;int;vchar(256);I;;;;;;
1 table:usecase _field type format index generic aggregat key acceptance alias description
2 ucid pk int N
3 name str vchar(256) I
4 description string vchar(256) N
5 project string vchar(256) I
6 application string vchar(256) N
7 reference str vchar(256) N
8 attributes string jlob N
9 insauthor str vchar(256) N
10 inscommit str vchar(256) N
11 instime time vchar(256) N
12 updauthor str vchar(256) N
13 updcommit str vchar(256) N
14 updtime time vchar(256) N
15 actual int vchar(256) I

16
tools/config_tool.py

@ -153,9 +153,19 @@ def getCompPath(job, name, subname, filename):
configpath = getExistingPath(job, pathnames)
if configpath is not None:
return configpath
if name == "Testserver":
print(name)
for format in CONFIG_FORMAT:
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_PROGRAM],
"model", subname + "." + format)
print(pathname)
if os.path.exists(pathname):
return pathname
for format in CONFIG_FORMAT:
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_COMPONENTS],
basic.componentHandling.getComponentFolder(name), filename + "." + format)
print(pathname)
if os.path.exists(pathname):
return pathname
for format in CONFIG_FORMAT:
@ -179,7 +189,7 @@ def getBasicPath(job, name):
def getTestPath(job, name, filename):
for format in CONFIG_FORMAT:
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_TDATA],
pathname = os.path.join(job.conf[B.SUBJECT_PATH][P.ATTR_PATH_TDATA], job.par.project,
name, filename + "." + format)
if os.path.exists(pathname):
return pathname
@ -255,8 +265,8 @@ def getConfig(job, modul, name, subname=""):
job.debug(verify, "getConfig " + pathname)
if len(pathname) < 1:
return confs
doc = tools.file_tool.read_file_dict(job, pathname, msg)
if modul == D.DDL_FILENAME:
doc = tools.file_tool.read_file_dict(job, pathname, msg, D.CSV_SPECTYPE_DATA)
# in csv the root is the subname
# from the Dict-structure of DDL_FILENAME pick the substructure of the subname
keys = list(doc.keys())
@ -267,6 +277,8 @@ def getConfig(job, modul, name, subname=""):
if subname in keys:
doc0 = doc[subname]
doc = doc0
else:
doc = tools.file_tool.read_file_dict(job, pathname, msg)
for i, v in doc.items():
confs[i] = v
return confs

2
tools/conn_tool.py

@ -13,7 +13,7 @@ def getConnection(job, comp, nr):
#job = basic.program.Job.getInstance()
verify = job.getDebugLevel("conn_tool")
conn = {}
if job.conf.confs.get(B.SUBJECT_TOOL).get("connsrc") == D.DFILE_TYPE_YML:
if job.conf.get(B.SUBJECT_TOOL).get("connsrc") == D.DFILE_TYPE_YML:
conn = tools.config_tool.getConfig(job, "tool", B.SUBJECT_CONN)
xtypes = None
if ("types" in conn["env"][comp]):

13
tools/data_const.py

@ -81,14 +81,23 @@ HEAD_ATTR_TARGET = "target"
HEAD_ATTR_USECASE = "usecase"
HEAD_ATTR_UCID = "usecase-id"
HEAD_ATTR_STORY = "story"
HEAD_ATTR_STORYID = "storyid-id"
HEAD_ATTR_STORYID = "story-id"
HEAD_ATTR_APP = B.SUBJECT_APP
HEAD_ATTR_APPS = B.SUBJECT_APPS
HEAD_ATTR_DEPR = "deprecated"
LIST_HEAD_ATTR = [HEAD_ATTR_DESCR, HEAD_ATTR_TARGET, HEAD_ATTR_USECASE, HEAD_ATTR_UCID,
HEAD_ATTR_STORY, HEAD_ATTR_STORYID, HEAD_ATTR_APPS, HEAD_ATTR_DEPR]
HEAD_ATTR_STORY, HEAD_ATTR_STORYID, HEAD_ATTR_APP, HEAD_ATTR_APPS, HEAD_ATTR_DEPR]
LIST_HEAD_CONST = ["HEAD_ATTR_DESCR", "HEAD_ATTR_TARGET", "HEAD_ATTR_USECASE", "HEAD_ATTR_UCID",
"HEAD_ATTR_STORY", "HEAD_ATTR_STORYID", "HEAD_ATTR_APPS", "HEAD_ATTR_DEPR"]
OPT_ATTR_DESCR = "decription"
OPT_ATTR_TARGET = "target"
OPT_ATTR_USECASE = "usecase"
OPT_ATTR_UCID = "usecase-id"
OPT_ATTR_STORY = "story"
OPT_ATTR_STORYID = "story-id"
LIST_OPT_ATTR = [OPT_ATTR_DESCR, OPT_ATTR_TARGET, OPT_ATTR_USECASE, OPT_ATTR_UCID,
OPT_ATTR_STORY, OPT_ATTR_STORYID]
CSV_HEADER_START = ["node", "table", "tabelle"]
CSV_DELIMITER = ";"

8
tools/dbmysql_tool.py

@ -4,12 +4,12 @@
# Author : Ulrich Carmesin
# Source : gitea.ucarmesin.de
# ---------------------------------------------------------------------------------------------------------
import utils.config_tool
import tools.config_tool
import tools.dbrel_tool
import mysql.connector
import basic.constants as B
import utils.data_const as D
import utils.date_tool
import tools.data_const as D
import tools.date_tool
class DbFcts(tools.dbrel_tool.DbFcts):
"""
@ -44,7 +44,7 @@ class DbFcts(tools.dbrel_tool.DbFcts):
i = 0
for f in self.comp.conf[B.DATA_NODE_DDL][table][B.DATA_NODE_HEADER]:
if self.comp.conf[B.DATA_NODE_DDL][table][f][D.DDL_TYPE] in [D.TYPE_TIME, D.TYPE_DATE]:
r[f] = utils.date_tool.getFormatdate(x[i], utils.date_tool.F_DIR)
r[f] = tools.date_tool.getFormatdate(x[i], tools.date_tool.F_DIR)
else:
r[f] = str(x[i])
i += 1

2
tools/dbrel_tool.py

@ -99,7 +99,7 @@ class DbFcts(tools.db_abstract.DbFcts):
return attr + " varchar(50)"
elif atype == D.TYPE_STRING:
return attr + " varchar(500)"
elif atype == D.TYPE_TEXT:
elif atype in [D.TYPE_TEXT, D.TYPE_CLOB, D.TYPE_JLOB, D.TYPE_XLOB]:
return attr + " text"
elif atype == D.TYPE_INT:
return attr + " integer"

2
tools/file_tool.py

@ -207,7 +207,7 @@ def getModTime(job, filepath):
return out
def read_file_dict(job, path, msg, ttype=""):
def read_file_dict(job, path, msg, ttype=D.DFILE_TYPE_CSV):
"""
reads and gets general a dict from any kind of filetyp
:param path: with extension of filetype

54
tools/git_tool.py

@ -20,7 +20,11 @@ COMMIT_AUTHOR = "author"
COMMIT_DATE = "date"
COMMIT_COMMENT = "comment"
def runGit(job, repo, cmd):
REPO_NAME = "name"
REPO_URL = "url"
REPO_BRANCH = "branch"
def execCmd(job, repo, cmd):
"""
executes the command on the repository
:param job:
@ -31,10 +35,11 @@ def runGit(job, repo, cmd):
cdpath = ""
if os.path.isdir(repo):
cdpath = repo
elif repo in job.conf.confs[B.SUBJECT_PATH]:
cdpath = job.conf.confs[B.SUBJECT_PATH][repo]
elif repo in job.conf[B.SUBJECT_PATH]:
cdpath = job.conf[B.SUBJECT_PATH][repo]
else:
raise Exception(T.EXP_PATH_MISSING, repo)
print("execCmd on " + cdpath + ": " + cmd)
os.chdir(cdpath)
text = ""
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
@ -43,7 +48,7 @@ def runGit(job, repo, cmd):
return text
def gitStatus(job, repo):
text = runGit(job, repo, "git status")
text = execCmd(job, repo, "git status")
return text
def gitLog(job, repo, arg="", cnt=DEFAULT_CNT_COMMITS):
@ -58,8 +63,8 @@ def gitLog(job, repo, arg="", cnt=DEFAULT_CNT_COMMITS):
arg = " -- "+arg
else:
arg = ""
text = runGit(job, repo, "git log -n "+str(cnt)+" --pretty=format:\"%H | %cn | %cd | %s\""+arg)
#print(text)
text = execCmd(job, repo, "git log -n "+str(cnt)+" --pretty=format:\"%H | %cn | %cd | %s\""+arg)
print(text+"\n\n")
logs = []
i = 0
for l in text.split("\n"):
@ -67,6 +72,9 @@ def gitLog(job, repo, arg="", cnt=DEFAULT_CNT_COMMITS):
break
res = {}
a = l.split("|")
print(str(a))
if len(a) < 2:
continue
res[COMMIT_ID] = a[0].strip()
res[COMMIT_AUTHOR] = a[1].strip()
cdate = utils.date_tool.parseDate(a[2].strip())
@ -82,19 +90,39 @@ def gitCommits(job, repo, arg=""):
arg = " -- "+arg
else:
arg = ""
text = runGit(job, repo, "git log --pretty=format:\"%H | %cn | %cd | %s\""+arg)
text = execCmd(job, repo, "git log --pretty=format:\"%H | %cn | %cd | %s\""+arg)
print(text)
def checkoutLocal(job, local):
os.chdir(local["url"])
cmd = "git checkout " + local["branch"]
execCmd(job, cmd)
def updateLocal(job, local, repo):
job.m.logInfo("--- aktualisiere git-Repo "+str(repo)+","+str(local))
checkoutLocal(job, local)
cmd = "git pull " + repo["name"] + " " + repo["branch"]
execCmd(job, cmd)
os.chdir(job.home)
def updateRemote(job, local, repo):
job.m.logInfo("--- aktualisiere git-Repo "+str(repo)+","+str(local))
checkoutLocal(job, local)
cmd = "git push " + repo["name"] + " " + repo["branch"]
execCmd(job, cmd)
os.chdir(job.home)
def gitPull(job, repo):
if "git" not in job.conf.confs[B.SUBJECT_TOOL] or repo not in job.conf.confs[B.SUBJECT_TOOL]["git"]:
if "git" not in job.conf[B.SUBJECT_TOOL] or repo not in job.conf[B.SUBJECT_TOOL]["git"]:
raise Exception(T.EXP_CONFIG_MISSING, "tool.git."+repo)
#print(str(job.conf.confs[B.SUBJECT_TOOL]["git"][repo]))
master = job.conf.confs[B.SUBJECT_TOOL]["git"][repo]["master"]
remote = job.conf.confs[B.SUBJECT_TOOL]["git"][repo]["remote"]
text = runGit(job, repo, "git status")
#print(str(job.conf[B.SUBJECT_TOOL]["git"][repo]))
master = job.conf[B.SUBJECT_TOOL]["git"][repo]["master"]
remote = job.conf[B.SUBJECT_TOOL]["git"][repo]["remote"]
text = execCmd(job, repo, "git status")
if "Commit vor" in text:
print("Das Repository "+repo+" bitte zuerst pushen \n")
#print(text+"\"-------------------------------------\n")
else:
print("Repository "+repo+" kann gepullt werden.")
#runGit(job, repo, "git pull "+remote+" "+master)
#execCmd(job, repo, "git pull "+remote+" "+master)

Loading…
Cancel
Save