Add explicit CM dependencies
[ta/config-manager.git] / config-manager.spec
1 # Copyright 2019 Nokia
2
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 Name:       config-manager
16 Version:    %{_version}
17 Release:    1%{?dist}
18 Summary:    Contains code for the config manager
19 License:    %{_platform_licence}
20 Source0:    %{name}-%{version}.tar.gz
21 Vendor:     %{_platform_vendor}
22 BuildArch:  noarch
23
24 BuildRequires: python2
25 BuildRequires: python2-setuptools
26 Requires:      python2, redis, python2-eventlet, python2-routes, python2-redis, python2-setuptools, python2-prettytable, python2-requests, python2-netaddr
27
28 %description
29 This RPM contains source code for the config manager.
30
31 %prep
32 %autosetup
33
34 %install
35 mkdir -p %{buildroot}/opt/cmframework/activators
36 mkdir -p %{buildroot}/opt/cmframework/validators
37 mkdir -p %{buildroot}/opt/cmframework/userconfighandlers
38 mkdir -p %{buildroot}/opt/cmframework/inventoryhandlers
39 mkdir -p %{buildroot}/etc/cmframework/masks.d
40
41 mkdir -p %{buildroot}/opt/cmframework/scripts
42 cp cmframework/scripts/*.sh %{buildroot}/opt/cmframework/scripts
43 cp cmframework/scripts/cmserver %{buildroot}/opt/cmframework/scripts
44 cp cmframework/scripts/cmagent %{buildroot}/opt/cmframework/scripts
45 cp cmframework/scripts/redis.conf %{buildroot}/opt/cmframework/scripts
46 cp cmframework/config/masks.d/default.cfg %{buildroot}/etc/cmframework/masks.d/
47
48 mkdir -p %{buildroot}/usr/lib/systemd/system
49 cp cmframework/systemd/config-manager.service  %{buildroot}/usr/lib/systemd/system
50 cp cmframework/systemd/cmagent.service  %{buildroot}/usr/lib/systemd/system
51
52 mkdir -p %{buildroot}/%{_python_site_packages_path}/cmframework/
53 set -e
54 cd cmframework/src && python2 setup.py install --root %{buildroot} --no-compile --install-purelib %{_python_site_packages_path} --install-scripts %{_platform_bin_path} && cd -
55
56 cd cmdatahandlers && python setup.py install --root %{buildroot} --no-compile --install-purelib %{_python_site_packages_path} --install-scripts %{_platform_bin_path} && cd -
57
58 mkdir -p %{buildroot}/etc/service-profiles/
59 cp serviceprofiles/profiles/*.profile %{buildroot}/etc/service-profiles/
60
61 cd serviceprofiles/python && python setup.py install --root %{buildroot} --no-compile --install-purelib %{_python_site_packages_path} && cd -
62
63 cd hostcli && python setup.py install --root %{buildroot} --no-compile --install-purelib %{_python_site_packages_path} && cd -
64
65 %files
66 %defattr(0755,root,root,0755)
67 /opt/cmframework
68 /usr/lib/systemd/system/config-manager.service
69 /usr/lib/systemd/system/cmagent.service
70 %{_platform_bin_path}/cmserver
71 %{_platform_bin_path}/cmcli
72 %{_platform_bin_path}/cmagent
73 %dir /etc/cmframework/masks.d
74 /etc/cmframework/masks.d/default.cfg
75 %{_python_site_packages_path}/cmframework*
76 %{_python_site_packages_path}/cmdatahandlers*
77 %{_python_site_packages_path}/serviceprofiles*
78 %{_python_site_packages_path}/cmcli*
79 /etc/service-profiles/*
80
81 %pre
82
83 %post
84 mkdir -p /opt/openstack-ansible/inventory/
85 ln -sf /opt/cmframework/scripts/inventory.sh /opt/openstack-ansible/inventory/
86 chmod -x /usr/lib/systemd/system/config-manager.service
87 chmod -x /usr/lib/systemd/system/cmagent.service
88
89 %preun
90
91 %postun
92
93 %clean
94 rm -rf %{buildroot}