diff options
author | Jerome Martin <jxm@risingtidesystems.com> | 2011-05-14 04:15:33 +0200 |
---|---|---|
committer | Jerome Martin <jxm@risingtidesystems.com> | 2011-05-14 18:58:46 +0200 |
commit | 9ec2cc7c3160efcdefe0f3f02c99192b26da61ae (patch) | |
tree | 54838f77b6492418ad0c6693c70aa871e0e0a000 | |
parent | c5578a5597e62b682382d1890d02dbe78d87da2a (diff) | |
download | rtslib-fb-9ec2cc7c3160efcdefe0f3f02c99192b26da61ae.tar.gz |
Build process cleanup, added rpm/deb targets.
* Now builds rpm and deb separately, intended to be used on debian and redhat
systems respectively. No more deb -> rpm conversion using alien.
* Integrated bin/clean into Makefile
* Now make clean does not remove packages, added cleanall target for that.
* Added .gitignore file.
-rw-r--r-- | .gitignore | 22 | ||||
-rw-r--r-- | Makefile | 69 | ||||
-rwxr-xr-x | bin/clean | 30 | ||||
-rwxr-xr-x | bin/gen_changelog | 8 | ||||
-rwxr-xr-x | bin/gen_changelog_cleanup | 2 | ||||
-rw-r--r-- | redhat/python-rtslib.spec.tmpl | 40 |
6 files changed, 113 insertions, 58 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..587bace --- /dev/null +++ b/.gitignore @@ -0,0 +1,22 @@ +debian/changelog +dpkg-buildpackage.log +dpkg-buildpackage.version +*.swp +*.swo +build-stamp +build/* +debian/files +debian/python-rtslib.debhelper.log +debian/python-rtslib.substvars +debian/python-rtslib/ +debian/rtslib-doc.debianebhelper.log +debian/rtslib-doc.substvars +debian/rtslib-doc/ +debian/tmp/ +dist/* +doc/* +*.pyc +debian/python-rtslib.substvars +debian/rtslib-doc.debhelper.log +debian/tmp/ +*.spec @@ -17,20 +17,22 @@ NAME = rtslib LIB = /usr/share DOC = ${LIB}/doc/ SETUP = ./setup.py -CLEAN = ./bin/clean GENDOC = ./bin/gendoc +RPMVERSION = $$(grep Version: redhat/python-rtslib.spec | awk '{print $$2}') all: usage usage: @echo "Usage:" - @echo " make install - Install rtslib" - @echo " make installdocs - Install the documentation" + @echo " make deb - Builds debian packages." + @echo " make rpm - Builds redhat packages." + @echo " make clean - Cleanup the local repository" + @echo " make cleanall - Cleanup the local repository and packages" @echo "Developer targets:" - @echo " make packages - Generate the Debian and RPM packages" - @echo " make doc - Generate the documentation" - @echo " make clean - Cleanup the local repository" - @echo " make sdist - Build the source tarball" - @echo " make bdist - Build the installable tarball" + @echo " make doc - Generate the documentation" + @echo " make sdist - Build the source tarball" + @echo " make bdist - Build the installable tarball" + @echo " make install - Install rtslib" + @echo " make installdocs - Install the documentation" install: ${SETUP} install @@ -46,10 +48,27 @@ installdocs: doc cp -r doc/* ${DOC}/${NAME}/ clean: - ${CLEAN} + rm -fv rtslib/*.pyc rtslib/*.html + rm -frv doc doc/*.pdf doc/html doc/pdf doc/*.html + rm -frv rtslib.egg-info MANIFEST build + rm -frv pdf html + rm -frv debian/tmp + rm -fv build-stamp + rm -fv dpkg-buildpackage.log dpkg-buildpackage.version + rm -frv *.rpm + rm -fv debian/files debian/*.log debian/*.substvars + rm -frv debian/rtslib-doc/ debian/python2.5-rtslib/ + rm -frv debian/python2.6-rtslib/ debian/python-rtslib/ + rm -frv results + rm -fv redhat/*.spec *.spec ./bin/gen_changelog_cleanup + echo "Finished cleanup." + +cleanall: clean + rm -frv dist -packages: clean doc +deb: doc + ./bin/gen_changelog dpkg-buildpackage -rfakeroot | tee dpkg-buildpackage.log ./bin/gen_changelog_cleanup grep "source version" dpkg-buildpackage.log | awk '{print $$4}' > dpkg-buildpackage.version @@ -58,24 +77,18 @@ packages: clean doc mv ../${NAME}_$$(cat dpkg-buildpackage.version)_*.changes dist mv ../${NAME}_$$(cat dpkg-buildpackage.version).tar.gz dist mv ../*${NAME}*$$(cat dpkg-buildpackage.version)*.deb dist - @test -e build || mkdir build - cd build; alien --scripts -k -g -r ../dist/rtslib-doc_$$(cat ../dpkg-buildpackage.version)_all.deb - cd build/rtslib-doc-*; mkdir usr/share/doc/packages - cd build/rtslib-doc-*; mv usr/share/doc/rtslib-doc usr/share/doc/packages/ - cd build/rtslib-doc-*; perl -pi -e "s,/usr/share/doc/rtslib-doc,/usr/share/doc/packages/rtslib-doc,g" *.spec - cd build/rtslib-doc-*; perl -pi -e "s,%%{ARCH},noarch,g" *.spec - cd build/rtslib-doc-*; perl -pi -e "s,%post,%posttrans,g" *.spec - cd build/rtslib-doc-*; rpmbuild --buildroot $$PWD -bb *.spec - cd build; alien --scripts -k -g -r ../dist/python-rtslib_$$(cat ../dpkg-buildpackage.version)_all.deb; cd .. - cd build/python-rtslib-*; mkdir usr/share/doc/packages - cd build/python-rtslib-*; mv usr/share/doc/python-rtslib usr/share/doc/packages/ - cd build/python-rtslib-*; perl -pi -e "s,/usr/share/doc/python-rtslib,/usr/share/doc/packages/python-rtslib,g" *.spec - cd build/python-rtslib-*; perl -pi -e 's/Group:/Requires: python >= 2.5\nGroup:/g' *.spec - cd build/python-rtslib-*; perl -pi -e "s,%%{ARCH},noarch,g" *.spec - cd build/python-rtslib-*; perl -pi -e "s,%post,%posttrans,g" *.spec - cd build/python-rtslib-*; rpmbuild --buildroot $$PWD -bb *.spec - mv build/*.rpm dist - rm dpkg-buildpackage.log dpkg-buildpackage.version + ./bin/gen_changelog_cleanup + +rpm: + ./bin/gen_changelog + echo Building RPM version ${RPMVERSION} + mkdir -p ~/rpmbuild/SOURCES/ + git archive master --prefix rtslib-${RPMVERSION}/ | gzip > ~/rpmbuild/SOURCES/rtslib-${RPMVERSION}.tar.gz + rpmbuild -ba redhat/*.spec + @test -e dist || mkdir dist + mv ~/rpmbuild/SRPMS/python-rtslib-${RPMVERSION}*.src.rpm dist/ + mv ~/rpmbuild/RPMS/noarch/python-rtslib-${RPMVERSION}*.rpm dist/ + ./bin/gen_changelog_cleanup sdist: clean doc ${SETUP} sdist diff --git a/bin/clean b/bin/clean deleted file mode 100755 index 40f4104..0000000 --- a/bin/clean +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# This file is part of RTSLib Community Edition. -# Copyright (c) 2011 by RisingTide Systems LLC -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, version 3 (AGPLv3). -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -rm -v rtslib/*.pyc rtslib/*.html 2>/dev/null -rm -rvf doc doc/*.pdf doc/html doc/pdf doc/*.html 2>/dev/null -rm -rfv rtslib.egg-info MANIFEST build dist 2>/dev/null -rm -rvf pdf html 2>/dev/null -rm -rvf debian/tmp 2>/dev/null -rm -v build-stamp 2>/dev/null -rm -v dpkg-buildpackage.log dpkg-buildpackage.version 2>/dev/null -rm -rfv *.rpm 2>/dev/null -rm -v debian/files debian/*.log debian/*.substvars 2>/dev/null -rm -rv debian/rtslib-doc/ debian/python2.5-rtslib/ debian/python2.6-rtslib/ debian/python-rtslib/ 2>/dev/null -rm -rv results 2>/dev/null -echo "Finished cleanup." - diff --git a/bin/gen_changelog b/bin/gen_changelog index 0aa9a4d..4c9fe67 100755 --- a/bin/gen_changelog +++ b/bin/gen_changelog @@ -31,8 +31,10 @@ TS=$(date +%Y%m%d%H%M%S) if [ -z $COMMIT ]; then VERSION="${LAST_TAG}" + RH_VERSION="${LAST_TAG}" else VERSION="${LAST_TAG}-${TS}.${COMMIT}" + RH_VERSION="${LAST_TAG}.${TS}.${COMMIT}" fi sed -i "s/__version__ = .*/__version__ = '${VERSION}'/g" ${SRCPKG}/__init__.py @@ -43,3 +45,9 @@ echo " * Generated package." >> debian/changelog echo >> debian/changelog echo " -- ${NAME} <${EMAIL}> ${DATE}" >> debian/changelog +RH_SPEC="redhat/python-rtslib.spec" +cp redhat/python-rtslib.spec.tmpl $RH_SPEC +sed -i "s/Version:\( *\).*/Version:\1${RH_VERSION}/g" $RH_SPEC +echo "* $(date +'%a %b %d %Y') ${NAME} <${EMAIL}> - ${RH_VERSION}" >> $RH_SPEC +echo "- Generated package." >> $RH_SPEC + diff --git a/bin/gen_changelog_cleanup b/bin/gen_changelog_cleanup index 6d21485..eab1a6a 100755 --- a/bin/gen_changelog_cleanup +++ b/bin/gen_changelog_cleanup @@ -16,5 +16,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. SRCPKG=$(cat debian/control | grep ^Source | awk '{print $2}') +RH_SPEC="redhat/python-rtslib.spec" rm -f debian/changelog sed -i "s/__version__ = .*/__version__ = 'GIT_VERSION'/g" ${SRCPKG}/__init__.py +rm -f $RH_SPEC diff --git a/redhat/python-rtslib.spec.tmpl b/redhat/python-rtslib.spec.tmpl new file mode 100644 index 0000000..8d8ff20 --- /dev/null +++ b/redhat/python-rtslib.spec.tmpl @@ -0,0 +1,40 @@ +%define oname rtslib + +Name: python-rtslib +License: AGPLv3 +Group: System Environment/Libraries +Summary: A framework to implement simple but nice CLIs. +Version: VERSION +Release: 1%{?dist} +URL: http://www.risingtidesystems.com/git/ +Source: %{oname}-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-rpmroot +BuildArch: noarch +BuildRequires: python-devel +Vendor: RisingTide Systems + +%description +API for RisingTide Systems generic SCSI target. + +%prep +%setup -q -n %{oname}-%{version} + +%build +%{__python} setup.py build + +%install +rm -rf %{buildroot} +%{__python} setup.py install --skip-build --root %{buildroot} +mkdir -p %{buildroot}/var/target/fabric +cp specs/* %{buildroot}/var/target/fabric + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%{python_sitelib} +/var/target +%doc COPYING README + +%changelog |