Add some stuff to make building rpms easier

Conflicts:
	pkg/rpm/salt.spec
This commit is contained in:
Michael Birtwell 2013-07-03 12:02:38 +01:00 committed by Michael Birtwell
parent 18fffe6ea3
commit b4e5114689
2 changed files with 41 additions and 2 deletions

39
pkg/rpm/build Executable file
View file

@ -0,0 +1,39 @@
#! /bin/env python
import sys
import os
import tarfile
from os.path import dirname, join, abspath
from shutil import copy
from subprocess import check_call
src = abspath(join(dirname(__file__), '../..'))
sys.path.append(src)
import salt.version
salt_version = '.'.join(map(str, salt.version.__version_info__[0:3]))
buildid = 6
rpmbuild = join(os.environ['HOME'], 'rpmbuild')
copy(join(src, 'pkg/rpm/salt.spec'), join(rpmbuild, 'SPECS'))
for f in os.listdir(join(src, 'pkg/rpm')):
if f in ['salt.spec', 'build']:
continue
copy(join(src, 'pkg/rpm', f), join(rpmbuild, 'SOURCES'))
def srcfilter(ti):
if ti.name.startswith('.git'):
return None
return ti
with tarfile.open(join(rpmbuild, 'SOURCES/salt-%s.tar.gz' % salt_version), 'w|gz') as tf:
tf.add(src, arcname = 'salt-%s' % salt_version,
filter = srcfilter)
cmd = ['rpmbuild', '-bb',
'--define=salt_version %s' % salt_version,
'--define=buildid %s' % buildid,
'salt.spec']
print "Executing: %s" % " ".join('"%s"' % c for c in cmd)
check_call(cmd, cwd = join(rpmbuild, 'SPECS'))

View file

@ -15,8 +15,8 @@
%define _salttesting_ver 0.5.1
Name: salt
Version: 0.17.1
Release: 1%{?dist}
Version: %{salt_version}
Release: %{buildid}%{?dist}
Summary: A parallel remote execution system
Group: System Environment/Daemons