generated from Cray-HPE/metal-template
-
Notifications
You must be signed in to change notification settings - Fork 6
/
canu.spec
91 lines (75 loc) · 3 KB
/
canu.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
#
# MIT License
#
# (C) Copyright 2022-2024 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# Define which Python flavors python-rpm-macros will use (this can be a list).
# https://github.com/openSUSE/python-rpm-macros#terminology
%define pythons %(echo $PYTHON_BIN)
# python*-devel is not listed because our build environments install Python from source and not from OS packaging.
BuildRequires: python-rpm-generators
BuildRequires: python-rpm-macros
Name: %(echo $NAME)
BuildArch: %(echo $ARCH)
License: MIT License
Summary: CSM Automatic Network Utility
Version: %(echo $VERSION)
Release: %(echo $RELEASE)
Source: %{name}-%{version}.tar.bz2
Vendor: Hewlett Packard Enterprise Development LP
%description
A network device configuration and firmware utility. Designed for use on Cray-HPE Shasta systems, canu
will faciliate paddling through network topology plumbing.
%prep
%setup -q
%build
# Install pyinstaller for our onefile binary.
%python_exec -m pip install -U pyinstaller
# Install setuptools_scm[toml] so any context in this RPM build can resolve the module version.
%python_exec -m pip install -U setuptools_scm[toml]
# Build a source distribution and a wheel.
%python_exec -m pip install -U build
%python_exec -m build --sdist --wheel
cp -pv pyinstaller.py pyinstaller.spec
%install
%python_exec -m pip install dist/*.whl
# Make the --onefile binary.
pyinstaller --clean -y --dist ./dist/linux --workpath /tmp pyinstaller.spec
rm pyinstaller.spec
chown -R --reference=. ./dist/linux
mkdir -p %{buildroot}%{_bindir}
install -m 755 dist/linux/canu %{buildroot}%{_bindir}/canu
# Test our installed binary.
%{buildroot}%{_bindir}/canu --version
install -m 755 dist/linux/canu-inventory %{buildroot}%{_bindir}/canu-inventory
%pre
# remove the canu user as it is no longer needed post v1.9.1
if getent passwd canu; then
userdel -r canu
fi
if getent group canu; then
groupdel canu
fi
%files
%attr(0755, -, -) %{_bindir}/canu
%attr(0755, -, -) %{_bindir}/canu-inventory
%license LICENSE
%changelog