Skip to contentSkip to conversation

ntp fixes

PATCH Superseded Paul Eggleton 4 participants 7 messages Nov 21, 2012 – Nov 22, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ntp fixes

The following changes since commit 9637cb304f1e9116b037d0afd69014836a2fa512:

Revert "ntp: Clean up recipes" (2012-11-21 08:32:18 -0500)

are available in the git repository at:

git://git.openembedded.org/meta-openembedded-contrib paule/ntp
http://cgit.openembedded.org/cgit.cgi/meta-openembedded-contrib/log/?h=paule/ntp

Paul Eggleton (2):
ntp: cleanup recipes and fix SSL support
ntp: make servers configurable and default to none configured

 .../recipes-support/ntp/files/openssl-check.patch  |   59 ++++++++++++++
 .../recipes-support/ntp/ntp-ssl_4.2.6p5.bb         |   11 ---
 meta-networking/recipes-support/ntp/ntp.inc        |   83 ++++++++++++++++----
 meta-networking/recipes-support/ntp/ntp_4.2.6p5.bb |   44 +----------
 4 files changed, 130 insertions(+), 67 deletions(-)
 create mode 100644 meta-networking/recipes-support/ntp/files/openssl-check.patch
 delete mode 100644 meta-networking/recipes-support/ntp/ntp-ssl_4.2.6p5.bb
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/2 ntp: cleanup recipes and fix SSL support

* Move common definitions to the inc file
* Drop override of do_configure which doesn't seem to be needed anymore
* Fold ntp-ssl into the ntp recipe as a PACKAGECONFIG option for those who want it (default to off) and fix configure-time checks to detect OpenSSL properly so that it gets enabled when selected
* Rearrange so that packaging definitions are towards the end in the expected order
* Add SUMMARY
* Update HOMEPAGE

This reapplies some of the changes from the original patch by Morgan Little <[email protected]>.

---
 .../recipes-support/ntp/files/openssl-check.patch  |   59 ++++++++++++++++
 .../recipes-support/ntp/ntp-ssl_4.2.6p5.bb         |   11 ---
 meta-networking/recipes-support/ntp/ntp.inc        |   73 ++++++++++++++++----
 meta-networking/recipes-support/ntp/ntp_4.2.6p5.bb |   44 +-----------
 4 files changed, 120 insertions(+), 67 deletions(-)
 create mode 100644 meta-networking/recipes-support/ntp/files/openssl-check.patch
 delete mode 100644 meta-networking/recipes-support/ntp/ntp-ssl_4.2.6p5.bb
meta-networking/recipes-support/ntp/files/openssl-check.patch new file +59 -0
new file mode 100644
index 0000000..8b4a673
@@ -0,0 +1,59 @@
+Hack OpenSSL check to work when libssl and libcrypto aren't in same dir
+
+Upstream-Status: Inappropriate [config]
+
+Signed-off-by: Paul Eggleton <[email protected]>
+---
+ configure         |    4 ++--
+ m4/ntp_openssl.m4 |    4 ++--
+ sntp/configure    |    4 ++--
+ 3 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/configure b/configure
+index aae2c01..6a3c15e 100755
+--- a/configure
++++ b/configure
+@@ -22868,8 +22868,8 @@ case "$ans" in
+ 	    test -f $i/libcrypto.dylib -a -f $i/libssl.dylib && break
+ 	    ;;
+ 	 *)
+-	    test -f $i/libcrypto.so -a -f $i/libssl.so && break
+-	    test -f $i/libcrypto.a -a -f $i/libssl.a && break
++	    test -f $i/libssl.so && break
++	    test -f $i/libssl.a && break
+ 	    ;;
+ 	esac
+     done
+diff --git a/m4/ntp_openssl.m4 b/m4/ntp_openssl.m4
+index 7d9f477..67bdd55 100644
+--- a/m4/ntp_openssl.m4
++++ b/m4/ntp_openssl.m4
+@@ -41,8 +41,8 @@ case "$ans" in
+ 	    test -f $i/libcrypto.dylib -a -f $i/libssl.dylib && break
+ 	    ;;
+ 	 *)
+-	    test -f $i/libcrypto.so -a -f $i/libssl.so && break
+-	    test -f $i/libcrypto.a -a -f $i/libssl.a && break
++	    test -f $i/libssl.so && break
++	    test -f $i/libssl.a && break
+ 	    ;;
+ 	esac
+     done
+diff --git a/sntp/configure b/sntp/configure
+index 7782c29..55e82d9 100755
+--- a/sntp/configure
++++ b/sntp/configure
+@@ -14810,8 +14810,8 @@ case "$ans" in
+ 	    test -f $i/libcrypto.dylib -a -f $i/libssl.dylib && break
+ 	    ;;
+ 	 *)
+-	    test -f $i/libcrypto.so -a -f $i/libssl.so && break
+-	    test -f $i/libcrypto.a -a -f $i/libssl.a && break
++	    test -f $i/libssl.so && break
++	    test -f $i/libssl.a && break
+ 	    ;;
+ 	esac
+     done
+-- 
+1.7.1
+
meta-networking/recipes-support/ntp/ntp-ssl_4.2.6p5.bb deleted +0 -11
deleted file mode 100644
index a158990..0000000
@@ -1,11 +0,0 @@
-require ntp_${PV}.bb
-DEPENDS = "openssl"
-
-S = "${WORKDIR}/ntp-${PV}"
-
-EXTRA_OECONF = "--with-openssl-libdir=${STAGING_LIBDIR} \
-	        --with-openssl-incdir=${STAGING_INCDIR}/openssl"
-
-
-SRC_URI[md5sum] = "98e16c7aa4ecd4c004b51bff18962e95"
-SRC_URI[sha256sum] = "9f4a5271a285d390c9225e3ea28f70049ea377d30fc6de4659007cfff278671a"
meta-networking/recipes-support/ntp/ntp.inc +58 -15

93 lines not on this page · raw message

meta-networking/recipes-support/ntp/ntp_4.2.6p5.bb +3 -41

48 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/2 ntp: make servers configurable and default to none configured

In reply to Paul Eggleton

People can't blindly use pool.ntp.org, especially if they are building for a product or something that could be used in a product, so at least try to get people to do the right thing and not use pool.ntp.org by default.

---
 meta-networking/recipes-support/ntp/ntp.inc |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
meta-networking/recipes-support/ntp/ntp.inc +11 -1
index d20bc2e..b54608a 100644
@@ -33,12 +33,22 @@ PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \
                           --without-openssl --without-crypto, \
                           openssl"
 
+# This should be set in the distro configuration
+NTP_SERVERS ??= ""
+
+python __anonymous() {
+    if not d.getVar("NTP_SERVERS", True):
+        raise bb.parse.SkipPackage("Please set NTP_SERVERS in order to build ntp - see http://www.openembedded.org/wiki/NTP for details")
+}
+
 do_install_append() {
 	install -d ${D}/${sysconfdir}/init.d
 	install -m 644 ${WORKDIR}/ntp.conf ${D}/${sysconfdir}
 	install -m 755 ${WORKDIR}/ntpd ${D}/${sysconfdir}/init.d
 	install -d ${D}/${sysconfdir}/network/if-up.d
 	install -m 755 ${WORKDIR}/ntpdate ${D}/${sysconfdir}/network/if-up.d
+
+	sed -i "s/pool.ntp.org/${NTP_SERVERS}/g" ${D}/${sysconfdir}/ntp.conf ${D}/${sysconfdir}/network/if-up.d/ntpdate
 }
 
 PACKAGES += "ntpdate ${PN}-bin ${PN}-tickadj ${PN}-utils"
@@ -71,7 +81,7 @@ else
         if ! grep -q -s ntpdate /var/spool/cron/root; then
                 echo "adding crontab"
                 test -d /var/spool/cron || mkdir -p /var/spool/cron
-                echo "30 * * * *    /usr/bin/ntpdate -b -s -u pool.ntp.org" >> /var/spool/cron/root
+                echo "30 * * * *    /usr/bin/ntpdate -b -s -u ${NTP_SERVERS}" >> /var/spool/cron/root
         fi
 fi
 }
Signature · 1 line
1.7.9.5
#3 lore raw

Re: [meta-networking][PATCH 2/2] ntp: make servers configurable and default to none configured

Quoted 15 lines · Paul Eggleton

People can't blindly use pool.ntp.org, especially if they are building for a product or something that could be used in a product, so at least try to get people to do the right thing and not use pool.ntp.org by default.

---
 meta-networking/recipes-support/ntp/ntp.inc |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
meta-networking/recipes-support/ntp/ntp.inc +0 -0
index d20bc2e..b54608a 100644

meta-networking/recipes-support/ntp/ntp.inc PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \ · line 42

Quoted 10 lines
meta-networking/recipes-support/ntp/ntp.inc +7 -0
@@ -33,12 +33,22 @@ PACKAGECONFIG[openssl] = "--with-openssl-libdir=${STAGING_LIBDIR} \
                           --without-openssl --without-crypto, \
                           openssl"
 
+# This should be set in the distro configuration
+NTP_SERVERS ??= ""
+
+python __anonymous() {
+    if not d.getVar("NTP_SERVERS", True):
+        raise bb.parse.SkipPackage("Please set NTP_SERVERS in order to build ntp - see http://www.openembedded.org/wiki/NTP for details")
+}

Cannot we move this logic to target?

I mean ntpdate can be usefull for end-user even without this cron job.

We can add something like
/etc/default/ntp
NTP_SERVERS=""

And change cron job as well as that systemd .service file we talked about before to show
"Please set correct NPT_SERVERS in /etc/default/ntp"
instead of failing (in systemd .service file case) or not being able to build ntpdate package unless you have distro with own ntp pool.

On other hand distro with own ntp pool can provide own value in /etc/default/ntp with .bbappend, so their users won't ever see this on target.

Cheers,

Quoted 29 lines
meta-networking/recipes-support/ntp/ntp.inc +4 -1
+
 do_install_append() {
 	install -d ${D}/${sysconfdir}/init.d
 	install -m 644 ${WORKDIR}/ntp.conf ${D}/${sysconfdir}
 	install -m 755 ${WORKDIR}/ntpd ${D}/${sysconfdir}/init.d
 	install -d ${D}/${sysconfdir}/network/if-up.d
 	install -m 755 ${WORKDIR}/ntpdate ${D}/${sysconfdir}/network/if-up.d
+
+	sed -i "s/pool.ntp.org/${NTP_SERVERS}/g" ${D}/${sysconfdir}/ntp.conf ${D}/${sysconfdir}/network/if-up.d/ntpdate
 }
 
 PACKAGES += "ntpdate ${PN}-bin ${PN}-tickadj ${PN}-utils"
@@ -71,7 +81,7 @@ else
         if ! grep -q -s ntpdate /var/spool/cron/root; then
                 echo "adding crontab"
                 test -d /var/spool/cron || mkdir -p /var/spool/cron
-                echo "30 * * * *    /usr/bin/ntpdate -b -s -u pool.ntp.org" >> /var/spool/cron/root
+                echo "30 * * * *    /usr/bin/ntpdate -b -s -u ${NTP_SERVERS}" >> /var/spool/cron/root
         fi
 fi
 }
Signature · 7 lines
1.7.9.5


_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#4 lore raw

Re: [meta-networking][PATCH 2/2] ntp: make servers configurable and default to none configured

Quoted 44 lines · On Wednesday 21 November 2012 18:37:54 Martin Jansa wrote:
Quoted 27 lines · Paul Eggleton

People can't blindly use pool.ntp.org, especially if they are building for a product or something that could be used in a product, so at least try to get people to do the right thing and not use pool.ntp.org by default.

---

 meta-networking/recipes-support/ntp/ntp.inc |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/meta-networking/recipes-support/ntp/ntp.inc index d20bc2e..b54608a 100644

meta-networking/recipes-support/ntp/ntp.inc +0 -0
@@ -33,12 +33,22 @@ PACKAGECONFIG[openssl] =

"--with-openssl-libdir=${STAGING_LIBDIR} \>

                           --without-openssl --without-crypto, \
                           openssl"
meta-networking/recipes-support/ntp/ntp.inc +6 -0
+# This should be set in the distro configuration
+NTP_SERVERS ??= ""
+
+python __anonymous() {
+    if not d.getVar("NTP_SERVERS", True):
+        raise bb.parse.SkipPackage("Please set NTP_SERVERS in order to
Quoted 1 line

build ntp - see http://www.openembedded.org/wiki/NTP for details") +}

Cannot we move this logic to target?

I mean ntpdate can be usefull for end-user even without this cron job.

We can add something like
/etc/default/ntp
NTP_SERVERS=""

And change cron job as well as that systemd .service file we talked about before to show
"Please set correct NPT_SERVERS in /etc/default/ntp"
instead of failing (in systemd .service file case) or not being able to build ntpdate package unless you have distro with own ntp pool.

Quoted 3 lines

On other hand distro with own ntp pool can provide own value in /etc/default/ntp with .bbappend, so their users won't ever see this on target.

Sure, this is an alternative approach. It will work for everything except ntp.conf, although for that we can just clear out that value in the file and get the distro to set their own custom version if they're going to use ntpd.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#6 lore raw
In reply to Paul Eggleton
Quoted 4 lines · Paul Eggleton

The following changes since commit 9637cb304f1e9116b037d0afd69014836a2fa512:

Revert "ntp: Clean up recipes" (2012-11-21 08:32:18 -0500)

Quoted 8 lines

are available in the git repository at:

git://git.openembedded.org/meta-openembedded-contrib paule/ntp
http://cgit.openembedded.org/cgit.cgi/meta-openembedded-contrib/log/?h=paule/ntp

Paul Eggleton (2):
ntp: cleanup recipes and fix SSL support
ntp: make servers configurable and default to none configured

Did you check my previous patches which move it to meta-networking? We need to fix it for systemd.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
#5 lore raw

Re: [meta-networking][PATCH 2/2] ntp: make servers configurable and default to none configured

In reply to Paul Eggleton
Quoted 47 lines · Paul Eggleton
Quoted 43 lines · On Wednesday 21 November 2012 18:37:54 Martin Jansa wrote:
Quoted 27 lines · Paul Eggleton

People can't blindly use pool.ntp.org, especially if they are building for a product or something that could be used in a product, so at least try to get people to do the right thing and not use pool.ntp.org by default.

---

  meta-networking/recipes-support/ntp/ntp.inc |   12 +++++++++++-
  1 file changed, 11 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/meta-networking/recipes-support/ntp/ntp.inc index d20bc2e..b54608a 100644

meta-networking/recipes-support/ntp/ntp.inc +0 -0
@@ -33,12 +33,22 @@ PACKAGECONFIG[openssl] =

"--with-openssl-libdir=${STAGING_LIBDIR} \>

                            --without-openssl --without-crypto, \
                            openssl"
meta-networking/recipes-support/ntp/ntp.inc +6 -0
+# This should be set in the distro configuration
+NTP_SERVERS ??= ""
+
+python __anonymous() {
+    if not d.getVar("NTP_SERVERS", True):
+        raise bb.parse.SkipPackage("Please set NTP_SERVERS in order to
Quoted 1 line

build ntp - see http://www.openembedded.org/wiki/NTP for details") +}

Cannot we move this logic to target?

I mean ntpdate can be usefull for end-user even without this cron job.

We can add something like
/etc/default/ntp
NTP_SERVERS=""

And change cron job as well as that systemd .service file we talked about before to show
"Please set correct NPT_SERVERS in /etc/default/ntp"
instead of failing (in systemd .service file case) or not being able to build ntpdate package unless you have distro with own ntp pool.

Quoted 3 lines

On other hand distro with own ntp pool can provide own value in /etc/default/ntp with .bbappend, so their users won't ever see this on target.

Quoted 7 lines

Sure, this is an alternative approach. It will work for everything except ntp.conf, although for that we can just clear out that value in the file and get the distro to set their own custom version if they're going to use ntpd.

Cheers,
Paul

This would be beneficial for me too as we intend to ship ntpd but it will be mainly for use with internal servers so I will not want or need a default server set.

Cheers,

Signature · 5 lines
  Jack Mitchell ([email protected])
  Embedded Systems Engineer
  http://www.embed.me.uk

--