Skip to content
Snippets Groups Projects
Commit 59c13965 authored by rishwanth1995's avatar rishwanth1995
Browse files

appveyor_check

parent 9b6896df
No related branches found
No related tags found
No related merge requests found
version: 4.6.0.{build}
cache:
- C:\Users\appveyor\.ant -> appveyor.yml
- C:\Users\appveyor\.ivy2 -> appveyor.yml
- C:\ProgramData\chocolatey\bin -> appveyor.yml
- C:\ProgramData\chocolatey\lib -> appveyor.yml
branches:
only:
- develop
image: Visual Studio 2015
init:
- ps: choco install ant --ignore-dependencies
- ps: $env:Path="C:\Program Files\Java\jdk1.8.0\bin;$($env:Path);C:\ProgramData\chocolatey\lib\ant"
- set PATH=C:\Python36-x64\';%PATH%
environment:
global:
TSK_HOME: "%APPVEYOR_BUILD_FOLDER%"
LIBVHDI_HOME: "C:\\libvhdi_64bit"
LIBVMDK_HOME: "C:\\libvmdk_64bit\\libvmdk"
LIBEWF_HOME: "C:\\libewf_64bit"
POSTGRESQL_HOME_64: "C:\\Program Files\\PostgreSQL\\9.5"
PYTHON: "C:\\Python36-x64"
services:
- postgresql95;
build_script:
- python setupLibs.py
- python %TSK_HOME%\win32\updateBuildLibs.py -m
- ps: ant -version
- ps: pushd bindings/java
- cmd: ant dist-PostgreSQL
- ps: popd
test: off
# Copyright (c) 2017 Basis Technology.
#
# This software is distributed under the Common Public License 1.0
#
# This script makes the repositories needed to compile The Sleuth Kit and its dependencies.
# To use it, first define the needed environment variables (such as LIBEWF_HOME). This script
# will then clone the git repositories into those locations.
import os
import subprocess
import sys
def setupLibrary(path):
''' sets up the library path variable '''
git_repository_url = "https://github.com/sleuthkit/"
git_zlib_repository_url="https://github.com/madler/"
gitClone(git_zlib_repository_url,"zlib",path["libewf_64bit"])
for library,base_library_path in path.items():
library_path = os.path.normpath(os.path.join(base_library_path , library))
if not os.path.exists(library_path):
gitClone(git_repository_url, library, base_library_path)
def gitClone(URL, repo, path):
cmd = ["git", "clone", URL + repo + ".git" ]
ret = subprocess.call(cmd, stdout=sys.stdout, cwd=path)
if ret != 0:
sys.exit(1)
def main():
#setting the base directory with the help of library env variables.
libewf_home = os.getenv("LIBEWF_HOME")
libvhdi_home = os.getenv("LIBVHDI_HOME")
libvmdk_home = os.getenv("LIBVMDK_HOME")
base_Library_path = {}
if(libewf_home != None):
base_Library_path["libewf_64bit"] = os.path.dirname(libewf_home)
else:
print('Please set the env variable LIBEWF_HOME')
if(libvhdi_home != None):
base_Library_path["libvhdi_64bit"] = os.path.dirname(libvhdi_home)
else:
print('Please set the env variable LIBVHDI_HOME')
if(libvmdk_home != None):
base_Library_path["libvmdk_64bit"] = os.path.dirname(os.path.dirname(libvmdk_home))
else:
print('Please set the env variable LIBVMDK_HOME')
setupLibrary(base_Library_path);
if __name__ == '__main__':
main()
# Copyright (c) 2017 Basis Technology. # Copyright (c) 2017 Basis Technology.
# #
# This software is distributed under the Common Public License 1.0 # This software is distributed under the Common Public License 1.0
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
import shutil import shutil
import subprocess import subprocess
import sys import sys
import getopt
from sys import platform as _platform from sys import platform as _platform
import time import time
...@@ -19,7 +20,8 @@ ...@@ -19,7 +20,8 @@
CURRENT_PATH = os.getcwd() CURRENT_PATH = os.getcwd()
# save the build log in the output directory # save the build log in the output directory
LOG_PATH = os.path.join(CURRENT_PATH, 'output', time.strftime("%Y.%m.%d-%H.%M.%S")) LOG_PATH = os.path.join(CURRENT_PATH, 'output', time.strftime("%Y.%m.%d-%H.%M.%S"))
APPVEYOR = os.getenv("APPVEYOR",False)
MINIMAL = False
def pullAndBuildAllDependencies(branch): def pullAndBuildAllDependencies(branch):
''' '''
Compile libewf, libvhdi, libvmdk. Compile libewf, libvhdi, libvmdk.
...@@ -34,8 +36,7 @@ def pullAndBuildAllDependencies(branch): ...@@ -34,8 +36,7 @@ def pullAndBuildAllDependencies(branch):
# get the LIBEWF_HOME, LIBVHDI_HOME, LIBVMDH_HOME # get the LIBEWF_HOME, LIBVHDI_HOME, LIBVMDH_HOME
ewfHome = os.getenv("LIBEWF_HOME", "C:\\libewf_64bit") ewfHome = os.getenv("LIBEWF_HOME", "C:\\libewf_64bit")
vhdiHome = os.getenv("LIBVHDI_HOME", "C:\\libvhdi_64bit") vhdiHome = os.getenv("LIBVHDI_HOME", "C:\\libvhdi_64bit")
vmdkHome = os.getenv("LIBVMDK_HOME", "C:\\libvmdk_64bit") vmdkHome = os.getenv("LIBVMDK_HOME", "C:\\libvmdk_64bit\\libvmdk")
# check if ewfHome, vhdiHome or vmdhHome exits # check if ewfHome, vhdiHome or vmdhHome exits
checkPathExist(ewfHome) checkPathExist(ewfHome)
checkPathExist(vhdiHome) checkPathExist(vhdiHome)
...@@ -48,36 +49,40 @@ def pullAndBuildAllDependencies(branch): ...@@ -48,36 +49,40 @@ def pullAndBuildAllDependencies(branch):
if(passed): if(passed):
gitPull(vmdkHome, "libvmdk_64bit", branch) gitPull(vmdkHome, "libvmdk_64bit", branch)
# build 32-bit of libewf, libvhdi, libvmdk and TSK if not MINIMAL:
if(passed): # build 32-bit of libewf, libvhdi, libvmdk and TSK
buildDependentLibs(ewfHome, 32, "libewf") if(passed):
if(passed): buildDependentLibs(ewfHome, 32, "libewf")
buildDependentLibs(vhdiHome, 32, "libvhdi") if(passed):
if(passed): buildDependentLibs(vhdiHome, 32, "libvhdi")
buildDependentLibs(vmdkHome, 32, "libvmdk") if(passed):
buildDependentLibs(vmdkHome, 32, "libvmdk")
# build 64-bit of libewf, libvhdi, libvmdk and TSK # build 64-bit of libewf, libvhdi, libvmdk and TSK
if(passed): if(passed):
buildDependentLibs(ewfHome, 64, "libewf") buildDependentLibs(ewfHome, 64, "libewf")
if(passed): if(passed):
buildDependentLibs(vhdiHome, 64, "libvhdi") buildDependentLibs(vhdiHome, 64, "libvhdi")
if(passed): if(passed):
buildDependentLibs(vmdkHome, 64, "libvmdk") buildDependentLibs(vmdkHome, 64, "libvmdk")
def buildTSKAll(): def buildTSKAll():
if(passed):
buildTSK(32, "Release")
if(passed):
buildTSK(32, "Release_NoLibs")
if(passed):
buildTSK(32, "Release_PostgreSQL")
if(passed): if not MINIMAL:
buildTSK(64, "Release") if(passed):
if(passed): buildTSK(32, "Release")
buildTSK(64, "Release_NoLibs") if(passed):
buildTSK(32, "Release_NoLibs")
if(passed):
buildTSK(32, "Release_PostgreSQL")
if(passed):
buildTSK(64, "Release")
if(passed):
buildTSK(64, "Release_NoLibs")
if(passed): if(passed):
buildTSK(64, "Release_PostgreSQL") buildTSK(64, "Release_PostgreSQL")
...@@ -143,7 +148,7 @@ def buildDependentLibs(libHome, wPlatform, targetDll): ...@@ -143,7 +148,7 @@ def buildDependentLibs(libHome, wPlatform, targetDll):
''' '''
global passed global passed
passed = True passed = True
print("Building " + str(wPlatform) + "-bit " + targetDll) print("Building " + str(wPlatform) + "-bit " + targetDll)
sys.stdout.flush() sys.stdout.flush()
...@@ -151,8 +156,8 @@ def buildDependentLibs(libHome, wPlatform, targetDll): ...@@ -151,8 +156,8 @@ def buildDependentLibs(libHome, wPlatform, targetDll):
if wPlatform == 64: if wPlatform == 64:
dllFile = os.path.join(libHome, "msvscpp", "x64", target, targetDll +".dll") dllFile = os.path.join(libHome, "msvscpp", "x64", target, targetDll +".dll")
elif wPlatform == 32: elif wPlatform == 32:
dllFile = os.path.join(libHome, "msvscpp", target, targetDll +".dll") dllFile = os.path.join(libHome,"msvscpp",target,targetDll + ".dll")
else: else:
print("Invalid platform") print("Invalid platform")
sys.stdout.flush() sys.stdout.flush()
...@@ -161,8 +166,7 @@ def buildDependentLibs(libHome, wPlatform, targetDll): ...@@ -161,8 +166,7 @@ def buildDependentLibs(libHome, wPlatform, targetDll):
if (os.path.isfile(dllFile)): if (os.path.isfile(dllFile)):
os.remove(dllFile) os.remove(dllFile)
os.chdir(os.path.join(libHome,"msvscpp"))
os.chdir(os.path.join(libHome, "msvscpp"))
vs = [] vs = []
vs.append(MSBUILD_PATH) vs.append(MSBUILD_PATH)
...@@ -172,12 +176,13 @@ def buildDependentLibs(libHome, wPlatform, targetDll): ...@@ -172,12 +176,13 @@ def buildDependentLibs(libHome, wPlatform, targetDll):
vs.append("/p:platform=x64") vs.append("/p:platform=x64")
elif wPlatform == 32: elif wPlatform == 32:
vs.append("/p:platform=Win32") vs.append("/p:platform=Win32")
vs.append("/v:quiet")
vs.append("/t:clean") vs.append("/t:clean")
vs.append("/t:build") vs.append("/t:build")
outputFile = os.path.join(LOG_PATH, targetDll + "Output.txt") outputFile = os.path.join(LOG_PATH, targetDll + "Output.txt")
VSout = open(outputFile, 'w') VSout = open(outputFile, 'w')
ret = subprocess.call(vs, stdout=VSout) ret = subprocess.call(vs, stdout=sys.stdout)
errorCode = ret errorCode = ret
VSout.close() VSout.close()
if ret > 0: if ret > 0:
...@@ -187,16 +192,16 @@ def buildDependentLibs(libHome, wPlatform, targetDll): ...@@ -187,16 +192,16 @@ def buildDependentLibs(libHome, wPlatform, targetDll):
errorCode = 0 errorCode = 0
if errorCode != 0 or not os.path.exists(dllFile) or os.path.getctime(dllFile) < (time.time() - 2 * 60): # the new dll should not be 2 mins old if errorCode != 0 or not os.path.exists(dllFile) or os.path.getctime(dllFile) < (time.time() - 2 * 60): # the new dll should not be 2 mins old
print(targetDll + " " + str(wPlatform) + "-bit C++ failed to build.\n") print(targetDll + " " + str(wPlatform) + "-bit C++ failed to build.\n")
print("return code: " + str(ret) + "\tdll file: " + dllFile + "\tcreated time: " + str(os.path.getctime(dllFile))) print("return code: " + str(ret) + "\tdll file: " + dllFile + "\tcreated time: " + str(os.path.getctime(dllFile)))
sys.stdout.flush() sys.stdout.flush()
passed = False passed = False
os.chdir(CURRENT_PATH) os.chdir(CURRENT_PATH)
return return
else: else:
print("Build " + str(wPlatform) + "-bit " + targetDll + " successfully") print("Build " + str(wPlatform) + "-bit " + targetDll + " successfully")
os.chdir(CURRENT_PATH) os.chdir(CURRENT_PATH)
def buildTSK(wPlatform, target): def buildTSK(wPlatform, target):
''' '''
Build C++ sleuthkit library Build C++ sleuthkit library
...@@ -205,6 +210,8 @@ def buildTSK(wPlatform, target): ...@@ -205,6 +210,8 @@ def buildTSK(wPlatform, target):
print ("Building TSK " + str(wPlatform) + "-bit " + target + " build.") print ("Building TSK " + str(wPlatform) + "-bit " + target + " build.")
sys.stdout.flush() sys.stdout.flush()
if(APPVEYOR):
os.chdir(os.path.join(os.getenv("TSK_HOME"),"win32"))
vs = [] vs = []
vs.append(MSBUILD_PATH) vs.append(MSBUILD_PATH)
...@@ -219,12 +226,13 @@ def buildTSK(wPlatform, target): ...@@ -219,12 +226,13 @@ def buildTSK(wPlatform, target):
sys.stdout.flush() sys.stdout.flush()
passed = False passed = False
return return
vs.append("/v:quiet")
vs.append("/t:clean") vs.append("/t:clean")
vs.append("/t:build") vs.append("/t:build")
outputFile = os.path.join(LOG_PATH, "TSKOutput.txt") outputFile = os.path.join(LOG_PATH, "TSKOutput.txt")
VSout = open(outputFile, 'w') VSout = open(outputFile, 'w')
ret = subprocess.call(vs, stdout=VSout) ret = subprocess.call(vs, stdout=sys.stdout)
VSout.close() VSout.close()
if ret != 0: if ret != 0:
print("ret = " + str(ret)) print("ret = " + str(ret))
...@@ -239,25 +247,38 @@ def usage(): ...@@ -239,25 +247,38 @@ def usage():
''' '''
Print out how to use this script. Print out how to use this script.
''' '''
print('Usage: python3 updataBuildlibs.py [branch]') print('Usage: python3 updataBuildlibs.py [[-h | --help, -b <branch> | --branch=<branch>, -m | --minimal]')
print('branch is which branch to build and is optional. Currently only works for master') print('branch is which branch to build and is optional. Currently only works for master')
print('-m,--minimal use this option for postgres build')
sys.stdout.flush() sys.stdout.flush()
sys.exit(1) sys.exit(1)
def main(): def main():
#by default we use master branch to update the source #by default we use master branch to update the source
branch = 'master' branch = 'master'
global MINIMAL
if len(sys.argv) == 2: #keep this parameter here for the future we may let user use different branch to update source try:
branch = sys.argv[1] opts, args = getopt.getopt(sys.argv[1:],"mhb:",['help','minimal','branch='])
elif len(sys.argv) > 2: except getopt.GetoptError as err:
print('Wrong arguments.') print(err)
usage() usage()
sys.exit(2)
for o,a in opts:
if o in ("-m","--minimal"):
MINIMAL = True
elif o in ("-b","--branch"):
branch = a
elif o in ("-h","--help"):
usage()
system.exit(2)
print('Updating source by %s branch.' % branch) print('Updating source by %s branch.' % branch)
if not os.path.exists(LOG_PATH): if not os.path.exists(LOG_PATH):
os.makedirs(LOG_PATH) os.makedirs(LOG_PATH)
if not os.path.exists(MSBUILD_PATH):
print("MS_BUILD Does not exist")
sys.stdout.flush()
pullAndBuildAllDependencies(branch) pullAndBuildAllDependencies(branch)
buildTSKAll() buildTSKAll()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment