On Mon, Aug 4, 2014 at 4:36 AM, Quibbler <[email protected]> wrote:
> The manual states that files that are included are relative to the file > containing the include directive. One might expect that same principle to > apply to Tuprules.tup but it does not appear to apply. Given a project > containing a source directory src, subdirectories such as src/A/B/C, and a > variant directory var, one would expect to find a Tuprules.tup file in the > root of the project (in the parent of src and var). Now if there is a > common tup file in src/tup/common.tup, the Tupfile in src/A/B/C might > include it with "include src/tup/common.tup". > > The problem arises when there is a Tuprules.tup file in src/A or src/A/B. > When the Tupfile in src/A/B/C includes src/tup/common.tup, the > include_rules directive in src/tup/common.tup should look for Tuprules.tup > files in all intervening directories such as src, src/A, src/A/B, and > src/A/B/C. According to the manual It is indeterminate whether it should > also check the directories about src/tup/common.tup, but I opine that it > should not. > > The problem is that it does not perform the checks above the including > file, but does perform the checks above the included file. > > It appears to me that this is a bug. The include_rules search should use > the directory context of the include directive. But as of 0.7.1-7-g99f3c3c > it does not. > > Hi Lee, Just to reiterate to make sure I understand correctly: You have src/A/B/C/Tupfile with something like: include ../../../tup/common.tup And a src/tup/common.tup with: include_rules (other common things here) And you are expecting the "include_rules" to include: ./Tuprules.tup src/Tuprules.tup src/A/Tuprules.tup src/A/B/Tuprules.tup src/A/B/C/Tuprules.tup But instead you find that it includes: ./Tuprules.tup src/Tuprules.tup src/tup/Tuprules.tup Is that right? The anticipated usage of include_rules is that it would be used in Tupfiles (generally as the first line), not in included files. (In fact, the Lua parser makes this the default and automatically does the equivalent of include_rules when using Tupfile.lua). I believe include_rules was actually broken for included files, but Doug fixed it with t2102 (see commit df6d6bded). Although including another file that does an include_rules is a bit awkward, I think the current approach does make some sense, since it means that it means the included file (common.tup) has access to the same Tuprules.tup files no matter where it is included from. >From the description of your problem, I'd guess you're trying to avoid having "include_rules" in each Tupfile and instead put it in the common one, is that right? Unfortunately including them automatically wasn't the default behavior from the start, but since it was pretty much standard to have "include_rules" as the first line of every Tupfile, that's why the Lua parser now does it by default. Hope this at least sheds some light on your question - let me know if I misunderstood. -Mike -- -- tup-users mailing list email: [email protected] unsubscribe: [email protected] options: http://groups.google.com/group/tup-users?hl=en --- You received this message because you are subscribed to the Google Groups "tup-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
