Add build script for generating packages
This adds a build script using make and removes the shell script that
was in place. It can generate deb packages and rpm packages. Versioning
is controlled in the top of the make file by setting the proper
variables. RHEL 7 and RHEL 8 use different spec files due to the
different naming conventions of the packages in the major releases. A
supported install and remove method are also provided.
Signed-off-by: Justin Thaler <thalerj@us.ibm.com>
Change-Id: I031d3e6af4ced0ef8281124f6e89401a7291e141
diff --git a/thalerj/build-scripts/openbmctool-rhel7.spec b/thalerj/build-scripts/openbmctool-rhel7.spec
new file mode 100644
index 0000000..7769223
--- /dev/null
+++ b/thalerj/build-scripts/openbmctool-rhel7.spec
@@ -0,0 +1,46 @@
+# Copyright (c) 2017 International Business Machines. All right reserved.
+%define _binaries_in_noarch_packages_terminate_build 0
+Summary: IBM OpenBMC tool
+Name: openbmctool
+Version: %{_version}
+Release: %{_release}
+License: Apache 2.0
+Group: System Environment/Base
+BuildArch: noarch
+URL: http://www.ibm.com/
+Source0: %{name}-%{version}-%{release}.tgz
+Prefix: /opt
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+Requires: python36
+Requires: python36-requests
+Requires: python36-simplejson
+
+# Turn off the brp-python-bytecompile script
+%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
+
+%description
+This package is to be applied to any linux machine that will be used to manage or interact with the IBM OpenBMC.
+It provides key functionality to easily work with the IBM OpenBMC RESTful API, making BMC management easy.
+
+%prep
+%setup -q -n %{name}
+
+%install
+export DESTDIR=$RPM_BUILD_ROOT/opt/ibm/ras
+mkdir -p $DESTDIR/bin
+mkdir -p $DESTDIR/lib
+cp openbmctool*.py $DESTDIR/bin
+cp *.json $DESTDIR/lib
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%attr(775,root,root) /opt/ibm/ras/bin/openbmctool.py
+%attr(664,root,root)/opt/ibm/ras/lib/policyTable.json
+
+%post
+ln -s -f /opt/ibm/ras/bin/openbmctool.py /usr/bin/openbmctool
+%changelog