diff options
-rw-r--r-- | doc/man/scons.1 | 6 | ||||
-rw-r--r-- | doc/user/troubleshoot.in | 23 | ||||
-rw-r--r-- | doc/user/troubleshoot.xml | 22 | ||||
-rw-r--r-- | src/CHANGES.txt | 4 | ||||
-rw-r--r-- | src/RELEASE.txt | 2 | ||||
-rw-r--r-- | src/engine/SCons/Node/FS.py | 7 | ||||
-rw-r--r-- | src/engine/SCons/Script/Main.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Script/SConsOptions.py | 2 |
8 files changed, 67 insertions, 1 deletions
diff --git a/doc/man/scons.1 b/doc/man/scons.1 index 3fa9e0c..62129ad 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -601,6 +601,12 @@ have been compiled with optimization files). .TP +--debug=duplicate +Print a line for each unlink/relink (or copy) of a variant file from +its source file. Includes debugging info for unlinking stale variant +files, as well as unlinking old targets before building them. + +.TP --debug=dtree A synonym for the newer .B --tree=derived diff --git a/doc/user/troubleshoot.in b/doc/user/troubleshoot.in index b0e8681..b237cbb 100644 --- a/doc/user/troubleshoot.in +++ b/doc/user/troubleshoot.in @@ -857,8 +857,31 @@ </section> + <section> + + <title>Why is a file disappearing? the --debug=duplicate Option</title> + + <para> + + When using the &Duplicate; option to create variant dirs, + sometimes you may find files not getting copied to where you + expect (or not at all), or files mysteriously disappearing. These + are usually because of a misconfiguration of some kind in the + SConstruct/SConscript, but they can be tricky to debug. The + --debug=duplicate option shows each time a variant file is + unlinked and relinked from its source (or copied, depending on + settings), and also shows a message for removing "stale" + variant-dir files that no longer have a corresponding source file. + It also prints a line for each target that's removed just before + building, since that can also be mistaken for the same thing. + + </para> + + </section> + <!-- + <section> <title>Where Are My Build Bottlenecks? the &profile; Option</title> diff --git a/doc/user/troubleshoot.xml b/doc/user/troubleshoot.xml index 586612a..c2a31b7 100644 --- a/doc/user/troubleshoot.xml +++ b/doc/user/troubleshoot.xml @@ -1275,6 +1275,28 @@ </section> + <section> + + <title>Why is a file disappearing? the --debug=duplicate Option</title> + + <para> + + When using the &Duplicate; option to create variant dirs, + sometimes you may find files not getting copied to where you + expect (or not at all), or files mysteriously disappearing. These + are usually because of a misconfiguration of some kind in the + SConstruct/SConscript, but they can be tricky to debug. The + --debug=duplicate option shows each time a variant file is + unlinked and relinked from its source (or copied, depending on + settings), and also shows a message for removing "stale" + variant-dir files that no longer have a corresponding source file. + It also prints a line for each target that's removed just before + building, since that can also be mistaken for the same thing. + + </para> + + </section> + <!-- <section> diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 31fa245..2aa48b3 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -14,6 +14,10 @@ RELEASE 2.1.0.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE - New --debug=prepare option to show each target as it's being prepared, whether or not anything needs to be done for it. + From Gary Oberbrunner: + - New debug option --debug=duplicate to print a line for each + unlink/relink (or copy) of a variant file from its source file. + From David Garcia Garzon: - Fix Delete to be able to delete broken symlinks and dir symlinks. diff --git a/src/RELEASE.txt b/src/RELEASE.txt index f9d550e..306403d 100644 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -73,6 +73,8 @@ IMPROVEMENTS + - New debugging options to print unlink/relinking of variant files + (--debug=duplicate) and preparation of targets (--debug=prepare). - SCons can now generate MSVS 9.0 and 10.0 Projects and Solutions. - MSVS Solution generation is improved. - Fortran 03 is supported (preliminary) diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index bb49f95..86649f3 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -56,6 +56,7 @@ import SCons.Warnings from SCons.Debug import Trace do_store_info = True +print_duplicate = 0 class EntryProxyAttributeError(AttributeError): @@ -2787,6 +2788,8 @@ class File(Base): def _rmv_existing(self): self.clear_memoized_values() + if print_duplicate: + print "dup: removing existing target %s"%self e = Unlink(self, [], None) if isinstance(e, SCons.Errors.BuildError): raise e @@ -2827,6 +2830,8 @@ class File(Base): def do_duplicate(self, src): self._createDir() + if print_duplicate: + print "dup: relinking variant '%s' from '%s'"%(self, src) Unlink(self, None, None) e = Link(self, src, None) if isinstance(e, SCons.Errors.BuildError): @@ -2860,6 +2865,8 @@ class File(Base): else: # The source file does not exist. Make sure no old # copy remains in the variant directory. + if print_duplicate: + print "dup: no src for %s, unlinking old variant copy"%self if Base.exists(self) or self.islink(): self.fs.unlink(self.path) # Return None explicitly because the Base.exists() call diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index 0513e41..0e029b5 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -656,6 +656,8 @@ def _set_debug_values(options): options.tree_printers.append(TreePrinter()) if "prepare" in debug_values: SCons.Taskmaster.print_prepare = 1 + if "duplicate" in debug_values: + SCons.Node.FS.print_duplicate = 1 def _create_path(plist): path = '.' diff --git a/src/engine/SCons/Script/SConsOptions.py b/src/engine/SCons/Script/SConsOptions.py index fc5f08d..3066c65 100644 --- a/src/engine/SCons/Script/SConsOptions.py +++ b/src/engine/SCons/Script/SConsOptions.py @@ -596,7 +596,7 @@ def Parser(version): "tree" : '; please use --tree=all instead', } - debug_options = ["count", "explain", "findlibs", + debug_options = ["count", "duplicate", "explain", "findlibs", "includes", "memoizer", "memory", "objects", "pdb", "prepare", "presub", "stacktrace", "time"] + list(deprecated_debug_options.keys()) |