On Mon, Nov 28, 2016 at 10:48 AM, Erik Brinkman <[email protected]> wrote: > Hi Matthias > > As far as I understand, `tup parse` instructs tup to run the parse phase, > e.g. read all files that have changed and update the database accordingly. > This obviously needs to be done before you could generate a todo. I think > the reason why parse is separate from todo is for use cases like `tup ref`. > tup parse is somewhat irreversible, and so you don't want it triggered on > accident, whereas todo is just formatting information from the database. It > would probably be helpful to have something like `tup todo -f` that forces a > parse if needed, and in my experience Mike has been very receptive pull > requests.
Erik is correct here - 'tup todo' isn't supposed to alter the database (except for the initial scan), and it won't know what commands need to be run unless Tupfiles are parsed. To elaborate a little further, tup runs in a few phases, which are visible in the top-level progress bar: $ tup phase 0: [ tup ] [0.000s] Scanning filesystem... phase 1: [ tup ] [0.000s] Reading in new environment variables... phase 2: [ tup ] [0.001s] No Tupfiles to parse. phase 2 (part of the parsing step): [ tup ] [0.001s] No files to delete. phase 3: [ tup ] [0.001s] No commands to execute. final message: [ tup ] [0.001s] Updated. The numbered steps correspond to commands like so: 0: tup scan (this step is skipped if the monitor is running) 1: tup read 2: tup parse 3: tup upd (or just 'tup') Normally you don't care about any of these intermediate steps or the "phase" numbers, but the commands exist to tell tup to stop processing after a particular step. 'tup todo' goes through each step looking for things that need to be done, and stops as soon as it finds something. For example, if you changed a tup.config file, 'tup todo' would show this: $ tup todo [ tup ] Scanning filesystem... Tup phase 1: The following tup.config files must be parsed: 100% tup.config Run 'tup read' to proceed to phase 2. So if we run 'tup read', we go past phase 1, and the next 'tup todo' will show us what needs to be parsed: $ tup read [ tup ] [0.000s] Scanning filesystem... [ tup ] [0.003s] Reading in new configuration/environment variables... 1) updated variant: tup.config [ ] 100% $ tup todo [ tup ] Scanning filesystem... Tup phase 2: The following directories must be parsed: 100% . Run 'tup parse' to proceed to phase 3. This tells us the top-level Tupfile needs to be parsed before we know what commands have to execute. So then a 'tup parse' and a 'tup todo' shows what sub-processes will be executed: $ tup parse [ tup ] [0.000s] Scanning filesystem... [ tup ] [0.000s] Reading in new environment variables... [ tup ] [0.001s] Parsing Tupfiles... 1) [0.002s] . [ ] 100% [ tup ] [0.005s] No files to delete. $ tup todo [ tup ] Scanning filesystem... Tup phase 3: The following 1 command will be executed: 100% echo foo Run 'tup upd' to bring the system up-to-date. Here we can see that tup will run 'echo foo' if we execute an update. So if we do the final 'tup upd' you'll see the command execute: $ tup [ tup ] [0.000s] Scanning filesystem... [ tup ] [0.000s] Reading in new environment variables... [ tup ] [0.001s] No Tupfiles to parse. [ tup ] [0.001s] No files to delete. [ tup ] [0.001s] Executing Commands... 1) [0.016s] echo foo foo [ ] 100% [ tup ] [0.037s] Updated. $ tup todo [ tup ] Scanning filesystem... tup: Everything is up-to-date. And the last 'tup todo' reports nothing to do. In short, if all you care about are the commands that will be executed, 'tup parse && tup todo' is probably what you want (I think this is equivalent to Erik's proposed 'tup todo -f'). But you can use the other commands as well to get a more detailed look at what's going on behind the scenes. -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.
