diff options
author | Simon J. Gerraty <sjg@FreeBSD.org> | 2014-01-27 17:47:21 +0000 |
---|---|---|
committer | Simon J. Gerraty <sjg@FreeBSD.org> | 2014-01-27 17:47:21 +0000 |
commit | 0dede8b0ba255c53c183d0cc15b6c52e9bb54794 (patch) | |
tree | 891905810fa98d3e2af074a163a102a34c3641ad /contrib/bmake/mk | |
parent | 6eebe8507a002f43ee9254dbcb369c87eb399315 (diff) | |
parent | d4343fd8915df5721887ab4615e263b27845c629 (diff) | |
download | src-0dede8b0ba255c53c183d0cc15b6c52e9bb54794.tar.gz src-0dede8b0ba255c53c183d0cc15b6c52e9bb54794.zip |
Notes
Diffstat (limited to 'contrib/bmake/mk')
-rw-r--r-- | contrib/bmake/mk/ChangeLog | 19 | ||||
-rw-r--r-- | contrib/bmake/mk/dirdeps.mk | 15 | ||||
-rw-r--r-- | contrib/bmake/mk/install-mk | 4 | ||||
-rwxr-xr-x | contrib/bmake/mk/meta2deps.py | 66 |
4 files changed, 65 insertions, 39 deletions
diff --git a/contrib/bmake/mk/ChangeLog b/contrib/bmake/mk/ChangeLog index b5471975a010..973db00b8a30 100644 --- a/contrib/bmake/mk/ChangeLog +++ b/contrib/bmake/mk/ChangeLog @@ -1,3 +1,22 @@ +2013-12-12 Simon J. Gerraty <sjg@bad.crufty.net> + + * install-mk (MK_VERSION): bump version + * meta2deps.py: convert to print function for python3 compat. + we also need to open files with mode 'r' rather than 'rb' + otherwise we get bytes instead of strings. + +2013-10-10 Simon J. Gerraty <sjg@bad.crufty.net> + + * install-mk (MK_VERSION): bump version + + * dirdeps.mk: when TARGET_SPEC_VARS is more than just MACHINE + apply the same filtering (M_dep_qual_fixes) when setting _machines + as _build_dirs. + Also fix the filtering of Makefile.depend files - for reporting + what we are looking for (M_dep_qual_fixes can get confused by + Makefile.depend) + Add some more debug info. + 2013-09-04 Simon J. Gerraty <sjg@bad.crufty.net> * gendirdeps.mk (_objtops): fix typo also diff --git a/contrib/bmake/mk/dirdeps.mk b/contrib/bmake/mk/dirdeps.mk index e812416cc88e..3335fdb0943a 100644 --- a/contrib/bmake/mk/dirdeps.mk +++ b/contrib/bmake/mk/dirdeps.mk @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.28 2013/03/25 21:11:43 sjg Exp $ +# $Id: dirdeps.mk,v 1.29 2013/10/13 18:43:53 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -149,11 +149,11 @@ DEP_$v ?= ${$v} JOT ?= jot _tspec_x := ${${JOT} ${TARGET_SPEC_VARS:[#]}:L:sh} # this handles unqualified entries -M_dep_qual_fixes = C;(/[^/.,]+)$$;\1.${DEP_TARGET_SPEC}; +M_dep_qual_fixes = C;(/[^/.,]+)$$;\1.$${DEP_TARGET_SPEC}; # there needs to be at least one item missing for these to make sense .for i in ${_tspec_x:[2..-1]} _tspec_m$i := ${TARGET_SPEC_VARS:[2..$i]:@w@[^,]+@:ts,} -_tspec_a$i := ,${TARGET_SPEC_VARS:[$i..-1]:@v@$${DEP_$v}@:ts,} +_tspec_a$i := ,${TARGET_SPEC_VARS:[$i..-1]:@v@$$$${DEP_$v}@:ts,} M_dep_qual_fixes += C;(\.${_tspec_m$i})$$;\1${_tspec_a$i}; .endfor .else @@ -359,7 +359,8 @@ _machines := ${_machines:O:u} .if ${TARGET_SPEC_VARS:[#]} > 1 # we need to tweak _machines _dm := ${DEP_MACHINE} -_machines := ${_machines:@DEP_MACHINE@${DEP_TARGET_SPEC}@} +# apply the same filtering that we do when qualifying DIRDEPS. +_machines := ${_machines:@DEP_MACHINE@${DEP_TARGET_SPEC}@:${M_dep_qual_fixes:ts:}:O:u} DEP_MACHINE := ${_dm} .endif @@ -464,6 +465,9 @@ ${_this_dir}.$m: ${_build_dirs:M*.$m:N${_this_dir}.$m} .if ${_DIRDEP_CHECKED:M$d} == "" # once only _DIRDEP_CHECKED += $d +.if !empty(_debug_search) +.info checking $d +.endif # Note: _build_dirs is fully qualifed so d:R is always the directory .if exists(${d:R}) # Warning: there is an assumption here that MACHINE is always @@ -471,7 +475,8 @@ _DIRDEP_CHECKED += $d # If TARGET_SPEC and MACHINE are insufficient, you have a problem. _m := ${.MAKE.DEPENDFILE_PREFERENCE:T:S;${TARGET_SPEC}$;${d:E};:S;${MACHINE};${d:E:C/,.*//};:@m@${exists(${d:R}/$m):?${d:R}/$m:}@:[1]} .if !empty(_m) -_qm := ${_m:${M_dep_qual_fixes:ts:}} +# M_dep_qual_fixes isn't geared to Makefile.depend +_qm := ${_m:C;(\.depend)$;\1.${d:E};:${M_dep_qual_fixes:ts:}} .if !empty(_debug_search) .info Looking for ${_qm} .endif diff --git a/contrib/bmake/mk/install-mk b/contrib/bmake/mk/install-mk index 0640906a2438..b91a961410ae 100644 --- a/contrib/bmake/mk/install-mk +++ b/contrib/bmake/mk/install-mk @@ -55,7 +55,7 @@ # Simon J. Gerraty <sjg@crufty.net> # RCSid: -# $Id: install-mk,v 1.93 2013/08/02 18:28:47 sjg Exp $ +# $Id: install-mk,v 1.95 2013/12/20 06:08:52 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -70,7 +70,7 @@ # sjg@crufty.net # -MK_VERSION=20130801 +MK_VERSION=20131212 OWNER= GROUP= MODE=444 diff --git a/contrib/bmake/mk/meta2deps.py b/contrib/bmake/mk/meta2deps.py index 254f230688a7..d4e4bb14cad4 100755 --- a/contrib/bmake/mk/meta2deps.py +++ b/contrib/bmake/mk/meta2deps.py @@ -1,5 +1,7 @@ #!/usr/bin/env python +from __future__ import print_function + """ This script parses each "meta" file and extracts the information needed to deduce build and src dependencies. @@ -35,7 +37,7 @@ We only pay attention to a subset of the information in the """ RCSid: - $Id: meta2deps.py,v 1.15 2013/07/29 20:41:23 sjg Exp $ + $Id: meta2deps.py,v 1.16 2013/12/20 06:08:52 sjg Exp $ Copyright (c) 2011-2013, Juniper Networks, Inc. All rights reserved. @@ -90,14 +92,14 @@ def resolve(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr): continue p = '/'.join([d,path]) if debug > 2: - print >> debug_out, "looking for:", p, + print("looking for:", p, end=' ', file=debug_out) if not os.path.exists(p): if debug > 2: - print >> debug_out, "nope" + print("nope", file=debug_out) p = None continue if debug > 2: - print >> debug_out, "found:", p + print("found:", p, file=debug_out) return p return None @@ -236,21 +238,21 @@ class MetaFile: self.objroots.sort(reverse=True) if self.debug: - print >> self.debug_out, "host_target=", self.host_target - print >> self.debug_out, "srctops=", self.srctops - print >> self.debug_out, "objroots=", self.objroots + print("host_target=", self.host_target, file=self.debug_out) + print("srctops=", self.srctops, file=self.debug_out) + print("objroots=", self.objroots, file=self.debug_out) self.dirdep_re = re.compile(r'([^/]+)/(.+)') if self.dpdeps and not self.reldir: if self.debug: - print >> self.debug_out, "need reldir:", + print("need reldir:", end=' ', file=self.debug_out) if self.curdir: srctop = self.find_top(self.curdir, self.srctops) if srctop: self.reldir = self.curdir.replace(srctop,'') if self.debug: - print >> self.debug_out, self.reldir + print(self.reldir, file=self.debug_out) if not self.reldir: self.dpdeps = None # we cannot do it? @@ -280,7 +282,7 @@ class MetaFile: if not self.reldir: return None for f in sort_unique(self.file_deps): - print >> out, 'DPDEPS_%s += %s' % (f, self.reldir) + print('DPDEPS_%s += %s' % (f, self.reldir), file=out) def seenit(self, dir): """rememer that we have seen dir.""" @@ -291,14 +293,14 @@ class MetaFile: if data not in list: list.append(data) if self.debug: - print >> self.debug_out, "%s: %sAdd: %s" % (self.name, clue, data) + print("%s: %sAdd: %s" % (self.name, clue, data), file=self.debug_out) def find_top(self, path, list): """the logical tree may be split accross multiple trees""" for top in list: if path.startswith(top): if self.debug > 2: - print >> self.debug_out, "found in", top + print("found in", top, file=self.debug_out) return top return None @@ -307,9 +309,9 @@ class MetaFile: ddep = None for ddepf in [path + '.dirdep', dir + '/.dirdep']: if not ddep and os.path.exists(ddepf): - ddep = open(ddepf, 'rb').readline().strip('# \n') + ddep = open(ddepf, 'r').readline().strip('# \n') if self.debug > 1: - print >> self.debug_out, "found %s: %s\n" % (ddepf, ddep) + print("found %s: %s\n" % (ddepf, ddep), file=self.debug_out) if ddep.endswith(self.machine): ddep = ddep[0:-(1+len(self.machine))] elif self.target_spec and ddep.endswith(self.target_spec): @@ -331,7 +333,7 @@ class MetaFile: if not (self.machine == 'host' and dmachine == self.host_target): if self.debug > 2: - print >> self.debug_out, "adding .%s to %s" % (dmachine, ddep) + print("adding .%s to %s" % (dmachine, ddep), file=self.debug_out) ddep += '.' + dmachine return ddep @@ -342,7 +344,7 @@ class MetaFile: self.parse(name, file) except: # give a useful clue - print >> sys.stderr, '{}:{}: '.format(self.name, self.line), + print('{}:{}: '.format(self.name, self.line), end=' ', file=sys.stderr) raise def parse(self, name=None, file=None): @@ -379,7 +381,7 @@ class MetaFile: f = file cwd = last_dir = self.cwd else: - f = open(self.name, 'rb') + f = open(self.name, 'r') skip = True pid_cwd = {} pid_last_dir = {} @@ -396,7 +398,7 @@ class MetaFile: if not line[0] in interesting: continue if self.debug > 2: - print >> self.debug_out, "input:", line, + print("input:", line, end=' ', file=self.debug_out) w = line.split() if skip: @@ -413,7 +415,7 @@ class MetaFile: self.cwd = cwd = last_dir = w[1] self.seenit(cwd) # ignore this if self.debug: - print >> self.debug_out, "%s: CWD=%s" % (self.name, cwd) + print("%s: CWD=%s" % (self.name, cwd), file=self.debug_out) continue pid = int(w[1]) @@ -438,12 +440,12 @@ class MetaFile: cwd = cwd[0:-2] last_dir = cwd if self.debug > 1: - print >> self.debug_out, "cwd=", cwd + print("cwd=", cwd, file=self.debug_out) continue if w[2] in self.seen: if self.debug > 2: - print >> self.debug_out, "seen:", w[2] + print("seen:", w[2], file=self.debug_out) continue # file operations if w[0] in 'ML': @@ -461,7 +463,7 @@ class MetaFile: dir,base = os.path.split(path) if dir in self.seen: if self.debug > 2: - print >> self.debug_out, "seen:", dir + 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 @@ -472,19 +474,19 @@ class MetaFile: # now put path back together path = '/'.join([dir,base]) if self.debug > 1: - print >> self.debug_out, "raw=%s rdir=%s dir=%s path=%s" % (w[2], rdir, dir, path) + 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 >> self.debug_out, "skipping:", path + 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 >> self.debug_out, "ldir=", last_dir + print("ldir=", last_dir, file=self.debug_out) continue if w[0] in 'REWML': @@ -642,10 +644,10 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None): debug_out = getv(conf, 'debug_out', sys.stderr) if debug: - print >> debug_out, "config:" - print >> debug_out, "psyco=", have_psyco - for k,v in conf.items(): - print >> debug_out, "%s=%s" % (k,v) + print("config:", file=debug_out) + print("psyco=", have_psyco, file=debug_out) + for k,v in list(conf.items()): + print("%s=%s" % (k,v), file=debug_out) for a in args: if a.endswith('.meta'): @@ -657,9 +659,9 @@ def main(argv, klass=MetaFile, xopts='', xoptf=None): m = klass(f, conf) if output: - print m.dirdeps() + print(m.dirdeps()) - print m.src_dirdeps('\nsrc:') + print(m.src_dirdeps('\nsrc:')) dpdeps = getv(conf, 'DPDEPS') if dpdeps: @@ -672,6 +674,6 @@ if __name__ == '__main__': main(sys.argv) except: # yes, this goes to stdout - print "ERROR: ", sys.exc_info()[1] + print("ERROR: ", sys.exc_info()[1]) raise |