[Omake] Set of changed files

Luis O'Shea loshea at gmail.com
Tue May 6 13:31:09 PDT 2008


Aleksey Nogin wrote:
> On 05.05.2008 18:51, Luis O'Shea wrote:
> 
>> Is there a way for a rule to find out which of its dependencies have
>> changed?  (This is not idle curiosity -- I actually need it.)
> 
> I believe that this information is not readily available in current 
> OMake. How do you need to use this information - perhaps there is some 
> alternative way to do what you need?

I would like to implement a simple fixed point build within omake (see 
http://lists.metaprl.org/pipermail/omake/2007-March/001505.html) to aid 
in compiling LaTeX documents.

Suppose you have a document a.tex and a bibliography x.bib, then a 
typical run to produce the final DVI would look like

   latex a
   bibtex a
   latex a
   latex a

Things can get more complicated than the above, of course.

The current approach (as implemented in LaTeX.om) has the following issues:
  1) It does not detect changes to x.bib
  2) It decides whether to rerun latex by regexing for certain output 
from latex.  This means that it will not work properly with biblatex 
(since it produces different output).

One possible solution is to build a latex document using a rule that 
computes the digests of its dependencies and then keeps running latex 
until the digests stabilize.  This solves (2).

Bibtex complicates things because we would like to only re-latex if 
necessary.  For example, if an additional and irrelevant entry is added 
to x.bib it would be nice if it would result in "bibtex a" being 
executed, but no further runs of latex.  It seems to me that if a rule 
could determine which dependencies caused it run, then it could do this. 
  The logic, in terms of a new omake function "changed", would go 
something like this (I'm sure my code has bugs, though):

# pseudo omake
a.dvi: a.tex x.bib a.aux
   d1 = $(digest-optional a.aux)
   if $(changed a.tex) or $(changed a.aux)
     latex a
   d2 = $(digest-optional a.aux)
   if $(changed x.bib) or $(changed a.aux) or d1 != d2
     bibtex a
     d2 = $(digest-optional a.aux)
     latex a
     export d2
   d3 = $(digest-optional a.aux)
   if d2 != d3
     latex a
     d4 = $(digest-optional a.aux)
     if d3 != d4
       latex a

Thanks,

Luis


More information about the Omake mailing list