Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
{ood,sources,targets}: fix relative paths; turn missing targets into …
…sources. When we check dependencies and a previously-is_generated dependency existed before, but no longer does, forget that it was is_generated. This slightly improves the situation where as a project evolves, a file that used to be a target gets removed, and then later is re-added as a static source file. (It doesn't fix the other variant, where a file is changed from target to source in a single atomic change, and is never missing. That one will be trickier to handle.) While adding a test for this behaviour, I discovered that redo-sources, redo-targets, and redo-ood were reporting their output relative to STARTDIR instead of relative to $PWD, so fix that too.
- Loading branch information
Showing
11 changed files
with
89 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
rm -f touch1 touch1-ran *~ .*~ | ||
rm -f touch1 touch1-ran *~ .*~ silence.do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
bork | ||
bork.do | ||
bork.log | ||
sub | ||
sub.log | ||
targets.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
exec >&2 | ||
rm -f bork.do bork bork.log sub sub.log targets.out | ||
|
||
qgrep() { | ||
# like "grep -q", but portable | ||
grep "$@" >/dev/null | ||
} | ||
|
||
cp bork.do.in bork.do | ||
redo bork | ||
[ "$(cat bork.log)" = "x" ] || exit 2 | ||
redo bork | ||
[ "$(cat bork.log)" = "xx" ] || exit 3 | ||
|
||
redo-ifchange sub | ||
[ "$(cat bork.log)" = "xx" ] || exit 10 | ||
[ "$(cat sub.log)" = "y" ] || exit 11 | ||
. ../skip-if-minimal-do.sh | ||
redo-sources | qgrep '^bork$' && exit 12 | ||
redo-targets | tee targets.out | qgrep '^bork$' || exit 13 | ||
|
||
# Might as well test redo-ood while we're here | ||
../flush-cache | ||
redo bork | ||
redo-targets | qgrep '^bork$' || exit 15 | ||
redo-targets | qgrep '^sub$' || exit 16 | ||
redo-ood | qgrep '^sub$' || exit 17 | ||
|
||
redo-ifchange sub | ||
[ "$(cat bork.log)" = "xxx" ] || exit 18 | ||
[ "$(cat sub.log)" = "yy" ] || exit 19 | ||
|
||
rm -f bork | ||
../flush-cache | ||
redo-ifchange sub # rebuilds, and sub.do drops dependency on bork | ||
[ "$(cat bork.log)" = "xxx" ] || exit 20 | ||
[ "$(cat sub.log)" = "yyy" ] || exit 21 | ||
redo-sources | qgrep '^bork$' && exit 22 # nonexistent, so not a source | ||
redo-targets | qgrep '^bork$' && exit 23 # deleted; not a target anymore | ||
|
||
echo static >bork | ||
../flush-cache | ||
redo-ifchange sub # doesn't depend on bork anymore, so doesn't rebuild | ||
[ "$(cat bork.log)" = "xxx" ] || exit 30 | ||
[ "$(cat sub.log)" = "yyy" ] || exit 31 | ||
|
||
# bork should now be considered static, so no warning or need to rebuild. | ||
# It should now be considered a source, not a target. | ||
redo sub # force rebuild; sub.do now declares dependency on bork | ||
[ "$(cat bork.log)" = "xxx" ] || exit 40 | ||
[ "$(cat sub.log)" = "yyyy" ] || exit 41 | ||
redo-sources | qgrep '^bork$' || exit 42 | ||
redo-targets | qgrep '^bork$' && exit 43 | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
echo bork | ||
printf x >>$1.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
rm -f *~ .*~ bork bork.do bork.log sub sub.log targets.out | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ -e bork ] && redo-ifchange bork | ||
echo sub | ||
printf y >>$1.log |