-
Notifications
You must be signed in to change notification settings - Fork 39
/
contrail-nodemgr.spec
147 lines (121 loc) · 3.73 KB
/
contrail-nodemgr.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
%define _contrailetc /etc/contrail
%define _contrailcontrol /opt/contrail/control-node
%define _supervisordir /etc/contrail/supervisord_control_files
%define _distropkgdir tools/packaging/common/control_files
%if 0%{?fedora} >= 17
%define _servicedir /usr/lib/systemd/system
%endif
%if 0%{?_buildTag:1}
%define _relstr %{_buildTag}
%else
%define _relstr %(date -u +%y%m%d%H%M)
%endif
%{echo: "Building release %{_relstr}\n"}
%if 0%{?_srcVer:1}
%define _verstr %{_srcVer}
%else
%define _verstr 1
%endif
Name: contrail-nodemgr
Version: %{_verstr}
Release: %{_relstr}%{?dist}
Summary: Contrail Nodemgr %{?_gitVer}
Group: Applications/System
License: Commercial
URL: http://www.juniper.net/
Vendor: Juniper Networks Inc
Requires: contrail-lib >= %{_verstr}-%{_relstr}
Requires: supervisor
Requires: xmltodict >= 0.7.0
Requires: python-bottle >= 0.11.6
Requires: python-contrail >= %{_verstr}-%{_relstr}
Requires: ntp
%if 0%{?rhel} && 0%{?rhel} <= 6
Requires: python-importlib
%endif
%define _pyver %( %{__python} -c "import sys; print '%s.%s' % sys.version_info[0:2]" )
%define _pysitepkg /lib/python%{_pyver}/site-packages
BuildRequires: make
BuildRequires: gcc
%description
Contrail Nodemgr package
%prep
#%setup -q
# start from git root.. run this
# git rev-parse --show-toplevel > %{SOURCE0}
# make sure we are in ctrlplane repo
# gitrepo=$(basename $(git remote show origin | grep "Fetch URL" | cut -d: -f3 ))
# if [ x$gitrepo != xctrlplane.git ]; then
gitrepo=contrail-controller
grep $gitrepo %{_builddir}/.git/config &> /dev/null
if [ $? -ne 0 ]; then
echo "Please use rpmbuild --define \"_builddir <git_sandbox>\""
exit -1
fi
%build
scons -U control-node:node_mgr
scons -U vrouter:node_mgr
scons -U opserver:node_mgr
scons -U database:node_mgr
scons -U src:nodemgr
if [ $? -ne 0 ] ; then
echo "build failed"
exit -1
fi
%install
# Setup directories
pushd %{_builddir}/..
#install files
install -d -m 755 %{buildroot}%{_bindir}
# install pysandesh files
%define _build_dist %{_builddir}/../build/debug
install -d -m 755 %{buildroot}
popd
mkdir -p build/python_dist
pushd build/python_dist
tar zxf %{_build_dist}/control-node/dist/Control-Node-0.1dev.tar.gz
pushd Control-Node-0.1dev
%{__python} setup.py install --root=%{buildroot}
install -d -m 755 %{buildroot}/usr/share/doc/python-Control-Node
if [ -d doc ]; then
cp -R doc/* %{buildroot}/usr/share/doc/python-Control-Node
fi
popd
tar zxf %{_build_dist}/vnsw/agent/uve/dist/vrouter-0.1dev.tar.gz
pushd vrouter-0.1dev
%{__python} setup.py install --root=%{buildroot}
install -d -m 755 %{buildroot}/usr/share/doc/python-vrouter
if [ -d doc ]; then
cp -R doc/* %{buildroot}/usr/share/doc/python-vrouter
fi
popd
tar zxf %{_build_dist}/opserver/node_mgr/dist/node_mgr-0.1dev.tar.gz
pushd node_mgr-0.1dev
%{__python} setup.py install --root=%{buildroot}
popd
tar zxf %{_build_dist}/nodemgr/dist/nodemgr-0.1dev.tar.gz
pushd nodemgr-0.1dev
%{__python} setup.py install --root=%{buildroot}
popd
tar zxvf %{_build_dist}/analytics/database/dist/database-0.1dev.tar.gz
pushd database-0.1dev
%{__python} setup.py install --root=%{buildroot}
popd
%files
%defattr(-,root,root,-)
%{_bindir}/contrail-nodemgr
%{python_sitelib}/Control_Node*
%{python_sitelib}/control_node*
%{python_sitelib}/vrouter
%{python_sitelib}/vrouter-*
%{python_sitelib}/node_mgr-*
%{python_sitelib}/database
%{python_sitelib}/database-*
%{python_sitelib}/analytics
%{python_sitelib}/nodemgr
%{python_sitelib}/nodemgr-*
%post
if [ -x /bin/systemctl ]; then
/bin/systemctl --system daemon-reload
fi
%changelog