mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 10:17:41 +00:00
changed algorithm for sleuthkit branches
This commit is contained in:
parent
c1e8df66d5
commit
496875b8d5
@ -9,13 +9,38 @@ import xml.etree.ElementTree as ET
|
|||||||
TSK_HOME=os.getenv("TSK_HOME",False)
|
TSK_HOME=os.getenv("TSK_HOME",False)
|
||||||
passed = 1
|
passed = 1
|
||||||
|
|
||||||
|
def getSleuthkitBranchList():
|
||||||
|
# Returns the list of sleuthkit branches
|
||||||
|
cmd = ['git','branch','-a']
|
||||||
|
retdir = os.getcwd()
|
||||||
|
os.chdir(TSK_HOME)
|
||||||
|
output = subprocess.check_output(cmd)
|
||||||
|
branches = []
|
||||||
|
for branch in output.strip().split():
|
||||||
|
if branch.startswith('remotes/origin'):
|
||||||
|
branches.append(branch.split('/')[2])
|
||||||
|
os.chdir(retdir)
|
||||||
|
return branches
|
||||||
|
|
||||||
def gitSleuthkitCheckout(branch):
|
def gitSleuthkitCheckout(branch):
|
||||||
|
'''
|
||||||
|
Checksout sleuthkit branch
|
||||||
|
Args:
|
||||||
|
branch: String, which branch to checkout
|
||||||
|
'''
|
||||||
|
# passed is a global variable that gets set to non-zero integer
|
||||||
|
# When an error occurs
|
||||||
global passed
|
global passed
|
||||||
cmd = ['git','checkout',branch]
|
cmd = ['git','checkout',branch]
|
||||||
passed = subprocess.call(cmd,stdout=sys.stdout,cwd=TSK_HOME)
|
passed = subprocess.call(cmd,stdout=sys.stdout,cwd=TSK_HOME)
|
||||||
|
|
||||||
def parseXML(xmlFile):
|
def parseXML(xmlFile):
|
||||||
tree = ET.parse('TSKVersion.xml')
|
'''
|
||||||
|
parses the TSKVersion.xml file for sleuthkit version
|
||||||
|
Args:
|
||||||
|
xmlFile: String, xml file to parse
|
||||||
|
'''
|
||||||
|
tree = ET.parse(xmlFile)
|
||||||
root = tree.getroot()
|
root = tree.getroot()
|
||||||
for child in root:
|
for child in root:
|
||||||
if child.attrib['name']=='TSK_VERSION':
|
if child.attrib['name']=='TSK_VERSION':
|
||||||
@ -39,13 +64,13 @@ def main():
|
|||||||
cmd=['git','rev-parse','--abbrev-ref','HEAD']
|
cmd=['git','rev-parse','--abbrev-ref','HEAD']
|
||||||
output = subprocess.check_output(cmd)
|
output = subprocess.check_output(cmd)
|
||||||
CURRENT_BRANCH=output.strip()
|
CURRENT_BRANCH=output.strip()
|
||||||
|
#check if sleuthkit has release branch
|
||||||
if CURRENT_BRANCH.startswith('custom-'):
|
if CURRENT_BRANCH.startswith('release'):
|
||||||
gitSleuthkitCheckout(CURRENT_BRANCH)
|
|
||||||
else:
|
|
||||||
version = parseXML('TSKVersion.xml')
|
version = parseXML('TSKVersion.xml')
|
||||||
RELEASE_BRANCH = "release-"+version
|
RELEASE_BRANCH = "release-"+version
|
||||||
gitSleuthkitCheckout(RELEASE_BRANCH)
|
gitSleuthkitCheckout(RELEASE_BRANCH)
|
||||||
|
elif CURRENT_BRANCH in getSleuthkitBranchList(): # check sleuthkit has same branch as autopsy
|
||||||
|
gitSleuthkitCheckout(CURRENT_BRANCH)
|
||||||
|
|
||||||
if passed != 0:
|
if passed != 0:
|
||||||
gitSleuthkitCheckout('develop')
|
gitSleuthkitCheckout('develop')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user