2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-17 01:32:12 +00:00

Fix a regression in the 'glob' rule -- it is broken with the current bjam.

Handle ".." correctly.


[SVN r26595]
This commit is contained in:
Vladimir Prus
2004-12-28 17:54:35 +00:00
parent b9d478e702
commit 552d98e3f8
2 changed files with 40 additions and 3 deletions

View File

@@ -37,10 +37,22 @@ t.write("d2/d/Jamfile", """
lib l : [ glob *.cpp ] ;
""")
t.run_build_system(subdir="d1")
t.write("d3/d/Jamfile", """
exe a : [ glob ../*.cpp ] ;
""")
t.write("d3/a.cpp", """
int main()
{
return 0;
}
""")
t.run_build_system(subdir="d1")
t.expect_addition("d1/bin/$toolset/debug/a.exe")
t.run_build_system(subdir="d3/d")
t.expect_addition("d3/d/bin/$toolset/debug/a.exe")
t.rm("d2/d/bin")
t.run_build_system(subdir="d2/d")
t.expect_addition("d2/d/bin/$toolset/debug/l.dll")

View File

@@ -217,9 +217,34 @@ rule glob ( dirs * : patterns + )
}
else
{
for dir in $(dirs)
# When a pattern has not directory, we glob directly.
# Take care of special ".." value. The "GLOB" rule simply ignores
# the ".." element (and ".") element in directory listings. This is
# needed so that
#
# [ glob libs/*/Jamfile ]
#
# don't return
#
# libs/../Jamfile (which is the same as ./Jamfile)
#
# On the other hand, when ".." is explicitly present in the pattern
# we need to return it.
#
for local dir in $(dirs)
{
result += [ sequence.transform make : [ GLOB [ native $(dir) ] : $(patterns) ] ] ;
for local p in $(patterns)
{
if $(p) != ".."
{
result += [ sequence.transform make
: [ GLOB [ native $(dir) ] : $(p) ] ] ;
}
else
{
result += [ path.join $(dir) .. ] ;
}
}
}
}
return $(result) ;