Commit ec977732 authored by Nicolas Dumazet's avatar Nicolas Dumazet

Initial checkout of a simple, buildout-base system to generate RPMs/DEBs from

official buildout.

It is not included in software buildout because self-containment is bad: RPM
generation uses software/appliance buildout to create RPM...


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32954 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5b2a13c7
import os
import collective.recipe.template
class Recipe(collective.recipe.template.Recipe):
def __init__(self, buildout, name, options):
"""
Create a Mandriva RPM spec file from a template
- input: path to spec template
- output: path where generated spec should be saved
- version: rpm version number, can be either the version
or a file path containing the version
- (section) name: rpm name
- build_requires: a list of Mandriva packages required to build the rpm
- svnpath: SVN path to current buildout
optional:
- release: rpm release number. Defaults to 1
"""
package_list = options['package_list'].splitlines()
package_list = map(lambda x: x.strip(), package_list)
dependencies = ["BuildRequires: %s" % pkg for pkg in package_list if pkg]
version = options['version'].strip()
if os.path.exists(version):
version = open(version, 'r').read().strip()
release = options.get('release', str(1))
options.update(dependencies="\n".join(dependencies),
version=version,
release=release)
collective.recipe.template.Recipe.__init__(self, buildout, name, options)
from setuptools import setup, find_packages
name = "createmandrivaspec"
version = '0.1'
setup(
name = name,
version = version,
author = "Nicolas Dumazet",
author_email = "nicolas.dumazet@nexedi.com",
description = "ZC Buildout recipe to generate a Mandriva spec file",
license = "ZPL 2.1",
keywords = "mandriva buildout",
packages = find_packages(),
scripts = [name+".py",],
include_package_data = True,
classifiers=[
"License :: OSI Approved :: Zope Public License",
"Framework :: Buildout",
"Operating System :: POSIX :: Linux",
],
install_requires = [
'collective.recipe.template',
],
zip_safe=False,
entry_points = {'zc.buildout': ['default = %s:Recipe' % name]},
)
%define version ${:version}
%define name ${:name}
%define release ${:release}
# We do not actually use /usr/local/bin/python
%define _requires_exceptions /usr/local/bin/python
%define fullname %{name}-%{version}
%define installdir /opt/erp5/%{version}
Name: %{name}
Version: %{version}
Release: %mkrel %{release}
Summary: Open Source ERP Solution
URL: http://www.erp5.org
License: GPL
Vendor: Nexedi
Packager: Nicolas Dumazet <nicolas.dumazet@nexedi.com>
Group: Databases
${:dependencies}
BuildRoot: /opt/rpmbuild/%{fullname}-%{release}-root
%description
%{summary}
%prep
%{__rm} -rf %{installdir}
%{__mkdir_p} %{installdir}
%build
cd %{installdir}
svn co ${:svnpath} .
python bootstrap/bootstrap.py
bin/buildout
%install
%{__rm} -rf %{buildroot}
%{__mkdir_p} %{buildroot}
%{__cp} -ar --parents %{installdir} %{buildroot}
# cleanup .svn files
find %{buildroot} -name .svn -print0 | xargs -0 %{__rm} -rf
%files
%defattr(-, root, root, 0755)
%{installdir}
%clean
%{__rm} -rf %{buildroot} %{installdir}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment