recognizing a new extra input

59 views
Skip to first unread message

Gavin Cannizzaro

unread,
Oct 9, 2015, 12:44:29 AM10/9/15
to tup-users
Hi, everyone.

I love love love Tup.  Love it.  I feel like I can say that here.

Consider this Tupfile:

: |> echo a > %o |> a.in
: |> echo 1 > %o |> a--1
#: |> echo 2 > %o |> a--2


: a.in | * |> cat %f %B--* > %o |> %B.out


If you run this, you'll get a.out containing the lines

a
1

Now, if you uncomment the third line, what should happen?

Two things, right?  The line "2" should be written to "b--2", clearly.

But shouldn't "b.out" also be updated to include that line?

For me, it doesn't.  I've tried all sorts of variations, including groups.

This seems like a bug, especially since if I remove "b.out", then it will be regenerated with all three lines.  Of course it will---but we expect the incremental build to match the new build, right?

Also, if I re-comment the third rule at that point, both rules are fired (as expected).  At that point, Tup knows that b--2 was used as an input to b.out.

But I would expect it to to consider b.out "dirty" upon the introduction of the third rule, due to the "*" used as an extra input.  (Again, I've tried it with various globs.)

Long live Tup!

Thanks,
Gavin

Gavin Cannizzaro

unread,
Oct 9, 2015, 12:46:52 AM10/9/15
to tup-users
Sorry, I meant a--2 and a.out (instead of "b").  I was looking at two different examples.

--gavin

Freddie Chopin

unread,
Oct 9, 2015, 4:04:21 AM10/9/15
to tup-...@googlegroups.com
Hello!

There is an issue for this particular problem here:

https://github.com/gittup/tup/issues/214

However your example would work with groups:

> $ cat Tupfile
>
> : |> echo a > %o |> a.in <group>
> : |> echo 1 > %o |> a--1 <group>
>
> #: |> echo 2 > %o |> a--2 <group>
>
> : <group> |> cat %<group> > %o |> a.out
>
> $ tup init
> .tup repository initialized.
> $ tup
> [ tup ] [0.007s] Scanning filesystem...
> [ tup ] [0.014s] Reading in new environment variables...
> [ tup ] [0.021s] Parsing Tupfiles...
>
> 1) [0.001s] .
> [ ] 100%
>
> [ tup ] [0.026s] No files to delete.
> [ tup ] [0.026s] Checking circular dependencies among groups...
> [ tup ] [0.026s] Generating .gitignore files...
> [ tup ] [0.034s] Executing Commands...
>
> 1) [0.001s] echo 1 > a--1
> 2) [0.001s] echo a > a.in
> 3) [0.001s] cat %<group> > a.out
> [ ] 100%
>
> [ tup ] [0.043s] Updated.
> $ cat a.out
> a
> 1
> $ <edit the Tupfile, uncomment the third line>
> $ cat Tupfile
>
> : |> echo a > %o |> a.in <group>
> : |> echo 1 > %o |> a--1 <group>
> : |> echo 2 > %o |> a--2 <group>
> :
> : <group> |> cat %<group> > %o |> a.out
>
> $ tup
> [ tup ] [0.000s] Scanning filesystem...
> [ tup ] [0.006s] Reading in new environment variables...
> [ tup ] [0.006s] Parsing Tupfiles...
>
> 1) [0.001s] .
> [ ] 100%
>
> [ tup ] [0.007s] No files to delete.
> [ tup ] [0.007s] Checking circular dependencies among groups...
> [ tup ] [0.007s] Generating .gitignore files...
> [ tup ] [0.013s] Executing Commands...
>
> 1) [0.001s] echo 2 > a--2
> 2) [0.001s] cat %<group> > a.out
> [ ] 100%
>
> [ tup ] [0.022s] Updated.
> $ cat a.out
> a
> 1
> 2
> $

This simple example would also work with {bins}.

Regards,
FCh

Gavin Cannizzaro

unread,
Nov 2, 2015, 3:22:07 PM11/2/15
to tup-users
Hi Freddie,

A belated thanks for this tip.

I was able to get something working using this %<group> construct.  It's a bit hackish (in my particular case), since I ended up merely echoing the value of %<group>, which somehow caused Tup to behave as I wanted.  But I understand the difficulty with the underlying issue.

The %<group> feature (as a command flag) is not mentioned in the manual.  I think I have read everything in the docs (including journal.html!)---is there some documentation of how this works exactly?

Further to that... not being a C programmer myself, but being a great fan of Tup, is there some way that I can help with the project?


Thanks for all your help,
Gavin

Mike Shal

unread,
Nov 16, 2015, 10:42:48 AM11/16/15
to tup-...@googlegroups.com
On Mon, Nov 2, 2015 at 3:22 PM, Gavin Cannizzaro <ga...@gavinpc.com> wrote:
Hi Freddie,

A belated thanks for this tip.

I was able to get something working using this %<group> construct.  It's a bit hackish (in my particular case), since I ended up merely echoing the value of %<group>, which somehow caused Tup to behave as I wanted.  But I understand the difficulty with the underlying issue.

Is there a reason you can't use a bin to group the inputs to the final rule? Something like:

: |> echo a > %o |> a.in {a-files}
: |> echo 1 > %o |> a--1 {a-files}
#: |> echo 2 > %o |> a--2 {a-files}


: {a-files} |> cat %> %o |> %B.out

 

The %<group> feature (as a command flag) is not mentioned in the manual.  I think I have read everything in the docs (including journal.html!)---is there some documentation of how this works exactly?

Not yet :(. If there is not an issue for documenting it yet please feel free to file one!
 

Further to that... not being a C programmer myself, but being a great fan of Tup, is there some way that I can help with the project?

Thanks for your offer! What sorts of things are you interested in? One thing that might be helpful is just going through the list of open github issues and seeing if any can be closed because they've already been fixed. I've been pretty terrible about updating github :(

-Mike
Reply all
Reply to author
Forward
0 new messages