diff options
author | Adrian Likins <alikins@redhat.com> | 2007-09-20 16:09:20 -0400 |
---|---|---|
committer | Adrian Likins <alikins@redhat.com> | 2007-09-20 16:09:20 -0400 |
commit | 7a70b5bb80c69dafc345dfd4df577bfb1e983ee9 (patch) | |
tree | 2b3ebe15ab9c14a438b4cea2b61b31d0512450c8 | |
parent | 322c6fd1fe1aa02b740d646a3c02f8ec46515fa3 (diff) | |
download | func-7a70b5bb80c69dafc345dfd4df577bfb1e983ee9.tar.gz func-7a70b5bb80c69dafc345dfd4df577bfb1e983ee9.tar.xz func-7a70b5bb80c69dafc345dfd4df577bfb1e983ee9.zip |
first pass at packaging stuff
version is 0.11-1 (this one goes to .11)
"make rpms" should build a rpm from the setup.py and func.spec
-rw-r--r-- | MANIFEST.in | 6 | ||||
-rwxr-xr-x | Makefile | 57 | ||||
-rw-r--r-- | certs/slave-keys.py (renamed from func/slave-keys.py) | 0 | ||||
-rw-r--r-- | client/__init__.py | 0 | ||||
-rw-r--r-- | func.spec | 61 | ||||
-rwxr-xr-x | init-scripts/funcd | 91 | ||||
-rw-r--r-- | settings | 1 | ||||
-rw-r--r-- | setup.py | 68 | ||||
-rw-r--r-- | version | 1 |
9 files changed, 285 insertions, 0 deletions
diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..d5ed9be --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +include settings +include version +recursive-include docs * +recursive-include init-scripts * +recursive-include po *.po +recursive-include po *.pot diff --git a/Makefile b/Makefile new file mode 100755 index 0000000..b831591 --- /dev/null +++ b/Makefile @@ -0,0 +1,57 @@ +VERSION = $(shell echo `awk '{ print $$1 }' version`) +RELEASE = $(shell echo `awk '{ print $$2 }' version`) +NEWRELEASE = $(shell echo $$(($(RELEASE) + 1))) + +MESSAGESPOT=po/messages.pot + +all: rpms + +clean: + -rm -f MANIFEST + -rm -rf dist/ build/ + -rm -rf *~ + -rm -rf rpm-build/ + +#manpage: +# pod2man --center="cobbler" --release="" cobbler.pod | gzip -c > cobbler.1.gz +# pod2html cobbler.pod > cobbler.html + +#test: +# python tests/tests.py +# -rm -rf /tmp/_cobbler-* + +messages: server/*.py + xgettext -k_ -kN_ -o $(MESSAGESPOT) server/*.py + sed -i'~' -e 's/SOME DESCRIPTIVE TITLE/func/g' -e 's/YEAR THE PACKAGE'"'"'S COPYRIGHT HOLDER/2007 Red Hat, inc. /g' -e 's/FIRST AUTHOR <EMAIL@ADDRESS>, YEAR/Adrian Likins <alikins@redhat.com>, 2007/g' -e 's/PACKAGE VERSION/func $(VERSION)-$(RELEASE)/g' -e 's/PACKAGE/func/g' $(MESSAGESPOT) + + +bumprelease: + -echo "$(VERSION) $(NEWRELEASE)" > version + +setversion: + -echo "$(VERSION) $(RELEASE)" > version + +build: clean + python setup.py build -f + +install: build + python setup.py install -f + +sdist: clean messages + python setup.py sdist + +new-rpms: bumprelease rpms + + +rpms: sdist + mkdir -p rpm-build + cp dist/*.gz rpm-build/ + cp version rpm-build/ + rpmbuild --define "_topdir %(pwd)/rpm-build" \ + --define "_builddir %{_topdir}" \ + --define "_rpmdir %{_topdir}" \ + --define "_srcrpmdir %{_topdir}" \ + --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \ + --define "_specdir %{_topdir}" \ + --define "_sourcedir %{_topdir}" \ + -ba func.spec diff --git a/func/slave-keys.py b/certs/slave-keys.py index dee0fd5..dee0fd5 100644 --- a/func/slave-keys.py +++ b/certs/slave-keys.py diff --git a/client/__init__.py b/client/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/client/__init__.py diff --git a/func.spec b/func.spec new file mode 100644 index 0000000..2ad7d6f --- /dev/null +++ b/func.spec @@ -0,0 +1,61 @@ + +%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} + +Summary: func remote config, monitoring, and management api +Name: func +Source1: version +Version: %(echo `awk '{ print $1 }' %{SOURCE1}`) +Release: %(echo `awk '{ print $2 }' %{SOURCE1}`)%{?dist} +Source0: %{name}-%{version}.tar.gz +License: GPL +Group: Applications/System +Requires: python >= 2.3 +Requires: rhpl +Requires: yum-utils +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot +BuildArch: noarch +Url: https://hosted.fedoraproject.org/projects/func/ + +%description + +func is a remote api for mangement, configation, and monitoring of systems. +%prep +%setup -q +%build +%{__python} setup.py build + +%install +test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT +%{__python} setup.py install --root=$RPM_BUILD_ROOT + +%files +%{_bindir}/funcd +/etc/init.d/funcd +#%dir /var/lib/virt-factory +%config(noreplace) /etc/func/settings +%dir %{python_sitelib}/func +%dir %{python_sitelib}/func/server +%dir %{python_sitelib}/func/client +%{python_sitelib}/func/server/*.py* +%{python_sitelib}/func/client/*.py* + +%dir %{python_sitelib}/func/server/modules +%{python_sitelib}/func/server/modules/*.py* +%dir %{python_sitelib}/func/server/yaml +%{python_sitelib}/func/server/yaml/*.py* +%dir /var/log/func + +%post +/sbin/chkconfig --add funcd +exit 0 + +%preun +if [ "$1" = 0 ] ; then + /sbin/service funcd stop > /dev/null 2>&1 + /sbin/chkconfig --del funcd +fi + + +%changelog +* Thu Sep 20 2007 Adrian Likins <alikins@redhat.com> - 0.0.11-1 +- initial release (this one goes to .11) diff --git a/init-scripts/funcd b/init-scripts/funcd new file mode 100755 index 0000000..6066d99 --- /dev/null +++ b/init-scripts/funcd @@ -0,0 +1,91 @@ +#!/bin/sh +# +# funcd func api provider +# +# chkconfig: 345 99 99 +# description: Server to expose config, monitoring, and management apis to func +# See https://hosted.fedoraproject.org/projects/func/ +# +# processname: /usr/bin/funcd + +# Sanity checks. +[ -x /usr/bin/funcd ] || exit 0 + +# Source function library. +. /etc/rc.d/init.d/functions + +RETVAL=0 + +start() { + echo -n $"Starting the funcd : " + if test -f /var/lock/subsys/funcd ; then + echo_failure + echo + return 1 + fi + /usr/bin/funcd --daemon + RETVAL=$? + echo_success + echo + touch /var/lock/subsys/funcd + return $RETVAL +} + + +stop() { + echo -n $"Stopping funcd daemon: " + if ! test -f /var/lock/subsys/funcd ; then + echo_failure + echo + return 1 + fi + pkill funcd + RETVAL=$? + rm /var/lock/subsys/funcd + echo_success + echo + return $RETVAL +} + +mystatus() { + if test -f /var/lock/subsys/funcd ; then + echo "the funcd is alive..." + return 0 + fi + echo "we have lost the funcd" + echo + return 0 +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + mystatus + RETVAL=$? + ;; + restart) + stop + start + ;; + condrestart) + if [ -f /var/lock/subsys/vf_server ]; then + stop + start + fi + ;; + reload) + echo "can't reload configuration, you have to restart it" + RETVAL=$? + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}" + ;; +esac +exit $RETVAL + diff --git a/settings b/settings new file mode 100644 index 0000000..9fe73d9 --- /dev/null +++ b/settings @@ -0,0 +1 @@ +this file is empty at the moment, but at some point it will be the config file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..9584b05 --- /dev/null +++ b/setup.py @@ -0,0 +1,68 @@ +#!/usr/bin/python + +import sys +from distutils.core import setup, Extension +#from setuptools import setup,find_packages +import string +import glob + +NAME = "func" +VERSION = open("version", "r+").read().split()[0] +SHORT_DESC = "%s remote configuration and management api" % NAME +LONG_DESC = """ +A small pluggabe xml-rpc daemon used by %s to implement various web services hooks +""" % NAME + + +if __name__ == "__main__": + + manpath = "share/man/man1/" + etcpath = "/etc/%s" % NAME + etcpathdb = "/etc/%s/db" % NAME + wwwpath = "/var/www/%s" % NAME + initpath = "/etc/init.d/" + logpath = "/var/log/%s/" % NAME + logpathdb = "/var/log/%s/db/" % NAME + settingspath = "/var/lib/%s/" % NAME + migraterepopath = "/var/lib/%s/db/" % NAME + schemapath = "/usr/share/%s/db_schema/" % NAME + upgradepath = schemapath + "upgrade/" + puppetpath = "/usr/share/%s/puppet-config/" % NAME + manifestpath = "/etc/puppet/manifests/" + profiletemplatepath = "/usr/share/%s/profile-template/" % NAME + profilespath = "/var/lib/%s/profiles/" % NAME + queuedprofilespath = "/var/lib/%s/profiles/queued/" % NAME + setup( + name="%s" % NAME, + version = VERSION, + author = "Lots", + author_email = "et-mgmt-tools@redhat.com", + url = "https://hosted.fedoraproject.org/projects/func/", + license = "GPL", + scripts = ["scripts/funcd", + ], + # package_data = { '' : ['*.*'] }, + package_dir = {"%s" % NAME: "", + "%s/server" % NAME: "server", + "%s/server/modules" % NAME: "modules/", + "%s/client" % NAME: "client", + "%s/server/yaml" % NAME: "server/yaml/", + }, + packages = ["%s" % NAME, + "%s/server" % NAME, + "%s/client" % NAME, + "%s/server/modules" % NAME, + "%s/server/yaml" % NAME, + ], + data_files = [(initpath, ["init-scripts/funcd"]), + (etcpath, ["settings",]), + (etcpathdb, []), + (logpath, []), + (logpathdb, []), + (migraterepopath, []), + (profilespath, []), + (queuedprofilespath, [])], + description = SHORT_DESC, + long_description = LONG_DESC + ) + @@ -0,0 +1 @@ +0.11 1 |