summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2017-08-05 16:55:07 +0000
committerngie <ngie@FreeBSD.org>2017-08-05 16:55:07 +0000
commit034fab23bef86464426f1f4a9a4ecdd6ccd62449 (patch)
treec2e861afdb4952d8b6b1d509e0b4fc7b282fbffa
parent28ea259723055ee64cc9f4a8eaa4ed6c7635d6ce (diff)
downloadFreeBSD-src-034fab23bef86464426f1f4a9a4ecdd6ccd62449.zip
FreeBSD-src-034fab23bef86464426f1f4a9a4ecdd6ccd62449.tar.gz
MFC r320702,r320703:
r320702: Formalize LEAPSECONDS and OLDTIMEZONES in share/zoneinfo/... as `MK_ZONEINFO_LEAPSECONDS_SUPPORT == yes` and `MK_ZONEINFO_OLD_TIMEZONES_SUPPORT == yes`. Keep `LEAPSECONDS` and `OLDTIMEZONES` for backwards compatibility, but print out a warning notifying users that they should use the new variables, in an effort to migrate them to the variables. This is being done mostly for automated build tools, etc, that might rely on these variables being set. The variables will be removed in the future on ^/head, e.g., after ^/stable/12 is cut. Relnotes: yes r320703: Add tests to help verify Links functionality for .../contrib/tzdata/backwards MFC with: r320702
-rw-r--r--etc/mtree/BSD.tests.dist2
-rw-r--r--share/mk/bsd.own.mk10
-rw-r--r--share/zoneinfo/Makefile20
-rw-r--r--share/zoneinfo/tests/Makefile18
-rwxr-xr-xshare/zoneinfo/tests/backward_test.sh44
-rwxr-xr-xshare/zoneinfo/tests/zoneinfo_common.sh54
-rw-r--r--tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT2
-rw-r--r--tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT3
8 files changed, 150 insertions, 3 deletions
diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist
index 683322f..3a4e605 100644
--- a/etc/mtree/BSD.tests.dist
+++ b/etc/mtree/BSD.tests.dist
@@ -374,6 +374,8 @@
..
..
..
+ zoneinfo
+ ..
..
sys
acl
diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk
index 1d7152a..f501f8d 100644
--- a/share/mk/bsd.own.mk
+++ b/share/mk/bsd.own.mk
@@ -411,7 +411,10 @@ __DEFAULT_NO_OPTIONS = \
SHARED_TOOLCHAIN \
SVN \
TESTS \
- USB_GADGET_EXAMPLES
+ USB_GADGET_EXAMPLES \
+ ZONEINFO_LEAPSECONDS_SUPPORT \
+ ZONEINFO_OLD_TIMEZONES_SUPPORT \
+
#
# Default behaviour of some options depends on the architecture. Unfortunately
@@ -586,6 +589,11 @@ MK_GCC:= no
MK_GDB:= no
.endif
+.if ${MK_ZONEINFO} == "no"
+MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no
+MK_ZONEINFO_OLD_TIMEZONES_SUPPORT:= no
+.endif
+
.if ${MK_CLANG} == "no"
MK_CLANG_EXTRAS:= no
MK_CLANG_FULL:= no
diff --git a/share/zoneinfo/Makefile b/share/zoneinfo/Makefile
index a3c81b9..75b1cca 100644
--- a/share/zoneinfo/Makefile
+++ b/share/zoneinfo/Makefile
@@ -28,12 +28,24 @@
# $ svn update # Commit message: "MFV of tzdata2008X"
#
+.include <bsd.own.mk>
+
CLEANFILES+= yearistype
CLEANDIRS+= builddir
CONTRIBDIR= ${.CURDIR}/../../contrib/tzdata/
.PATH: ${CONTRIBDIR}
.if defined(LEAPSECONDS)
+.warning "Using backwards compatibility variable for LEAPSECONDS; please use WITH_ZONEINFO_LEAPSECONDS_SUPPORT instead"
+MK_ZONEINFO_LEAPSECONDS_SUPPORT= yes
+.endif
+
+.if defined(OLDTIMEZONES)
+.warning "Using backwards compatibility variable for OLDTIMEZONES; please use WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT instead"
+MK_ZONEINFO_OLD_TIMEZONES_SUPPORT= yes
+.endif
+
+.if ${MK_ZONEINFO_LEAPSECONDS_SUPPORT} != "no"
LEAPFILE= -L ${CONTRIBDIR}leapseconds
.else
LEAPFILE=
@@ -43,7 +55,7 @@ TZFILES= africa antarctica asia australasia etcetera europe \
factory northamerica southamerica
POSIXRULES= America/New_York
-.if defined(OLDTIMEZONES)
+.if ${MK_ZONEINFO_OLD_TIMEZONES_SUPPORT} != "no"
TZFILES+= backward systemv
.endif
@@ -67,7 +79,7 @@ TZBUILDSUBDIRS= \
Pacific \
SystemV
-.if defined(OLDTIMEZONES)
+.if ${MK_ZONEINFO_OLD_TIMEZONES_SUPPORT} != "no"
TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil
.endif
@@ -111,4 +123,8 @@ afterinstall:
echo "Run tzsetup(8) manually to update /etc/localtime."; \
fi
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
.include <bsd.prog.mk>
diff --git a/share/zoneinfo/tests/Makefile b/share/zoneinfo/tests/Makefile
new file mode 100644
index 0000000..2e65d68
--- /dev/null
+++ b/share/zoneinfo/tests/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+.PATH: ${SRCTOP}/contrib/tzdata
+
+FILESGROUPS= FILES
+FILESGROUPS+= TESTFILES
+
+.if ${MK_ZONEINFO_OLD_TIMEZONES_SUPPORT} != "no"
+ATF_TESTS_SH+= backward_test
+TESTFILES+= backward
+.endif
+
+TESTFILES+= zoneinfo_common.sh
+TESTFILESDIR= ${TESTSDIR}
+
+.include <bsd.test.mk>
diff --git a/share/zoneinfo/tests/backward_test.sh b/share/zoneinfo/tests/backward_test.sh
new file mode 100755
index 0000000..41d2df9
--- /dev/null
+++ b/share/zoneinfo/tests/backward_test.sh
@@ -0,0 +1,44 @@
+#
+# Copyright (c) 2017 Ngie Cooper <ngie@FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+atf_test_case links
+links_head()
+{
+ atf_set "descr" "Verify Links directives in contrib/tzdata/backward"
+}
+
+links_body()
+{
+ verify_Links $(atf_get_srcdir)/backward
+}
+
+atf_init_test_cases()
+{
+ . "$(dirname "$0")/zoneinfo_common.sh"
+
+ atf_add_test_case links
+}
diff --git a/share/zoneinfo/tests/zoneinfo_common.sh b/share/zoneinfo/tests/zoneinfo_common.sh
new file mode 100755
index 0000000..0a00a39
--- /dev/null
+++ b/share/zoneinfo/tests/zoneinfo_common.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+# Copyright (c) 2017 Ngie Cooper <ngie@FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+
+ZONEINFO_DIR=/usr/share/zoneinfo
+
+verify_Links()
+{
+ local zoneinfo_file
+
+ zoneinfo_file=$1
+
+ awk '$1 == "Link" && NF == 3 { print $2, $3; }' < $zoneinfo_file | \
+ while read src dest; do
+ verify_Link $src $dest
+ done
+}
+
+verify_Link()
+{
+ local src dest
+
+ old_path=$ZONEINFO_DIR/$src
+ new_path=$ZONEINFO_DIR/$dest
+
+ atf_check test -f $new_path
+ atf_check test -f $old_path
+
+ atf_check cmp $old_path $new_path
+}
diff --git a/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT b/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT
new file mode 100644
index 0000000..535f603
--- /dev/null
+++ b/tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Set to build leapsecond information in to the timezone database.
diff --git a/tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT b/tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT
new file mode 100644
index 0000000..664b032
--- /dev/null
+++ b/tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT
@@ -0,0 +1,3 @@
+.\" $FreeBSD$
+Set to build backward compatibility timezone aliases in to the timezone
+database.
OpenPOWER on IntegriCloud