blob: 8c247f9929c2625250852dbe83ae34c355371dcb (
plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/bin/bash -x
#
# Commit tag and Version number should be provided as input in the command line
#
#
if [ $# -ne 2 ];
then
echo 'create-rpm <version> <based_on_tag>'
exit 1
fi
command -v ronn &>/dev/null || { echo >&2 "ronn needs to be installed."; exit 1; }
command -v rpmbuild &>/dev/null || { echo >&2 "rpmbuild needs to be installed."; exit 1; }
set -e
base_folder=`readlink -m $(dirname $0)`
pushd ${base_folder} >/dev/null
rpm_build_area=${base_folder}/rpm_build_area
rm -rf ${rpm_build_area:=/non-existent-dir}
mkdir -p ${rpm_build_area}/{SOURCES,SPECS,BUILD,RPMS,SRPMS,BUILDROOT}
echo RPM build area is in ${rpm_build_area}
VERSION=$1
BASED_ON_TAG=$2
REAL_PACKAGE_NAME=q
RPM_PACKAGE_NAME=q-text-as-data
FULL_NAME_FOLDER=${RPM_PACKAGE_NAME}-${VERSION}
if [ ! -e ${RPM_PACKAGE_NAME}.spec.template ];
then
echo "spec template does not exist. can't continue"
exit 1
fi
curl -f -o ${rpm_build_area}/SOURCES/q.tar.gz -L -R "https://github.com/harelba/q/tarball/$BASED_ON_TAG"
mkdir -p ${rpm_build_area}/SOURCES
pushd ${rpm_build_area}/SOURCES >/dev/null
tar xvzf ./q.tar.gz --strip-components=1
rm -vf ./q.tar.gz
curl -f -o ./bin/q -L -R "https://github.com/harelba/packages-for-q/raw/master/single-binary/x86_64/${VERSION}/q"
chmod +x ./bin/q
popd >/dev/null
find ${rpm_build_area}/ -ls
cat ${RPM_PACKAGE_NAME}.spec.template | sed "s/VERSION_PLACEHOLDER/$VERSION/g" > ${rpm_build_area}/SPECS/${RPM_PACKAGE_NAME}.spec
rpmbuild -v --define "_topdir ${rpm_build_area}" -ba ${rpm_build_area}/SPECS/${RPM_PACKAGE_NAME}.spec
popd >/dev/null
|