Update meta* from bmake-20161212
This commit is contained in:
parent
f29b919350
commit
b47b9f6bd8
@ -1,5 +1,5 @@
|
||||
# $FreeBSD$
|
||||
# $Id: dirdeps.mk,v 1.73 2016/08/15 19:28:13 sjg Exp $
|
||||
# $Id: dirdeps.mk,v 1.84 2016/11/27 02:44:34 sjg Exp $
|
||||
|
||||
# Copyright (c) 2010-2013, Juniper Networks, Inc.
|
||||
# All rights reserved.
|
||||
@ -57,9 +57,12 @@
|
||||
# .MAKE.DEPENDFILE_PREFIX) to refer to these makefiles to
|
||||
# distinguish them from others.
|
||||
#
|
||||
# Each Makefile.depend file sets DEP_RELDIR to be the
|
||||
# the RELDIR (path relative to SRCTOP) for its directory, and
|
||||
# since each Makefile.depend file includes dirdeps.mk, this
|
||||
# Before each Makefile.depend file is read, we set
|
||||
# DEP_RELDIR to be the the RELDIR (path relative to SRCTOP) for
|
||||
# its directory, and DEP_MACHINE etc according to the .<target_spec>
|
||||
# represented by the suffix of the corresponding target.
|
||||
#
|
||||
# Since each Makefile.depend file includes dirdeps.mk, this
|
||||
# processing is recursive and results in .MAKE.LEVEL 0 learning the
|
||||
# dependencies of the tree wrt the initial directory (_DEP_RELDIR).
|
||||
#
|
||||
@ -111,6 +114,29 @@
|
||||
# # as we may need it to find Makefile.depend*
|
||||
# TARGET_SPEC = ${TARGET_SPEC_VARS:@v@${$v:U}@:ts,}
|
||||
#
|
||||
# The following variables can influence the initial DIRDEPS
|
||||
# computation with regard to the TARGET_SPECs that will be
|
||||
# built.
|
||||
# Most should also be considered by init.mk
|
||||
#
|
||||
# ONLY_TARGET_SPEC_LIST
|
||||
# Defines a list of TARGET_SPECs for which the current
|
||||
# directory can be built.
|
||||
# If ALL_MACHINES is defined, we build for all the
|
||||
# TARGET_SPECs listed.
|
||||
#
|
||||
# ONLY_MACHINE_LIST
|
||||
# As for ONLY_TARGET_SPEC_LIST but only specifies
|
||||
# MACHINEs.
|
||||
#
|
||||
# NOT_TARGET_SPEC_LIST
|
||||
# A list of TARGET_SPECs for which the current
|
||||
# directory should not be built.
|
||||
#
|
||||
# NOT_MACHINE_LIST
|
||||
# A list of MACHINEs the current directory should not be
|
||||
# built for.
|
||||
#
|
||||
|
||||
# touch this at your peril
|
||||
_DIRDEP_USE_LEVEL?= 0
|
||||
@ -172,9 +198,13 @@ DEP_$v ?= ${$v}
|
||||
# we compute below are fully qualified wrt DEP_TARGET_SPEC.
|
||||
# The makefiles may only partially specify (eg. MACHINE only),
|
||||
# so we need to construct a set of modifiers to fill in the gaps.
|
||||
# jot 10 should output 1 2 3 .. 10
|
||||
JOT ?= jot
|
||||
_tspec_x := ${${JOT} ${TARGET_SPEC_VARS:[#]}:L:sh}
|
||||
.if ${TARGET_SPEC_VARS:[#]} > 10
|
||||
# seriously? better have jot(1) or equivalent to produce suitable sequence
|
||||
_tspec_x := ${${JOT:Ujot} ${TARGET_SPEC_VARS:[#]}:L:sh}
|
||||
.else
|
||||
# we can provide the sequence ourselves
|
||||
_tspec_x := ${1 2 3 4 5 6 7 8 9 10:L:[1..${TARGET_SPEC_VARS:[#]}]}
|
||||
.endif
|
||||
# this handles unqualified entries
|
||||
M_dep_qual_fixes = C;(/[^/.,]+)$$;\1.$${DEP_TARGET_SPEC};
|
||||
# there needs to be at least one item missing for these to make sense
|
||||
@ -288,6 +318,18 @@ _DEP_RELDIR := ${DEP_RELDIR}
|
||||
|
||||
.endif
|
||||
|
||||
# DIRDEPS_CACHE can be very handy for debugging.
|
||||
# Also if repeatedly building the same target,
|
||||
# we can avoid the overhead of re-computing the tree dependencies.
|
||||
MK_DIRDEPS_CACHE ?= no
|
||||
BUILD_DIRDEPS_CACHE ?= no
|
||||
BUILD_DIRDEPS ?= yes
|
||||
|
||||
.if ${MK_DIRDEPS_CACHE} == "yes"
|
||||
# this is where we will cache all our work
|
||||
DIRDEPS_CACHE ?= ${_OBJDIR:tA}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.}
|
||||
.endif
|
||||
|
||||
# pickup customizations
|
||||
# as below you can use !target(_DIRDEP_USE) to protect things
|
||||
# which should only be done once.
|
||||
@ -306,8 +348,10 @@ SKIP_DIR.host += ${SKIP_HOSTDIR}
|
||||
|
||||
DEP_SKIP_DIR = ${SKIP_DIR} \
|
||||
${SKIP_DIR.${DEP_TARGET_SPEC}:U} \
|
||||
${SKIP_DIR.${DEP_MACHINE}:U} \
|
||||
${SKIP_DIRDEPS.${DEP_MACHINE}:U}
|
||||
${TARGET_SPEC_VARS:@v@${SKIP_DIR.${DEP_$v}:U}@} \
|
||||
${SKIP_DIRDEPS.${DEP_TARGET_SPEC}:U} \
|
||||
${TARGET_SPEC_VARS:@v@${SKIP_DIRDEPS.${DEP_$v}:U}@}
|
||||
|
||||
|
||||
NSkipDir = ${DEP_SKIP_DIR:${M_ListToSkip}}
|
||||
|
||||
@ -345,7 +389,7 @@ _DIRDEP_USE: .USE .MAKE
|
||||
.ifdef ALL_MACHINES
|
||||
# this is how you limit it to only the machines we have been built for
|
||||
# previously.
|
||||
.if empty(ONLY_MACHINE_LIST)
|
||||
.if empty(ONLY_TARGET_SPEC_LIST) && empty(ONLY_MACHINE_LIST)
|
||||
.if !empty(ALL_MACHINE_LIST)
|
||||
# ALL_MACHINE_LIST is the list of all legal machines - ignore anything else
|
||||
_machine_list != cd ${_CURDIR} && 'ls' -1 ${ALL_MACHINE_LIST:O:u:@m@${.MAKE.DEPENDFILE:T:R}.$m@} 2> /dev/null; echo
|
||||
@ -354,7 +398,7 @@ _machine_list != 'ls' -1 ${_CURDIR}/${.MAKE.DEPENDFILE_PREFIX}.* 2> /dev/null; e
|
||||
.endif
|
||||
_only_machines := ${_machine_list:${NIgnoreFiles:UN*.bak}:E:O:u}
|
||||
.else
|
||||
_only_machines := ${ONLY_MACHINE_LIST}
|
||||
_only_machines := ${ONLY_TARGET_SPEC_LIST:U} ${ONLY_MACHINE_LIST:U}
|
||||
.endif
|
||||
|
||||
.if empty(_only_machines)
|
||||
@ -363,30 +407,35 @@ _only_machines := ${TARGET_MACHINE:U${ALL_MACHINE_LIST:U${DEP_MACHINE}}}
|
||||
.endif
|
||||
|
||||
.else # ! ALL_MACHINES
|
||||
# if ONLY_MACHINE_LIST is set, we are limited to that
|
||||
# if ONLY_TARGET_SPEC_LIST or ONLY_MACHINE_LIST is set, we are limited to that.
|
||||
# Note that ONLY_TARGET_SPEC_LIST should be fully qualified.
|
||||
# if TARGET_MACHINE is set - it is really the same as ONLY_MACHINE_LIST
|
||||
# otherwise DEP_MACHINE is it - so DEP_MACHINE will match.
|
||||
_only_machines := ${ONLY_TARGET_SPEC_LIST:U:M${DEP_MACHINE},*}
|
||||
.if empty(_only_machines)
|
||||
_only_machines := ${ONLY_MACHINE_LIST:U${TARGET_MACHINE:U${DEP_MACHINE}}:M${DEP_MACHINE}}
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if !empty(NOT_MACHINE_LIST)
|
||||
_only_machines := ${_only_machines:${NOT_MACHINE_LIST:${M_ListToSkip}}}
|
||||
.endif
|
||||
.if !empty(NOT_TARGET_SPEC_LIST)
|
||||
# we must first qualify
|
||||
_dm := ${DEP_MACHINE}
|
||||
_only_machines := ${_only_machines:M*,*} ${_only_machines:N*,*:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:${M_dep_qual_fixes:ts:}:O:u:S,^.,,}
|
||||
DEP_MACHINE := ${_dm}
|
||||
_only_machines := ${_only_machines:${NOT_TARGET_SPEC_LIST:${M_ListToSkip}}}
|
||||
.endif
|
||||
# clean up
|
||||
_only_machines := ${_only_machines:O:u}
|
||||
|
||||
# make sure we have a starting place?
|
||||
DIRDEPS ?= ${RELDIR}
|
||||
.endif # target
|
||||
|
||||
# if repeatedly building the same target,
|
||||
# we can avoid the overhead of re-computing the tree dependencies.
|
||||
MK_DIRDEPS_CACHE ?= no
|
||||
BUILD_DIRDEPS_CACHE ?= no
|
||||
BUILD_DIRDEPS ?= yes
|
||||
|
||||
.if !defined(NO_DIRDEPS) && !defined(NO_DIRDEPS_BELOW)
|
||||
.if ${MK_DIRDEPS_CACHE} == "yes"
|
||||
# this is where we will cache all our work
|
||||
DIRDEPS_CACHE?= ${_OBJDIR:tA}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.}
|
||||
|
||||
# just ensure this exists
|
||||
build-dirdeps:
|
||||
@ -421,6 +470,7 @@ ${DIRDEPS_CACHE}: .META .NOMETA_CMP
|
||||
} > ${.TARGET}.new
|
||||
+@MAKELEVEL=${.MAKE.LEVEL} DIRDEPS_CACHE=${DIRDEPS_CACHE} \
|
||||
DIRDEPS="${DIRDEPS}" \
|
||||
TARGET_SPEC=${TARGET_SPEC} \
|
||||
MAKEFLAGS= ${.MAKE} -C ${_CURDIR} -f ${BUILD_DIRDEPS_MAKEFILE} \
|
||||
${BUILD_DIRDEPS_TARGETS} BUILD_DIRDEPS_CACHE=yes \
|
||||
.MAKE.DEPENDFILE=.none \
|
||||
@ -490,8 +540,10 @@ _machines := ${_machines:O:u}
|
||||
_dm := ${DEP_MACHINE}
|
||||
# apply the same filtering that we do when qualifying DIRDEPS.
|
||||
# M_dep_qual_fixes expects .${MACHINE}* so add (and remove) '.'
|
||||
_machines := ${_machines:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:${M_dep_qual_fixes:ts:}:O:u:S,^.,,}
|
||||
# Again we expect that any already qualified machines are fully qualified.
|
||||
_machines := ${_machines:M*,*} ${_machines:N*,*:@DEP_MACHINE@${DEP_TARGET_SPEC}@:S,^,.,:${M_dep_qual_fixes:ts:}:O:u:S,^.,,}
|
||||
DEP_MACHINE := ${_dm}
|
||||
_machines := ${_machines:O:u}
|
||||
.endif
|
||||
|
||||
# reset each time through
|
||||
@ -523,7 +575,7 @@ _build_dirs += ${_machines:N${DEP_TARGET_SPEC}:@m@${_CURDIR}.$m@}
|
||||
# these we reset each time through as they can depend on DEP_MACHINE
|
||||
DEP_DIRDEPS_FILTER = \
|
||||
${DIRDEPS_FILTER.${DEP_TARGET_SPEC}:U} \
|
||||
${DIRDEPS_FILTER.${DEP_MACHINE}:U} \
|
||||
${TARGET_SPEC_VARS:@v@${DIRDEPS_FILTER.${DEP_$v}:U}@} \
|
||||
${DIRDEPS_FILTER:U}
|
||||
.if empty(DEP_DIRDEPS_FILTER)
|
||||
# something harmless
|
||||
@ -622,6 +674,19 @@ _dirdeps_checked.$d:
|
||||
.endif
|
||||
# Note: _build_all_dirs is fully qualifed so d:R is always the directory
|
||||
.if exists(${d:R})
|
||||
# we pass _DEP_TARGET_SPEC to tell the next step what we want
|
||||
_DEP_TARGET_SPEC := ${d:E}
|
||||
# some makefiles may still look at this
|
||||
_DEP_MACHINE := ${d:E:C/,.*//}
|
||||
# set these too in case Makefile.depend* uses them
|
||||
.if ${TARGET_SPEC_VARS:[#]} > 1
|
||||
_dtspec := ${_DEP_TARGET_SPEC:S/,/ /g}
|
||||
.for i in ${_tspec_x}
|
||||
DEP_${TARGET_SPEC_VARS:[$i]} := ${_dtspec:[$i]}
|
||||
.endfor
|
||||
.else
|
||||
DEP_MACHINE := ${_DEP_MACHINE}
|
||||
.endif
|
||||
# Warning: there is an assumption here that MACHINE is always
|
||||
# the first entry in TARGET_SPEC_VARS.
|
||||
# If TARGET_SPEC and MACHINE are insufficient, you have a problem.
|
||||
@ -632,10 +697,6 @@ _qm := ${_m:C;(\.depend)$;\1.${d:E};:${M_dep_qual_fixes:ts:}}
|
||||
.if ${_debug_search}
|
||||
.info Looking for ${_qm}
|
||||
.endif
|
||||
# we pass _DEP_TARGET_SPEC to tell the next step what we want
|
||||
_DEP_TARGET_SPEC := ${d:E}
|
||||
# some makefiles may still look at this
|
||||
_DEP_MACHINE := ${d:E:C/,.*//}
|
||||
# set this "just in case"
|
||||
# we can skip :tA since we computed the path above
|
||||
DEP_RELDIR := ${_m:H:S,${SRCTOP}/,,}
|
||||
@ -688,7 +749,7 @@ _src != cd ${.CURDIR} && for m in ${.MAKE.DEPENDFILE_PREFERENCE:T:S,${MACHINE},*
|
||||
|
||||
_src?= ${.MAKE.DEPENDFILE}
|
||||
|
||||
.MAKE.DEPENDFILE_BOOTSTRAP_SED+= -e 's,${_src:E},${MACHINE},g'
|
||||
.MAKE.DEPENDFILE_BOOTSTRAP_SED+= -e 's/${_src:E:C/,.*//}/${MACHINE}/g'
|
||||
|
||||
# just create Makefile.depend* for this dir
|
||||
bootstrap-this: .NOTMAIN
|
||||
|
@ -1,5 +1,5 @@
|
||||
# $FreeBSD$
|
||||
# $Id: gendirdeps.mk,v 1.30 2016/02/27 00:20:39 sjg Exp $
|
||||
# $Id: gendirdeps.mk,v 1.33 2016/10/11 22:37:28 sjg Exp $
|
||||
|
||||
# Copyright (c) 2010-2013, Juniper Networks, Inc.
|
||||
# All rights reserved.
|
||||
@ -147,6 +147,9 @@ M2D_OBJROOTS += ${OBJTOP} ${_OBJROOT} ${_objroot}
|
||||
.if defined(SB_OBJROOT)
|
||||
M2D_OBJROOTS += ${SB_OBJROOT}
|
||||
.endif
|
||||
.if defined(STAGE_ROOT)
|
||||
M2D_OBJROOTS += ${STAGE_ROOT}
|
||||
.endif
|
||||
.if ${.MAKE.DEPENDFILE_PREFERENCE:U${.MAKE.DEPENDFILE}:M*.${MACHINE}} == ""
|
||||
# meta2deps.py only groks objroot
|
||||
# so we need to give it what it expects
|
||||
|
@ -1,5 +1,5 @@
|
||||
# $FreeBSD$
|
||||
# $Id: meta.stage.mk,v 1.45 2016/05/26 03:59:09 sjg Exp $
|
||||
# $Id: meta.stage.mk,v 1.47 2016/12/07 23:07:49 sjg Exp $
|
||||
#
|
||||
# @(#) Copyright (c) 2011, Simon J. Gerraty
|
||||
#
|
||||
@ -59,7 +59,7 @@ GENDIRDEPS_FILTER += Nnot-empty-is-important \
|
||||
|
||||
LN_CP_SCRIPT = LnCp() { \
|
||||
rm -f $$2 2> /dev/null; \
|
||||
{ [ -z "$$mode" ] && ln $$1 $$2 2> /dev/null; } || \
|
||||
{ [ -z "$$mode" ] && ${LN:Uln} $$1 $$2 2> /dev/null; } || \
|
||||
cp -p $$1 $$2; }
|
||||
|
||||
# a staging conflict should cause an error
|
||||
@ -220,19 +220,29 @@ stage_symlinks: .dirdep
|
||||
.if !empty(STAGE_AS_SETS)
|
||||
CLEANFILES += ${STAGE_AS_SETS:@s@stage*$s@}
|
||||
|
||||
STAGE_TARGETS += stage_as
|
||||
STAGE_TARGETS += stage_as stage_as_and_symlink
|
||||
|
||||
# sometimes things need to be renamed as they are staged
|
||||
# each ${file} will be staged as ${STAGE_AS_${file:T}}
|
||||
# one could achieve the same with SYMLINKS
|
||||
# stage_as_and_symlink makes the original name a symlink to the new name
|
||||
# it is the same as using stage_as and stage_symlinks but ensures
|
||||
# both operations happen together
|
||||
.for s in ${STAGE_AS_SETS:O:u}
|
||||
STAGE_AS.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
|
||||
STAGE_AS_AND_SYMLINK.$s ?= ${.ALLSRC:N.dirdep:Nstage_*}
|
||||
|
||||
stage_as: stage_as.$s
|
||||
stage_as.$s: .dirdep
|
||||
@${STAGE_AS_SCRIPT}; StageAs ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS.$s:@f@$f ${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}}@}
|
||||
@touch $@
|
||||
|
||||
stage_as_and_symlink: stage_as_and_symlink.$s
|
||||
stage_as_and_symlink.$s: .dirdep
|
||||
@${STAGE_AS_SCRIPT}; StageAs ${FLAGS.$@} ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS_AND_SYMLINK.$s:@f@$f ${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}}@}
|
||||
@${STAGE_LINKS_SCRIPT}; StageLinks -s ${STAGE_FILES_DIR.$s:U${STAGE_DIR.$s}:${STAGE_DIR_FILTER}} ${STAGE_AS_AND_SYMLINK.$s:@f@${STAGE_AS_${f:tA}:U${STAGE_AS_${f:T}:U${f:T}}} $f@}
|
||||
@touch $@
|
||||
|
||||
.endfor
|
||||
.endif
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
# $FreeBSD$
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
@ -38,7 +37,8 @@
|
||||
|
||||
"""
|
||||
RCSid:
|
||||
$Id: meta2deps.py,v 1.19 2016/04/02 20:45:40 sjg Exp $
|
||||
$FreeBSD$
|
||||
$Id: meta2deps.py,v 1.22 2016/12/12 19:07:42 sjg Exp $
|
||||
|
||||
Copyright (c) 2011-2013, Juniper Networks, Inc.
|
||||
All rights reserved.
|
||||
@ -114,7 +114,7 @@ def abspath(path, cwd, last_dir=None, debug=0, debug_out=sys.stderr):
|
||||
if rpath:
|
||||
path = rpath
|
||||
if (path.find('/') < 0 or
|
||||
path.find('./') > 0 or
|
||||
path.find('./') > 0 or
|
||||
path.endswith('/..') or
|
||||
os.path.islink(path)):
|
||||
return os.path.realpath(path)
|
||||
@ -154,38 +154,38 @@ def __init__(self, name, conf={}):
|
||||
"""if name is set we will parse it now.
|
||||
conf can have the follwing keys:
|
||||
|
||||
SRCTOPS list of tops of the src tree(s).
|
||||
SRCTOPS list of tops of the src tree(s).
|
||||
|
||||
CURDIR the src directory 'bmake' was run from.
|
||||
CURDIR the src directory 'bmake' was run from.
|
||||
|
||||
RELDIR the relative path from SRCTOP to CURDIR
|
||||
RELDIR the relative path from SRCTOP to CURDIR
|
||||
|
||||
MACHINE the machine we built for.
|
||||
set to 'none' if we are not cross-building.
|
||||
More specifically if machine cannot be deduced from objdirs.
|
||||
MACHINE the machine we built for.
|
||||
set to 'none' if we are not cross-building.
|
||||
More specifically if machine cannot be deduced from objdirs.
|
||||
|
||||
TARGET_SPEC
|
||||
Sometimes MACHINE isn't enough.
|
||||
Sometimes MACHINE isn't enough.
|
||||
|
||||
HOST_TARGET
|
||||
when we build for the pseudo machine 'host'
|
||||
the object tree uses HOST_TARGET rather than MACHINE.
|
||||
when we build for the pseudo machine 'host'
|
||||
the object tree uses HOST_TARGET rather than MACHINE.
|
||||
|
||||
OBJROOTS a list of the common prefix for all obj dirs it might
|
||||
end in '/' or '-'.
|
||||
end in '/' or '-'.
|
||||
|
||||
DPDEPS names an optional file to which per file dependencies
|
||||
will be appended.
|
||||
For example if 'some/path/foo.h' is read from SRCTOP
|
||||
then 'DPDEPS_some/path/foo.h +=' "RELDIR" is output.
|
||||
This can allow 'bmake' to learn all the dirs within
|
||||
the tree that depend on 'foo.h'
|
||||
DPDEPS names an optional file to which per file dependencies
|
||||
will be appended.
|
||||
For example if 'some/path/foo.h' is read from SRCTOP
|
||||
then 'DPDEPS_some/path/foo.h +=' "RELDIR" is output.
|
||||
This can allow 'bmake' to learn all the dirs within
|
||||
the tree that depend on 'foo.h'
|
||||
|
||||
EXCLUDES
|
||||
A list of paths to ignore.
|
||||
ccache(1) can otherwise be trouble.
|
||||
EXCLUDES
|
||||
A list of paths to ignore.
|
||||
ccache(1) can otherwise be trouble.
|
||||
|
||||
debug desired debug level
|
||||
debug desired debug level
|
||||
|
||||
debug_out open file to send debug output to (sys.stderr)
|
||||
|
||||
@ -229,8 +229,9 @@ def __init__(self, name, conf={}):
|
||||
if objroot.endswith(e):
|
||||
# this is not what we want - fix it
|
||||
objroot = objroot[0:-len(e)]
|
||||
if e.endswith('/'):
|
||||
objroot += '/'
|
||||
|
||||
if objroot[-1] != '/':
|
||||
objroot += '/'
|
||||
if not objroot in self.objroots:
|
||||
self.objroots.append(objroot)
|
||||
_objroot = os.path.realpath(objroot)
|
||||
@ -293,6 +294,9 @@ def file_depends(self, out=None):
|
||||
return None
|
||||
for f in sort_unique(self.file_deps):
|
||||
print('DPDEPS_%s += %s' % (f, self.reldir), file=out)
|
||||
# these entries provide for reverse DIRDEPS lookup
|
||||
for f in self.obj_deps:
|
||||
print('DEPDIRS_%s += %s' % (f, self.reldir), file=out)
|
||||
|
||||
def seenit(self, dir):
|
||||
"""rememer that we have seen dir."""
|
||||
@ -360,28 +364,28 @@ def try_parse(self, name=None, file=None):
|
||||
def parse(self, name=None, file=None):
|
||||
"""A meta file looks like:
|
||||
|
||||
# Meta data file "path"
|
||||
CMD "command-line"
|
||||
CWD "cwd"
|
||||
TARGET "target"
|
||||
-- command output --
|
||||
-- filemon acquired metadata --
|
||||
# buildmon version 3
|
||||
V 3
|
||||
C "pid" "cwd"
|
||||
E "pid" "path"
|
||||
F "pid" "child"
|
||||
R "pid" "path"
|
||||
W "pid" "path"
|
||||
X "pid" "status"
|
||||
D "pid" "path"
|
||||
L "pid" "src" "target"
|
||||
M "pid" "old" "new"
|
||||
S "pid" "path"
|
||||
# Bye bye
|
||||
# Meta data file "path"
|
||||
CMD "command-line"
|
||||
CWD "cwd"
|
||||
TARGET "target"
|
||||
-- command output --
|
||||
-- filemon acquired metadata --
|
||||
# buildmon version 3
|
||||
V 3
|
||||
C "pid" "cwd"
|
||||
E "pid" "path"
|
||||
F "pid" "child"
|
||||
R "pid" "path"
|
||||
W "pid" "path"
|
||||
X "pid" "status"
|
||||
D "pid" "path"
|
||||
L "pid" "src" "target"
|
||||
M "pid" "old" "new"
|
||||
S "pid" "path"
|
||||
# Bye bye
|
||||
|
||||
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.
|
||||
"""
|
||||
|
||||
version = 0 # unknown
|
||||
@ -431,7 +435,6 @@ def parse(self, name=None, file=None):
|
||||
pid = int(w[1])
|
||||
if pid != last_pid:
|
||||
if last_pid:
|
||||
pid_cwd[last_pid] = cwd
|
||||
pid_last_dir[last_pid] = self.last_dir
|
||||
cwd = getv(pid_cwd, pid, self.cwd)
|
||||
self.last_dir = getv(pid_last_dir, pid, self.cwd)
|
||||
@ -448,7 +451,8 @@ def parse(self, name=None, file=None):
|
||||
cwd = abspath(w[2], cwd, None, self.debug, self.debug_out)
|
||||
if cwd.endswith('/.'):
|
||||
cwd = cwd[0:-2]
|
||||
self.last_dir = cwd
|
||||
self.last_dir = pid_last_dir[pid] = cwd
|
||||
pid_cwd[pid] = cwd
|
||||
if self.debug > 1:
|
||||
print("cwd=", cwd, file=self.debug_out)
|
||||
continue
|
||||
@ -545,6 +549,9 @@ def parse_path(self, path, cwd, op=None, w=[]):
|
||||
ddep = self.find_obj(objroot, dir, path, w[2])
|
||||
if ddep:
|
||||
self.add(self.obj_deps, ddep, 'obj')
|
||||
if self.dpdeps and objroot.endswith('/stage/'):
|
||||
sp = '/'.join(path.replace(objroot,'').split('/')[1:])
|
||||
self.add(self.file_deps, sp, 'file')
|
||||
else:
|
||||
# don't waste time looking again
|
||||
self.seenit(w[2])
|
||||
|
@ -1,4 +1,3 @@
|
||||
# $FreeBSD$
|
||||
#!/bin/sh
|
||||
|
||||
# NAME:
|
||||
@ -53,7 +52,7 @@
|
||||
# $SB/obj-i386/bsd/gnu/lib/csu
|
||||
# $SB/obj-i386/bsd/gnu/lib/libgcc
|
||||
# $SB/obj-i386/bsd/include
|
||||
# $SB/obj-i386/bsd/lib/csu/i386-elf
|
||||
# $SB/obj-i386/bsd/lib/csu/i386
|
||||
# $SB/obj-i386/bsd/lib/libc
|
||||
# $SB/src/bsd/include
|
||||
# $SB/src/bsd/sys/i386/include
|
||||
@ -78,7 +77,8 @@
|
||||
|
||||
|
||||
# RCSid:
|
||||
# $Id: meta2deps.sh,v 1.9 2015/04/03 18:23:25 sjg Exp $
|
||||
# $FreeBSD$
|
||||
# $Id: meta2deps.sh,v 1.12 2016/12/13 20:44:16 sjg Exp $
|
||||
|
||||
# Copyright (c) 2010-2013, Juniper Networks, Inc.
|
||||
# All rights reserved.
|
||||
@ -256,7 +256,7 @@ meta2deps() {
|
||||
*)
|
||||
case "$lpid" in
|
||||
"") ;;
|
||||
*) eval ldir_$lpid=$ldir cwd_$lpid=$cwd;;
|
||||
*) eval ldir_$lpid=$ldir;;
|
||||
esac
|
||||
eval ldir=\${ldir_$pid:-$CWD} cwd=\${cwd_$pid:-$CWD}
|
||||
lpid=$pid
|
||||
@ -272,9 +272,11 @@ meta2deps() {
|
||||
esac
|
||||
# watch out for temp dirs that no longer exist
|
||||
test -d ${cwd:-/dev/null/no/such} || cwd=$CWD
|
||||
eval cwd_$pid=$cwd
|
||||
continue
|
||||
;;
|
||||
F,*) eval cwd_$path=$cwd ldir_$path=$ldir
|
||||
F,*) # $path is new pid
|
||||
eval cwd_$path=$cwd ldir_$path=$ldir
|
||||
continue
|
||||
;;
|
||||
*) dir=${path%/*}
|
||||
|
Loading…
Reference in New Issue
Block a user