From 9d18d3a7aac8eab8fb2fe0ef55291e4994df5a9b Mon Sep 17 00:00:00 2001 From: Nic Henke Date: Thu, 29 Mar 2018 10:48:03 -0600 Subject: [PATCH] Add script to build rpms and populate distro release To better support building RPMs for multiple distribution versions, we need a bit of help to organize the RPMs. We take the path of adding a 'rpms/7.4.1708' style directory, with the implicit knowledge this is for CentOS and RHEL. Other distribution handling is left for the future. To ease DOCKER_IMAGE selection for different distribution versions, the environment variable DISTRO_VERS can be used. This simplifies a bunch of call locations and scripting when we don't need to change the Docker image flavor beyond this distribution version toggle. i.e: DISTRO_VERS=el73 ./indocker.sh ./build_rpms.sh The directory tree ends up looking like this: rpms/7.4.1708/kmod-scoutfs-1.0-0.git.5fee207.el7.x86_64.rpm rpms/7.3.1611/kmod-scoutfs-1.0-0.git.5fee207.el7.x86_64.rpm --- kmod/.gitignore | 1 + kmod/build_rpms.sh | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100755 kmod/build_rpms.sh diff --git a/kmod/.gitignore b/kmod/.gitignore index 2fa4c0bc..a1fd5abc 100644 --- a/kmod/.gitignore +++ b/kmod/.gitignore @@ -10,5 +10,6 @@ cscope.* *.spec *.sw[po] rpmbuild/ +rpms/ scoutfs-*.git*/ diff --git a/kmod/build_rpms.sh b/kmod/build_rpms.sh new file mode 100755 index 00000000..c9d5c479 --- /dev/null +++ b/kmod/build_rpms.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e -o pipefail + +# Build RPMs, populating a directory structure that indicates the OS release. +# NOTE: This expects to run in a CentOS or RHEL environment, preferrably one of the versity +# rpm-build Docker containers. + +OS_RELEASE=$(grep -oE '[0-9]+\.[0-9]+\.[0-9]+' /etc/redhat-release) +echo "OS RELEASE: $OS_RELEASE" + +make rpm + +rpm_dist="rpms/$OS_RELEASE" +rm -fvr "$rpm_dist" +mkdir -p "$rpm_dist" + +cp -v rpmbuild/RPMS/x86_64/kmod-scoutfs*.rpm "$rpm_dist/"