diff --git a/builddeb b/builddeb new file mode 100755 index 00000000..38c5fbf4 --- /dev/null +++ b/builddeb @@ -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/ diff --git a/buildrpm b/buildrpm index 6cc5cdbc..0a7df85c 100755 --- a/buildrpm +++ b/buildrpm @@ -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/ diff --git a/makesetup b/makesetup new file mode 100755 index 00000000..7288b9e1 --- /dev/null +++ b/makesetup @@ -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 + diff --git a/setup.py.tmpl b/setup.py.tmpl new file mode 100644 index 00000000..cd18bec3 --- /dev/null +++ b/setup.py.tmpl @@ -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') +