Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Autopsy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IRT
Autopsy
Commits
f0dd4f56
Commit
f0dd4f56
authored
11 years ago
by
Jeff Wallace
Browse files
Options
Downloads
Patches
Plain Diff
Updated output formatting and added return value enumeration.
parent
02984502
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
update_versions.py
+34
-39
34 additions, 39 deletions
update_versions.py
with
34 additions
and
39 deletions
update_versions.py
+
34
−
39
View file @
f0dd4f56
...
@@ -23,9 +23,9 @@
...
@@ -23,9 +23,9 @@
#
#
# http://wiki.sleuthkit.org/index.php?title=Autopsy_3_Module_Versions
# http://wiki.sleuthkit.org/index.php?title=Autopsy_3_Module_Versions
#
#
# The basic idea is that this script uses javadoc/jdiff to
# The basic idea is that this script uses javadoc/jdiff to
# compare the current state of the source code to the last
# compare the current state of the source code to the last
# tag and identifies if APIs were removed, added, etc.
# tag and identifies if APIs were removed, added, etc.
#
#
# When run from the Autopsy build script, this script will:
# When run from the Autopsy build script, this script will:
# - Clone Autopsy and checkout to the previous release tag
# - Clone Autopsy and checkout to the previous release tag
...
@@ -61,6 +61,12 @@
...
@@ -61,6 +61,12 @@
from
tempfile
import
mkstemp
from
tempfile
import
mkstemp
from
xml.dom.minidom
import
parse
,
parseString
from
xml.dom.minidom
import
parse
,
parseString
# Jdiff return codes. Described in more detail further on
NO_CHANGES
=
100
COMPATIBLE
=
101
NON_COMPATIBLE
=
102
ERROR
=
1
# An Autopsy module object
# An Autopsy module object
class
Module
:
class
Module
:
# Initialize it with a name, return code, and version numbers
# Initialize it with a name, return code, and version numbers
...
@@ -218,11 +224,11 @@ def compare_xml(module, apiname_tag, apiname_cur):
...
@@ -218,11 +224,11 @@ def compare_xml(module, apiname_tag, apiname_cur):
log
.
close
()
log
.
close
()
code
=
jdiff
.
returncode
code
=
jdiff
.
returncode
print
(
"
Compared XML for
"
+
module
.
name
)
print
(
"
Compared XML for
"
+
module
.
name
)
if
code
==
100
:
if
code
==
NO_CHANGES
:
print
(
"
No API changes
"
)
print
(
"
No API changes
"
)
elif
code
==
101
:
elif
code
==
COMPATIBLE
:
print
(
"
API Changes are backwards compatible
"
)
print
(
"
API Changes are backwards compatible
"
)
elif
code
==
102
:
elif
code
==
NON_COMPATIBLE
:
print
(
"
API Changes are not backwards compatible
"
)
print
(
"
API Changes are not backwards compatible
"
)
else
:
else
:
print
(
"
*Error in XML, most likely an empty module
"
)
print
(
"
*Error in XML, most likely an empty module
"
)
...
@@ -564,18 +570,18 @@ def update_versions(modules, source):
...
@@ -564,18 +570,18 @@ def update_versions(modules, source):
if
manifest
==
None
or
project
==
None
:
if
manifest
==
None
or
project
==
None
:
print
(
"
Error finding manifeset and project properties files
"
)
print
(
"
Error finding manifeset and project properties files
"
)
return
return
if
module
.
ret
==
101
:
if
module
.
ret
==
COMPATIBLE
:
versions
=
[
versions
[
0
].
set
(
versions
[
0
].
increment
()),
versions
[
1
]
+
1
,
versions
[
2
]]
versions
=
[
versions
[
0
].
set
(
versions
[
0
].
increment
()),
versions
[
1
]
+
1
,
versions
[
2
]]
set_specification
(
project
,
manifest
,
versions
[
0
])
set_specification
(
project
,
manifest
,
versions
[
0
])
set_implementation
(
manifest
,
versions
[
1
])
set_implementation
(
manifest
,
versions
[
1
])
module
.
set_versions
(
versions
)
module
.
set_versions
(
versions
)
elif
module
.
ret
==
102
:
elif
module
.
ret
==
NON_COMPATIBLE
:
versions
=
[
versions
[
0
].
set
(
versions
[
0
].
overflow
()),
versions
[
1
]
+
1
,
versions
[
2
]
+
1
]
versions
=
[
versions
[
0
].
set
(
versions
[
0
].
overflow
()),
versions
[
1
]
+
1
,
versions
[
2
]
+
1
]
set_specification
(
project
,
manifest
,
versions
[
0
])
set_specification
(
project
,
manifest
,
versions
[
0
])
set_implementation
(
manifest
,
versions
[
1
])
set_implementation
(
manifest
,
versions
[
1
])
set_release
(
manifest
,
versions
[
2
])
set_release
(
manifest
,
versions
[
2
])
module
.
set_versions
(
versions
)
module
.
set_versions
(
versions
)
elif
module
.
ret
==
100
:
elif
module
.
ret
==
NO_CHANGES
:
versions
=
[
versions
[
0
],
versions
[
1
]
+
1
,
versions
[
2
]]
versions
=
[
versions
[
0
],
versions
[
1
]
+
1
,
versions
[
2
]]
set_implementation
(
manifest
,
versions
[
1
])
set_implementation
(
manifest
,
versions
[
1
])
module
.
set_versions
(
versions
)
module
.
set_versions
(
versions
)
...
@@ -624,48 +630,40 @@ def print_version_updates(modules):
...
@@ -624,48 +630,40 @@ def print_version_updates(modules):
f
=
open
(
"
gen_version.txt
"
,
"
a
"
)
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
==
COMPATIBLE
:
output
=
(
module
.
name
+
"
:
\n
"
)
output
=
(
module
.
name
+
"
:
\n
"
)
output
+=
(
"
Current Specification version:
\t
"
+
str
(
versions
[
0
])
+
"
\n
"
)
output
+=
(
"
\t
Specification:
\t
"
+
str
(
versions
[
0
])
+
"
\t
->
\t
"
+
str
(
versions
[
0
].
increment
())
+
"
\n
"
)
output
+=
(
"
Updated Specification version:
\t
"
+
str
(
versions
[
0
].
increment
())
+
"
\n
"
)
output
+=
(
"
\t
Implementation:
\t
"
+
str
(
versions
[
1
])
+
"
\t
->
\t
"
+
str
(
versions
[
1
]
+
1
)
+
"
\n
"
)
output
+=
(
"
\n
"
)
output
+=
(
"
\t
Release:
\t
No Change.
\n
"
)
output
+=
(
"
Current Implementation version:
\t
"
+
str
(
versions
[
1
])
+
"
\n
"
)
output
+=
(
"
Updated Implementation version:
\t
"
+
str
(
versions
[
1
]
+
1
)
+
"
\n
"
)
output
+=
(
"
\n
"
)
output
+=
(
"
\n
"
)
print
(
output
)
print
(
output
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
f
.
write
(
output
)
f
.
write
(
output
)
elif
module
.
ret
==
102
:
elif
module
.
ret
==
NON_COMPATIBLE
:
output
=
(
module
.
name
+
"
:
\n
"
)
output
=
(
module
.
name
+
"
:
\n
"
)
output
+=
(
"
Current Specification version:
\t
"
+
str
(
versions
[
0
])
+
"
\n
"
)
output
+=
(
"
\t
Specification:
\t
"
+
str
(
versions
[
0
])
+
"
\t
->
\t
"
+
str
(
versions
[
0
].
overflow
())
+
"
\n
"
)
output
+=
(
"
Updated Specification version:
\t
"
+
str
(
versions
[
0
].
overflow
())
+
"
\n
"
)
output
+=
(
"
\t
Implementation:
\t
"
+
str
(
versions
[
1
])
+
"
\t
->
\t
"
+
str
(
versions
[
1
]
+
1
)
+
"
\n
"
)
output
+=
(
"
\n
"
)
output
+=
(
"
\t
Release:
\t
"
+
str
(
versions
[
2
])
+
"
\t
->
\t
"
+
str
(
versions
[
2
]
+
1
)
+
"
\n
"
)
output
+=
(
"
Current Implementation version:
\t
"
+
str
(
versions
[
1
])
+
"
\n
"
)
output
+=
(
"
Updated Implementation version:
\t
"
+
str
(
versions
[
1
]
+
1
)
+
"
\n
"
)
output
+=
(
"
\n
"
)
output
+=
(
"
Current Release version:
\t\t
"
+
str
(
versions
[
2
])
+
"
\n
"
)
output
+=
(
"
Updated Release version:
\t\t
"
+
str
(
versions
[
2
]
+
1
)
+
"
\n
"
)
output
+=
(
"
\n
"
)
output
+=
(
"
\n
"
)
print
(
output
)
print
(
output
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
f
.
write
(
output
)
f
.
write
(
output
)
elif
module
.
ret
==
1
:
elif
module
.
ret
==
ERROR
:
output
=
(
module
.
name
+
"
:
\n
"
)
output
=
(
module
.
name
+
"
:
\n
"
)
output
+=
(
"
*Unable to detect necessary changes
\n
"
)
output
+=
(
"
\t
*Unable to detect necessary changes
\n
"
)
output
+=
(
"
Current
Specification
version
:
\t
"
+
str
(
versions
[
0
])
+
"
\n
"
)
output
+=
(
"
\t
Specification:
\t
"
+
str
(
versions
[
0
])
+
"
\n
"
)
output
+=
(
"
Current
Implementation
version
:
\t
"
+
str
(
versions
[
1
])
+
"
\n
"
)
output
+=
(
"
\t
Implementation:
\t
"
+
str
(
versions
[
1
])
+
"
\n
"
)
output
+=
(
"
Current Release version
:
\t\t
"
+
str
(
versions
[
2
])
+
"
\n
"
)
output
+=
(
"
\t
Release
:
\t\t
"
+
str
(
versions
[
2
])
+
"
\n
"
)
output
+=
(
"
\n
"
)
output
+=
(
"
\n
"
)
print
(
output
)
print
(
output
)
f
.
write
(
output
)
f
.
write
(
output
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
elif
module
.
ret
==
100
:
elif
module
.
ret
==
NO_CHANGES
:
output
=
(
module
.
name
+
"
:
\n
"
)
output
=
(
module
.
name
+
"
:
\n
"
)
if
versions
[
1
]
is
None
:
if
versions
[
1
]
is
None
:
output
+=
(
"
No
Implementation
versi
on
.
\n
"
)
output
+=
(
"
\t
Implementation
: N
on
e
\n
"
)
else
:
else
:
output
+=
(
"
Current Implementation version:
\t
"
+
str
(
versions
[
1
])
+
"
\n
"
)
output
+=
(
"
\t
Implementation:
\t
"
+
str
(
versions
[
1
])
+
"
\t
->
\t
"
+
str
(
versions
[
1
]
+
1
)
+
"
\n
"
)
output
+=
(
"
Updated Implementation version:
\t
"
+
str
(
versions
[
1
]
+
1
)
+
"
\n
"
)
output
+=
(
"
\n
"
)
output
+=
(
"
\n
"
)
print
(
output
)
print
(
output
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
...
@@ -673,16 +671,13 @@ def print_version_updates(modules):
...
@@ -673,16 +671,13 @@ def print_version_updates(modules):
elif
module
.
ret
is
None
:
elif
module
.
ret
is
None
:
output
=
(
"
Added
"
+
module
.
name
+
"
:
\n
"
)
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
"
:
output
+=
(
"
Current Specification version:
\t
"
+
str
(
module
.
spec
())
+
"
\n
"
)
output
+=
(
"
\t
Specification:
\t
"
+
str
(
module
.
spec
())
+
"
\t
->
\t
"
+
"
1.0
\n
"
)
output
+=
(
"
Updated Specification version:
\t
1.0
\n
"
)
output
+=
(
"
\n
"
)
output
+=
(
"
\n
"
)
if
module
.
impl
()
!=
1
:
if
module
.
impl
()
!=
1
:
output
+=
(
"
Current Implementation version:
\t
"
+
str
(
module
.
impl
())
+
"
\n
"
)
output
+=
(
"
\t
Implementation:
\t
"
+
str
(
module
.
impl
())
+
"
\t
->
\t
"
+
"
1
\n
"
)
output
+=
(
"
Updated Implementation version:
\t
1
\n
"
)
output
+=
(
"
\n
"
)
output
+=
(
"
\n
"
)
if
module
.
release
()
!=
1
and
module
.
release
()
!=
0
:
if
module
.
release
()
!=
1
and
module
.
release
()
!=
0
:
output
+=
(
"
Current Release version:
\t\t
"
+
str
(
module
.
release
())
+
"
\n
"
)
output
+=
(
"
Release:
\t\t
"
+
str
(
module
.
release
())
+
"
\t
->
\t
"
+
"
1
\n
"
)
output
+=
(
"
Updated Release version:
\t\t
1
\n
"
)
output
+=
(
"
\n
"
)
output
+=
(
"
\n
"
)
print
(
output
)
print
(
output
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment