redo.py: report when you're trying to rebuild a static file.

In redo-ifchange, this might be a good idea, since you might just want to
set a dependency on it, so we won't say anything from inside builder.py.
But if you're calling redo.py, that means you expect it to be rebuilt, since
there's no other reason to try.  So print a warning.

(This is what make does, more or less.)
This commit is contained in:
Avery Pennarun 2010-12-11 21:19:15 -08:00
commit 1cb000ece1
3 changed files with 13 additions and 5 deletions

View file

@ -10,14 +10,11 @@ import vars, state, builder, jwack
from helpers import unlink
from log import debug, debug2, err
def _nice(t):
return state.relpath(os.path.join(vars.BASE, t), vars.STARTDIR)
CLEAN = 0
DIRTY = 1
def dirty_deps(f, depth, max_changed):
if vars.DEBUG >= 1:
debug('%s?%s\n' % (depth, _nice(f.name)))
debug('%s?%s\n' % (depth, f.nicename()))
if f.failed_runid:
debug('%s-- DIRTY (failed last time)\n' % depth)

View file

@ -39,9 +39,16 @@ import vars_init
vars_init.init(targets)
import vars, state, builder, jwack
from log import err
from log import warn, err
try:
for t in targets:
if os.path.exists(t):
f = state.File(name=t)
if not f.is_generated:
warn('%s: exists and not marked as generated; not redoing.\n'
% f.nicename())
j = atoi(opt.jobs or 1)
if j < 1 or j > 1000:
err('invalid --jobs value: %r\n' % opt.jobs)

View file

@ -276,6 +276,10 @@ class File(object):
# a "unique identifier" stamp for a regular file
return str((st.st_ctime, st.st_mtime, st.st_size, st.st_ino))
def nicename(self):
return relpath(os.path.join(vars.BASE, self.name), vars.STARTDIR)
# FIXME: I really want to use fcntl F_SETLK, F_SETLKW, etc here. But python
# doesn't do the lockdata structure in a portable way, so we have to use