This is an automated email from the ASF dual-hosted git repository. alexey pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
commit 0f38821c4867b86044be22dbceb80c7bc04b5d33 Author: Alexey Serbin <[email protected]> AuthorDate: Wed Jul 24 14:36:07 2019 -0700 [thirdparty] introduce chrony Added chrony into the thirdparty: a set of follow-up patches use the chronyd NTP implementation and its chronyc CLI to provide the functionality of reference NTP servers for test scenarios involving Kudu built-in NTP client. One nice feature that chronyd has is the ability to run in server-only mode, i.e. not driving the system clock: 'man chronyd', the '-x' option. Also, it's possible to chronyd NTP server using the system clock as a source instead of a physical device (GPS, oscillator, etc.). In addition, it's possible to manually set the reference time for chrony NTP server running in server-only local mode. The chrony suite has 'chronyc' CLI tool to send control commands to chronyd NTP daemon. As of now, the latest version 3.5 is used with not-yet-upstream patch to drop the requirements of being run under superuser UID when driving the system clock is not required (e.g., when running in server-only mode, see '-x' command-line flag). Change-Id: I71ed12311b10979af8a12094881b6b8b47ef8008 Reviewed-on: http://gerrit.cloudera.org:8080/13915 Tested-by: Kudu Jenkins Reviewed-by: Adar Dembo <[email protected]> Reviewed-by: Grant Henke <[email protected]> --- thirdparty/build-definitions.sh | 40 ++++++++++++++++++++++++++++ thirdparty/build-thirdparty.sh | 5 ++++ thirdparty/download-thirdparty.sh | 7 +++++ thirdparty/patches/chrony-no-superuser.patch | 31 +++++++++++++++++++++ thirdparty/vars.sh | 3 +++ 5 files changed, 86 insertions(+) diff --git a/thirdparty/build-definitions.sh b/thirdparty/build-definitions.sh index f125ea5..8dcad99 100644 --- a/thirdparty/build-definitions.sh +++ b/thirdparty/build-definitions.sh @@ -1004,3 +1004,43 @@ build_yaml() { popd done } + +build_chrony() { + CHRONY_BDIR=$TP_BUILD_DIR/$CHRONY_NAME$MODE_SUFFIX + mkdir -p $CHRONY_BDIR + pushd $CHRONY_BDIR + + # The configure script for chrony doesn't follow the common policy of + # the autogen tools (probably, it's manually written from scratch). + # It's not possible to configure and build chrony in a separate directory; + # it's necessary to do so in the source directory itself. + rsync -av --delete $CHRONY_SOURCE/ . + + # In the scope of using chrony in Kudu test framework, it's better to have + # leaner binaries for chronyd and chronyc, stripping off everything but + # essential functionality. + CFLAGS="$EXTRA_CFLAGS" \ + CXXFLAGS="$EXTRA_CXXFLAGS" \ + LDFLAGS="$EXTRA_LDFLAGS" \ + LIBS="$EXTRA_LIBS" \ + ./configure \ + --prefix=$PREFIX \ + --sysconfdir=$PREFIX/etc \ + --localstatedir=$PREFIX/var \ + --enable-debug \ + --disable-ipv6 \ + --disable-pps \ + --disable-privdrop \ + --disable-readline \ + --without-editline \ + --without-nettle \ + --without-nss \ + --without-tomcrypt \ + --without-libcap \ + --without-seccomp \ + --disable-forcednsretry \ + --disable-sechash + + make -j$PARALLEL $EXTRA_MAKEFLAGS install + popd +} diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh index 169300d..81d36d6 100755 --- a/thirdparty/build-thirdparty.sh +++ b/thirdparty/build-thirdparty.sh @@ -102,6 +102,7 @@ else "hive") F_HIVE=1 ;; "sentry") F_SENTRY=1 ;; "yaml") F_YAML=1 ;; + "chrony") F_CHRONY=1 ;; *) echo "Unknown module: $arg"; exit 1 ;; esac done @@ -247,6 +248,10 @@ if [ -n "$F_COMMON" -o -n "$F_BISON" ]; then build_bison fi +if [ -n "$F_COMMON" -o -n "$F_CHRONY" ]; then + build_chrony +fi + # Install Hadoop, Hive, and Sentry by symlinking their source directories (which # are pre-built) into $PREFIX/opt. if [ -n "$F_COMMON" -o -n "$F_HADOOP" ]; then diff --git a/thirdparty/download-thirdparty.sh b/thirdparty/download-thirdparty.sh index ee481c3..7160c5d 100755 --- a/thirdparty/download-thirdparty.sh +++ b/thirdparty/download-thirdparty.sh @@ -442,5 +442,12 @@ fetch_and_patch \ $YAML_SOURCE \ $YAML_PATCHLEVEL +CHRONY_PATCHLEVEL=1 +fetch_and_patch \ + $CHRONY_NAME.tar.gz \ + $CHRONY_SOURCE \ + $CHRONY_PATCHLEVEL \ + "patch -p1 < $TP_DIR/patches/chrony-no-superuser.patch" + echo "---------------" echo "Thirdparty dependencies downloaded successfully" diff --git a/thirdparty/patches/chrony-no-superuser.patch b/thirdparty/patches/chrony-no-superuser.patch new file mode 100644 index 0000000..937f5d9 --- /dev/null +++ b/thirdparty/patches/chrony-no-superuser.patch @@ -0,0 +1,31 @@ +commit ecdaaf222a126ec9aeecb0479e2337f875a9618f +Author: Alexey Serbin <[email protected]> +Date: Tue Aug 20 16:47:02 2019 -0700 + + main: allow to run under regular user in server-only mode + + This patch allows for running chronyd under non-superuser account when + no clock control is requested (i.e. when '-d' option is specified). + + The motivation for this change is to run chronyd in server-only mode + (i.e. not driving system's clock) in various development and testing + environments. Of course, it's assumed non-standard ports are used + for the NTP and the command endpoints in such a case, otherwise + chronyd would fail to bind to the standard NTP (123) and + command (323) ports since these are privileged ones. + +diff --git a/main.c b/main.c +index fafca65..d94a3b5 100644 +--- a/main.c ++++ b/main.c +@@ -501,8 +501,9 @@ int main + } + } + +- if (getuid() && !client_only) ++ if (getuid() && !(client_only || !clock_control)) { + LOG_FATAL("Not superuser"); ++ } + + /* Turn into a daemon */ + if (!nofork) { diff --git a/thirdparty/vars.sh b/thirdparty/vars.sh index 3bbcaa1..1c386c0 100644 --- a/thirdparty/vars.sh +++ b/thirdparty/vars.sh @@ -244,3 +244,6 @@ YAML_VERSION=0.6.2 YAML_NAME=yaml-cpp-yaml-cpp-$YAML_VERSION YAML_SOURCE=$TP_SOURCE_DIR/$YAML_NAME +CHRONY_VERSION=3.5 +CHRONY_NAME=chrony-$CHRONY_VERSION +CHRONY_SOURCE=$TP_SOURCE_DIR/$CHRONY_NAME
