Deleted Added
full compact
40c40
< $Id: meta2deps.py,v 1.17 2014/04/05 22:56:54 sjg Exp $
---
> $Id: meta2deps.py,v 1.18 2015/04/03 18:23:25 sjg Exp $
115c115,116
< if (path.find('./') > 0 or
---
> if (path.find('/') < 0 or
> path.find('./') > 0 or
145c146
<
---
> excludes = []
181a183,186
> EXCLUDES
> A list of paths to ignore.
> ccache(1) can otherwise be trouble.
>
239c244,246
<
---
>
> self.excludes = getv(conf, 'EXCLUDES', [])
>
243a251
> print("excludes=", self.excludes, file=self.debug_out)
259a268
> self.last_dir = self.cwd
363c372
< F "pid" "child"
---
> F "pid" "child"
367,371c376,380
< D "pid" "path"
< L "pid" "src" "target"
< M "pid" "old" "new"
< S "pid" "path"
< # Bye bye
---
> D "pid" "path"
> L "pid" "src" "target"
> M "pid" "old" "new"
> S "pid" "path"
> # Bye bye
373,374c382,383
< We go to some effort to avoid processing a dependency more than once.
< Of the above record types only C,E,F,L,R,V and W are of interest.
---
> We go to some effort to avoid processing a dependency more than once.
> Of the above record types only C,E,F,L,R,V and W are of interest.
382c391
< cwd = last_dir = self.cwd
---
> cwd = self.last_dir = self.cwd
415c424
< self.cwd = cwd = last_dir = w[1]
---
> self.cwd = cwd = self.last_dir = w[1]
425c434
< pid_last_dir[last_pid] = last_dir
---
> pid_last_dir[last_pid] = self.last_dir
427c436
< last_dir = getv(pid_last_dir, pid, self.cwd)
---
> self.last_dir = getv(pid_last_dir, pid, self.cwd)
441c450
< last_dir = cwd
---
> self.last_dir = cwd
452,456c461,464
< path = w[2].strip("'")
< else:
< path = w[2]
< # we are never interested in .dirdep files as dependencies
< if path.endswith('.dirdep'):
---
> # these are special, tread src as read and
> # target as write
> self.parse_path(w[1].strip("'"), cwd, 'R', w)
> self.parse_path(w[2].strip("'"), cwd, 'W', w)
458,464c466,483
< # we don't want to resolve the last component if it is
< # a symlink
< path = resolve(path, cwd, last_dir, self.debug, self.debug_out)
< if not path:
< continue
< dir,base = os.path.split(path)
< if dir in self.seen:
---
> elif w[0] in 'ERWS':
> path = w[2]
> self.parse_path(path, cwd, w[0], w)
>
> if not file:
> f.close()
>
> def parse_path(self, path, cwd, op=None, w=[]):
> """look at a path for the op specified"""
>
> if not op:
> op = w[0]
>
> # we are never interested in .dirdep files as dependencies
> if path.endswith('.dirdep'):
> return
> for p in self.excludes:
> if p and path.startswith(p):
466,490c485,517
< print("seen:", dir, file=self.debug_out)
< continue
< # we can have a path in an objdir which is a link
< # to the src dir, we may need to add dependencies for each
< rdir = dir
< dir = abspath(dir, cwd, last_dir, self.debug, self.debug_out)
< if rdir == dir or rdir.find('./') > 0:
< rdir = None
< # now put path back together
< path = '/'.join([dir,base])
< if self.debug > 1:
< print("raw=%s rdir=%s dir=%s path=%s" % (w[2], rdir, dir, path), file=self.debug_out)
< if w[0] in 'SRWL':
< if w[0] == 'W' and path.endswith('.dirdep'):
< continue
< if path in [last_dir, cwd, self.cwd, self.curdir]:
< if self.debug > 1:
< print("skipping:", path, file=self.debug_out)
< continue
< if os.path.isdir(path):
< if w[0] in 'RW':
< last_dir = path;
< if self.debug > 1:
< print("ldir=", last_dir, file=self.debug_out)
< continue
---
> print >> self.debug_out, "exclude:", p, path
> return
> # we don't want to resolve the last component if it is
> # a symlink
> path = resolve(path, cwd, self.last_dir, self.debug, self.debug_out)
> if not path:
> return
> dir,base = os.path.split(path)
> if dir in self.seen:
> if self.debug > 2:
> print("seen:", dir, file=self.debug_out)
> return
> # we can have a path in an objdir which is a link
> # to the src dir, we may need to add dependencies for each
> rdir = dir
> dir = abspath(dir, cwd, self.last_dir, self.debug, self.debug_out)
> if rdir == dir or rdir.find('./') > 0:
> rdir = None
> # now put path back together
> path = '/'.join([dir,base])
> if self.debug > 1:
> print("raw=%s rdir=%s dir=%s path=%s" % (w[2], rdir, dir, path), file=self.debug_out)
> if op in 'RWS':
> if path in [self.last_dir, cwd, self.cwd, self.curdir]:
> if self.debug > 1:
> print("skipping:", path, file=self.debug_out)
> return
> if os.path.isdir(path):
> if op in 'RW':
> self.last_dir = path;
> if self.debug > 1:
> print("ldir=", self.last_dir, file=self.debug_out)
> return
492,507c519,534
< if w[0] in 'REWML':
< # finally, we get down to it
< if dir == self.cwd or dir == self.curdir:
< continue
< srctop = self.find_top(path, self.srctops)
< if srctop:
< if self.dpdeps:
< self.add(self.file_deps, path.replace(srctop,''), 'file')
< self.add(self.src_deps, dir.replace(srctop,''), 'src')
< self.seenit(w[2])
< self.seenit(dir)
< if rdir and not rdir.startswith(srctop):
< dir = rdir # for below
< rdir = None
< else:
< continue
---
> if op in 'ERW':
> # finally, we get down to it
> if dir == self.cwd or dir == self.curdir:
> return
> srctop = self.find_top(path, self.srctops)
> if srctop:
> if self.dpdeps:
> self.add(self.file_deps, path.replace(srctop,''), 'file')
> self.add(self.src_deps, dir.replace(srctop,''), 'src')
> self.seenit(w[2])
> self.seenit(dir)
> if rdir and not rdir.startswith(srctop):
> dir = rdir # for below
> rdir = None
> else:
> return
509,515c536,540
< objroot = None
< for dir in [dir,rdir]:
< if not dir:
< continue
< objroot = self.find_top(dir, self.objroots)
< if objroot:
< break
---
> objroot = None
> for dir in [dir,rdir]:
> if not dir:
> continue
> objroot = self.find_top(dir, self.objroots)
517,525c542,550
< ddep = self.find_obj(objroot, dir, path, w[2])
< if ddep:
< self.add(self.obj_deps, ddep, 'obj')
< else:
< # don't waste time looking again
< self.seenit(w[2])
< self.seenit(dir)
< if not file:
< f.close()
---
> break
> if objroot:
> ddep = self.find_obj(objroot, dir, path, w[2])
> if ddep:
> self.add(self.obj_deps, ddep, 'obj')
> else:
> # don't waste time looking again
> self.seenit(w[2])
> self.seenit(dir)
532c557
< script [options] [key=value ...] "meta" ...
---
> script [options] [key=value ...] "meta" ...
538c563
< add "SRCTOP" to the "SRCTOPS" list.
---
> add "SRCTOP" to the "SRCTOPS" list.
543c568
< add "OBJROOT" to the "OBJROOTS" list.
---
> add "OBJROOT" to the "OBJROOTS" list.
553c578
< -d bumps debug level
---
> -d bumps debug level
570a596
> 'EXCLUDES': [],
592c618
< opts, args = getopt.getopt(argv[1:], 'a:dS:C:O:R:m:D:H:qT:' + xopts)
---
> opts, args = getopt.getopt(argv[1:], 'a:dS:C:O:R:m:D:H:qT:X:' + xopts)
617a644,646
> elif o == '-X':
> if a not in conf['EXCLUDES']:
> conf['EXCLUDES'].append(a)
651a681
> m = None
653a684,685
> if not os.path.exists(a):
> continue
658a691,692
> if not os.path.exists(f):
> continue
661c695
< if output:
---
> if output and m: