Fetch implicit dependencies from SCCS/RCS.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 29 Jan 2004 06:57:54 +0000 (06:57 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 29 Jan 2004 06:57:54 +0000 (06:57 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@888 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Node/FS.py
src/engine/SCons/Node/FSTests.py
test/RCS.py
test/SCCS.py

index 8b14bf4b34b8838b09dd097f038a17d1b9abe2a1..b66333d192ab9fd5520a2156be7611afec0aca99 100644 (file)
@@ -147,6 +147,9 @@ RELEASE 0.95 - XXX
   - Provide a more useful error message if a construction variable
     expansion contains a syntax error during evaluation.
 
+  - Fix transparent checkout of implicit dependency files from SCCS
+    and RCS.
+
   From Vincent Risi:
 
   - Add support for the bcc32, ilink32 and tlib Borland tools.
index 46d72d750a54f8387b360903e03c7bf44314c8a7..cbfe396fd4cbdf5bf4c87d062e382221aa757569 100644 (file)
@@ -1543,8 +1543,9 @@ def find_file(filename, paths, node_factory = default_fs.File):
     for dir in paths:
         try:
             node = node_factory(filename, dir)
-            # Return true of the node exists or is a derived node.
+            # Return true if the node exists or is a derived node.
             if node.is_derived() or \
+               node.is_pseudo_derived() or \
                (isinstance(node, SCons.Node.FS.Base) and node.exists()):
                 retval = node
                 break
index 132e8f61e90da1c0ee3bb75a7fea16841552d528..ef1f52aa4901554ccc59bb9d6a759f8f3bb36f19 100644 (file)
@@ -1373,13 +1373,17 @@ class find_fileTestCase(unittest.TestCase):
         os.chdir(test.workpath("")) # FS doesn't like the cwd to be something other than it's root
         node_derived = fs.File(test.workpath('bar/baz'))
         node_derived.builder_set(1) # Any non-zero value.
+        node_pseudo = fs.File(test.workpath('pseudo'))
+        node_pseudo.set_src_builder(1) # Any non-zero value.
         paths = map(fs.Dir, ['.', './bar'])
         nodes = [SCons.Node.FS.find_file('foo', paths, fs.File), 
-                 SCons.Node.FS.find_file('baz', paths, fs.File)] 
+                 SCons.Node.FS.find_file('baz', paths, fs.File),
+                 SCons.Node.FS.find_file('pseudo', paths, fs.File)] 
         file_names = map(str, nodes)
         file_names = map(os.path.normpath, file_names)
         assert os.path.normpath('./foo') in file_names, file_names
         assert os.path.normpath('./bar/baz') in file_names, file_names
+        assert os.path.normpath('./pseudo') in file_names, file_names
 
 class StringDirTestCase(unittest.TestCase):
     def runTest(self):
index 7be008094c2dee57875a0715c0793f014173aba5..93a985e154886f046b214670d30e346ff006e8f3 100644 (file)
@@ -49,6 +49,8 @@ def is_writable(file):
     mode = os.stat(file)[stat.ST_MODE]
     return mode & stat.S_IWUSR
 
+
+
 # Test explicit checkouts from local RCS files.
 test.subdir('work1', ['work1', 'sub'])
 
@@ -137,6 +139,8 @@ test.fail_test(is_writable(test.workpath('work1', 'ccc.in')))
 test.fail_test(is_writable(test.workpath('work1', 'sub', 'ddd.in')))
 test.fail_test(is_writable(test.workpath('work1', 'sub', 'fff.in')))
 
+
+
 # Test transparent RCS checkouts from an RCS subdirectory.
 test.subdir('work2', ['work2', 'RCS'],
             ['work2', 'sub'], ['work2', 'sub', 'RCS'])
@@ -241,5 +245,47 @@ test.fail_test(not is_writable(test.workpath('work2', 'ccc.in')))
 test.fail_test(not is_writable(test.workpath('work2', 'sub', 'ddd.in')))
 test.fail_test(not is_writable(test.workpath('work2', 'sub', 'fff.in')))
 
+
+
+# Test transparent RCS checkouts of implicit dependencies.
+test.subdir('work3', ['work3', 'RCS'])
+
+test.write(['work3', 'foo.c'], """\
+#include "foo.h"
+int
+main(int argc, char *argv[]) {
+    printf(STR);
+    printf("work3/foo.c\\n");
+}
+""")
+test.run(chdir = 'work3',
+         program = ci,
+         arguments = "-f -tfoo.c foo.c",
+         stderr = None)
+
+test.write(['work3', 'foo.h'], """\
+#define STR     "work3/foo.h\\n"
+""")
+test.run(chdir = 'work3',
+         program = ci,
+         arguments = "-f -tfoo.h foo.h",
+         stderr = None)
+
+test.write(['work3', 'SConstruct'], """
+env = Environment()
+env.Program('foo.c')
+""")
+
+test.run(chdir='work3', stderr="""\
+RCS/foo.c,v  -->  foo.c
+revision 1.1
+done
+RCS/foo.h,v  -->  foo.h
+revision 1.1
+done
+""")
+
+
+
 #
 test.pass_test()
index 3194f4f223ecb1dcb93656f5a97f846c1c1ef3be..b98e9a73e37d006e0ee317c3408aeebc16b5b809 100644 (file)
@@ -44,6 +44,8 @@ def is_writable(file):
     mode = os.stat(file)[stat.ST_MODE]
     return mode & stat.S_IWUSR
 
+
+
 # Test explicit checkouts from local SCCS files.
 test.subdir('work1', ['work1', 'sub'])
 
@@ -130,6 +132,8 @@ test.fail_test(not is_writable(test.workpath('work1', 'ccc.in')))
 test.fail_test(not is_writable(test.workpath('work1', 'sub', 'ddd.in')))
 test.fail_test(not is_writable(test.workpath('work1', 'sub', 'fff.in')))
 
+
+
 # Test transparent checkouts from SCCS files in an SCCS subdirectory.
 test.subdir('work2', ['work2', 'SCCS'],
             ['work2', 'sub'], ['work2', 'sub', 'SCCS'])
@@ -215,4 +219,47 @@ test.fail_test(is_writable(test.workpath('work2', 'ccc.in')))
 test.fail_test(is_writable(test.workpath('work2', 'sub', 'ddd.in')))
 test.fail_test(is_writable(test.workpath('work2', 'sub', 'fff.in')))
 
+
+
+
+# Test transparent SCCS checkouts of implicit dependencies.
+test.subdir('work3', ['work3', 'SCCS'])
+
+test.write(['work3', 'foo.c'], """\
+#include "foo.h"
+int
+main(int argc, char *argv[]) {
+    printf(STR);
+    printf("work3/foo.c\\n");
+}
+""")
+test.run(chdir = 'work3',
+         program = sccs,
+         arguments = "create foo.c",
+         stderr = None)
+test.unlink(['work3', 'foo.c'])
+test.unlink(['work3', ',foo.c'])
+
+test.write(['work3', 'foo.h'], """\
+#define STR     "work3/foo.h\\n"
+""")
+test.run(chdir = 'work3',
+         program = sccs,
+         arguments = "create foo.h",
+         stderr = None)
+test.unlink(['work3', 'foo.h'])
+test.unlink(['work3', ',foo.h'])
+
+test.write(['work3', 'SConstruct'], """
+env = Environment()
+env.Program('foo.c')
+""")
+
+test.run(chdir='work3', stderr = """\
+foo.c 1.1: 6 lines
+foo.h 1.1: 1 lines
+""")
+
+
+
 test.pass_test()