Merge branch 'rpm_build_helper' of git://github.com/mbirtwell/salt into mbirtwell-rpm_build_helper

Conflicts:
	pkg/rpm/salt.spec
This commit is contained in:
Thomas S Hatch 2013-12-02 11:07:59 -07:00
commit e70b605471
3 changed files with 50 additions and 3 deletions

2
.gitignore vendored
View file

@ -1,4 +1,4 @@
build
/build
*.py[co]
pkg/arch/*.tar.xz
*.swp

47
pkg/rpm/build Executable file
View file

@ -0,0 +1,47 @@
#! /bin/env python
import sys
import os
import tarfile
import argparse
from os.path import dirname, join, abspath
from shutil import copy
from subprocess import check_call
parser = argparse.ArgumentParser(
description = "Build salt rpms",
)
parser.add_argument('buildid',
help="The build id to use i.e. the bit after the salt version in the package name",
)
args = parser.parse_args()
src = abspath(join(dirname(__file__), '../..'))
sys.path.append(src)
import salt.version
salt_version = '.'.join(map(str, salt.version.__version_info__[0:3]))
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 '/.git' in ti.name:
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' % args.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.3
Name: salt
Version: 0.17.2
Release: 1%{?dist}
Version: %{salt_version}
Release: %{buildid}%{?dist}
Summary: A parallel remote execution system
Group: System Environment/Daemons