bigtop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject [1/4] bigtop git commit: BIGTOP-2492 Split flink rpm packaging
Date Wed, 22 Mar 2017 23:22:21 GMT
Repository: bigtop
Updated Branches:
  refs/heads/master c7e06bb48 -> 61718f27b


BIGTOP-2492 Split flink rpm packaging


Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/1d9561a1
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/1d9561a1
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/1d9561a1

Branch: refs/heads/master
Commit: 1d9561a1c868ad5a5c160fc25213a5a9d9f78ff2
Parents: 511507c
Author: David Moravek <david.moravek@firma.seznam.cz>
Authored: Wed Jul 13 19:41:08 2016 +0200
Committer: Roman Shaposhnik <rvs@apache.org>
Committed: Wed Mar 22 16:21:51 2017 -0700

----------------------------------------------------------------------
 bigtop-packages/src/rpm/flink/SPECS/flink.spec | 70 +++++++++++++++------
 1 file changed, 51 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/bigtop/blob/1d9561a1/bigtop-packages/src/rpm/flink/SPECS/flink.spec
----------------------------------------------------------------------
diff --git a/bigtop-packages/src/rpm/flink/SPECS/flink.spec b/bigtop-packages/src/rpm/flink/SPECS/flink.spec
index 250ec19..d4b4dfa 100644
--- a/bigtop-packages/src/rpm/flink/SPECS/flink.spec
+++ b/bigtop-packages/src/rpm/flink/SPECS/flink.spec
@@ -28,10 +28,11 @@
 %define doc_flink %{_docdir}/%{flink_name}-%{flink_version}
 %define alternatives_cmd alternatives
 %define build_flink %{_builddir}/%{flink_name}-%{flink_version}/flink-dist/target/%{flink_name}-%{flink_version}-bin/%{flink_name}-%{flink_version}/
-
+%global initd_dir %{_sysconfdir}/rc.d/init.d
 %else
 %define doc_flink %{_docdir}/%{flink_name}-%{flink_version}
 %define alternatives_cmd update-alternatives
+%global initd_dir %{_sysconfdir}/rc.d
 %endif
 
 Name: %{flink_name}
@@ -54,6 +55,14 @@ Source6: bigtop.bom
 Requires: bigtop-utils >= 0.7
 Requires(preun): /sbin/service
 
+%if  %{?suse_version:1}0
+# Required for init scripts
+Requires: insserv
+%else
+# Required for init scripts
+Requires: /lib/lsb/init-functions
+%endif
+
 %description
 Apache Flink is an open source platform for distributed stream and batch data processing.
 Flinkā€™s core is a streaming dataflow engine that provides data distribution, communication,
@@ -73,19 +82,38 @@ Some of the key features of Apache Flink includes.
     * Fault-tolerance via Lightweight Distributed Snapshots
     * Hadoop-native YARN & HDFS implementation
 
-# Additions for master-worker configuration #
+%package jobmanager
+Summary: Provides the Apache Flink Job Manager service.
+Group: System/Daemons
+Requires: %{name} = %{version}-%{release}
+Requires(pre): %{name} = %{version}-%{release}
 
-%global initd_dir %{_sysconfdir}/init.d
+%description jobmanager
+Apache Flink Job Manager service.
 
 %if  %{?suse_version:1}0
 # Required for init scripts
 Requires: insserv
-%global initd_dir %{_sysconfdir}/rc.d
+%else
+# Required for init scripts
+Requires: /lib/lsb/init-functions
+%endif
+
+%package taskmanager
+Summary: Provides the Apache Flink Task Manager service.
+Group: System/Daemons
+Requires: %{name} = %{version}-%{release}
+Requires(pre): %{name} = %{version}-%{release}
 
+%description taskmanager
+Apache Flink Task Manager service.
+
+%if  %{?suse_version:1}0
+# Required for init scripts
+Requires: insserv
 %else
 # Required for init scripts
 Requires: /lib/lsb/init-functions
-%global initd_dir %{_sysconfdir}/rc.d/init.d
 %endif
 
 ##############################################
@@ -107,8 +135,6 @@ bash $RPM_SOURCE_DIR/do-component-build
 
 sh -x %{SOURCE2} --prefix=$RPM_BUILD_ROOT --source-dir=$RPM_SOURCE_DIR --build-dir=`pwd`/%{build_target_flink}
 
-
-
 for service in %{flink_services}
 do
     # Install init script
@@ -116,20 +142,10 @@ do
     bash %{SOURCE3} $RPM_SOURCE_DIR/${service}.svc rpm $init_file
 done
 
-
-%preun
-for service in %{flink_services}; do
-  /sbin/service ${service} status > /dev/null 2>&1
-  if [ $? -eq 0 ]; then
-    /sbin/service ${service} stop > /dev/null 2>&1
-  fi
-done
-
 %pre
 getent group flink >/dev/null || groupadd -r flink
 getent passwd flink >/dev/null || useradd -c "Flink" -s /sbin/nologin -g flink -r -d %{lib_flink}
flink 2> /dev/null || :
 
-
 %post
 %{alternatives_cmd} --install %{config_flink} %{flink_name}-conf %{config_flink}.dist 30
 systemctl daemon-reload
@@ -141,10 +157,26 @@ systemctl daemon-reload
 %config(noreplace) %{config_flink}.dist
 
 %dir %{_sysconfdir}/%{flink_name}
-%config(noreplace) %{initd_dir}/flink-jobmanager
-%config(noreplace) %{initd_dir}/flink-taskmanager
 #%doc %{doc_flink}
 %attr(0755,flink,flink) %{var_log_flink}
 %attr(0767,flink,flink) /var/log/flink-cli
 %{lib_flink}
 %{bin_flink}/flink
+
+%define service_macro() \
+%files %1 \
+%config(noreplace) %{initd_dir}/%{name}-%1 \
+%post %1 \
+chkconfig --add %{name}-%1 \
+%preun %1 \
+/sbin/service ${name}-%1 status > /dev/null 2>&1 \
+if [ "$?" -eq 0 ]; then \
+  service ${name}-%1 stop > /dev/null 2>&1 \
+  chkconfig --del %{name}-%1 \
+fi \
+%postun %1 \
+if [ "$?" -ge 1 ]; then \
+   service %{name}-%1 condrestart > /dev/null 2>&1 || : \
+fi
+%service_macro jobmanager 
+%service_macro taskmanager


Mime
View raw message