summaryrefslogtreecommitdiff
path: root/SCons/SConsign.py
diff options
context:
space:
mode:
authorJacob Cassagnol <87133045+jcassagnol-public@users.noreply.github.com>2021-11-09 12:45:16 -0500
committerJacob Cassagnol <87133045+jcassagnol-public@users.noreply.github.com>2021-11-09 12:45:16 -0500
commit699d6b0d571827de973e027d765f64b629f08ed9 (patch)
tree2c96c3c72a94b2cfea0bcbc41b2715c5bd4b7b2f /SCons/SConsign.py
parent1dc541ef4dafed2cd7af68d23856dd99dd7b5644 (diff)
downloadscons-git-699d6b0d571827de973e027d765f64b629f08ed9.tar.gz
Tests pass in python 3.6 and 3.9 in Linux
Modified failing tests to use the new defaulted .sconsign database based on the hash algorithm For MD5, default database will be .sconsign.dblite For other algorithms the default will be .sconsign_<hashname>.dblite. For all cases where the user changes the hash algorithm used, the database will be .sconsign_<hashname>.dblite (including md5) For sub-scons directories it remains as .sconsign Also added unit-tests for Util.py for the new hash default changes. It's difficult to setup a fips-compliant platform using containers, and instead we mock that. option--config uses multiple types of hash algorithms so was skipped. Removed one f-string (python 3.5 doesn't support those) Corrupt.py is using an explicit .sconsign so that was left as-is, and only the parent default .sconsign was changed for work test 1. A fetch-database name option was added to the testing framework. The unlink_sconsignfile was not updated as no usages of it were found.
Diffstat (limited to 'SCons/SConsign.py')
-rw-r--r--SCons/SConsign.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/SCons/SConsign.py b/SCons/SConsign.py
index ade8a10f1..95ceac191 100644
--- a/SCons/SConsign.py
+++ b/SCons/SConsign.py
@@ -64,10 +64,17 @@ def Get_DataBase(dir):
if DB_Name is None:
hash_format = SCons.Util.get_hash_format()
- if hash_format is None:
+ current_hash_algorithm = SCons.Util.get_current_hash_algorithm_used()
+ # if the user left the options defaulted AND the default algorithm set by
+ # SCons is md5, then set the database name to be the special default name
+ #
+ # otherwise, if it defaults to something like 'sha1' or the user explicitly
+ # set 'md5' as the hash format, set the database name to .sconsign_<algorithm>
+ # eg .sconsign_sha1, etc.
+ if hash_format is None and current_hash_algorithm == 'md5':
DB_Name = ".sconsign"
else:
- DB_Name = ".sconsign_%s" % hash_format
+ DB_Name = ".sconsign_%s" % current_hash_algorithm
top = dir.fs.Top
if not os.path.isabs(DB_Name) and top.repositories: