Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alchemy
autobuild
Commits
9ae09e4b
Commit
9ae09e4b
authored
Oct 03, 2021
by
Rye Mutt
🍞
Browse files
Update default hashing algorithm to blake2b
parent
4b612955
Pipeline
#1153
passed with stages
in 36 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
autobuild/autobuild_tool_edit.py
View file @
9ae09e4b
...
...
@@ -260,7 +260,7 @@ class Archive(InteractiveCommand):
ARGUMENTS
=
[
'format'
,
'hash_algorithm'
,
'platform'
]
ARG_DICT
=
{
'format'
:
{
'help'
:
'Archive format (e.g zip, tbz2, tgz, txz)'
},
'hash_algorithm'
:
{
'help'
:
'The algorithm for computing the archive hash (e.g. md5, sha256, sha3_256, sha3_384)'
},
'hash_algorithm'
:
{
'help'
:
'The algorithm for computing the archive hash (e.g. md5, sha256, sha3_256, sha3_384
, blake2b
)'
},
'platform'
:
{
'help'
:
'The name of the platform archive to be configured'
}
}
...
...
autobuild/autobuild_tool_installables.py
View file @
9ae09e4b
...
...
@@ -142,8 +142,8 @@ def _get_new_metadata(config, args_name, args_archive, arguments):
metadata
.
archive
.
url
=
archive_url
if
'hash'
not
in
key_values
:
logger
.
warning
(
"No hash specified, computing from %s"
%
archive_file
)
metadata
.
archive
[
'hash'
]
=
common
.
compute_
sha3_384
(
archive_file
)
metadata
.
archive
[
'hash_algorithm'
]
=
'
sha3_384
'
metadata
.
archive
[
'hash'
]
=
common
.
compute_
blake2b
(
archive_file
)
metadata
.
archive
[
'hash_algorithm'
]
=
'
blake2b
'
if
archive_file
is
None
:
logger
.
warning
(
"Archive not downloaded; some integrity checks may not work"
)
...
...
autobuild/autobuild_tool_package.py
View file @
9ae09e4b
...
...
@@ -406,19 +406,22 @@ def _print_hash(filename, results, results_dict):
sha256
=
common
.
compute_sha256
(
filename
)
sha3_256
=
common
.
compute_sha3_256
(
filename
)
sha3_384
=
common
.
compute_sha3_384
(
filename
)
blake2b
=
common
.
compute_blake2b
(
filename
)
# printing unconditionally on stdout for backward compatibility
# the Linden Lab build scripts no longer rely on this
# (they use the --results-file option instead)
print
(
"md5 %s"
%
md5
)
print
(
"sha256 %s"
%
sha256
)
print
(
"md5
%s"
%
md5
)
print
(
"sha256
%s"
%
sha256
)
print
(
"sha3_256 %s"
%
sha3_256
)
print
(
"sha3_384 %s"
%
sha3_384
)
print
(
"blake2b %s"
%
blake2b
)
if
results
:
results_dict
[
"autobuild_package_md5"
]
=
md5
results_dict
[
"autobuild_package_sha256"
]
=
sha256
results_dict
[
"autobuild_package_sha3_256"
]
=
sha3_256
results_dict
[
"autobuild_package_sha3_384"
]
=
sha3_384
results_dict
[
"autobuild_package_blake2b"
]
=
blake2b
json
.
dump
(
obj
=
results_dict
,
fp
=
results
,
sort_keys
=
True
,
indent
=
4
,
separators
=
(
','
,
': '
))
# Not using logging, since this output should be produced unconditionally on stdout
...
...
autobuild/common.py
View file @
9ae09e4b
...
...
@@ -389,8 +389,6 @@ def compute_sha3_256(path):
Returns the SHA3_256 sum for the given file.
"""
import
hashlib
if
sys
.
version_info
<
(
3
,
6
):
import
sha3
try
:
stream
=
open
(
path
,
'rb'
)
...
...
@@ -410,8 +408,6 @@ def compute_sha3_384(path):
Returns the SHA3_256 sum for the given file.
"""
import
hashlib
if
sys
.
version_info
<
(
3
,
6
):
import
sha3
try
:
stream
=
open
(
path
,
'rb'
)
...
...
@@ -426,6 +422,25 @@ def compute_sha3_384(path):
return
hasher
.
hexdigest
()
def
compute_blake2b
(
path
):
"""
Returns the blake2b sum for the given file.
"""
import
hashlib
try
:
stream
=
open
(
path
,
'rb'
)
except
IOError
as
err
:
raise
AutobuildError
(
"Can't compute blake2b for %s: %s"
%
(
path
,
err
))
try
:
hasher
=
hashlib
.
blake2b
(
stream
.
read
())
finally
:
stream
.
close
()
return
hasher
.
hexdigest
()
def
split_tarname
(
pathname
):
"""
Given a tarfile pathname of the form:
...
...
autobuild/hash_algorithms.py
View file @
9ae09e4b
...
...
@@ -103,4 +103,8 @@ def _verify_sha256(pathname, hash):
@
hash_algorithm
(
"sha3_384"
)
def
_verify_sha256
(
pathname
,
hash
):
return
common
.
compute_sha3_384
(
pathname
)
==
hash
\ No newline at end of file
return
common
.
compute_sha3_384
(
pathname
)
==
hash
@
hash_algorithm
(
"blake2b"
)
def
_verify_blake2b
(
pathname
,
hash
):
return
common
.
compute_blake2b
(
pathname
)
==
hash
autobuild/tests/test_package.py
View file @
9ae09e4b
...
...
@@ -136,7 +136,7 @@ class TestPackaging(BaseTest):
self
.
tar_has_expected
(
self
.
tar_name
)
def
test_results
(
self
):
raise
unittest
.
SkipTest
(
"
pydot not installed, skipping
"
)
raise
unittest
.
SkipTest
(
"
This test is extremely flakey
"
)
logger
.
setLevel
(
logging
.
DEBUG
)
results_output
=
tempfile
.
mktemp
()
package
.
package
(
self
.
config
,
self
.
config
.
get_build_directory
(
None
,
'common'
),
...
...
autobuild/version.py
View file @
9ae09e4b
...
...
@@ -43,4 +43,4 @@ $/LicenseInfo$
# will wreak havoc upon new users of your package, as they will not be able to
# install your package without manually installing the dependencies first."
AUTOBUILD_VERSION_STRING
=
"2.0.
8
"
AUTOBUILD_VERSION_STRING
=
"2.0.
9
"
setup.py
View file @
9ae09e4b
...
...
@@ -73,8 +73,7 @@ setup(
scripts
=
[],
license
=
'MIT'
,
classifiers
=
[
line
for
line
in
CLASSIFIERS
.
split
(
"
\n
"
)
if
line
],
install_requires
=
[
'llbase'
,
'pydot'
]
+
\
([
'pysha3'
]
if
sys
.
version_info
[:
2
]
<
(
3
,
6
)
else
[]),
python_requires
=
">=3.4"
,
install_requires
=
[
'llbase'
,
'pydot'
],
python_requires
=
">=3.6"
,
#ext_modules=ext_modules,
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment