Skip to content

Commit

Permalink
ntpsec: remove gcc from requires
Browse files Browse the repository at this point in the history
openssl: spec cleanup

Change-Id: I29bd7d9e4f03c62cba7f5d4a1e7391a950aaa5e1
Signed-off-by: Shreenidhi Shedi <[email protected]>
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/17797
Tested-by: gerrit-photon <[email protected]>
Reviewed-by: Tapas Kundu <[email protected]>
  • Loading branch information
sshedi authored and tapakund committed Sep 21, 2022
1 parent 9f90972 commit 2ca286b
Show file tree
Hide file tree
Showing 3 changed files with 236 additions and 172 deletions.
34 changes: 34 additions & 0 deletions SPECS/ntpsec/dont-check-for-libssp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From 180ae0478053739a0a401dc81e79fb7127fcf8cf Mon Sep 17 00:00:00 2001
From: Shreenidhi Shedi <[email protected]>
Date: Thu, 8 Sep 2022 13:31:03 +0530
Subject: [PATCH] Don't check for libssp, this brings gcc while installing
ntpsec

Signed-off-by: Shreenidhi Shedi <[email protected]>
---
wscript | 2 ++
1 file changed, 2 insertions(+)

diff --git a/wscript b/wscript
index c7c5468..049ef0c 100644
--- a/wscript
+++ b/wscript
@@ -312,6 +312,7 @@ def configure(ctx):
if ret:
ctx.env.LDFLAGS += ["-lbsd"]

+ """
# -lssp and -lssp_nonshared may be needed by older gcc to
# support "-fstack-protector-all"
ret = ctx.check_cc(lib="ssp", mandatory=False,
@@ -323,6 +324,7 @@ def configure(ctx):
comment="libssp_nonshared")
if ret:
ctx.env.LDFLAGS += ["-lssp_nonshared"]
+ """

cc_test_flags = [
('f_stack_protector_all', '-fstack-protector-all'),
--
2.25.1

46 changes: 28 additions & 18 deletions SPECS/ntpsec/ntpsec.spec
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
Summary: Improved implementation of Network Time Protocol
Name: ntpsec
Version: 1.1.8
Release: 1%{?dist}
Release: 2%{?dist}
License: BSD-2-Clause AND NTP AND BSD-3-Clause AND MIT
Group: System Environment/NetworkingPrograms
Vendor: VMware, Inc.
Distribution: Photon
Url: https://www.ntpsec.org/
Source0: https://ftp.ntpsec.org/pub/releases/%{name}-%{version}.tar.gz
%define sha512 ntpsec=0920f25adf68f1b8ccd1734c5d61ba1c858cd86b342db7b5155dd9b58e538aa96aad3fd4058597f079ec3df63cb51d2900ac8e6d9c84d6f2bd4a3a22cc0c967c
Patch0: ntpstats_path.patch
Url: https://www.ntpsec.org

Source0: https://ftp.ntpsec.org/pub/releases/%{name}-%{version}.tar.gz
%define sha512 %{name}=0920f25adf68f1b8ccd1734c5d61ba1c858cd86b342db7b5155dd9b58e538aa96aad3fd4058597f079ec3df63cb51d2900ac8e6d9c84d6f2bd4a3a22cc0c967c

Patch0: ntpstats_path.patch
Patch1: dont-check-for-libssp.patch

BuildRequires: asciidoc3
BuildRequires: binutils
Expand All @@ -26,7 +29,6 @@ BuildRequires: python3-devel
BuildRequires: systemd-devel

Requires(pre): /usr/sbin/useradd /usr/sbin/groupadd
Requires: gcc
Requires: glibc
Requires: openssl
Requires: libevent
Expand All @@ -51,47 +53,53 @@ The ntpsec python bindings used by various ntp utilities.
%autosetup -p1

%build
export CFLAGS="%{optflags}"
export CCFLAGS="%{optflags}"
python3 ./waf configure \
%{python3} ./waf configure \
--enable-debug \
--enable-debug-gdb \
--prefix=%{_prefix} \
--python=%{python3} \
--pythonarchdir=%{python3_sitearch}

python3 ./waf build --notests
%{python3} ./waf build --notests

%install
python3 ./waf --destdir=%{buildroot} install --notests
%{python3} ./waf --destdir=%{buildroot} install --notests

mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d \
%{buildroot}%{_libdir}/systemd/ntp-units.d \
%{buildroot}%{_sharedstatedir}/ntp \
%{buildroot}%{_localstatedir}/log/ntpstats

mkdir -p %{buildroot}/{%{_sysconfdir}/logrotate.d,%{_libdir}/systemd/ntp-units.d,\
%{_sharedstatedir}/ntp,%{_localstatedir}/log/ntpstats}
install -p -m755 attic/ntpdate %{buildroot}%{_sbindir}/ntpdate

install -p -m644 etc/logrotate-config.ntpd \
%{buildroot}%{_sysconfdir}/logrotate.d/ntpsec.conf

touch %{buildroot}%{_sharedstatedir}/ntp/ntp.drift
echo 'ntpd.service' > %{buildroot}%{_libdir}/systemd/ntp-units.d/60-ntpd.list

cat > %{buildroot}/etc/ntp.conf <<- "EOF"
cat > %{buildroot}%{_sysconfdir}/ntp.conf <<- "EOF"
tinker panic 0
restrict default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
driftfile /var/lib/ntp/drift/ntp.drift
driftfile %{_sharedstatedir}/ntp/drift/ntp.drift
EOF

rm -rf %{buildroot}%{_docdir}

%if 0%{?with_check}
%check
python3 ./waf check --verbose %{?_smp_mflags}
%{python3} ./waf check --verbose
%endif

%pre
if ! getent group ntp >/dev/null; then
groupadd -g 87 ntp
fi
if ! getent passwd ntp >/dev/null; then
useradd -c "Network Time Protocol" -d /var/lib/ntp -u 87 -g ntp -s /bin/false ntp
useradd -c "Network Time Protocol" -d %{_sharedstatedir}/ntp -u 87 \
-g ntp -s /bin/false ntp
fi
%post
%{_sbindir}/ldconfig
Expand All @@ -118,7 +126,7 @@ rm -rf %{buildroot}/*
%{_sbindir}/ntp*
%{_unitdir}/ntp*.service
%{_unitdir}/ntp*.timer
%{_prefix}/lib/systemd/ntp-units.d/*ntpd.list
%{_libdir}/systemd/ntp-units.d/*ntpd.list
%dir %attr(-,ntp,ntp) %{_sharedstatedir}/ntp
%dir %attr(-,ntp,ntp) %{_localstatedir}/log/ntpstats

Expand All @@ -127,5 +135,7 @@ rm -rf %{buildroot}/*
%{python3_sitearch}/ntp*

%changelog
* Thu Sep 08 2022 Shreenidhi Shedi <[email protected]> 1.1.8-2
- Add patch to remove gcc from Requires
* Fri May 27 2022 Prashant S Chauhan <[email protected]> 1.1.8-1
- ntpsec initial build
Loading

0 comments on commit 2ca286b

Please sign in to comment.