summaryrefslogtreecommitdiffstats
path: root/dist/create-rpm
diff options
context:
space:
mode:
Diffstat (limited to 'dist/create-rpm')
-rwxr-xr-xdist/create-rpm52
1 files changed, 52 insertions, 0 deletions
diff --git a/dist/create-rpm b/dist/create-rpm
new file mode 100755
index 0000000..e6d1a3a
--- /dev/null
+++ b/dist/create-rpm
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+#
+# Simplistic RPM creation logic. See q.spec.template for actual spec
+#
+# Version number should be provided as input in the command line
+#
+# requires:
+# * installation of ronn
+# * installation of rpmbuild
+#
+# Output rpm is generated inside build/rpm/RPMS/noarch/
+#
+
+if [ $# -ne 1 ];
+then
+ echo 'create-rpm <version>'
+ 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; }
+
+base_folder=$(dirname $0)
+
+pushd ${base_folder}
+
+VERSION=$1
+REAL_PACKAGE_NAME=q
+RPM_PACKAGE_NAME=q
+MAN_PAGE_SRC=${RPM_PACKAGE_NAME}.manpage.1.ronn
+
+rm -rf build/
+
+mkdir -p build/rpm
+
+TAR_NAME=${RPM_PACKAGE_NAME}-${VERSION}.tar.gz
+
+ronn ${REAL_PACKAGE_NAME}.manpage.1.ronn
+rm ${REAL_PACKAGE_NAME}.1.html
+
+cat ${RPM_PACKAGE_NAME}.spec.template | sed "s/VERSION_PLACEHOLDER/$1/" > ${RPM_PACKAGE_NAME}.spec
+
+tar --create --transform s,^,${RPM_PACKAGE_NAME}-$1/, --exclude ${RPM_PACKAGE_NAME}.spec.template -f ${TAR_NAME} *
+
+rpmbuild --define "_topdir `pwd`/build/rpm" -ta ${TAR_NAME}
+
+rm ${RPM_PACKAGE_NAME}.spec
+rm ${TAR_NAME}
+rm ${REAL_PACKAGE_NAME}.1
+
+popd