summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Martin <jxm@risingtidesystems.com>2011-05-14 01:07:08 +0200
committerJerome Martin <jxm@risingtidesystems.com>2011-05-14 19:13:06 +0200
commitc65215a4bc0f16f61b77d5240578b4ec228e436c (patch)
tree12a9ffd65849aaa151ccfe96d968b4953ea79ff6
parentaf729c19ab72237c6987941929631b788828de61 (diff)
downloadconfigshell-fb-c65215a4bc0f16f61b77d5240578b4ec228e436c.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. * Added urwid version to debian/control depend.
-rw-r--r--.gitignore22
-rw-r--r--Makefile70
-rwxr-xr-xbin/clean30
-rwxr-xr-xbin/gen_changelog7
-rwxr-xr-xbin/gen_changelog_cleanup2
-rw-r--r--debian/control2
-rw-r--r--redhat/python-configshell.spec.tmpl38
7 files changed, 111 insertions, 60 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f63f7e8
--- /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-configshell.debhelper.log
+debian/python-configshell.substvars
+debian/python-configshell/
+debian/configshell-doc.debhelper.log
+debian/configshell-doc.substvars
+debian/configshell-doc/
+debian/tmp/
+dist/*
+doc/*
+*.pyc
+debian/python-configshell.substvars
+debian/configshell-doc.debhelper.log
+debian/tmp/
+*.spec
diff --git a/Makefile b/Makefile
index 55b6cdd..48adf3e 100644
--- a/Makefile
+++ b/Makefile
@@ -17,26 +17,27 @@ NAME = configshell
LIB = /usr/share
DOC = ${LIB}/doc/
SETUP = ./setup.py
-CLEAN = ./bin/clean
GENDOC = ./bin/gendoc
+RPMVERSION = $$(grep Version: redhat/python-configshell.spec | awk '{print $$2}')
all: usage
usage:
@echo "Usage:"
- @echo " make install - Install configshell"
- @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 configshell"
+ @echo " make installdocs - Install the documentation"
install:
${SETUP} install
doc:
- ./bin/gen_changelog
${GENDOC}
installdocs: doc
@@ -46,10 +47,27 @@ installdocs: doc
cp -r doc/* ${DOC}/${NAME}/
clean:
- ${CLEAN}
+ rm -fv configshell/*.pyc configshell/*.html
+ rm -frv doc doc/*.pdf doc/html doc/pdf doc/*.html
+ rm -frv configshell.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/configshell-doc/ debian/python2.5-configshell/
+ rm -frv debian/python2.6-configshell/ debian/python-configshell/
+ rm -frv results
+ rm -fv redhat/*.spec *.spec
./bin/gen_changelog_cleanup
+ echo "Finished cleanup."
-packages: clean doc
+cleanall: clean
+ rm -frv dist
+
+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 +76,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/configshell-doc_$$(cat ../dpkg-buildpackage.version)_all.deb
- cd build/configshell-doc-*; mkdir usr/share/doc/packages
- cd build/configshell-doc-*; mv usr/share/doc/configshell-doc usr/share/doc/packages/
- cd build/configshell-doc-*; perl -pi -e "s,/usr/share/doc/configshell-doc,/usr/share/doc/packages/configshell-doc,g" *.spec
- cd build/configshell-doc-*; perl -pi -e "s,%%{ARCH},noarch,g" *.spec
- cd build/configshell-doc-*; perl -pi -e "s,%post,%posttrans,g" *.spec
- cd build/configshell-doc-*; rpmbuild --buildroot $$PWD -bb *.spec
- cd build; alien --scripts -k -g -r ../dist/python-configshell_$$(cat ../dpkg-buildpackage.version)_all.deb; cd ..
- cd build/python-configshell-*; mkdir usr/share/doc/packages
- cd build/python-configshell-*; mv usr/share/doc/python-configshell usr/share/doc/packages/
- cd build/python-configshell-*; perl -pi -e "s,/usr/share/doc/python-configshell,/usr/share/doc/packages/python-configshell,g" *.spec
- cd build/python-configshell-*; perl -pi -e 's/Group:/Requires: python >= 2.5\nGroup:/g' *.spec
- cd build/python-configshell-*; perl -pi -e "s,%%{ARCH},noarch,g" *.spec
- cd build/python-configshell-*; perl -pi -e "s,%post,%posttrans,g" *.spec
- cd build/python-configshell-*; 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 configshell-${RPMVERSION}/ | gzip > ~/rpmbuild/SOURCES/configshell-${RPMVERSION}.tar.gz
+ rpmbuild -ba redhat/*.spec
+ @test -e dist || mkdir dist
+ mv ~/rpmbuild/SRPMS/python-configshell-${RPMVERSION}*.src.rpm dist/
+ mv ~/rpmbuild/RPMS/noarch/python-configshell-${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 6692f6c..0000000
--- a/bin/clean
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-
-# This file is part of ConfigShell 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 configshell/*.pyc configshell/*.html 2>/dev/null
-rm -rvf doc doc/*.pdf doc/html doc/pdf doc/*.html 2>/dev/null
-rm -rfv configshell.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/configshell-doc/ debian/python2.5-configshell/ debian/python2.6-configshell/ debian/python-configshell/ 2>/dev/null
-rm -rv results 2>/dev/null
-echo "Finished cleanup."
-
diff --git a/bin/gen_changelog b/bin/gen_changelog
index 617a7cd..a132ef7 100755
--- a/bin/gen_changelog
+++ b/bin/gen_changelog
@@ -32,8 +32,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
@@ -44,3 +46,8 @@ echo " * Generated package." >> debian/changelog
echo >> debian/changelog
echo " -- ${NAME} <${EMAIL}> ${DATE}" >> debian/changelog
+RH_SPEC="redhat/python-configshell.spec"
+cp redhat/python-configshell.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 ee6565e..71faccc 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-configshell.spec"
rm -f debian/changelog
sed -i "s/__version__ = .*/__version__ = 'GIT_VERSION'/g" ${SRCPKG}/__init__.py
+rm -f $RH_SPEC
diff --git a/debian/control b/debian/control
index 69f19bc..02ac836 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@ Standards-Version: 3.8.1
Package: python-configshell
Architecture: all
-Depends: python (>= 2.6)|python2.6, python-epydoc, python-simpleparse, python-urwid
+Depends: python (>= 2.6)|python2.6, python-epydoc, python-simpleparse, python-urwid (>=0.9.9)
Suggests: configshell-doc
Description: Framework to create CLI interfaces.
.
diff --git a/redhat/python-configshell.spec.tmpl b/redhat/python-configshell.spec.tmpl
new file mode 100644
index 0000000..9cb6456
--- /dev/null
+++ b/redhat/python-configshell.spec.tmpl
@@ -0,0 +1,38 @@
+%define oname configshell
+
+Name: python-configshell
+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, epydoc, python-simpleparse
+Requires: python-simpleparse, python-urwid >= 0.9.9
+Vendor: RisingTide Systems
+
+%description
+A framework to implement simple but nice command-line interfaces.
+
+%prep
+%setup -q -n %{oname}-%{version}
+
+%build
+%{__python} setup.py build
+
+%install
+rm -rf %{buildroot}
+%{__python} setup.py install --skip-build --root %{buildroot}
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%{python_sitelib}
+%doc examples COPYING README
+
+%changelog