mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-09 14:49:32 +00:00
Update release script and ant target
This commit is contained in:
parent
cd00782f44
commit
84e3110bae
9
.gitignore
vendored
9
.gitignore
vendored
@ -26,8 +26,9 @@ genfiles.properties
|
|||||||
*~
|
*~
|
||||||
/netbeans-plat
|
/netbeans-plat
|
||||||
/docs/doxygen/doxygen_docs
|
/docs/doxygen/doxygen_docs
|
||||||
/thirdparty/jdiff/v-custom/javadocs/*
|
/jdiff-javadocs/*
|
||||||
/thirdparty/jdiff/v-custom/xml/*
|
/jdiff-xml/*
|
||||||
/thirdparty/jdiff/v-custom/autopsy/*
|
/jdiff-logs/*
|
||||||
/thirdparty/jdiff/v-custom/logs/*
|
/autopsy-update_versions/*
|
||||||
|
/gen_version.txt
|
||||||
|
|
||||||
|
15
build.xml
15
build.xml
@ -205,18 +205,21 @@
|
|||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="release-script">
|
<target name="release-script">
|
||||||
|
<echo>** build type: ${build.type}</echo>
|
||||||
|
<echo>** update_versions = ${update_versions}</echo>
|
||||||
<if>
|
<if>
|
||||||
|
<and>
|
||||||
<equals arg1="${build.type}" arg2="RELEASE"/>
|
<equals arg1="${build.type}" arg2="RELEASE"/>
|
||||||
|
<equals arg1="${update_versions}" arg2="true"/>
|
||||||
|
</and>
|
||||||
<then>
|
<then>
|
||||||
<echo>Running script for release: ${build.type}</echo>
|
<exec dir="${basedir}" executable="python" failonerror="true" resultproperty="App.state">
|
||||||
<exec dir="${thirdparty.dir}/jdiff/v-custom" executable="python">
|
<arg line="update_versions.py -a" />
|
||||||
<arg line="release.py -a" />
|
|
||||||
</exec>
|
</exec>
|
||||||
</then>
|
</then>
|
||||||
<else>
|
<else>
|
||||||
<echo>Running script for development: ${build.type}</echo>
|
<exec dir="${basedir}" executable="python" failonerror="true" resultproperty="App.state">
|
||||||
<exec dir="${thirdparty.dir}/jdiff/v-custom" executable="python">
|
<arg value="update_versions.py" />
|
||||||
<arg value="release.py" />
|
|
||||||
</exec>
|
</exec>
|
||||||
</else>
|
</else>
|
||||||
</if>
|
</if>
|
||||||
|
@ -9,6 +9,7 @@ app.name=autopsy
|
|||||||
### Must be one of: DEVELOPMENT, RELEASE
|
### Must be one of: DEVELOPMENT, RELEASE
|
||||||
#build.type=RELEASE
|
#build.type=RELEASE
|
||||||
build.type=DEVELOPMENT
|
build.type=DEVELOPMENT
|
||||||
|
update_versions=false
|
||||||
auxiliary.org-netbeans-modules-apisupport-installer.license-type=apache.v2
|
auxiliary.org-netbeans-modules-apisupport-installer.license-type=apache.v2
|
||||||
auxiliary.org-netbeans-modules-apisupport-installer.os-linux=false
|
auxiliary.org-netbeans-modules-apisupport-installer.os-linux=false
|
||||||
auxiliary.org-netbeans-modules-apisupport-installer.os-macosx=false
|
auxiliary.org-netbeans-modules-apisupport-installer.os-macosx=false
|
||||||
|
@ -1,3 +1,29 @@
|
|||||||
|
# ============================================================
|
||||||
|
# update_versions.py
|
||||||
|
# ============================================================
|
||||||
|
#
|
||||||
|
# When run from the Autopsy build script, this script will:
|
||||||
|
# - Clone Autopsy and checkout to the previous release tag
|
||||||
|
# as found in the NEWS.txt file
|
||||||
|
# - Auto-discover all modules and packages
|
||||||
|
# - Run jdiff, comparing the current and previous modules
|
||||||
|
# - Use jdiff's output to determine if each module
|
||||||
|
# a) has no changes
|
||||||
|
# b) has backwards compatible changes
|
||||||
|
# c) has backwards incompatible changes
|
||||||
|
# - Based off it's compatibility, updates each module's
|
||||||
|
# a) Major version
|
||||||
|
# b) Specification version
|
||||||
|
# c) Implementation version
|
||||||
|
# - Updates the dependencies on each module depending on the
|
||||||
|
# updated version numbers
|
||||||
|
#
|
||||||
|
# Optionally, when run from the command line, one can provide the
|
||||||
|
# desired tag to compare the current version to, the directory for
|
||||||
|
# the current version of Autopsy, and whether to automatically
|
||||||
|
# update the version numbers and dependencies.
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -112,24 +138,25 @@ class Spec:
|
|||||||
# return code 1 = error in jdiff
|
# return code 1 = error in jdiff
|
||||||
# return code 100 = no changes
|
# return code 100 = no changes
|
||||||
# return code 101 = compatible changes
|
# return code 101 = compatible changes
|
||||||
# return code 102 = un-compatible changes
|
# return code 102 = incompatible changes
|
||||||
def compare_xml(module, apiname_tag, apiname_cur):
|
def compare_xml(module, apiname_tag, apiname_cur):
|
||||||
global docdir
|
global docdir
|
||||||
make_dir(docdir)
|
make_dir(docdir)
|
||||||
null_file = fix_path("lib/Null.java")
|
null_file = fix_path(os.path.abspath("./thirdparty/jdiff/v-custom/lib/Null.java"))
|
||||||
oldapi = fix_path("xml/" + apiname_tag + "-" + module.name)
|
jdiff = fix_path(os.path.abspath("./thirdparty/jdiff/v-custom/jdiff.jar"))
|
||||||
newapi = fix_path("xml/" + apiname_cur + "-" + module.name)
|
oldapi = fix_path("jdiff-xml/" + apiname_tag + "-" + module.name)
|
||||||
|
newapi = fix_path("jdiff-xml/" + apiname_cur + "-" + module.name)
|
||||||
docs = fix_path(docdir + "/" + module.name)
|
docs = fix_path(docdir + "/" + module.name)
|
||||||
comments = fix_path(docs + "/user_comments_for_xml")
|
comments = fix_path(docs + "/user_comments_for_jdiff-xml")
|
||||||
tag_comments = fix_path(comments + "/" + apiname_tag + "-" + module.name + "_to_xml")
|
tag_comments = fix_path(comments + "/" + apiname_tag + "-" + module.name + "_to_jdiff-xml")
|
||||||
make_dir(docs)
|
make_dir(docs)
|
||||||
make_dir(comments)
|
make_dir(comments)
|
||||||
make_dir(tag_comments)
|
make_dir(tag_comments)
|
||||||
make_dir("logs")
|
make_dir("jdiff-logs")
|
||||||
log = open("logs/COMPARE-" + module.name + ".log", "w")
|
log = open("jdiff-logs/COMPARE-" + module.name + ".log", "w")
|
||||||
cmd = ["javadoc",
|
cmd = ["javadoc",
|
||||||
"-doclet", "jdiff.JDiff",
|
"-doclet", "jdiff.JDiff",
|
||||||
"-docletpath", "jdiff.jar",
|
"-docletpath", jdiff,
|
||||||
"-d", docs,
|
"-d", docs,
|
||||||
"-oldapi", oldapi,
|
"-oldapi", oldapi,
|
||||||
"-newapi", newapi,
|
"-newapi", newapi,
|
||||||
@ -162,14 +189,15 @@ def gen_xml(path, modules, name):
|
|||||||
src = os.path.join(path, module.name, "test", "qa-functional", "src")
|
src = os.path.join(path, module.name, "test", "qa-functional", "src")
|
||||||
else:
|
else:
|
||||||
src = os.path.join(path, module.name, "src")
|
src = os.path.join(path, module.name, "src")
|
||||||
xerces = os.path.abspath("./lib/xerces.jar")
|
# xerces = os.path.abspath("./lib/xerces.jar")
|
||||||
xml_out = fix_path(os.path.abspath("./xml/" + name + "-" + module.name))
|
xml_out = fix_path(os.path.abspath("./jdiff-xml/" + name + "-" + module.name))
|
||||||
make_dir("xml")
|
jdiff = fix_path(os.path.abspath("./thirdparty/jdiff/v-custom/jdiff.jar"))
|
||||||
make_dir("logs")
|
make_dir("jdiff-xml")
|
||||||
log = open("logs/GEN_XML-" + name + "-" + module.name + ".log", "w")
|
make_dir("jdiff-logs")
|
||||||
|
log = open("jdiff-logs/GEN_XML-" + name + "-" + module.name + ".log", "w")
|
||||||
cmd = ["javadoc",
|
cmd = ["javadoc",
|
||||||
"-doclet", "jdiff.JDiff",
|
"-doclet", "jdiff.JDiff",
|
||||||
"-docletpath", "jdiff.jar", # ;" + xerces, <-- previous problems required this
|
"-docletpath", jdiff, # ;" + xerces, <-- previous problems required this
|
||||||
"-apiname", xml_out, # leaving it in just in case it's needed once again
|
"-apiname", xml_out, # leaving it in just in case it's needed once again
|
||||||
"-sourcepath", fix_path(src)]
|
"-sourcepath", fix_path(src)]
|
||||||
cmd = cmd + get_packages(src)
|
cmd = cmd + get_packages(src)
|
||||||
@ -536,49 +564,59 @@ def replace(file, pattern, subst):
|
|||||||
|
|
||||||
# Given a list of modules print the version numbers that need changing
|
# Given a list of modules print the version numbers that need changing
|
||||||
def print_version_updates(modules):
|
def print_version_updates(modules):
|
||||||
|
f = open("gen_version.txt", "a")
|
||||||
for module in modules:
|
for module in modules:
|
||||||
versions = module.versions
|
versions = module.versions
|
||||||
if module.ret == 101:
|
if module.ret == 101:
|
||||||
print(module.name + ":")
|
output = (module.name + ":\n")
|
||||||
print(" Current Specification version:\t" + str(versions[0]))
|
output += (" Current Specification version:\t" + str(versions[0]) + "\n")
|
||||||
print(" Updated Specification version:\t" + str(versions[0].increment()))
|
output += (" Updated Specification version:\t" + str(versions[0].increment()) + "\n")
|
||||||
print("")
|
output += ("\n")
|
||||||
print(" Current Implementation version:\t" + str(versions[1]))
|
output += (" Current Implementation version:\t" + str(versions[1]) + "\n")
|
||||||
print(" Updated Implementation version:\t" + str(versions[1] + 1))
|
output += (" Updated Implementation version:\t" + str(versions[1] + 1) + "\n")
|
||||||
print("")
|
output += ("\n")
|
||||||
|
print(output)
|
||||||
|
f.write(output)
|
||||||
elif module.ret == 102:
|
elif module.ret == 102:
|
||||||
print(module.name + ":")
|
output = (module.name + ":\n")
|
||||||
print(" Current Specification version:\t" + str(versions[0]))
|
output += (" Current Specification version:\t" + str(versions[0]) + "\n")
|
||||||
print(" Updated Specification version:\t" + str(versions[0].overflow()))
|
output += (" Updated Specification version:\t" + str(versions[0].overflow()) + "\n")
|
||||||
print("")
|
output += ("\n")
|
||||||
print(" Current Implementation version:\t" + str(versions[1]))
|
output += (" Current Implementation version:\t" + str(versions[1]) + "\n")
|
||||||
print(" Updated Implementation version:\t" + str(versions[1] + 1))
|
output += (" Updated Implementation version:\t" + str(versions[1] + 1) + "\n")
|
||||||
print("")
|
output += ("\n")
|
||||||
print(" Current Release version:\t\t" + str(versions[2]))
|
output += (" Current Release version:\t\t" + str(versions[2]) + "\n")
|
||||||
print(" Updated Release version:\t\t" + str(versions[2] + 1))
|
output += (" Updated Release version:\t\t" + str(versions[2] + 1) + "\n")
|
||||||
print("")
|
output += ("\n")
|
||||||
|
print(output)
|
||||||
|
f.write(output)
|
||||||
elif module.ret == 1:
|
elif module.ret == 1:
|
||||||
print(module.name + ":")
|
output = (module.name + ":\n")
|
||||||
print(" *Unable to detect necessary changes")
|
output += (" *Unable to detect necessary changes\n")
|
||||||
print(" Current Specification version:\t" + str(versions[0]))
|
output += (" Current Specification version:\t" + str(versions[0]) + "\n")
|
||||||
print(" Current Implementation version:\t" + str(versions[1]))
|
output += (" Current Implementation version:\t" + str(versions[1]) + "\n")
|
||||||
print(" Current Release version:\t\t" + str(versions[2]))
|
output += (" Current Release version:\t\t" + str(versions[2]) + "\n")
|
||||||
print("")
|
output += ("\n")
|
||||||
|
print(output)
|
||||||
|
f.write(output)
|
||||||
elif module.ret is None:
|
elif module.ret is None:
|
||||||
print("Added " + module.name + ":")
|
output = ("Added " + module.name + ":\n")
|
||||||
if module.spec() != "1.0" and module.spec() != "0.0":
|
if module.spec() != "1.0" and module.spec() != "0.0":
|
||||||
print(" Current Specification version:\t" + str(module.spec()))
|
output += (" Current Specification version:\t" + str(module.spec()) + "\n")
|
||||||
print(" Updated Specification version:\t1.0")
|
output += (" Updated Specification version:\t1.0\n")
|
||||||
print("")
|
output += ("\n")
|
||||||
if module.impl() != 1:
|
if module.impl() != 1:
|
||||||
print(" Current Implementation version:\t" + str(module.impl()))
|
output += (" Current Implementation version:\t" + str(module.impl()) + "\n")
|
||||||
print(" Updated Implementation version:\t1")
|
output += (" Updated Implementation version:\t1\n")
|
||||||
print("")
|
output += ("\n")
|
||||||
if module.release() != 1 and module.release() != 0:
|
if module.release() != 1 and module.release() != 0:
|
||||||
print(" Current Release version:\t\t" + str(module.release()))
|
output += (" Current Release version:\t\t" + str(module.release()) + "\n")
|
||||||
print(" Updated Release version:\t\t1")
|
output += (" Updated Release version:\t\t1\n")
|
||||||
print("")
|
output += ("\n")
|
||||||
|
print(output)
|
||||||
|
f.write(output)
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
f.close()
|
||||||
|
|
||||||
# Changes cygwin paths to Windows
|
# Changes cygwin paths to Windows
|
||||||
def fix_path(path):
|
def fix_path(path):
|
||||||
@ -642,7 +680,7 @@ def del_dir(dir):
|
|||||||
def do_git(tag, tag_dir):
|
def do_git(tag, tag_dir):
|
||||||
try:
|
try:
|
||||||
printt("Cloning Autopsy (this could take a while)...")
|
printt("Cloning Autopsy (this could take a while)...")
|
||||||
subprocess.call(["git", "clone", "https://github.com/sleuthkit/autopsy.git"],
|
subprocess.call(["git", "clone", "https://github.com/sleuthkit/autopsy.git", tag_dir],
|
||||||
stdout=subprocess.PIPE)
|
stdout=subprocess.PIPE)
|
||||||
printt("Checking out tag " + tag + "...")
|
printt("Checking out tag " + tag + "...")
|
||||||
subprocess.call(["git", "checkout", tag],
|
subprocess.call(["git", "checkout", tag],
|
||||||
@ -687,13 +725,13 @@ def printinfo():
|
|||||||
global dry
|
global dry
|
||||||
printt("Release script information:")
|
printt("Release script information:")
|
||||||
if source is None:
|
if source is None:
|
||||||
source = fix_path(os.path.abspath('../../..'))
|
source = fix_path(os.path.abspath("."))
|
||||||
print("Using source directory:\n " + source)
|
print("Using source directory:\n " + source)
|
||||||
if tag is None:
|
if tag is None:
|
||||||
tag = get_tag(source)
|
tag = get_tag(source)
|
||||||
print("Checking out to tag:\n " + tag)
|
print("Checking out to tag:\n " + tag)
|
||||||
if docdir is None:
|
if docdir is None:
|
||||||
docdir = fix_path(os.path.abspath("./javadocs"))
|
docdir = fix_path(os.path.abspath("./jdiff-javadocs"))
|
||||||
print("Generating jdiff JavaDocs in:\n " + docdir)
|
print("Generating jdiff JavaDocs in:\n " + docdir)
|
||||||
if dry is True:
|
if dry is True:
|
||||||
print("Dry run: will not auto-update version numbers")
|
print("Dry run: will not auto-update version numbers")
|
||||||
@ -717,6 +755,8 @@ def usage():
|
|||||||
-d --dir The output directory for the jdiff JavaDocs. If no
|
-d --dir The output directory for the jdiff JavaDocs. If no
|
||||||
directory is given, the default is /javadocs/{module}.
|
directory is given, the default is /javadocs/{module}.
|
||||||
|
|
||||||
|
-s --source The directory containing Autopsy's source code.
|
||||||
|
|
||||||
-a --auto Automatically update version numbers (not dry).
|
-a --auto Automatically update version numbers (not dry).
|
||||||
|
|
||||||
-h --help Prints this usage.
|
-h --help Prints this usage.
|
||||||
@ -734,7 +774,7 @@ def main():
|
|||||||
ret = args()
|
ret = args()
|
||||||
if ret:
|
if ret:
|
||||||
print(usage())
|
print(usage())
|
||||||
return
|
return 0
|
||||||
printinfo()
|
printinfo()
|
||||||
|
|
||||||
# -----------------------------------------------
|
# -----------------------------------------------
|
||||||
@ -742,10 +782,10 @@ def main():
|
|||||||
# 2) Get the modules in the clone and the source
|
# 2) Get the modules in the clone and the source
|
||||||
# 3) Generate the xml comparison
|
# 3) Generate the xml comparison
|
||||||
# -----------------------------------------------
|
# -----------------------------------------------
|
||||||
del_dir("autopsy")
|
del_dir("autopsy-update_versions")
|
||||||
tag_dir = os.path.abspath("./autopsy")
|
tag_dir = os.path.abspath("./autopsy-update_versions")
|
||||||
if not do_git(tag, tag_dir):
|
if not do_git(tag, tag_dir):
|
||||||
return
|
return 1
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
tag_modules = find_modules(tag_dir)
|
tag_modules = find_modules(tag_dir)
|
||||||
@ -806,12 +846,12 @@ def main():
|
|||||||
update_dependencies(the_modules, source)
|
update_dependencies(the_modules, source)
|
||||||
|
|
||||||
printt("Deleting jdiff XML...")
|
printt("Deleting jdiff XML...")
|
||||||
xml_dir = os.path.abspath("./xml")
|
xml_dir = os.path.abspath("./jdiff-xml")
|
||||||
print("XML successfully deleted" if del_dir(xml_dir) else "Failed to delete XML")
|
print("XML successfully deleted" if del_dir(xml_dir) else "Failed to delete XML")
|
||||||
|
|
||||||
print("\n--- Script completed successfully ---")
|
print("\n--- Script completed successfully ---")
|
||||||
return 1
|
return 0
|
||||||
|
|
||||||
# Start off the script
|
# Start off the script
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
sys.exit(main())
|
Loading…
x
Reference in New Issue
Block a user