Failed to reproduce %<group> example in tup manual

32 views
Skip to first unread message

Peter Jaspers

unread,
Jan 8, 2024, 9:43:23 AMJan 8
to tup-users
I tried to reproduce the %<group> example in the %-flags section of the tup manual
on my Windows computer. This failed: the content of the resulting submodules_group.txt
file was not as expected (it was empty, see below).

Directories and files:
test_tup\
    .tup\
    project\
        Tupfile
    submodules\
        sm1\
            foo.cpp
            Tupfile
        sm2\
            bar.cpp
            Tupfile

Tupfiles:
#test_tup\submodules\sm1\Tupfile
: foo.cpp |> cmd /c copy %f %o |> %B.obj ..\<submodgroup>
 
#test_tup\submodules\sm2\Tupfile
: bar.cpp |> cmd /c copy %f %o |> %B.obj ..\<submodgroup>

# test_tup\project\Tupfile
: ../submodules/<submodgroup> |> echo "%f" > %o |> submodules_f.txt
: ../submodules/<submodgroup> |> echo '%<submodgroup>' > %o |> submodules_group.txt 

Running tup produces all 4 expected output files.
submodules_f.txt contains the expected "../submodules/<submodgroup>".
submodules_group.txt however only contains 2 quotes ('') instead of the expected
../submodules/sm1/foo.o ../submodules/sm2/bar.o

Note:using echo '%f' > %o  instead of  echo "%f" > %o made the build fail:
[ tup ] [0.041s] Executing Commands...
* 0) project: echo '../submodules/<submodgroup>' > submodules_f.txt
Het systeem kan het opgegeven bestand niet vinden.

Replacing echo '%<submodgroup>'  by echo "%<submodgroup>" results in 
submodules_group.txt to contain ""

What am I doing wrong?

Peter Jaspers

unread,
Jan 9, 2024, 10:20:02 AMJan 9
to tup-users
I found my mistake: I used backward slash instead of forward slash:  ..\<submodgroup> must be ../<submodgroup>
And for who wonders what " Het systeem kan het opgegeven bestand niet vinden" means: it is Dutch for "The system can not find the given file".


Op maandag 8 januari 2024 om 15:43:23 UTC+1 schreef Peter Jaspers:

Mike Shal

unread,
Jan 9, 2024, 8:22:38 PMJan 9
to tup-...@googlegroups.com
Tup uses the backslash character in paths as an escape character, primarily to support filenames with spaces. Eg: an output of "foo bar" can be written as foo\ bar in the output section. To put an actual backslash in the path, you'd have to use \\, so the example should work with ..\\<submodgroup>

Note that tup should work fine on Windows when the subprocess uses files with backslash as the path separator. So both of the following should work:

: |> cmd /c copy input foo\bar |> foo/bar
: |> cmd /c copy input foo\bar2 |> foo\\bar2

I'm not sure about the difference between single and double-quotes, and I'm unable to reproduce it. Is that still causing a problem for you?

-Mike

--
--
tup-users mailing list
email: tup-...@googlegroups.com
unsubscribe: tup-users+...@googlegroups.com
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 tup-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tup-users/b9b4e941-47ff-4307-84e2-0e5b99986becn%40googlegroups.com.

Peter Jaspers

unread,
Jan 9, 2024, 10:57:55 PMJan 9
to tup-users
Thanks for explaining the use of backslashes. 

’m not sure about the difference between single and double-quotes, and I'm unable to reproduce it. Is that still causing a problem for you?

It is not causing a problem now that I  know the workaround. But it still puzzles me. 

Peter

Op woensdag 10 januari 2024 om 02:22:38 UTC+1 schreef mar...@gmail.com:
Reply all
Reply to author
Forward
0 new messages