diff options
author | Jacob Cassagnol <87133045+jcassagnol-public@users.noreply.github.com> | 2021-11-10 00:03:39 (GMT) |
---|---|---|
committer | Jacob Cassagnol <87133045+jcassagnol-public@users.noreply.github.com> | 2021-11-10 00:03:39 (GMT) |
commit | d83d77dd881e683decc1b957f8b0fc3a9d4b8b40 (patch) | |
tree | 2d315d6e4632b79b9d3d54c59394edc9a385596a | |
parent | 3a7e06174766bfb40d64e16758543bdf313a134d (diff) | |
download | SCons-d83d77dd881e683decc1b957f8b0fc3a9d4b8b40.zip SCons-d83d77dd881e683decc1b957f8b0fc3a9d4b8b40.tar.gz SCons-d83d77dd881e683decc1b957f8b0fc3a9d4b8b40.tar.bz2 |
Normalized all sconsfiles and sub-sconsfiles to use algorithm if not defaulted to md5.
Dir search now excludes all types of sconsfiles that are now created.
Environment now defaults to the current scons filename instead of .sconsfile
Sconsign now has a function used by a lot of code that gets the default sconsign filename
Any tests referring to .sconsfile have now been changed, including one old legacy test.
-rw-r--r-- | SCons/Environment.py | 2 | ||||
-rw-r--r-- | SCons/EnvironmentTests.py | 3 | ||||
-rw-r--r-- | SCons/SConsign.py | 28 | ||||
-rw-r--r-- | SCons/Scanner/Dir.py | 19 | ||||
-rw-r--r-- | SCons/Scanner/DirTests.py | 43 | ||||
-rw-r--r-- | test/Removed/SourceSignatures/Old/no-csigs.py | 2 | ||||
-rw-r--r-- | test/SConsignFile/default.py | 15 | ||||
-rw-r--r-- | test/SConsignFile/explicit-dbm-module.py | 15 | ||||
-rw-r--r-- | test/SConsignFile/explicit-file.py | 9 | ||||
-rw-r--r-- | test/SConsignFile/make-directory.py | 3 | ||||
-rw-r--r-- | test/SConsignFile/use-dbhash.py | 22 | ||||
-rw-r--r-- | test/SConsignFile/use-dbm.py | 25 | ||||
-rw-r--r-- | test/SConsignFile/use-dumbdbm.py | 35 | ||||
-rw-r--r-- | test/SConsignFile/use-gdbm.py | 20 | ||||
-rw-r--r-- | test/implicit/changed-node.py | 3 | ||||
-rw-r--r-- | test/sconsign/corrupt.py | 9 | ||||
-rw-r--r-- | test/sconsign/nonwritable.py | 9 | ||||
-rw-r--r-- | test/sconsign/script/SConsignFile.py | 20 | ||||
-rw-r--r-- | test/sconsign/script/Signatures.py | 6 | ||||
-rw-r--r-- | test/sconsign/script/no-SConsignFile.py | 24 |
20 files changed, 182 insertions, 130 deletions
diff --git a/SCons/Environment.py b/SCons/Environment.py index 957a6e4..c8cddf7 100644 --- a/SCons/Environment.py +++ b/SCons/Environment.py @@ -2252,7 +2252,7 @@ class Base(SubstitutionEnvironment): nkw = self.subst_kw(kw) return SCons.Scanner.ScannerBase(*nargs, **nkw) - def SConsignFile(self, name=".sconsign", dbm_module=None): + def SConsignFile(self, name=SCons.SConsign.current_sconsign_filename(), dbm_module=None): if name is not None: name = self.subst(name) if not os.path.isabs(name): diff --git a/SCons/EnvironmentTests.py b/SCons/EnvironmentTests.py index 2ed897a..cd36fd2 100644 --- a/SCons/EnvironmentTests.py +++ b/SCons/EnvironmentTests.py @@ -41,6 +41,7 @@ from SCons.Environment import ( is_valid_construction_var, ) from SCons.Util import CLVar +from SCons.SConsign import current_sconsign_filename def diff_env(env1, env2): @@ -3321,7 +3322,7 @@ def generate(env): assert dbms[-1] == 7, dbms env.SConsignFile() - assert fnames[-1] == os.path.join(os.sep, 'dir', '.sconsign'), fnames + assert fnames[-1] == os.path.join(os.sep, 'dir', current_sconsign_filename()), fnames assert dbms[-1] is None, dbms env.SConsignFile(None) diff --git a/SCons/SConsign.py b/SCons/SConsign.py index 95ceac1..5b78855 100644 --- a/SCons/SConsign.py +++ b/SCons/SConsign.py @@ -58,23 +58,25 @@ DB_Module = SCons.dblite DB_Name = None DB_sync_list = [] +def current_sconsign_filename(): + hash_format = SCons.Util.get_hash_format() + 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': + return ".sconsign" + else: + return ".sconsign_" + current_hash_algorithm def Get_DataBase(dir): global DataBase, DB_Module, DB_Name if DB_Name is None: - hash_format = SCons.Util.get_hash_format() - 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" % current_hash_algorithm + DB_Name = current_sconsign_filename() top = dir.fs.Top if not os.path.isabs(DB_Name) and top.repositories: @@ -342,7 +344,7 @@ class DirFile(Dir): """ self.dir = dir - self.sconsign = os.path.join(dir.get_internal_path(), '.sconsign') + self.sconsign = os.path.join(dir.get_internal_path(), current_sconsign_filename()) try: fp = open(self.sconsign, 'rb') diff --git a/SCons/Scanner/Dir.py b/SCons/Scanner/Dir.py index 162e9ef..239b1ec 100644 --- a/SCons/Scanner/Dir.py +++ b/SCons/Scanner/Dir.py @@ -63,6 +63,25 @@ skip_entry_list = [ '.sconsign_md5.dblite', '.sconsign_sha1.dblite', '.sconsign_sha256.dblite', + # and all the duplicate files for each sub-sconsfile type + '.sconsign_md5', + '.sconsign_md5.dir', + '.sconsign_md5.pag', + '.sconsign_md5.dat', + '.sconsign_md5.bak', + '.sconsign_md5.db', + '.sconsign_sha1', + '.sconsign_sha1.dir', + '.sconsign_sha1.pag', + '.sconsign_sha1.dat', + '.sconsign_sha1.bak', + '.sconsign_sha1.db', + '.sconsign_sha256', + '.sconsign_sha256.dir', + '.sconsign_sha256.pag', + '.sconsign_sha256.dat', + '.sconsign_sha256.bak', + '.sconsign_sha256.db', ] for skip in skip_entry_list: diff --git a/SCons/Scanner/DirTests.py b/SCons/Scanner/DirTests.py index 2e73fe2..06d3382 100644 --- a/SCons/Scanner/DirTests.py +++ b/SCons/Scanner/DirTests.py @@ -28,6 +28,7 @@ import TestCmd import SCons.Node.FS import SCons.Scanner.Dir +from SCons.SConsign import current_sconsign_filename #class DummyNode: # def __init__(self, name, fs): @@ -57,23 +58,25 @@ class DirScannerTestBase(unittest.TestCase): self.test.subdir('dir', ['dir', 'sub']) + sconsign = current_sconsign_filename() + self.test.write(['dir', 'f1'], "dir/f1\n") self.test.write(['dir', 'f2'], "dir/f2\n") - self.test.write(['dir', '.sconsign'], "dir/.sconsign\n") - self.test.write(['dir', '.sconsign.bak'], "dir/.sconsign.bak\n") - self.test.write(['dir', '.sconsign.dat'], "dir/.sconsign.dat\n") - self.test.write(['dir', '.sconsign.db'], "dir/.sconsign.db\n") - self.test.write(['dir', '.sconsign.dblite'], "dir/.sconsign.dblite\n") - self.test.write(['dir', '.sconsign.dir'], "dir/.sconsign.dir\n") - self.test.write(['dir', '.sconsign.pag'], "dir/.sconsign.pag\n") - self.test.write(['dir', 'sub', 'f3'], "dir/sub/f3\n") - self.test.write(['dir', 'sub', 'f4'], "dir/sub/f4\n") - self.test.write(['dir', 'sub', '.sconsign'], "dir/.sconsign\n") - self.test.write(['dir', 'sub', '.sconsign.bak'], "dir/.sconsign.bak\n") - self.test.write(['dir', 'sub', '.sconsign.dat'], "dir/.sconsign.dat\n") - self.test.write(['dir', 'sub', '.sconsign.dblite'], "dir/.sconsign.dblite\n") - self.test.write(['dir', 'sub', '.sconsign.dir'], "dir/.sconsign.dir\n") - self.test.write(['dir', 'sub', '.sconsign.pag'], "dir/.sconsign.pag\n") + self.test.write(['dir', '{}'.format(sconsign)], "dir/{}\n".format(sconsign)) + self.test.write(['dir', '{}.bak'.format(sconsign)], "dir/{}.bak\n".format(sconsign)) + self.test.write(['dir', '{}.dat'.format(sconsign)], "dir/{}.dat\n".format(sconsign)) + self.test.write(['dir', '{}.db'.format(sconsign)], "dir/{}.db\n".format(sconsign)) + self.test.write(['dir', '{}.dblite'.format(sconsign)], "dir/{}.dblite\n".format(sconsign)) + self.test.write(['dir', '{}.dir'.format(sconsign)], "dir/{}.dir\n".format(sconsign)) + self.test.write(['dir', '{}.pag'.format(sconsign)], "dir/{}.pag\n".format(sconsign)) + self.test.write(['dir', 'sub', 'f3'.format(sconsign)], "dir/sub/f3\n".format(sconsign)) + self.test.write(['dir', 'sub', 'f4'.format(sconsign)], "dir/sub/f4\n".format(sconsign)) + self.test.write(['dir', 'sub', '{}'.format(sconsign)], "dir/{}\n".format(sconsign)) + self.test.write(['dir', 'sub', '{}.bak'.format(sconsign)], "dir/{}.bak\n".format(sconsign)) + self.test.write(['dir', 'sub', '{}.dat'.format(sconsign)], "dir/{}.dat\n".format(sconsign)) + self.test.write(['dir', 'sub', '{}.dblite'.format(sconsign)], "dir/{}.dblite\n".format(sconsign)) + self.test.write(['dir', 'sub', '{}.dir'.format(sconsign)], "dir/{}.dir\n".format(sconsign)) + self.test.write(['dir', 'sub', '{}.pag'.format(sconsign)], "dir/{}.pag\n".format(sconsign)) class DirScannerTestCase(DirScannerTestBase): def runTest(self): @@ -88,7 +91,7 @@ class DirScannerTestCase(DirScannerTestBase): ] deps = s(env.Dir('dir'), env, ()) sss = list(map(str, deps)) - assert sss == expect, sss + assert sss == expect, "Found {}, expected {}".format(sss, expect) expect = [ os.path.join('dir', 'sub', 'f3'), @@ -96,7 +99,7 @@ class DirScannerTestCase(DirScannerTestBase): ] deps = s(env.Dir('dir/sub'), env, ()) sss = list(map(str, deps)) - assert sss == expect, sss + assert sss == expect, "Found {}, expected {}".format(sss, expect) class DirEntryScannerTestCase(DirScannerTestBase): def runTest(self): @@ -106,16 +109,16 @@ class DirEntryScannerTestCase(DirScannerTestBase): deps = s(env.Dir('dir'), env, ()) sss = list(map(str, deps)) - assert sss == [], sss + assert sss == [], "Found {}, expected {}".format(sss, expect) deps = s(env.Dir('dir/sub'), env, ()) sss = list(map(str, deps)) - assert sss == [], sss + assert sss == [], "Found {}, expected {}".format(sss, expect) # Make sure we don't blow up if handed a non-Dir node. deps = s(env.File('dir/f1'), env, ()) sss = list(map(str, deps)) - assert sss == [], sss + assert sss == [], "Found {}, expected {}".format(sss, expect) if __name__ == "__main__": unittest.main() diff --git a/test/Removed/SourceSignatures/Old/no-csigs.py b/test/Removed/SourceSignatures/Old/no-csigs.py index 60c0460..483eeea 100644 --- a/test/Removed/SourceSignatures/Old/no-csigs.py +++ b/test/Removed/SourceSignatures/Old/no-csigs.py @@ -66,7 +66,7 @@ f2.out: \S+ \d+ \d+ \S+ \[build\(target, source, env\)\] """ -test.run_sconsign(arguments = test.workpath('.sconsign'), +test.run_sconsign(arguments = test.workpath(test.get_sconsignname()), stdout = expect) diff --git a/test/SConsignFile/default.py b/test/SConsignFile/default.py index 868f9d7..99ae54e 100644 --- a/test/SConsignFile/default.py +++ b/test/SConsignFile/default.py @@ -59,9 +59,12 @@ test.write(['subdir', 'f4.in'], "subdir/f4.in\n") test.run() -test.must_exist(test.workpath('.sconsign.dblite')) -test.must_not_exist(test.workpath('.sconsign')) -test.must_not_exist(test.workpath('subdir', '.sconsign')) +database_name = test.get_sconsignname() +database_filename = database_name + ".dblite" + +test.must_exist(test.workpath(database_filename)) +test.must_not_exist(test.workpath(database_name)) +test.must_not_exist(test.workpath('subdir', database_name)) test.must_match('f1.out', "f1.in\n") test.must_match('f2.out', "f2.in\n") @@ -70,9 +73,9 @@ test.must_match(['subdir', 'f4.out'], "subdir/f4.in\n") test.up_to_date(arguments='.') -test.must_exist(test.workpath('.sconsign.dblite')) -test.must_not_exist(test.workpath('.sconsign')) -test.must_not_exist(test.workpath('subdir', '.sconsign')) +test.must_exist(test.workpath(database_filename)) +test.must_not_exist(test.workpath(database_name)) +test.must_not_exist(test.workpath('subdir', database_name)) test.pass_test() diff --git a/test/SConsignFile/explicit-dbm-module.py b/test/SConsignFile/explicit-dbm-module.py index c093271..628d8b5 100644 --- a/test/SConsignFile/explicit-dbm-module.py +++ b/test/SConsignFile/explicit-dbm-module.py @@ -61,9 +61,12 @@ test.write(['subdir', 'f4.in'], "subdir/f4.in\n") test.run() -test.must_exist(test.workpath('.sconsign.dblite')) -test.must_not_exist(test.workpath('.sconsign')) -test.must_not_exist(test.workpath('subdir', '.sconsign')) +database_name = test.get_sconsignname() +database_filename = database_name + ".dblite" + +test.must_exist(test.workpath(database_filename)) +test.must_not_exist(test.workpath(database_name)) +test.must_not_exist(test.workpath('subdir', database_name)) test.must_match('f1.out', "f1.in\n") test.must_match('f2.out', "f2.in\n") @@ -72,9 +75,9 @@ test.must_match(['subdir', 'f4.out'], "subdir/f4.in\n") test.up_to_date(arguments='.') -test.must_exist(test.workpath('.sconsign.dblite')) -test.must_not_exist(test.workpath('.sconsign')) -test.must_not_exist(test.workpath('subdir', '.sconsign')) +test.must_exist(test.workpath(database_filename)) +test.must_not_exist(test.workpath(database_name)) +test.must_not_exist(test.workpath('subdir', database_name)) test.pass_test() diff --git a/test/SConsignFile/explicit-file.py b/test/SConsignFile/explicit-file.py index 850b0ef..c601f7f 100644 --- a/test/SConsignFile/explicit-file.py +++ b/test/SConsignFile/explicit-file.py @@ -59,9 +59,10 @@ test.write(['subdir', 'f8.in'], "subdir/f8.in\n") test.run() +database_name = test.get_sconsignname() test.must_exist(test.workpath('my_sconsign.dblite')) -test.must_not_exist(test.workpath('.sconsign')) -test.must_not_exist(test.workpath('subdir', '.sconsign')) +test.must_not_exist(test.workpath(database_name)) +test.must_not_exist(test.workpath('subdir', database_name)) test.must_match('f5.out', "f5.in\n") test.must_match('f6.out', "f6.in\n") @@ -71,8 +72,8 @@ test.must_match(['subdir', 'f8.out'], "subdir/f8.in\n") test.up_to_date(arguments='.') test.must_exist(test.workpath('my_sconsign.dblite')) -test.must_not_exist(test.workpath('.sconsign')) -test.must_not_exist(test.workpath('subdir', '.sconsign')) +test.must_not_exist(test.workpath(database_name)) +test.must_not_exist(test.workpath('subdir', database_name)) test.pass_test() diff --git a/test/SConsignFile/make-directory.py b/test/SConsignFile/make-directory.py index 264ee26..f2a0db1 100644 --- a/test/SConsignFile/make-directory.py +++ b/test/SConsignFile/make-directory.py @@ -57,7 +57,8 @@ test.must_not_exist(['bar', 'foo.txt']) test.must_not_exist('sub') test.must_not_exist(['sub', 'dir']) -test.must_not_exist(['sub', 'dir', '.sconsign.dblite']) +database_name = test.get_sconsignname() +test.must_not_exist(['sub', 'dir', database_name + '.dblite']) test.run(stdout=expect) diff --git a/test/SConsignFile/use-dbhash.py b/test/SConsignFile/use-dbhash.py index 2968cd7..65eb92c 100644 --- a/test/SConsignFile/use-dbhash.py +++ b/test/SConsignFile/use-dbhash.py @@ -48,10 +48,12 @@ with open(sys.argv[1], 'wb') as ofp, open(sys.argv[2], 'rb') as ifp: sys.exit(0) """) +database_name = test.get_sconsignname() + # test.write('SConstruct', """ import %(use_dbm)s -SConsignFile('.sconsign', %(use_dbm)s) +SConsignFile('%(database_name)s', %(use_dbm)s) DefaultEnvironment(tools=[]) B = Builder(action = r'%(_python_)s build.py $TARGETS $SOURCES') env = Environment(BUILDERS={'B': B}, tools=[]) @@ -68,10 +70,12 @@ test.write(['subdir', 'f4.in'], "subdir/f4.in\n") test.run() -test.must_exist(test.workpath('.sconsign')) -test.must_not_exist(test.workpath('.sconsign.dblite')) -test.must_not_exist(test.workpath('subdir', '.sconsign')) -test.must_not_exist(test.workpath('subdir', '.sconsign.dblite')) +database_name = test.get_sconsignname() +database_filename = database_name + ".dblite" +test.must_exist(test.workpath(database_name)) +test.must_not_exist(test.workpath(database_filename)) +test.must_not_exist(test.workpath('subdir', database_name)) +test.must_not_exist(test.workpath('subdir', database_filename)) test.must_match('f1.out', "f1.in\n") test.must_match('f2.out', "f2.in\n") @@ -80,10 +84,10 @@ test.must_match(['subdir', 'f4.out'], "subdir/f4.in\n") test.up_to_date(arguments = '.') -test.must_exist(test.workpath('.sconsign')) -test.must_not_exist(test.workpath('.sconsign.dblite')) -test.must_not_exist(test.workpath('subdir', '.sconsign')) -test.must_not_exist(test.workpath('subdir', '.sconsign.dblite')) +test.must_exist(test.workpath(database_name)) +test.must_not_exist(test.workpath(database_filename)) +test.must_not_exist(test.workpath('subdir', database_name)) +test.must_not_exist(test.workpath('subdir', database_filename)) test.pass_test() diff --git a/test/SConsignFile/use-dbm.py b/test/SConsignFile/use-dbm.py index a1ef1b2..6b6c96b 100644 --- a/test/SConsignFile/use-dbm.py +++ b/test/SConsignFile/use-dbm.py @@ -49,10 +49,11 @@ with open(sys.argv[1], 'wb') as ofp, open(sys.argv[2], 'rb') as ifp: sys.exit(0) """) +database_name = test.get_sconsignname() # test.write('SConstruct', """ import %(use_dbm)s -SConsignFile('.sconsign', %(use_dbm)s) +SConsignFile('%(database_name)s', %(use_dbm)s) DefaultEnvironment(tools=[]) B = Builder(action=r'%(_python_)s build.py $TARGETS $SOURCES') env = Environment(BUILDERS={'B': B}, tools=[]) @@ -72,13 +73,15 @@ test.run() # We don't check for explicit .db or other file, because base "dbm" # can use different file extensions on different implementations. +database_name = test.get_sconsignname() +database_filename = database_name + '.dblite' test.fail_test( - os.path.exists('.sconsign') and 'dbm' not in dbm.whichdb('.sconsign'), - message=".sconsign existed and wasn't any type of dbm file", + os.path.exists(database_name) and 'dbm' not in dbm.whichdb(database_name), + message="{} existed and wasn't any type of dbm file".format(database_name), ) -test.must_not_exist(test.workpath('.sconsign.dblite')) -test.must_not_exist(test.workpath('subdir', '.sconsign')) -test.must_not_exist(test.workpath('subdir', '.sconsign.dblite')) +test.must_not_exist(test.workpath(database_filename)) +test.must_not_exist(test.workpath('subdir', database_name)) +test.must_not_exist(test.workpath('subdir', database_filename)) test.must_match('f1.out', "f1.in\n") test.must_match('f2.out', "f2.in\n") @@ -87,11 +90,11 @@ test.must_match(['subdir', 'f4.out'], "subdir/f4.in\n") test.up_to_date(arguments='.') -test.fail_test(os.path.exists('.sconsign') and 'dbm' not in dbm.whichdb('.sconsign'), - message=".sconsign existed and wasn't any type of dbm file") -test.must_not_exist(test.workpath('.sconsign.dblite')) -test.must_not_exist(test.workpath('subdir', '.sconsign')) -test.must_not_exist(test.workpath('subdir', '.sconsign.dblite')) +test.fail_test(os.path.exists(database_name) and 'dbm' not in dbm.whichdb(database_name), + message="{} existed and wasn't any type of dbm file".format(database_name)) +test.must_not_exist(test.workpath(database_filename)) +test.must_not_exist(test.workpath('subdir', database_name)) +test.must_not_exist(test.workpath('subdir', database_filename)) test.pass_test() diff --git a/test/SConsignFile/use-dumbdbm.py b/test/SConsignFile/use-dumbdbm.py index 875f3fc..e7fb091 100644 --- a/test/SConsignFile/use-dumbdbm.py +++ b/test/SConsignFile/use-dumbdbm.py @@ -48,10 +48,11 @@ with open(sys.argv[1], 'wb') as ofp, open(sys.argv[2], 'rb') as ifp: sys.exit(0) """) +database_name = test.get_sconsignname() # test.write('SConstruct', """ import %(use_dbm)s -SConsignFile('.sconsign', %(use_dbm)s) +SConsignFile('%(database_name)s', %(use_dbm)s) DefaultEnvironment(tools=[]) B = Builder(action=r'%(_python_)s build.py $TARGETS $SOURCES') env = Environment(BUILDERS={'B': B}, tools=[]) @@ -68,14 +69,14 @@ test.write(['subdir', 'f4.in'], "subdir/f4.in\n") test.run() -test.must_exist(test.workpath('.sconsign.dat')) -test.must_exist(test.workpath('.sconsign.dir')) -test.must_not_exist(test.workpath('.sconsign')) -test.must_not_exist(test.workpath('.sconsign.dblite')) -test.must_not_exist(test.workpath('subdir', '.sconsign')) -test.must_not_exist(test.workpath('subdir', '.sconsign.dblite')) -test.must_not_exist(test.workpath('subdir', '.sconsign.dat')) -test.must_not_exist(test.workpath('subdir', '.sconsign.dir')) +test.must_exist(test.workpath('{}.dat'.format(database_name))) +test.must_exist(test.workpath('{}.dir'.format(database_name))) +test.must_not_exist(test.workpath('{}'.format(database_name))) +test.must_not_exist(test.workpath('{}.dblite'.format(database_name))) +test.must_not_exist(test.workpath('subdir', '{}'.format(database_name))) +test.must_not_exist(test.workpath('subdir', '{}.dblite'.format(database_name))) +test.must_not_exist(test.workpath('subdir', '{}.dat'.format(database_name))) +test.must_not_exist(test.workpath('subdir', '{}.dir'.format(database_name))) test.must_match('f1.out', "f1.in\n") test.must_match('f2.out', "f2.in\n") @@ -84,14 +85,14 @@ test.must_match(['subdir', 'f4.out'], "subdir/f4.in\n") test.up_to_date(arguments='.') -test.must_exist(test.workpath('.sconsign.dat')) -test.must_exist(test.workpath('.sconsign.dir')) -test.must_not_exist(test.workpath('.sconsign')) -test.must_not_exist(test.workpath('.sconsign.dblite')) -test.must_not_exist(test.workpath('subdir', '.sconsign')) -test.must_not_exist(test.workpath('subdir', '.sconsign.dblite')) -test.must_not_exist(test.workpath('subdir', '.sconsign.dat')) -test.must_not_exist(test.workpath('subdir', '.sconsign.dir')) +test.must_exist(test.workpath('{}.dat'.format(database_name))) +test.must_exist(test.workpath('{}.dir'.format(database_name))) +test.must_not_exist(test.workpath('{}'.format(database_name))) +test.must_not_exist(test.workpath('{}.dblite'.format(database_name))) +test.must_not_exist(test.workpath('subdir', '{}'.format(database_name))) +test.must_not_exist(test.workpath('subdir', '{}.dblite'.format(database_name))) +test.must_not_exist(test.workpath('subdir', '{}.dat'.format(database_name))) +test.must_not_exist(test.workpath('subdir', '{}.dir'.format(database_name))) test.pass_test() diff --git a/test/SConsignFile/use-gdbm.py b/test/SConsignFile/use-gdbm.py index c1f0c4d..11ae052 100644 --- a/test/SConsignFile/use-gdbm.py +++ b/test/SConsignFile/use-gdbm.py @@ -48,10 +48,12 @@ with open(sys.argv[1], 'wb') as ofp, open(sys.argv[2], 'rb') as ifp: sys.exit(0) """) +database_name = test.get_sconsignname() +database_filename = database_name + '.dblite' # test.write('SConstruct', """ import %(use_dbm)s -SConsignFile('.sconsign', %(use_dbm)s) +SConsignFile('%(database_name)s', %(use_dbm)s) DefaultEnvironment(tools=[]) B = Builder(action='%(_python_)s build.py $TARGETS $SOURCES') env = Environment(BUILDERS={'B': B}, tools=[]) @@ -68,10 +70,10 @@ test.write(['subdir', 'f4.in'], "subdir/f4.in\n") test.run() -test.must_exist(test.workpath('.sconsign')) -test.must_not_exist(test.workpath('.sconsign.dblite')) -test.must_not_exist(test.workpath('subdir', '.sconsign')) -test.must_not_exist(test.workpath('subdir', '.sconsign.dblite')) +test.must_exist(test.workpath(database_name)) +test.must_not_exist(test.workpath(database_filename)) +test.must_not_exist(test.workpath('subdir', database_name)) +test.must_not_exist(test.workpath('subdir', database_filename)) test.must_match('f1.out', "f1.in\n") test.must_match('f2.out', "f2.in\n") @@ -80,10 +82,10 @@ test.must_match(['subdir', 'f4.out'], "subdir/f4.in\n") test.up_to_date(arguments='.') -test.must_exist(test.workpath('.sconsign')) -test.must_not_exist(test.workpath('.sconsign.dblite')) -test.must_not_exist(test.workpath('subdir', '.sconsign')) -test.must_not_exist(test.workpath('subdir', '.sconsign.dblite')) +test.must_exist(test.workpath(database_name)) +test.must_not_exist(test.workpath(database_filename)) +test.must_not_exist(test.workpath('subdir', database_name)) +test.must_not_exist(test.workpath('subdir', database_filename)) test.pass_test() diff --git a/test/implicit/changed-node.py b/test/implicit/changed-node.py index c8c5a01..d89c14b 100644 --- a/test/implicit/changed-node.py +++ b/test/implicit/changed-node.py @@ -126,8 +126,9 @@ test.pass_test() #def clean(full=0): # for f in ('d','b','a','SConstruct'): # rm(f) +# database_name = test.get_sconsignname() # if full: -# for f in ('.sconsign.dblite', 'build.py'): +# for f in (database_name + '.dblite', 'build.py'): # rm(f) # #clean(1) diff --git a/test/sconsign/corrupt.py b/test/sconsign/corrupt.py index 61da3a2..fa6a0e9 100644 --- a/test/sconsign/corrupt.py +++ b/test/sconsign/corrupt.py @@ -37,12 +37,13 @@ test = TestSCons.TestSCons(match = TestCmd.match_re) test.subdir('work1', ['work1', 'sub'], 'work2', ['work2', 'sub']) -database_filename = test.get_sconsignname() + ".dblite" +database_name = test.get_sconsignname() +database_filename = database_name + ".dblite" # for test1 we're using the default database filename work1__sconsign_dblite = test.workpath('work1', database_filename) # for test 2 we have an explicit hardcode to .sconsign -work2_sub__sconsign = test.workpath('work2', 'sub', ".sconsign") +work2_sub__sconsign = test.workpath('work2', 'sub', database_name) SConstruct_contents = """\ def build1(target, source, env): @@ -87,9 +88,9 @@ test.write(['work2', 'SConstruct'], SConstruct_contents) test.write(['work2', 'foo.in'], "work2/foo.in\n") stderr = r''' -scons: warning: Ignoring corrupt .sconsign file: sub.\.sconsign +scons: warning: Ignoring corrupt .sconsign file: sub.{} .* -''' +'''.format(database_name) stdout = test.wrap_stdout(r'build1\(\["sub.foo\.out"\], \["foo\.in"\]\)' + '\n') diff --git a/test/sconsign/nonwritable.py b/test/sconsign/nonwritable.py index 812a476..e952078 100644 --- a/test/sconsign/nonwritable.py +++ b/test/sconsign/nonwritable.py @@ -44,10 +44,11 @@ test.subdir('work1', ['work2', 'sub2'], ['work2', 'sub3']) -work1__sconsign_dblite = test.workpath('work1', '.sconsign.dblite') -work2_sub1__sconsign = test.workpath('work2', 'sub1', '.sconsign') -work2_sub2__sconsign = test.workpath('work2', 'sub2', '.sconsign') -work2_sub3__sconsign = test.workpath('work2', 'sub3', '.sconsign') +database_name = test.get_sconsignname() +work1__sconsign_dblite = test.workpath('work1', database_name + '.dblite') +work2_sub1__sconsign = test.workpath('work2', 'sub1', database_name) +work2_sub2__sconsign = test.workpath('work2', 'sub2', database_name) +work2_sub3__sconsign = test.workpath('work2', 'sub3', database_name) SConstruct_contents = """\ def build1(target, source, env): diff --git a/test/sconsign/script/SConsignFile.py b/test/sconsign/script/SConsignFile.py index 354bd05..4e29ef0 100644 --- a/test/sconsign/script/SConsignFile.py +++ b/test/sconsign/script/SConsignFile.py @@ -143,7 +143,9 @@ test.run(arguments = '--implicit-cache .') sig_re = r'[0-9a-fA-F]{32,64}' -test.run_sconsign(arguments = ".sconsign", +database_name = test.get_sconsignname() + +test.run_sconsign(arguments = database_name, stdout = r"""=== .: SConstruct: None \d+ \d+ fake_cc\.py: %(sig_re)s \d+ \d+ @@ -174,7 +176,7 @@ inc1.h: %(sig_re)s \d+ \d+ inc2.h: %(sig_re)s \d+ \d+ """ % locals()) -test.run_sconsign(arguments = "--raw .sconsign", +test.run_sconsign(arguments = "--raw " + database_name, stdout = r"""=== .: SConstruct: {'csig': None, 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2} fake_cc\.py: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2} @@ -302,9 +304,9 @@ inc2.h: size: \d+ """ % locals() -test.run_sconsign(arguments = "-v .sconsign", stdout=expect) +test.run_sconsign(arguments = "-v " + database_name, stdout=expect) -test.run_sconsign(arguments = "-c -v .sconsign", +test.run_sconsign(arguments = "-c -v " + database_name, stdout = r"""=== .: SConstruct: csig: None @@ -332,7 +334,7 @@ inc2.h: csig: %(sig_re)s """ % locals()) -test.run_sconsign(arguments = "-s -v .sconsign", +test.run_sconsign(arguments = "-s -v " + database_name, stdout = r"""=== .: SConstruct: size: \d+ @@ -360,7 +362,7 @@ inc2.h: size: \d+ """ % locals()) -test.run_sconsign(arguments = "-t -v .sconsign", +test.run_sconsign(arguments = "-t -v " + database_name, stdout = r"""=== .: SConstruct: timestamp: \d+ @@ -388,7 +390,7 @@ inc2.h: timestamp: \d+ """ % locals()) -test.run_sconsign(arguments = "-e hello.obj .sconsign", +test.run_sconsign(arguments = "-e hello.obj " + database_name, stdout = r"""=== .: === sub1: hello.obj: %(sig_re)s \d+ \d+ @@ -406,7 +408,7 @@ hello.obj: %(sig_re)s \d+ \d+ stderr = r"""sconsign: no entry `hello\.obj' in `\.' """ % locals()) -test.run_sconsign(arguments = "-e hello.obj -e hello.exe -e hello.obj .sconsign", +test.run_sconsign(arguments = "-e hello.obj -e hello.exe -e hello.obj " + database_name, stdout = r"""=== .: === sub1: hello.obj: %(sig_re)s \d+ \d+ @@ -444,7 +446,7 @@ sconsign: no entry `hello\.exe' in `\.' sconsign: no entry `hello\.obj' in `\.' """ % locals()) -#test.run_sconsign(arguments = "-i -v .sconsign", +#test.run_sconsign(arguments = "-i -v " + database_name, # stdout = r"""=== sub1: #hello.exe: # implicit: diff --git a/test/sconsign/script/Signatures.py b/test/sconsign/script/Signatures.py index ecb8dc2..ced5b44 100644 --- a/test/sconsign/script/Signatures.py +++ b/test/sconsign/script/Signatures.py @@ -152,7 +152,9 @@ test.run(arguments = '. --max-drift=1') sig_re = r'[0-9a-fA-F]{32,64}' date_re = r'\S+ \S+ [ \d]\d \d\d:\d\d:\d\d \d\d\d\d' -test.run_sconsign(arguments = "-e hello.exe -e hello.obj sub1/.sconsign", +database_name = test.get_sconsignname() + +test.run_sconsign(arguments = "-e hello.exe -e hello.obj sub1/{}".format(database_name), stdout = r"""hello.exe: %(sig_re)s \d+ \d+ %(sub1_hello_obj)s: %(sig_re)s \d+ \d+ fake_link\.py: None \d+ \d+ @@ -163,7 +165,7 @@ hello.obj: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] """ % locals()) -test.run_sconsign(arguments = "-e hello.exe -e hello.obj -r sub1/.sconsign", +test.run_sconsign(arguments = "-e hello.exe -e hello.obj -r sub1/{}".format(database_name), stdout = r"""hello.exe: %(sig_re)s '%(date_re)s' \d+ %(sub1_hello_obj)s: %(sig_re)s '%(date_re)s' \d+ fake_link\.py: None '%(date_re)s' \d+ diff --git a/test/sconsign/script/no-SConsignFile.py b/test/sconsign/script/no-SConsignFile.py index 1598af4..bdd878b 100644 --- a/test/sconsign/script/no-SConsignFile.py +++ b/test/sconsign/script/no-SConsignFile.py @@ -40,6 +40,8 @@ test = TestSConsign.TestSConsign(match = TestSConsign.match_re) test.subdir('sub1', 'sub2') +database_name = test.get_sconsignname() + # Because this test sets SConsignFile(None), we execute our fake # scripts directly, not by feeding them to the Python executable. # That is, we chmod 0o755 and use a "#!/usr/bin/env python" first @@ -165,9 +167,9 @@ hello.obj: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] """ % locals() -test.run_sconsign(arguments = "sub1/.sconsign", stdout=expect) +test.run_sconsign(arguments = "sub1/{}".format(database_name), stdout=expect) -test.run_sconsign(arguments = "--raw sub1/.sconsign", +test.run_sconsign(arguments = "--raw sub1/{}".format(database_name), stdout = r"""hello.c: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2} hello.exe: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2} %(sub1_hello_obj)s: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_id': 2} @@ -179,7 +181,7 @@ hello.obj: {'csig': '%(sig_re)s', 'timestamp': \d+L?, 'size': \d+L?, '_version_i %(sig_re)s \[.*\] """ % locals()) -test.run_sconsign(arguments = "-v sub1/.sconsign", +test.run_sconsign(arguments = "-v sub1/{}".format(database_name), stdout = r"""hello.c: csig: %(sig_re)s timestamp: \d+ @@ -214,7 +216,7 @@ hello.obj: action: %(sig_re)s \[.*\] """ % locals()) -test.run_sconsign(arguments = "-c -v sub1/.sconsign", +test.run_sconsign(arguments = "-c -v sub1/{}".format(database_name), stdout = r"""hello.c: csig: %(sig_re)s hello.exe: @@ -223,7 +225,7 @@ hello.obj: csig: %(sig_re)s """ % locals()) -test.run_sconsign(arguments = "-s -v sub1/.sconsign", +test.run_sconsign(arguments = "-s -v sub1/{}".format(database_name), stdout = r"""hello.c: size: \d+ hello.exe: @@ -232,7 +234,7 @@ hello.obj: size: \d+ """ % locals()) -test.run_sconsign(arguments = "-t -v sub1/.sconsign", +test.run_sconsign(arguments = "-t -v sub1/{}".format(database_name), stdout = r"""hello.c: timestamp: \d+ hello.exe: @@ -241,14 +243,14 @@ hello.obj: timestamp: \d+ """ % locals()) -test.run_sconsign(arguments = "-e hello.obj sub1/.sconsign", +test.run_sconsign(arguments = "-e hello.obj sub1/{}".format(database_name), stdout = r"""hello.obj: %(sig_re)s \d+ \d+ %(sub1_hello_c)s: %(sig_re)s \d+ \d+ fake_cc\.py: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] """ % locals()) -test.run_sconsign(arguments = "-e hello.obj -e hello.exe -e hello.obj sub1/.sconsign", +test.run_sconsign(arguments = "-e hello.obj -e hello.exe -e hello.obj sub1/{}".format(database_name), stdout = r"""hello.obj: %(sig_re)s \d+ \d+ %(sub1_hello_c)s: %(sig_re)s \d+ \d+ fake_cc\.py: %(sig_re)s \d+ \d+ @@ -263,7 +265,7 @@ hello.obj: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] """ % locals()) -test.run_sconsign(arguments = "sub2/.sconsign", +test.run_sconsign(arguments = "sub2/{}".format(database_name), stdout = r"""hello.c: %(sig_re)s \d+ \d+ hello.exe: %(sig_re)s \d+ \d+ %(sub2_hello_obj)s: %(sig_re)s \d+ \d+ @@ -279,7 +281,7 @@ inc1.h: %(sig_re)s \d+ \d+ inc2.h: %(sig_re)s \d+ \d+ """ % locals()) -#test.run_sconsign(arguments = "-i -v sub2/.sconsign", +#test.run_sconsign(arguments = "-i -v sub2/{}".format(database_name), # stdout = r"""hello.c: %(sig_re)s \d+ \d+ #hello.exe: %(sig_re)s \d+ \d+ # implicit: @@ -291,7 +293,7 @@ inc2.h: %(sig_re)s \d+ \d+ # inc2.h: %(sig_re)s \d+ \d+ #""" % locals()) -test.run_sconsign(arguments = "-e hello.obj sub2/.sconsign sub1/.sconsign", +test.run_sconsign(arguments = "-e hello.obj sub2/{} sub1/{}".format(database_name, database_name), stdout = r"""hello.obj: %(sig_re)s \d+ \d+ %(sub2_hello_c)s: %(sig_re)s \d+ \d+ %(sub2_inc1_h)s: %(sig_re)s \d+ \d+ |