Defer evaluation of modified until after it's set

With the reorg r348175, we now look at modified before it is
set. Rearrange things so that we can set include_metadata to either
yes, no or if-modified. This should fix the -R flag that was broken in
r348175, which broke WITH_REPRODUCIBLE_BUILD for kernels.

Feedback From: emaste@
Differential Revision: https://reviews.freebsd.org/D20480
This commit is contained in:
Warner Losh 2019-05-31 22:57:20 +00:00
parent b8590dae50
commit 89afd39c2c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=348486

View File

@ -96,7 +96,10 @@ fi
COPYRIGHT="$COPYRIGHT
"
include_metadata=true
# We expand include_metadata later since we may set it to the
# future value of modified.
include_metadata=yes
modified=no
while getopts crRvV: opt; do
case "$opt" in
c)
@ -104,12 +107,10 @@ while getopts crRvV: opt; do
exit 0
;;
r)
include_metadata=
include_metadata=no
;;
R)
if [ -z "${modified}" ]; then
include_metadata=
fi
include_metadata=if-modified
;;
v)
# Only put variables that are single lines here.
@ -253,7 +254,7 @@ if [ -n "$svnversion" ] ; then
case "$svn" in
[0-9]*[MSP]|*:*)
svn=" r${svn}"
modified=true
modified=yes
;;
[0-9]*)
svn=" r${svn}"
@ -296,7 +297,7 @@ if [ -n "$git_cmd" ] ; then
fi
if git_tree_modified; then
git="${git}-dirty"
modified=true
modified=yes
fi
fi
@ -312,7 +313,8 @@ if [ -n "$hg_cmd" ] ; then
fi
fi
if [ -z "${include_metadata}" ]; then
[ ${include_metadata} = "if-modified" -a ${modified} = "yes" ] && include_metadata=yes
if [ ${include_metadata} != "yes" ]; then
VERINFO="${VERSION}${svn}${git}${hg} ${i}"
VERSTR="${VERINFO}\\n"
else