You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The lua copies from source to dest and I want the destination to be build-dbg/root/lib/sample.txt but it winds up at 'build-dbg/src/utils/root/lib/sample.txt'
[0.029s] [build-dbg] src/utils/test: cp -v sample.txt ../../../build-dbg/src/utils/test/../root/lib/sample.txt
'sample.txt' -> '../../../build-dbg/src/utils/test/../root/lib/sample.txt'
[ ] 100%
[ tup ] [0.104s] Updated. If I try to add a rule to copy from where the result should be: $(DIR_LIBS)/sample.txt |> !cp |> $(DIR_TEST)/%bproduces an error:tup error: Failed to find directory ID for dir '../../../root/lib/sample.txt' relative to '[build-dbg] src/utils/test'
tup error: Error parsing Tupfile line 16
Line was: ': $(DIR_LIBS)/sample.txt |> !cp |> $(DIR_TEST)/%b'
[ ] 100%`
But if I change the DST to $(TUP_VARIANTDIR)/sample.txt and the copy rule to : $(TUP_VARIANTDIR)/sample.txt |> !cp |> $(DIR_LIBS)/%b
I finally get the file where I want it build-dbg/root/nimble/lib/sample.txt
Let me clean this up a bit.
I create VARIANT_ROOT = $(TUP_VARIANTDIR) in the topmost Tuprules.tup to use to define DIR_TEST = $(VARIANT_ROOT)/root/test
The attached example has a lua which generates a cp command to copy a file to a destination. If the destination is specified as $(DIR_TEST)/sample.txt from src/utils/test the result winds up in build-dbg/src/utils/src/utils/test/root/test/sample.txt rather than build-dbg/root/test/sample.txt as intended.
If I add a rule to the Tupfile to copy the result from $(DIR_TEST)/sample.txt to $(DIR_BIN)/%b produces the error:
`
tup error: Failed to find directory ID for dir '../../../root/test/sample.txt' relative to '[build-dbg] src/utils/test'
tup error: Error parsing Tupfile line 17
I'm not sure if I fully understood your test tarball in terms of what was expected to work and what was debug or a work in progress, but I do see how there was a problem with tup.getvariantdir() in Lua. I believe that is fixed with commit 41d1302, but I'm not sure if that fixes your problem here or not. Can you give the latest a try and see if things are working as you expect? If not, can you try to distill it down to a simpler test case? Thanks!
I'm having a problem getting a lua file to generate a rule which outputs to a different directory. I've simplified the example to highlight the issue.
TEST_SAMPLE_SRC = sample.txt
TEST_SAMPLE_DST = $(DIR_LIBS)/sample.txt
The lua copies from source to dest and I want the destination to be
build-dbg/root/lib/sample.txt
but it winds up at 'build-dbg/src/utils/root/lib/sample.txt'`
[rodried@ln80-ryzen-build0-lazyk-local:60]
/git/tup_test3/sw(master)> rm -rf build-*/ .tup && tup-v0.7.11-120-g8739d024 init && tup-v0.7.11-120-g8739d024 variant build_tools/variants/dbg.config/git/tup_test3/sw(master)> tup-v0.7.11-120-g8739d024 --verbose.tup repository initialized: .tup/db
tup: Added variant 'build-dbg' using config file 'build_tools/variants/dbg.config'
[rodried@ln80-ryzen-build0-lazyk-local:61]
[ tup ] [0.007s] Scanning filesystem...
[ tup ] [0.026s] Reading in new configuration/environment variables...
0) new variant: [build-dbg] tup.config
[ ] 100%
[ tup ] [0.045s] Parsing Tupfiles...
6) [0.002s] [build-dbg] build_tools/variants
5) [0.001s] [build-dbg] build_tools
4) [0.006s] [build-dbg] src/utils/test
src_name=sample.txt
dst_name=%18t/root/lib/sample.txt
VARIANTDIR=%18t
VARIANT_OUTPUTDIR=../../../build-dbg/src/utils/test
tup.getcwd()=../../../build_tools
tup.getdirectory()=build_tools
tup.getvariantdir()=../../../build-dbg/build_tools
elements[1]="%18t/root/lib/sample.txt"
result=../../../build-dbg/build_tools/../root/lib/sample.txt
fix_dst_name=../../../build-dbg/build_tools/../root/lib/sample.txt
cp_cmd=^ BIN %o^ cp -v %f %o
cp_rule=../root/lib/sample.txt
3) [0.001s] [build-dbg] src/utils
2) [0.001s] [build-dbg] src/include
[ ] 100%
[ tup ] [0.061s] No files to delete.
[ tup ] [0.061s] Generating .gitignore files...
[ tup ] [0.067s] Executing Commands...
'sample.txt' -> '../../../build-dbg/src/utils/test/../root/lib/sample.txt'
[ ] 100%
[ tup ] [0.104s] Updated.
If I try to add a rule to copy from where the result should be
:produces an error:
tup error: Failed to find directory ID for dir '../../../root/lib/sample.txt' relative to '[build-dbg] src/utils/test'tup error: Error parsing Tupfile line 16
Line was: ':
[ ] 100%`
But if I change the DST to $(TUP_VARIANTDIR)/sample.txt and the copy rule to
: $(TUP_VARIANTDIR)/sample.txt |> !cp |> $(DIR_LIBS)/%b
I finally get the file where I want it
build-dbg/root/nimble/lib/sample.txt
tup_test3.tgz
The text was updated successfully, but these errors were encountered: