net-misc/getdate: Fix build with glibc-2.31, bump EAPI
authorSam James (sam_c) <sam@cmpct.info>
Tue, 10 Mar 2020 23:38:53 +0000 (23:38 +0000)
committerSergei Trofimovich <slyfox@gentoo.org>
Sat, 14 Mar 2020 21:42:22 +0000 (21:42 +0000)
* Patches getdate to not use stime (removed in glibc-2.31).
  (Tested and adjusts time fine.)

* Bump EAPI from 4 -> 7

Closes: https://bugs.gentoo.org/709642
Signed-off-by: Sam James (sam_c) <sam@cmpct.info>
Closes: https://github.com/gentoo/gentoo/pull/14923
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
net-misc/getdate/files/getdate-glibc-2.31.patch [new file with mode: 0644]
net-misc/getdate/getdate-1.2-r2.ebuild [new file with mode: 0644]

diff --git a/net-misc/getdate/files/getdate-glibc-2.31.patch b/net-misc/getdate/files/getdate-glibc-2.31.patch
new file mode 100644 (file)
index 0000000..2926f7c
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/getdate.c
++++ b/getdate.c
+@@ -214,7 +214,9 @@
+                               /* Dangerous!  Could upset cron and other
+                                * timer related events.
+                                */
+-    stime(&new_time);
++    struct timespec s = {0};
++    s.tv_sec = new_time;
++    clock_settime(CLOCK_REALTIME, &s);
+     print_samples(host, first_sample, second_sample);
+     printf("getdate: set time to %s to match host %s\n", 
+          time_to_str(new_time),
diff --git a/net-misc/getdate/getdate-1.2-r2.ebuild b/net-misc/getdate/getdate-1.2-r2.ebuild
new file mode 100644 (file)
index 0000000..93e4e9d
--- /dev/null
@@ -0,0 +1,42 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+MY_PN="${PN}_rfc868"
+MY_P="${MY_PN}-${PV}"
+
+inherit toolchain-funcs
+
+DESCRIPTION="Network Date/Time Query and Set Local Date/Time Utility"
+HOMEPAGE="http://www.ibiblio.org/pub/Linux/system/network/misc/"
+SRC_URI="http://www.ibiblio.org/pub/Linux/system/network/misc/${MY_P}.tar.gz"
+
+LICENSE="GPL-1+"
+SLOT="0"
+KEYWORDS="~amd64 ~mips ~ppc ~x86"
+IUSE=""
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-glibc-2.31.patch"
+)
+
+src_prepare() {
+       sed -i -e "/errno.h/ a\#include <string.h>" getdate.c || die
+       # Respect CFLAGS
+       sed -i -e "/CFLAGS/d" Makefile || die
+
+       default
+}
+
+src_compile() {
+       emake CC="$(tc-getCC)"
+}
+
+src_install() {
+       dobin getdate
+       doman getdate.8
+       dodoc README getdate-cron
+}