From f38de3f45fa7b42cb8b881d86165154dae932100 Mon Sep 17 00:00:00 2001 From: Abraham Arce Date: Mon, 2 Sep 2019 17:03:16 -0500 Subject: [PATCH] openSUSE: Open Build Service Artifacts OBS is a generic system to build and distribute binary packages from sources [0], StarlingX OBS Project: - Cloud:StarlingX:2.0 [1] Build Service Management uses Open Build Service (OBS) with the following base artifacts under Service Management repository: - Specfiles - Changelogs - Rpmlintrcs The following components are included and succesfully building, (with their source OBS repository): - sm [2] - sm-common [3] - sm-db [4] - sm-api [5] - sm-client [6] - sm-tools [7] The following considerations are taken for Gerrit files: - Added %changelog directive to all specfiles The following considerations are taken for OBS _service files: - Added parameter "extract" to get spec, changes and rpmlintrc files. - All component version standardized to 1.0.0 [0] openbuildservice.org [1] https://build.opensuse.org/project/show/Cloud:StarlingX:2.0 [2] https://build.opensuse.org/package/show/home:xe1gyq:branches:Cloud:StarlingX:2.0/sm [3] https://build.opensuse.org/package/show/home:xe1gyq:branches:Cloud:StarlingX:2.0/sm-common [4] https://build.opensuse.org/package/show/home:xe1gyq:branches:Cloud:StarlingX:2.0/sm-db [5] https://build.opensuse.org/package/show/home:xe1gyq:branches:Cloud:StarlingX:2.0/sm-api [6] https://build.opensuse.org/package/show/home:xe1gyq:branches:Cloud:StarlingX:2.0/sm-client [7] https://build.opensuse.org/package/show/home:xe1gyq:branches:Cloud:StarlingX:2.0/sm-tools Story: 2006508 Task: 36495 Task: 36496 Task: 36497 Task: 36498 Task: 36534 Task: 36794 Change-Id: I06a7e132de4892b846d99977ff1bfc5bf240ade4 Co-authored-by: Erich Cordoba Signed-off-by: Abraham Arce --- service-mgmt-api/opensuse/sm-api.changes | 14 ++ service-mgmt-api/opensuse/sm-api.rpmlintrc | 1 + service-mgmt-api/opensuse/sm-api.spec | 72 +++++++++ .../opensuse/sm-client.changes | 9 ++ .../opensuse/sm-client.rpmlintrc | 1 + service-mgmt-client/opensuse/sm-client.spec | 43 ++++++ service-mgmt-tools/opensuse/sm-tools.changes | 4 + .../opensuse/sm-tools.rpmlintrc | 1 + service-mgmt-tools/opensuse/sm-tools.spec | 36 +++++ .../sm-common/opensuse/sm-common.changes | 9 ++ .../sm-common/opensuse/sm-common.rpmlintrc | 1 + .../sm-common/opensuse/sm-common.spec | 139 ++++++++++++++++++ service-mgmt/sm-db/opensuse/libsm_db1.changes | 9 ++ .../sm-db/opensuse/libsm_db1.rpmlintrc | 1 + service-mgmt/sm-db/opensuse/libsm_db1.spec | 70 +++++++++ service-mgmt/sm/opensuse/sm.changes | 19 +++ service-mgmt/sm/opensuse/sm.rpmlintrc | 1 + service-mgmt/sm/opensuse/sm.spec | 92 ++++++++++++ 18 files changed, 522 insertions(+) create mode 100644 service-mgmt-api/opensuse/sm-api.changes create mode 100644 service-mgmt-api/opensuse/sm-api.rpmlintrc create mode 100644 service-mgmt-api/opensuse/sm-api.spec create mode 100644 service-mgmt-client/opensuse/sm-client.changes create mode 100644 service-mgmt-client/opensuse/sm-client.rpmlintrc create mode 100644 service-mgmt-client/opensuse/sm-client.spec create mode 100644 service-mgmt-tools/opensuse/sm-tools.changes create mode 100644 service-mgmt-tools/opensuse/sm-tools.rpmlintrc create mode 100644 service-mgmt-tools/opensuse/sm-tools.spec create mode 100644 service-mgmt/sm-common/opensuse/sm-common.changes create mode 100644 service-mgmt/sm-common/opensuse/sm-common.rpmlintrc create mode 100644 service-mgmt/sm-common/opensuse/sm-common.spec create mode 100644 service-mgmt/sm-db/opensuse/libsm_db1.changes create mode 100644 service-mgmt/sm-db/opensuse/libsm_db1.rpmlintrc create mode 100644 service-mgmt/sm-db/opensuse/libsm_db1.spec create mode 100644 service-mgmt/sm/opensuse/sm.changes create mode 100644 service-mgmt/sm/opensuse/sm.rpmlintrc create mode 100644 service-mgmt/sm/opensuse/sm.spec diff --git a/service-mgmt-api/opensuse/sm-api.changes b/service-mgmt-api/opensuse/sm-api.changes new file mode 100644 index 00000000..581850af --- /dev/null +++ b/service-mgmt-api/opensuse/sm-api.changes @@ -0,0 +1,14 @@ +------------------------------------------------------------------- +Tue Sep 24 05:22:50 UTC 2019 - Abraham Arce - 3 + +- Move to _service to get source from git repo + +------------------------------------------------------------------- +Thu Jun 20 17:00:16 UTC 2019 - Marcela Rosales - 2 + +- Modify Requires: chkconfig is in aaa_base openSUSE package. + +------------------------------------------------------------------- +Wed Jun 5 09:44:11 UTC 2019 - Marcela Rosales - 1 + +- Initial Commit. diff --git a/service-mgmt-api/opensuse/sm-api.rpmlintrc b/service-mgmt-api/opensuse/sm-api.rpmlintrc new file mode 100644 index 00000000..adc59bf3 --- /dev/null +++ b/service-mgmt-api/opensuse/sm-api.rpmlintrc @@ -0,0 +1 @@ +setBadness('script-without-shebang', 2) diff --git a/service-mgmt-api/opensuse/sm-api.spec b/service-mgmt-api/opensuse/sm-api.spec new file mode 100644 index 00000000..5a35df0e --- /dev/null +++ b/service-mgmt-api/opensuse/sm-api.spec @@ -0,0 +1,72 @@ +Summary: Service Management API +Name: sm-api +Version: 1.0.0 +Release: %{tis_patch_ver}%{?_tis_dist} +License: Apache-2.0 +Group: System/Packages +URL: https://opendev.org/starlingx/ha/ +Source0: %{name}-%{version}.tar.gz + +%define debug_package %{nil} + +BuildRequires: python +BuildRequires: python-setuptools +BuildRequires: python2-pip +BuildRequires: util-linux +# BuildRequires systemd is to get %%_unitdir I think +BuildRequires: systemd +BuildRequires: systemd-devel +%if 0%{?suse_version} +BuildRequires: gcc-c++ +BuildRequires: systemd-sysvinit +BuildRequires: insserv-compat +%endif +Requires: python2-six +# Needed for %%{_sysconfdir}/init.d, can be removed when we go fully systemd +Requires: aaa_base +# Needed for %%{_sysconfdir}/pmon.d +Requires: libamon1 + +%description +The Service Management API + +%prep +%setup -n %{name}-%{version}/%{name} + +%build +%{__python2} setup.py build + +%install +%global _buildsubdir %{_builddir}/%{name}-%{version}/%{name} +%{__python2} setup.py install -O1 --skip-build --root %{buildroot} +install -d %{buildroot}%{_sysconfdir}/sm +install -d %{buildroot}%{_sysconfdir}/init.d +install -d %{buildroot}%{_sysconfdir}/pmon.d +install -d %{buildroot}%{_sysconfdir}/sm-api +install -d %{buildroot}%{_unitdir} +install -m 644 %{_buildsubdir}/scripts/sm_api.ini %{buildroot}%{_sysconfdir}/sm +install -m 755 %{_buildsubdir}/scripts/sm-api %{buildroot}%{_sysconfdir}/init.d +install -m 644 %{_buildsubdir}/scripts/sm-api.service %{buildroot}%{_unitdir} +install -m 644 %{_buildsubdir}/scripts/sm-api.conf %{buildroot}%{_sysconfdir}/pmon.d +install -m 644 %{_buildsubdir}%{_sysconfdir}/sm-api/policy.json %{buildroot}%{_sysconfdir}/sm-api + +%post +%{_bindir}/systemctl enable sm-api.service >/dev/null 2>&1 + +%files +%dir %{_sysconfdir}/pmon.d +%dir %{_sysconfdir}/sm-api +%defattr(-,root,root,-) +%dir "%{_prefix}/lib/python2.7/site-packages/sm_api" +%{_prefix}/lib/python2.7/site-packages/sm_api/* +%dir "%{_prefix}/lib/python2.7/site-packages/sm_api-1.0.0-py2.7.egg-info" +%{_prefix}/lib/python2.7/site-packages/sm_api-1.0.0-py2.7.egg-info/* +"%{_bindir}/sm-api" +%dir "%{_sysconfdir}/sm" +"%{_sysconfdir}/init.d/sm-api" +"%{_sysconfdir}/pmon.d/sm-api.conf" +"%{_sysconfdir}/sm-api/policy.json" +"%{_sysconfdir}/sm/sm_api.ini" +%{_unitdir}/* + +%changelog diff --git a/service-mgmt-client/opensuse/sm-client.changes b/service-mgmt-client/opensuse/sm-client.changes new file mode 100644 index 00000000..7a8665f2 --- /dev/null +++ b/service-mgmt-client/opensuse/sm-client.changes @@ -0,0 +1,9 @@ +------------------------------------------------------------------- +Tue Sep 24 05:22:50 UTC 2019 - Abraham Arce - 2 + +- Move to _service to get source from git repo + +------------------------------------------------------------------- +Tue May 21 21:29:56 UTC 2019 - Erich Cordoba - 1 + +- First version of sm-client diff --git a/service-mgmt-client/opensuse/sm-client.rpmlintrc b/service-mgmt-client/opensuse/sm-client.rpmlintrc new file mode 100644 index 00000000..adc59bf3 --- /dev/null +++ b/service-mgmt-client/opensuse/sm-client.rpmlintrc @@ -0,0 +1 @@ +setBadness('script-without-shebang', 2) diff --git a/service-mgmt-client/opensuse/sm-client.spec b/service-mgmt-client/opensuse/sm-client.spec new file mode 100644 index 00000000..a43c4213 --- /dev/null +++ b/service-mgmt-client/opensuse/sm-client.spec @@ -0,0 +1,43 @@ +Summary: Service Management Client and CLI +Name: sm-client +Version: 1.0.0 +Release: 4 +BuildArch: noarch +License: Apache-2.0 +Group: System/Base +URL: https://www.starlingx.io +Source0: %{name}-%{version}.tar.gz + +%define debug_package %{nil} + +BuildRequires: python +BuildRequires: python-setuptools +BuildRequires: fdupes +Requires: python-six + +%description +Service Management Client and command line interface. + +%prep +%setup -n %{name}-%{version}/%{name} + +%build +%{__python2} setup.py build + +%install +%global _buildsubdir %{_builddir}/%{name}-%{version}/%{name} +%{__python2} setup.py install -O1 --skip-build --root %{buildroot} +install -d %{buildroot}/usr/bin +ls %{_builddir}/ +install -m 755 %{_buildsubdir}/usr/bin/smc %{buildroot}/usr/bin +%fdupes %{buildroot}/usr/lib/python2.7/site-packages/sm_client/ + +%files +%defattr(-,root,root,-) +%dir /usr/lib/python2.7/site-packages/sm_client +/usr/lib/python2.7/site-packages/sm_client/* +/usr/bin/smc +%dir /usr/lib/python2.7/site-packages/sm_client-1.0.0-py2.7.egg-info +/usr/lib/python2.7/site-packages/sm_client-1.0.0-py2.7.egg-info/* + +%changelog diff --git a/service-mgmt-tools/opensuse/sm-tools.changes b/service-mgmt-tools/opensuse/sm-tools.changes new file mode 100644 index 00000000..8bf0d179 --- /dev/null +++ b/service-mgmt-tools/opensuse/sm-tools.changes @@ -0,0 +1,4 @@ +------------------------------------------------------------------- +Tue Jun 11 13:00:38 UTC 2019 - Abraham Arce - 1 + +- Initial commit diff --git a/service-mgmt-tools/opensuse/sm-tools.rpmlintrc b/service-mgmt-tools/opensuse/sm-tools.rpmlintrc new file mode 100644 index 00000000..adc59bf3 --- /dev/null +++ b/service-mgmt-tools/opensuse/sm-tools.rpmlintrc @@ -0,0 +1 @@ +setBadness('script-without-shebang', 2) diff --git a/service-mgmt-tools/opensuse/sm-tools.spec b/service-mgmt-tools/opensuse/sm-tools.spec new file mode 100644 index 00000000..a39673f2 --- /dev/null +++ b/service-mgmt-tools/opensuse/sm-tools.spec @@ -0,0 +1,36 @@ +Summary: Service Management Tools +Name: sm-tools +Version: 1.0.0 +Release: 0 +License: Apache-2.0 +Group: Development/Tools/Other +URL: https://opendev.org/starlingx/metal +Source0: %{name}-%{version}.tar.gz + +BuildRequires: python +BuildRequires: python-pip +BuildRequires: python-setuptools + +BuildArch: noarch + +%description +StarlingX Service Management Tools + +%prep +%setup -n %{name}-%{version}/%{name} + +%build +python2 setup.py build + +%install +python2 setup.py install -O1 --skip-build --root %{buildroot} + +%files +%defattr(-,root,root,-) +%dir "%{_prefix}/lib/python2.7/site-packages/sm_tools" +%{_prefix}/lib/python2.7/site-packages/sm_tools/* +%dir "%{_prefix}/lib/python2.7/site-packages/sm_tools-1.0.0-py2.7.egg-info" +%{_prefix}/lib/python2.7/site-packages/sm_tools-1.0.0-py2.7.egg-info/* +%{_bindir}/* + +%changelog diff --git a/service-mgmt/sm-common/opensuse/sm-common.changes b/service-mgmt/sm-common/opensuse/sm-common.changes new file mode 100644 index 00000000..c7772243 --- /dev/null +++ b/service-mgmt/sm-common/opensuse/sm-common.changes @@ -0,0 +1,9 @@ +------------------------------------------------------------------- +Mon Sep 23 22:03:54 UTC 2019 - Erich Cordoba - 2 + +- Adding _service and removing source code tarball. + +------------------------------------------------------------------- +Fri May 17 22:17:32 UTC 2019 - Erich Cordoba - 1 + +- Adding first version of sm-common. diff --git a/service-mgmt/sm-common/opensuse/sm-common.rpmlintrc b/service-mgmt/sm-common/opensuse/sm-common.rpmlintrc new file mode 100644 index 00000000..adc59bf3 --- /dev/null +++ b/service-mgmt/sm-common/opensuse/sm-common.rpmlintrc @@ -0,0 +1 @@ +setBadness('script-without-shebang', 2) diff --git a/service-mgmt/sm-common/opensuse/sm-common.spec b/service-mgmt/sm-common/opensuse/sm-common.spec new file mode 100644 index 00000000..3ced7265 --- /dev/null +++ b/service-mgmt/sm-common/opensuse/sm-common.spec @@ -0,0 +1,139 @@ +Summary: Service Management Common +Name: sm-common +Version: 1.0.0 +Release: 1 +License: Apache-2.0 +Group: System/Base +URL: https://www.starlingx.io +Source0: %{name}-%{version}.tar.gz + +BuildRequires: glib2-devel +BuildRequires: sqlite-devel +BuildRequires: gcc +BuildRequires: util-linux +BuildRequires: libuuid-devel +BuildRequires: gcc-c++ +BuildRequires: systemd-sysvinit +BuildRequires: insserv-compat + +Requires: libamon1 +Requires: /bin/sh +Requires: sqlite +Requires: util-linux +Requires: systemd +BuildRequires: systemd +BuildRequires: systemd-devel +Requires(post): systemd +Requires: %{name}-libs = %{version}-%{release} + +%description +Service Managment Common + +%package libs +Summary: Service Management Common - shared library fles +Group: System/Base + +%description libs +Service Managment Common This package contains shared libraries. + +%package devel +Summary: Service Management Common - Development files +Group: Development/Libraries/Other +Requires: %{name}-libs = %{version}-%{release} + +%description devel +Service Managment Common This package contains symbolic links, header +files, and related items necessary for software development. + +%package -n sm-eru +Summary: Service Management ERU +Group: System/Base +Requires: %{name}-libs = %{version}-%{release} + +%description -n sm-eru +Service Managment ERU. + +%prep +%setup -n %{name}-%{version} + +%build +VER=%{version} + +MAJOR=`echo $VER | awk -F . '{print $1}'` +MINOR=`echo $VER | awk -F . '{print $2}'` +make VER=${VER} VER_MJR=$MAJOR %{?_smp_mflags} + +%global _buildsubdir %{_builddir}/%{name}-%{version} + +%install +rm -rf %{buildroot} +VER=%{version} +MAJOR=`echo $VER | awk -F . '{print $1}'` +MINOR=`echo $VER | awk -F . '{print $2}'` +make DEST_DIR=%{buildroot} BIN_DIR=%{_bindir} UNIT_DIR=%{_unitdir} LIB_DIR=%{_libdir} INC_DIR=%{_includedir} BUILDSUBDIR=%{_buildsubdir} VER=$VER VER_MJR=$MAJOR install + +%pre +%service_add_pre sm-watchdog.service sm-watchdog.target + +%preun +%service_del_preun sm-watchdog.service sm-watchdog.target + +%post +%service_add_post sm-watchdog.service sm-watchdog.target +/usr/bin/systemctl enable sm-watchdog.service + +%postun +%service_del_postun sm-watchdog.service sm-watchdog.target + +%pre -n sm-eru +%service_add_pre sm-eru.service sm-eru.target + +%preun -n sm-eru +%service_del_preun sm-eru.service sm-eru.target + +%post -n sm-eru +%service_add_post sm-eru.service sm-eru.target +/usr/bin/systemctl enable sm-eru.service + +%postun -n sm-eru +%service_del_postun sm-eru.service sm-eru.target +/usr/bin/systemctl disable sm-eru.service + +%post -n sm-common-libs +/sbin/ldconfig + +%postun -n sm-common-libs +/sbin/ldconfig + +%files +%license LICENSE +%defattr(-,root,root,-) +%{_sysconfdir}/init.d/sm-watchdog +%config %{_sysconfdir}/pmon.d/sm-watchdog.conf +%{_bindir}/sm-watchdog +%{_unitdir}/sm-watchdog.service + +%files libs +%{_libdir}/*.so.* +%dir %{_sharedstatedir}/sm +%dir %{_sharedstatedir}/sm/watchdog +%dir %{_sharedstatedir}/sm/watchdog/modules +%{_sharedstatedir}/sm/watchdog/modules/*.so.* + +%files -n sm-eru +%defattr(-,root,root,-) +%dir %{_sysconfdir}/init.d +%dir %{_sysconfdir}/pmon.d +%{_sysconfdir}/init.d/sm-eru +%config %{_sysconfdir}/pmon.d/sm-eru.conf +%{_bindir}/sm-eru +%{_bindir}/sm-eru-dump +%{_unitdir}/sm-eru.service + +%files devel +%defattr(-,root,root,-) +%{_includedir}/* +%{_libdir}/*.so +%{_sharedstatedir}/sm/watchdog/modules/libsm_watchdog_nfs.so + +%changelog diff --git a/service-mgmt/sm-db/opensuse/libsm_db1.changes b/service-mgmt/sm-db/opensuse/libsm_db1.changes new file mode 100644 index 00000000..25b77489 --- /dev/null +++ b/service-mgmt/sm-db/opensuse/libsm_db1.changes @@ -0,0 +1,9 @@ +------------------------------------------------------------------- +Wed Jun 26 17:33:07 UTC 2019 - Erich Cordoba - 2 + +- Update tarball to match other ha/sm projects. + +------------------------------------------------------------------- +Tue May 21 20:02:52 UTC 2019 - Erich Cordoba - 1 + +- Adding first version for sm-db. diff --git a/service-mgmt/sm-db/opensuse/libsm_db1.rpmlintrc b/service-mgmt/sm-db/opensuse/libsm_db1.rpmlintrc new file mode 100644 index 00000000..adc59bf3 --- /dev/null +++ b/service-mgmt/sm-db/opensuse/libsm_db1.rpmlintrc @@ -0,0 +1 @@ +setBadness('script-without-shebang', 2) diff --git a/service-mgmt/sm-db/opensuse/libsm_db1.spec b/service-mgmt/sm-db/opensuse/libsm_db1.spec new file mode 100644 index 00000000..9026868b --- /dev/null +++ b/service-mgmt/sm-db/opensuse/libsm_db1.spec @@ -0,0 +1,70 @@ +Summary: Service Management Databases +Name: libsm_db1 +Version: 1.0.0 +Release: 5 +License: Apache-2.0 +Group: System/Base +URL: https://www.starlingx.io +Source0: %{name}-%{version}.tar.gz + +BuildRequires: gcc-c++ +BuildRequires: sm-common-devel +BuildRequires: glib2-devel +BuildRequires: glibc +BuildRequires: sqlite3-devel +BuildRequires: libuuid-devel +BuildRequires: libsqlite3-0 +BuildRequires: sqlite3 + +Requires: sqlite3 + +%description +The StarlingX Service Managment Databases + +%package devel +Summary: Service Management Databases - Development files +Group: Development/Libraries/Other +Requires: %{name} = %{version}-%{release} + +%description devel +Service Managment Databases This package contains symbolic links, header +files, and related items necessary for software development. + +%prep +%setup -n %{name}-%{version} + +%build +sqlite3 database/sm.db < database/create_sm_db.sql +sqlite3 database/sm.hb.db < database/create_sm_hb_db.sql +VER=%{version} +export SUSE_ASNEEDED=0 +MAJOR=`echo $VER | awk -F . '{print $1}'` +make VER=${VER} VER_MJR=$MAJOR + +%install +VER=%{version} +MAJOR=`echo $VER | awk -F . '{print $1}'` +make DEST_DIR=$RPM_BUILD_ROOT VER=$VER VER_MJR=$MAJOR install + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + +%files +%license LICENSE +%defattr(-,root,root,-) +%dir %{_sharedstatedir}/sm/patches +%{_libdir}/libsm_db.so.1 +%{_libdir}/libsm_db.so.1.0.0 +%config(noreplace) %{_sharedstatedir}/sm/sm.hb.db +%config(noreplace) %{_sharedstatedir}/sm/sm.db +%{_sharedstatedir}/sm/patches/sm-patch.sql + +%files devel +%defattr(-,root,root,-) +%{_libdir}/libsm_db.so +%{_includedir}/*.h + +%changelog diff --git a/service-mgmt/sm/opensuse/sm.changes b/service-mgmt/sm/opensuse/sm.changes new file mode 100644 index 00000000..7ce7103d --- /dev/null +++ b/service-mgmt/sm/opensuse/sm.changes @@ -0,0 +1,19 @@ +------------------------------------------------------------------- +Mon Sep 23 22:17:37 UTC 2019 - Erich Cordoba - 4 + +- Removing patches that were merged in source code. + +------------------------------------------------------------------- +Mon Sep 16 15:45:00 UTC 2019 - Dominig ar Foll Intel Open Source - 3 + +- move to _service to get source from git repo. + +------------------------------------------------------------------- +Wed Jun 26 03:23:14 UTC 2019 - Erich Cordoba - 2 + +- Add unmodified tarball and upstream packages. + +------------------------------------------------------------------- +Mon Jun 17 17:35:48 UTC 2019 - Erich Cordoba - 1 + +- Initial commit for building sm in openSUSE. diff --git a/service-mgmt/sm/opensuse/sm.rpmlintrc b/service-mgmt/sm/opensuse/sm.rpmlintrc new file mode 100644 index 00000000..adc59bf3 --- /dev/null +++ b/service-mgmt/sm/opensuse/sm.rpmlintrc @@ -0,0 +1 @@ +setBadness('script-without-shebang', 2) diff --git a/service-mgmt/sm/opensuse/sm.spec b/service-mgmt/sm/opensuse/sm.spec new file mode 100644 index 00000000..c5bc52cb --- /dev/null +++ b/service-mgmt/sm/opensuse/sm.spec @@ -0,0 +1,92 @@ +Summary: Service Management +Name: sm +Version: 1.0.0 +Release: 2 +License: Apache-2.0 +Group: System/Base +URL: https://www.starlingx.io +Source0: %{name}-%{version}.tar.gz + +# Patches no applied to upstream yet. +Patch0: 0001-Change-shebang-to-help-rpm-runtime-dependency-detect.patch + +BuildRequires: gcc-c++ +BuildRequires: fm-common-dev +BuildRequires: libsm_db1-devel +BuildRequires: sm-common-devel +BuildRequires: mtce-devel +BuildRequires: glib2-devel +BuildRequires: glibc +BuildRequires: sqlite3-devel +BuildRequires: gcc +BuildRequires: libuuid-devel +BuildRequires: libjson-c3 +BuildRequires: libjson-c-devel +BuildRequires: openssl-devel +BuildRequires: systemd-sysvinit +BuildRequires: insserv-compat + +BuildRequires: systemd +BuildRequires: systemd-devel +Requires(post): systemd +Requires(preun): systemd + +# Needed for /etc/init.d, can be removed when we go fully systemd +Requires: aaa_base +# Needed for /etc/logrotate.d +Requires: logrotate +# for collect stuff +Requires: time + + +%description +The StarlingX Service Managment system. + +%prep +%setup -n %{name}-%{version} +%patch0 -p3 + +%build +VER=%{version} +MAJOR=`echo $VER | awk -F . '{print $1}'` +make -j"%(nproc)" + +%install +rm -rf %{buildroot} +VER=%{version} +MAJOR=`echo $VER | awk -F . '{print $1}'` +make DEST_DIR=%{buildroot} UNIT_DIR=%{_unitdir} install + +%pre +%service_add_pre sm.service +%service_add_pre sm-shutdown.service + +%preun +%service_del_preun sm.service +%service_del_preun sm-shutdown.service + +%post +%service_add_post sm.service +%service_add_post sm-shutdown.service +/usr/bin/systemctl enable sm.service >/dev/null 2>&1 +/usr/bin/systemctl enable sm-shutdown.service >/dev/null 2>&1 + +%postun +%service_del_postun sm.service +%service_del_postun sm-shutdown.service + +%files +%license LICENSE +%defattr(-,root,root,-) +%dir %{_sysconfdir}/pmon.d +%{_unitdir}/* +%{_bindir}/sm +/usr/local/sbin/sm-notify +/usr/local/sbin/sm-troubleshoot +/usr/local/sbin/sm-notification +%{_sysconfdir}/init.d/sm +%{_sysconfdir}/init.d/sm-shutdown +%config %{_sysconfdir}/pmon.d/sm.conf +%config %{_sysconfdir}/logrotate.d/sm.logrotate + +%changelog