2
0
mirror of https://opendev.org/x/pyghmi synced 2024-12-25 12:41:37 +00:00

Enable package builds without pbr

There are some build environments we are being asked
to support that pbr does not.  A quick fallback
to handle such environments.

Change-Id: Ie5dac2555c73e80e4cf589932a18f31a530bdf65
This commit is contained in:
Jarrod Johnson 2019-02-04 15:53:40 -05:00
parent 2c901ac471
commit 40c546400e
4 changed files with 55 additions and 1 deletions

14
builddeb Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
cd `dirname $0`
# If not PBR, use the setup.py.tmpl
python -c 'import pbr' || ./makesetup
VERSION=`python setup.py --version`
python setup.py sdist
py2dsc dist/pyghmi-$VERSION.tar.gz
shopt -s extglob
cd deb_dist/!(*.orig)/
dpkg-buildpackage -rfakeroot -uc -us -i
cd -
rm -rf $(find deb_dist -mindepth 1 -maxdepth 1 -type d)
rm $1/*pyghmi*
cp deb_dist/* $1/

View File

@ -1,7 +1,10 @@
cd `dirname $0`
# If not PBR, use the setup.py.tmpl
python -c 'import pbr' || ./makesetup
VERSION=`python setup.py --version`
python setup.py sdist
cp dist/pyghmi-$VERSION.tar.gz ~/rpmbuild/SOURCES
rpmbuild -bs python-pyghmi.spec
grep -v python.-pbr python-pyghmi.spec > currentbuild.spec
rpmbuild -bs currentbuild.spec
rm $1/python-pyghmi-*rpm
cp ~/rpmbuild/SRPMS/python-pyghmi-$VERSION-1.src.rpm $1/

10
makesetup Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
cd `dirname $0`
VERSION=`git describe|cut -d- -f 1`
NUMCOMMITS=`git describe|cut -d- -f 2`
if [ "$NUMCOMMITS" != "$VERSION" ]; then
VERSION=$VERSION.dev$NUMCOMMITS.g`git describe|cut -d- -f 3`
fi
echo $VERSION > VERSION
sed -e "s/#VERSION#/$VERSION/" setup.py.tmpl > setup.py

27
setup.py.tmpl Normal file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env python
# Copyright (c) 2019 Lenovo
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
setuptools.setup(
name='pyghmi',
version='#VERSION#',
description='Python General Hardware Management Initiative (IPMI, redfish, etc)',
author='Jarrod Johnson',
autheor_email='jjohnson2@lenovo.com',
license='Apache License, Version 2.0')