Page MenuHomeFreeBSD

D19849.id57783.diff
No OneTemporary

D19849.id57783.diff

Index: bin/freebsd-version/Makefile
===================================================================
--- bin/freebsd-version/Makefile
+++ bin/freebsd-version/Makefile
@@ -7,7 +7,7 @@
NEWVERS = ${SRCTOP}/sys/conf/newvers.sh
freebsd-version.sh: ${.CURDIR}/freebsd-version.sh.in ${NEWVERS}
- eval $$(egrep '^(TYPE|REVISION|BRANCH)=' ${NEWVERS}) ; \
+ eval $$(sh ${NEWVERS} -v); \
if ! sed -e "\
s/@@TYPE@@/$${TYPE}/g; \
s/@@REVISION@@/$${REVISION}/g; \
Index: include/mk-osreldate.sh
===================================================================
--- include/mk-osreldate.sh
+++ include/mk-osreldate.sh
@@ -38,8 +38,8 @@
${ECHO} creating osreldate.h from newvers.sh
set +e
-VARS_ONLY=1
-. "${NEWVERS_SH:=$CURDIR/../sys/conf/newvers.sh}" || exit 1
+COPYRIGHT=$(sh ${NEWVERS_SH:=$CURDIR/../sys/conf/newvers.sh} -c) || exit 1
+eval $(sh ${NEWVERS_SH} -V RELDATE) || exit 1
set -e
cat > $tmpfile <<EOF
$COPYRIGHT
Index: sys/conf/newvers.sh
===================================================================
--- sys/conf/newvers.sh
+++ sys/conf/newvers.sh
@@ -34,18 +34,23 @@
# Command line options:
#
-# -r Reproducible build. Do not embed directory names, user
-# names, time stamps or other dynamic information into
-# the output file. This is intended to allow two builds
-# done at different times and even by different people on
-# different hosts to produce identical output.
+# -c Print the copyright / license statement as a C comment and exit
+#
+# -r Reproducible build. Do not embed directory names, user names,
+# time stamps or other dynamic information into the output file.
+# This is intended to allow two builds done at different times
+# and even by different people on different hosts to produce
+# identical output.
+#
+# -R Reproducible build if the tree represents an unmodified
+# checkout from a version control system. Metadata is included
+# if the tree is modified.
+#
+# -V var Print ${var}="${val-of-var}" and exit
+#
+# -v Print TYPE REVISION BRANCH RELEASE VERSION RELDATE variabkes
+# like the -V command
#
-# -R Reproducible build if the tree represents an unmodified
-# checkout from a version control system. Metadata is
-# included if the tree is modified.
-
-# Note: usr.sbin/amd/include/newvers.sh assumes all variable assignments of
-# upper case variables starting in column 1 are on one line w/o continuation.
TYPE="FreeBSD"
REVISION="13.0"
@@ -53,6 +58,81 @@
RELEASE="${REVISION}-${BRANCH}"
VERSION="${TYPE} ${RELEASE}"
+if [ -z "${SYSDIR}" ]; then
+ SYSDIR=$(dirname $0)/..
+fi
+
+RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' ${PARAMFILE:-${SYSDIR}/sys/param.h})
+
+if [ -r "${SYSDIR}/../COPYRIGHT" ]; then
+ year=$(sed -Ee '/^Copyright .* The FreeBSD Project/!d;s/^.*1992-([0-9]*) .*$/\1/g' ${SYSDIR}/../COPYRIGHT)
+else
+ year=$(date +%Y)
+fi
+# look for copyright template
+b=share/examples/etc/bsd-style-copyright
+for bsd_copyright in $b ../$b ../../$b ../../../$b /usr/src/$b /usr/$b
+do
+ if [ -r "$bsd_copyright" ]; then
+ COPYRIGHT=$(sed \
+ -e "s/\[year\]/1992-$year/" \
+ -e 's/\[your name here\]\.* /The FreeBSD Project./' \
+ -e 's/\[your name\]\.*/The FreeBSD Project./' \
+ -e '/\[id for your version control system, if any\]/d' \
+ $bsd_copyright)
+ break
+ fi
+done
+
+# no copyright found, use a dummy
+if [ -z "$COPYRIGHT" ]; then
+ COPYRIGHT="/*-
+ * Copyright (c) 1992-$year The FreeBSD Project.
+ *
+ */"
+fi
+
+# add newline
+COPYRIGHT="$COPYRIGHT
+"
+
+include_metadata=true
+while getopts crRvV: opt; do
+ case "$opt" in
+ c)
+ echo "$COPYRIGHT"
+ exit 0
+ ;;
+ r)
+ include_metadata=
+ ;;
+ R)
+ if [ -z "${modified}" ]; then
+ include_metadata=
+ fi
+ ;;
+ v)
+ # Only put variables that are single lines here.
+ for v in TYPE REVISION BRANCH RELEASE VERSION RELDATE; do
+ eval val=\$${v}
+ echo ${v}=\"${val}\"
+ done
+ exit 0
+ ;;
+ V)
+ v=$OPTARG
+ eval val=\$${v}
+ echo ${v}=\"${val}\"
+ exit 0
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+# VARS_ONLY means no files should be generated, this is just being
+# included.
+[ -n "$VARS_ONLY" ] && return 0
+
#
# findvcs dir
# Looks up directory dir at world root and up the filesystem
@@ -103,49 +183,6 @@
return 1
}
-
-if [ -z "${SYSDIR}" ]; then
- SYSDIR=$(dirname $0)/..
-fi
-
-RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' ${PARAMFILE:-${SYSDIR}/sys/param.h})
-
-if [ -r "${SYSDIR}/../COPYRIGHT" ]; then
- year=$(sed -Ee '/^Copyright .* The FreeBSD Project/!d;s/^.*1992-([0-9]*) .*$/\1/g' ${SYSDIR}/../COPYRIGHT)
-else
- year=$(date +%Y)
-fi
-# look for copyright template
-b=share/examples/etc/bsd-style-copyright
-for bsd_copyright in ../$b ../../$b ../../../$b /usr/src/$b /usr/$b
-do
- if [ -r "$bsd_copyright" ]; then
- COPYRIGHT=$(sed \
- -e "s/\[year\]/1992-$year/" \
- -e 's/\[your name here\]\.* /The FreeBSD Project./' \
- -e 's/\[your name\]\.*/The FreeBSD Project./' \
- -e '/\[id for your version control system, if any\]/d' \
- $bsd_copyright)
- break
- fi
-done
-
-# no copyright found, use a dummy
-if [ -z "$COPYRIGHT" ]; then
- COPYRIGHT="/*-
- * Copyright (c) 1992-$year The FreeBSD Project.
- *
- */"
-fi
-
-# add newline
-COPYRIGHT="$COPYRIGHT
-"
-
-# VARS_ONLY means no files should be generated, this is just being
-# included.
-[ -n "$VARS_ONLY" ] && return 0
-
LC_ALL=C; export LC_ALL
if [ ! -r version ]
then
@@ -275,20 +312,6 @@
fi
fi
-include_metadata=true
-while getopts rR opt; do
- case "$opt" in
- r)
- include_metadata=
- ;;
- R)
- if [ -z "${modified}" ]; then
- include_metadata=
- fi
- esac
-done
-shift $((OPTIND - 1))
-
if [ -z "${include_metadata}" ]; then
VERINFO="${VERSION}${svn}${git}${hg} ${i}"
VERSTR="${VERINFO}\\n"
Index: usr.sbin/amd/include/newvers.sh
===================================================================
--- usr.sbin/amd/include/newvers.sh
+++ usr.sbin/amd/include/newvers.sh
@@ -5,7 +5,7 @@
#
if [ -e $1 ]; then
- eval `LC_ALL=C egrep '^[A-Z]+=' $1 | grep -v COPYRIGHT`
+ eval $(sh $1 -v)
OS=`echo ${TYPE} | LC_ALL=C tr 'A-Z' 'a-z'`
echo '/* Define name and version of host machine (eg. solaris2.5.1) */'
echo "#define HOST_OS \"${OS}${REVISION}\""

File Metadata

Mime Type
text/plain
Expires
Sun, Jun 14, 6:06 AM (14 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33943583
Default Alt Text
D19849.id57783.diff (6 KB)

Event Timeline