Remove special case for "dirname" -> "dirname/all"
It actually decreases readability of the .do files - by not making it explicit when you're going into a subdir. Plus it adds ambiguity: what if there's a dirname.do *and* a dirname/all? We could resolve the ambiguity if we wanted, but that adds more code, while taking out this special case makes *less* code and improves readability. I think it's the right way to go.
This commit is contained in:
parent
282bb0488e
commit
984ad747f8
13 changed files with 38 additions and 41 deletions
|
|
@ -176,9 +176,6 @@ def main(targets, shouldbuildfunc):
|
|||
|
||||
for i in range(len(targets)):
|
||||
t = targets[i]
|
||||
if os.path.exists('%s/all.do' % t):
|
||||
# t is a directory, but it has a default target
|
||||
targets[i] = '%s/all' % t
|
||||
|
||||
# In the first cycle, we just build as much as we can without worrying
|
||||
# about any lock contention. If someone else has it locked, we move on.
|
||||
|
|
|
|||
|
|
@ -73,9 +73,6 @@ _do()
|
|||
redo()
|
||||
{
|
||||
for i in "$@"; do
|
||||
if [ -e "$i/." ]; then
|
||||
i="$i/all"
|
||||
fi
|
||||
_dirsplit "$i"
|
||||
( cd "$dir" && _do "$dir" "$base" ) || exit $?
|
||||
done
|
||||
|
|
|
|||
|
|
@ -5,8 +5,13 @@ from helpers import debug, err, mkdirp, unlink
|
|||
|
||||
|
||||
def dirty_deps(t, depth):
|
||||
if os.path.exists('%s/.' % t):
|
||||
t = '%s/all' % t
|
||||
try:
|
||||
st = os.stat(t)
|
||||
realtime = st.st_mtime
|
||||
except OSError:
|
||||
st = None
|
||||
realtime = 0
|
||||
|
||||
debug('%s?%s\n' % (depth, t))
|
||||
if state.isbuilt(t):
|
||||
debug('%s-- DIRTY (built)\n' % depth)
|
||||
|
|
@ -20,11 +25,6 @@ def dirty_deps(t, depth):
|
|||
debug('%s-- DIRTY (no stamp)\n' % depth)
|
||||
return True
|
||||
|
||||
try:
|
||||
realtime = os.stat(t).st_mtime
|
||||
except OSError:
|
||||
realtime = 0
|
||||
|
||||
if stamptime != realtime:
|
||||
debug('%s-- DIRTY (mtime)\n' % depth)
|
||||
return True
|
||||
|
|
|
|||
2
t/.gitignore
vendored
2
t/.gitignore
vendored
|
|
@ -8,3 +8,5 @@ test.args
|
|||
test2.args
|
||||
/passfail
|
||||
mode1
|
||||
makedir
|
||||
makedir.log
|
||||
3
t/all.do
3
t/all.do
|
|
@ -1 +1,2 @@
|
|||
redo-ifchange hello yellow bellow c d example/
|
||||
redo-ifchange hello yellow bellow c d example/all
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
redo example/clean curse/clean deps/clean "space dir/clean"
|
||||
rm -f c c.c c.c.c c.c.c.b c.c.c.b.b d mode1
|
||||
rm -f c c.c c.c.c c.c.c.b c.c.c.b.b d mode1 makedir.log
|
||||
rm -f hello [by]ellow *.o *~ .*~ CC LD passfail
|
||||
rm -rf makedir
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
redo-ifchange dir1/
|
||||
redo-ifchange dir1/all
|
||||
echo $$ >>log
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
redo-ifchange dir1
|
||||
echo $$ >>log
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
redo-ifchange dir1/all
|
||||
echo $$ >>log
|
||||
|
|
@ -1,19 +1,15 @@
|
|||
touch t?.do
|
||||
for first in t1 t2 t3; do
|
||||
for second in t1 t2 t3; do
|
||||
rm -f log dir1/log dir1/stinky
|
||||
. ../../flush-cache.sh
|
||||
redo $first
|
||||
touch $second.do
|
||||
. ../../flush-cache.sh
|
||||
redo $second
|
||||
. ../../flush-cache.sh
|
||||
redo-ifchange $second
|
||||
C1="$(wc -l <dir1/log)"
|
||||
C2="$(wc -l <log)"
|
||||
if [ "$C1" != 1 -o "$C2" != 2 ]; then
|
||||
echo "failed: $first>$second, c1=$C1, c2=$C2" >&2
|
||||
rm -f log dir1/log dir1/stinky
|
||||
touch t1.do
|
||||
. ../../flush-cache.sh
|
||||
redo t1
|
||||
touch t1.do
|
||||
. ../../flush-cache.sh
|
||||
redo t1
|
||||
. ../../flush-cache.sh
|
||||
redo-ifchange t1
|
||||
C1="$(wc -l <dir1/log)"
|
||||
C2="$(wc -l <log)"
|
||||
if [ "$C1" != 1 -o "$C2" != 2 ]; then
|
||||
echo "failed: t1>t1, c1=$C1, c2=$C2" >&2
|
||||
exit 55
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
[ -e "$1" ] && rmdir $1
|
||||
rm -rf "$1"
|
||||
mkdir $1
|
||||
echo $$ >>makedir.log
|
||||
|
|
|
|||
7
t/makedir2.do
Normal file
7
t/makedir2.do
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
rm -f makedir.log
|
||||
redo makedir
|
||||
touch makedir/outfile
|
||||
. ./flush-cache.sh
|
||||
redo-ifchange makedir
|
||||
COUNT=$(wc -l <makedir.log)
|
||||
[ "$COUNT" = 1 ] || exit 99
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
redo-ifchange all
|
||||
./hello >&2
|
||||
redo deltest deltest2 test.args test2.args passfailtest \
|
||||
curse/test deps/test "space dir/test" modetest makedir
|
||||
curse/test deps/test "space dir/test" modetest makedir2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue