mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
Updated function calls in srcupdater
This commit is contained in:
parent
dc7fcb3790
commit
317a31b47f
@ -1,186 +1,187 @@
|
|||||||
import codecs
|
import codecs
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import socket
|
import socket
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from sys import platform as _platform
|
from sys import platform as _platform
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
import xml
|
import xml
|
||||||
from xml.dom.minidom import parse, parseString
|
from xml.dom.minidom import parse, parseString
|
||||||
import Emailer
|
import Emailer
|
||||||
|
from regression_utils import *
|
||||||
def compile(errore, attachli, parsedin):
|
|
||||||
global redo
|
def compile(errore, attachli, parsedin):
|
||||||
global tryredo
|
global redo
|
||||||
global failedbool
|
global tryredo
|
||||||
global errorem
|
global failedbool
|
||||||
errorem = errore
|
global errorem
|
||||||
global attachl
|
errorem = errore
|
||||||
attachl = attachli
|
global attachl
|
||||||
global passed
|
attachl = attachli
|
||||||
global parsed
|
global passed
|
||||||
parsed = parsedin
|
global parsed
|
||||||
passed = True
|
parsed = parsedin
|
||||||
tryredo = False
|
passed = True
|
||||||
redo = True
|
tryredo = False
|
||||||
while(redo):
|
redo = True
|
||||||
passed = True
|
while(redo):
|
||||||
if(passed):
|
passed = True
|
||||||
gitPull("sleuthkit")
|
if(passed):
|
||||||
if(passed):
|
gitPull("sleuthkit")
|
||||||
vsBuild()
|
if(passed):
|
||||||
if(passed):
|
vsBuild()
|
||||||
gitPull("autopsy")
|
if(passed):
|
||||||
if(passed):
|
gitPull("autopsy")
|
||||||
antBuild("datamodel", False)
|
if(passed):
|
||||||
if(passed):
|
antBuild("datamodel", False)
|
||||||
antBuild("autopsy", True)
|
if(passed):
|
||||||
if(passed):
|
antBuild("autopsy", True)
|
||||||
redo = False
|
if(passed):
|
||||||
else:
|
redo = False
|
||||||
print("Compile Failed")
|
else:
|
||||||
time.sleep(3600)
|
print("Compile Failed")
|
||||||
attachl = []
|
time.sleep(3600)
|
||||||
errorem = "The test standard didn't match the gold standard.\n"
|
attachl = []
|
||||||
failedbool = False
|
errorem = "The test standard didn't match the gold standard.\n"
|
||||||
if(tryredo):
|
failedbool = False
|
||||||
errorem = ""
|
if(tryredo):
|
||||||
errorem += "Rebuilt properly.\n"
|
errorem = ""
|
||||||
Emailer.send_email(parsed, errorem, attachl, True)
|
errorem += "Rebuilt properly.\n"
|
||||||
attachl = []
|
Emailer.send_email(parsed, errorem, attachl, True)
|
||||||
passed = True
|
attachl = []
|
||||||
|
passed = True
|
||||||
#Pulls from git
|
|
||||||
def gitPull(TskOrAutopsy):
|
#Pulls from git
|
||||||
global SYS
|
def gitPull(TskOrAutopsy):
|
||||||
global errorem
|
global SYS
|
||||||
global attachl
|
global errorem
|
||||||
ccwd = ""
|
global attachl
|
||||||
gppth = Emailer.make_local_path("..", "GitPullOutput" + TskOrAutopsy + ".txt")
|
ccwd = ""
|
||||||
attachl.append(gppth)
|
gppth = make_local_path("..", "GitPullOutput" + TskOrAutopsy + ".txt")
|
||||||
gpout = open(gppth, 'a')
|
attachl.append(gppth)
|
||||||
toPull = "https://www.github.com/sleuthkit/" + TskOrAutopsy
|
gpout = open(gppth, 'a')
|
||||||
call = ["git", "pull", toPull]
|
toPull = "https://www.github.com/sleuthkit/" + TskOrAutopsy
|
||||||
if TskOrAutopsy == "sleuthkit":
|
call = ["git", "pull", toPull]
|
||||||
ccwd = os.path.join("..", "..", "..", "sleuthkit")
|
if TskOrAutopsy == "sleuthkit":
|
||||||
else:
|
ccwd = os.path.join("..", "..", "..", "sleuthkit")
|
||||||
ccwd = os.path.join("..", "..")
|
else:
|
||||||
subprocess.call(call, stdout=sys.stdout, cwd=ccwd)
|
ccwd = os.path.join("..", "..")
|
||||||
gpout.close()
|
subprocess.call(call, stdout=sys.stdout, cwd=ccwd)
|
||||||
|
gpout.close()
|
||||||
|
|
||||||
#Builds TSK as a win32 applicatiion
|
|
||||||
def vsBuild():
|
#Builds TSK as a win32 applicatiion
|
||||||
global redo
|
def vsBuild():
|
||||||
global tryredo
|
global redo
|
||||||
global passed
|
global tryredo
|
||||||
global parsed
|
global passed
|
||||||
#Please ensure that the current working directory is $autopsy/testing/script
|
global parsed
|
||||||
oldpath = os.getcwd()
|
#Please ensure that the current working directory is $autopsy/testing/script
|
||||||
os.chdir(os.path.join("..", "..", "..","sleuthkit", "win32"))
|
oldpath = os.getcwd()
|
||||||
vs = []
|
os.chdir(os.path.join("..", "..", "..","sleuthkit", "win32"))
|
||||||
vs.append("/cygdrive/c/windows/microsoft.NET/framework/v4.0.30319/MSBuild.exe")
|
vs = []
|
||||||
vs.append(os.path.join("Tsk-win.sln"))
|
vs.append("/cygdrive/c/windows/microsoft.NET/framework/v4.0.30319/MSBuild.exe")
|
||||||
vs.append("/p:configuration=release")
|
vs.append(os.path.join("Tsk-win.sln"))
|
||||||
vs.append("/p:platform=win32")
|
vs.append("/p:configuration=release")
|
||||||
vs.append("/t:clean")
|
vs.append("/p:platform=win32")
|
||||||
vs.append("/t:rebuild")
|
vs.append("/t:clean")
|
||||||
print(vs)
|
vs.append("/t:rebuild")
|
||||||
VSpth = Emailer.make_local_path("..", "VSOutput.txt")
|
print(vs)
|
||||||
VSout = open(VSpth, 'a')
|
VSpth = make_local_path("..", "VSOutput.txt")
|
||||||
subprocess.call(vs, stdout=VSout)
|
VSout = open(VSpth, 'a')
|
||||||
VSout.close()
|
subprocess.call(vs, stdout=VSout)
|
||||||
os.chdir(oldpath)
|
VSout.close()
|
||||||
chk = os.path.join("..", "..", "..","sleuthkit", "win32", "Release", "libtsk_jni.dll")
|
os.chdir(oldpath)
|
||||||
try:
|
chk = os.path.join("..", "..", "..","sleuthkit", "win32", "Release", "libtsk_jni.dll")
|
||||||
open(chk)
|
try:
|
||||||
except IOError as e:
|
open(chk)
|
||||||
global errorem
|
except IOError as e:
|
||||||
global attachl
|
global errorem
|
||||||
if(not tryredo):
|
global attachl
|
||||||
errorem += "LIBTSK C++ failed to build.\n"
|
if(not tryredo):
|
||||||
attachl.append(VSpth)
|
errorem += "LIBTSK C++ failed to build.\n"
|
||||||
Emailer.send_email(parsed, errorem, attachl, False)
|
attachl.append(VSpth)
|
||||||
tryredo = True
|
send_email(parsed, errorem, attachl, False)
|
||||||
passed = False
|
tryredo = True
|
||||||
redo = True
|
passed = False
|
||||||
|
redo = True
|
||||||
|
|
||||||
|
|
||||||
#Builds Autopsy or the Datamodel
|
|
||||||
def antBuild(which, Build):
|
#Builds Autopsy or the Datamodel
|
||||||
global redo
|
def antBuild(which, Build):
|
||||||
global passed
|
global redo
|
||||||
global tryredo
|
global passed
|
||||||
global parsed
|
global tryredo
|
||||||
directory = os.path.join("..", "..")
|
global parsed
|
||||||
ant = []
|
directory = os.path.join("..", "..")
|
||||||
if which == "datamodel":
|
ant = []
|
||||||
directory = os.path.join("..", "..", "..", "sleuthkit", "bindings", "java")
|
if which == "datamodel":
|
||||||
ant.append("ant")
|
directory = os.path.join("..", "..", "..", "sleuthkit", "bindings", "java")
|
||||||
ant.append("-f")
|
ant.append("ant")
|
||||||
ant.append(directory)
|
ant.append("-f")
|
||||||
ant.append("clean")
|
ant.append(directory)
|
||||||
if(Build):
|
ant.append("clean")
|
||||||
ant.append("build")
|
if(Build):
|
||||||
else:
|
ant.append("build")
|
||||||
ant.append("dist")
|
else:
|
||||||
antpth = Emailer.make_local_path("..", "ant" + which + "Output.txt")
|
ant.append("dist")
|
||||||
antout = open(antpth, 'a')
|
antpth = make_local_path("..", "ant" + which + "Output.txt")
|
||||||
succd = subprocess.call(ant, stdout=antout)
|
antout = open(antpth, 'a')
|
||||||
antout.close()
|
succd = subprocess.call(ant, stdout=antout)
|
||||||
global errorem
|
antout.close()
|
||||||
global attachl
|
global errorem
|
||||||
if which == "datamodel":
|
global attachl
|
||||||
chk = os.path.join("..", "..", "..","sleuthkit", "bindings", "java", "dist", "TSK_DataModel.jar")
|
if which == "datamodel":
|
||||||
try:
|
chk = os.path.join("..", "..", "..","sleuthkit", "bindings", "java", "dist", "TSK_DataModel.jar")
|
||||||
open(chk)
|
try:
|
||||||
except IOError as e:
|
open(chk)
|
||||||
if(not tryredo):
|
except IOError as e:
|
||||||
errorem += "DataModel Java build failed.\n"
|
if(not tryredo):
|
||||||
attachl.append(antpth)
|
errorem += "DataModel Java build failed.\n"
|
||||||
Emailer.send_email(parsed, errorem, attachl, False)
|
attachl.append(antpth)
|
||||||
passed = False
|
Emailer.send_email(parsed, errorem, attachl, False)
|
||||||
tryredo = True
|
passed = False
|
||||||
elif (succd != 0 and (not tryredo)):
|
tryredo = True
|
||||||
errorem += "Autopsy build failed.\n"
|
elif (succd != 0 and (not tryredo)):
|
||||||
attachl.append(antpth)
|
errorem += "Autopsy build failed.\n"
|
||||||
Emailer.send_email(parsed, errorem, attachl, False)
|
attachl.append(antpth)
|
||||||
tryredo = True
|
Emailer.send_email(parsed, errorem, attachl, False)
|
||||||
elif (succd != 0):
|
tryredo = True
|
||||||
passed = False
|
elif (succd != 0):
|
||||||
|
passed = False
|
||||||
|
|
||||||
def main():
|
|
||||||
errore = ""
|
def main():
|
||||||
attachli = []
|
errore = ""
|
||||||
config_file = ""
|
attachli = []
|
||||||
arg = sys.argv.pop(0)
|
config_file = ""
|
||||||
arg = sys.argv.pop(0)
|
arg = sys.argv.pop(0)
|
||||||
config_file = arg
|
arg = sys.argv.pop(0)
|
||||||
parsedin = parse(config_file)
|
config_file = arg
|
||||||
compile(errore, attachli, parsedin)
|
parsedin = parse(config_file)
|
||||||
|
compile(errore, attachli, parsedin)
|
||||||
class OS:
|
|
||||||
LINUX, MAC, WIN, CYGWIN = range(4)
|
class OS:
|
||||||
if __name__ == "__main__":
|
LINUX, MAC, WIN, CYGWIN = range(4)
|
||||||
global SYS
|
if __name__ == "__main__":
|
||||||
if _platform == "linux" or _platform == "linux2":
|
global SYS
|
||||||
SYS = OS.LINUX
|
if _platform == "linux" or _platform == "linux2":
|
||||||
elif _platform == "darwin":
|
SYS = OS.LINUX
|
||||||
SYS = OS.MAC
|
elif _platform == "darwin":
|
||||||
elif _platform == "win32":
|
SYS = OS.MAC
|
||||||
SYS = OS.WIN
|
elif _platform == "win32":
|
||||||
elif _platform == "cygwin":
|
SYS = OS.WIN
|
||||||
SYS = OS.CYGWIN
|
elif _platform == "cygwin":
|
||||||
|
SYS = OS.CYGWIN
|
||||||
if SYS is OS.WIN or SYS is OS.CYGWIN:
|
|
||||||
main()
|
if SYS is OS.WIN or SYS is OS.CYGWIN:
|
||||||
else:
|
main()
|
||||||
print("We only support Windows and Cygwin at this time.")
|
else:
|
||||||
|
print("We only support Windows and Cygwin at this time.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user