Long Li 9ec7cf4447 Update engtools to use python3
Change spec and scripts to only use
python3 explicitly

Verification:
1. Regard as the README,in development docker environment, run
./patch-engtools.sh,
it will generate the ENGTOOLS-20.01.patch
if we scp the patch to controller,
we could sw-patch upload and sw-apply it successfully.

2. The engtools-1.0-4.tis.noarch.rpm is not built into bootimage by default
thus if we package it into bootimage when to verify it.
1). Run some bash script, such as
ceph.sh, memstats.sh, netstats.sh and so on
it will display the collect system resource information.
2). The service of collect-engtools.service
could start and stop without problem
3). If we run the modified python which we have changed to python3.
python3 buddyinfo.py
it will deplay the resource information
python3 live_stream.py
the log of livestream.log will display collect information

This package only be packaged into bootimage when we need it to
collect system resource information.

Change-Id: I9bd77e34650e200f0c65db966635a8ebcdc584aa
Story: 2007106
Task: 39112
Depends-on: https://review.opendev.org/#/c/712218/
Depends-on: https://review.opendev.org/#/c/714072/
Signed-off-by: Long Li <lilong-neu@neusoft.com>
2020-04-07 08:04:59 +00:00

104 lines
3.7 KiB
RPMSpec

Summary: Host performance data collection tools package
Name: engtools
Version: 1.0
Release: %{tis_patch_ver}%{?_tis_dist}
License: Apache-2.0
Group: Tools
Packager: Wind River <info@windriver.com>
URL: http://www.windriver.com/
BuildArch: noarch
Source: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: systemd
Requires: iperf3
Requires: python36-six
Requires: python36-psutil
%description
This package contains data collection tools to monitor host performance.
Tools are general purpose engineering and debugging related. Includes
overall memory, cpu occupancy, per-task cpu, per-task scheduling, per-task
io.
# Don't try fancy stuff like debuginfo, which is useless on binary-only
# packages. Don't strip binary too
# Be sure buildpolicy set to do nothing
%define __spec_install_post %{nil}
%define debug_package %{nil}
%define __os_install_post %{_dbpath}/brp-compress
%define _binaries_in_noarch_packages_terminate_build 0
%define local_dir /usr/local
%define local_bindir %{local_dir}/bin/
%define local_initdir /etc/init.d/
%define local_confdir /etc/engtools/
%define local_systemddir /etc/systemd/system/
%prep
%setup -q
%build
# Empty section.
%install
mkdir -p %{buildroot}
install -d 755 %{buildroot}%{local_bindir}
# Installing additional tools, memtop, occtop and schedtop are already in the image
install -m 755 buddyinfo.py %{buildroot}%{local_bindir}
install -m 755 chewmem %{buildroot}%{local_bindir}
# Installing data collection scripts
install -m 755 ceph.sh %{buildroot}%{local_bindir}
install -m 755 cleanup-engtools.sh %{buildroot}%{local_bindir}
install -m 755 collect-engtools.sh %{buildroot}%{local_bindir}
install -m 755 diskstats.sh %{buildroot}%{local_bindir}
install -m 755 engtools_util.sh %{buildroot}%{local_bindir}
install -m 755 filestats.sh %{buildroot}%{local_bindir}
install -m 755 iostat.sh %{buildroot}%{local_bindir}
install -m 755 linux_benchmark.sh %{buildroot}%{local_bindir}
install -m 755 memstats.sh %{buildroot}%{local_bindir}
install -m 755 netstats.sh %{buildroot}%{local_bindir}
install -m 755 postgres.sh %{buildroot}%{local_bindir}
install -m 755 rabbitmq.sh %{buildroot}%{local_bindir}
install -m 755 remote/rbzip2-engtools.sh %{buildroot}%{local_bindir}
install -m 755 remote/rstart-engtools.sh %{buildroot}%{local_bindir}
install -m 755 remote/rstop-engtools.sh %{buildroot}%{local_bindir}
install -m 755 remote/rsync-engtools-data.sh %{buildroot}%{local_bindir}
install -m 755 slab.sh %{buildroot}%{local_bindir}
install -m 755 ticker.sh %{buildroot}%{local_bindir}
install -m 755 top.sh %{buildroot}%{local_bindir}
install -m 755 vswitch.sh %{buildroot}%{local_bindir}
install -m 755 live_stream.py %{buildroot}%{local_bindir}
# Installing conf file
install -d 755 %{buildroot}%{local_confdir}
install -m 644 -p -D cfg/engtools.conf %{buildroot}%{local_confdir}
# Installing init script
install -d 755 %{buildroot}%{local_initdir}
install -m 755 init.d/collect-engtools.sh %{buildroot}%{local_initdir}
# Installing service file
install -d 755 %{buildroot}%{local_systemddir}
install -m 644 -p -D collect-engtools.service %{buildroot}%{local_systemddir}
%clean
rm -rf $RPM_BUILD_ROOT
%files
%license LICENSE
%defattr(-,root,root,-)
%{local_bindir}/*
%{local_confdir}/*
%{local_initdir}/*
%{local_systemddir}/*
%post
/bin/systemctl enable collect-engtools.service > /dev/null 2>&1
/bin/systemctl start collect-engtools.service > /dev/null 2>&1
%preun
#/bin/systemctl --no-reload disable collect-engtools.sh.service > /dev/null 2>&1
#/bin/systemctl stop collect-engtools.sh.service > /dev/null 2>&1
%systemd_preun collect-engtools.service
%postun
%systemd_postun_with_restart collect-engtools.service