forked from google/stenographer
-
Notifications
You must be signed in to change notification settings - Fork 3
/
rpmbuild-steno-centos
45 lines (32 loc) · 1.56 KB
/
rpmbuild-steno-centos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Copyright 2016 Google Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
commit=`curl https://api.github.com/repos/google/stenographer/commits/master | awk 'NR==2{print $0}' | awk -F'"' '{print $4}'`
short_commit=`echo ${commit:0:7}`
TMP=`mktemp -d`
pushd $TMP
# pull lastest versions checked in to github
curl -L -J -O https://github.com/qxip/stenographer/archive/$commit.tar.gz
# create working directory for rpmbuild to use
mkdir -p $TMP/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
# copy current source
cp stenographer-$commit.tar.gz $TMP/rpmbuild/SOURCES
# untar to pull latest specfile for use
tar -xzf stenographer-$commit.tar.gz
# copy current spec file into the expected folder
cp $TMP/stenographer-$commit/stenographer.spec $TMP/rpmbuild/SPECS/
# run rpmbuild to create source rpm
rpmbuild --define "_topdir $TMP/rpmbuild" -bs $TMP/rpmbuild/SPECS/stenographer.spec
# use mock to create rpm for centos 7
sudo mock -r epel-7-x86_64 --init
sudo mock -r epel-7-x86_64 --clean
sudo mock -r epel-7-x86_64 rebuild $TMP/rpmbuild/SRPMS/stenographer-*$short_commit.*.src.rpm