Skip to content

Commit 3ace7ec

Browse files
committed
Add support for module versions on el8 #1
1 parent 1790e62 commit 3ace7ec

File tree

6 files changed

+77
-30
lines changed

6 files changed

+77
-30
lines changed

.github/workflows/release.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,21 @@ jobs:
2828
matrix:
2929
image:
3030
- centos-7
31-
- centos-8
31+
- centos-8-1.16
32+
- centos-8-mainline
3233

3334
env:
3435
BUILD_IMAGE: ${{ matrix.image }}
3536

3637
steps:
3738
- name: Checkout
38-
uses: actions/checkout@v1
39+
uses: actions/checkout@v2
3940
with:
4041
fetch-depth: 1
4142
- name: Build RPM
4243
id: build_rpm
4344
run: |
44-
./build $(echo ${BUILD_IMAGE} | sed 's/-/:/')
45+
./build $(echo ${BUILD_IMAGE} | sed 's/-/:/g')
4546
echo "##[set-output name=release-tag;]$(echo ${{ github.ref }} | sed -e 's|refs/tags/||g')"
4647
- name: Upload Assets
4748
uses: AButler/[email protected]

.github/workflows/test.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,24 @@ jobs:
1313
matrix:
1414
image:
1515
- centos-7
16-
- centos-8
16+
- centos-8-1.16
17+
- centos-8-mainline
1718

1819
env:
1920
BUILD_IMAGE: ${{ matrix.image }}
2021

2122
steps:
2223
- name: Checkout
23-
uses: actions/checkout@v1
24+
uses: actions/checkout@v2
2425
with:
2526
fetch-depth: 1
2627
- name: Build RPM
2728
id: build_rpm
2829
run: |
29-
./build $(echo ${BUILD_IMAGE} | sed 's/-/:/')
30+
./build $(echo ${BUILD_IMAGE} | sed 's/-/:/g')
3031
- name: Upload artifacts
31-
uses: actions/upload-artifact@v1
32+
uses: actions/upload-artifact@v2
3233
with:
3334
name: ${{ matrix.image }}
34-
path: rpmbuild/RPMS/x86_64
35+
path: rpmbuild/**/*.rpm
3536

README.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,19 @@ RPM Packaging for [ngx-fancyindex](https://github.com/aperezdc/ngx-fancyindex).
77
## Install an RPM package
88

99
- [Download](https://github.com/jfut/nginx-module-fancyindex-rpm/releases)
10-
- `yum install nginx-module-fancyindex-x.y.z-n.elx.x86_64.rpm`
10+
- Install:
11+
12+
```
13+
# el7
14+
yum install nginx-module-fancyindex-0.4.4-2.el7.x86_64.rpm
15+
16+
# el8 + module 1.16 stream
17+
dnf install nginx-module-fancyindex-0.4.4-2.module_el8.1.16.x86_64.rpm
18+
19+
# el8 + EPEL module mainline stream
20+
dnf install nginx-module-fancyindex-0.4.4-2.module_el8.mainline.x86_64.rpm
21+
```
22+
1123
- Add `load_module` in `nginx.conf`:
1224
```
1325
load_module "modules/ngx_http_fancyindex_module.so";
@@ -19,16 +31,20 @@ RPM Packaging for [ngx-fancyindex](https://github.com/aperezdc/ngx-fancyindex).
1931
2032
```
2133
Usage:
22-
build [-d] [-h] BUILD_IMAGE_NAME
34+
build [-d] [-h] BUILD_IMAGE_NAME:BUILD_IMAGE_TAG[:MODULE_VERSION]
2335

2436
Options:
2537
-d Debug mode.
2638

27-
Build for CentOS 8:
28-
build -i centos:8
39+
Build for CentOS 8 + AppStream module:
40+
# build centos:8:1.14 1.14 (not supported)
41+
build centos:8:1.16
42+
43+
Build for CentOS 8 + EPEL Stream module:
44+
build centos:8:mainline
2945

3046
Build for CentOS 7:
31-
build -i centos:7
47+
build centos:7
3248
```
3349
3450
## Build RPM Packages with Docker
@@ -43,16 +59,16 @@ You can build RPM packages in Docker.
4359
4460
```
4561
./build -d
46-
/pkg/build-rpm /pkg/rpmbuild nginx-module-fancyindex.spec
62+
/pkg/build-rpm /pkg/rpmbuild nginx-module-fancyindex.spec 1.6
4763
```
4864
4965
## Release tag
5066
5167
e.g.:
5268
5369
```
54-
git tag -a v1.5.1-1 -m "v1.5.1-1"
55-
git push origin refs/tags/v1.5.1-1
70+
git tag -a v0.4.4-2 -m "v0.4.4-2"
71+
git push origin refs/tags/v0.4.4-2
5672
```
5773
5874
## License

build

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#
33
# Build RPM with docker
44

5+
set -e
6+
set -u
57

68
DOCKER_RPMBUILD_DIR="/pkg/rpmbuild"
79
SPEC_FILE_NAME="nginx-module-fancyindex.spec"
@@ -11,17 +13,23 @@ HOST_RPMBUILD_DIR="${SCRIPT_DIR}/rpmbuild"
1113

1214
PACKAGER="$(basename "${0}")"
1315

16+
DEBUG="no"
17+
1418
# Usage
1519
usage() {
1620
cat << _EOF_
1721
Usage:
18-
${PACKAGER} [-d] [-h] BUILD_IMAGE_NAME
22+
${PACKAGER} [-d] [-h] BUILD_IMAGE_NAME:BUILD_IMAGE_TAG[:MODULE_VERSION]
1923
2024
Options:
2125
-d Debug mode.
2226
23-
Build for CentOS 8:
24-
${PACKAGER} centos:8
27+
Build for CentOS 8 + AppStream module:
28+
# ${PACKAGER} centos:8:1.14 1.14 (not supported)
29+
${PACKAGER} centos:8:1.16
30+
31+
Build for CentOS 8 + EPEL Stream module:
32+
${PACKAGER} centos:8:mainline
2533
2634
Build for CentOS 7:
2735
${PACKAGER} centos:7
@@ -40,13 +48,19 @@ setup_dir() {
4048
}
4149

4250
build() {
43-
local BUILD_IMAGE="$1"
51+
local BUILD_ARGS="$1"
52+
53+
local BUILD_IMAGE_NAME=$(echo ${BUILD_ARGS} | cut -d':' -f 1)
54+
local BUILD_IMAGE_TAG=$(echo ${BUILD_ARGS} | cut -d':' -f 2)
55+
local MODULE_VERSION=$(echo ${BUILD_ARGS} | cut -d':' -f 3)
4456

45-
local BUILD_HOSTNAME="rpmbuild.$(echo ${BUILD_IMAGE} | tr -d ':').docker"
57+
local BUILD_IMAGE="${BUILD_IMAGE_NAME}:${BUILD_IMAGE_TAG}"
58+
local BUILD_HOSTNAME="rpmbuild.${BUILD_IMAGE_NAME}${BUILD_IMAGE_TAG}.docker"
4659

4760
local DOCKER_OPTIONS=""
48-
local BUILD_CMD="$(dirname ${DOCKER_RPMBUILD_DIR})/build-rpm ${DOCKER_RPMBUILD_DIR} ${SPEC_FILE_NAME}"
61+
local BUILD_CMD="$(dirname ${DOCKER_RPMBUILD_DIR})/build-rpm ${DOCKER_RPMBUILD_DIR} ${SPEC_FILE_NAME} ${MODULE_VERSION}"
4962
if [[ "${DEBUG}" = "yes" ]]; then
63+
echo "# Manual Build: ${BUILD_CMD}"
5064
DOCKER_OPTIONS="-it"
5165
BUILD_CMD="/bin/bash"
5266
fi

build-rpm

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,22 @@
44
#
55
# @author Jun Futagawa
66

7+
set -e
8+
set -u
9+
10+
export LC_ALL=C
11+
712
BUILD_PACKAGES="autoconf automake libtool gcc make rpm-build rpmdevtools"
813
MAX_RETRY="10"
914

1015
if [[ $# -lt 2 ]]; then
11-
echo $0 RPMBUILD_DIR SPEC_FILE_NAME
16+
echo $0 RPMBUILD_DIR SPEC_FILE_NAME [MODULE_VERSION]
1217
exit 1
1318
fi
1419

15-
RPMBUILD_DIR="$1"
16-
SPEC_FILE_NAME="$2"
17-
18-
export LC_ALL=C
20+
RPMBUILD_DIR="${1}"
21+
SPEC_FILE_NAME="${2}"
22+
MODULE_VERSION="${3:-}"
1923

2024
pushd "${RPMBUILD_DIR}"
2125

@@ -28,10 +32,15 @@ if [[ -f /usr/bin/dnf ]]; then
2832
PACKAGE_MANAGER="dnf"
2933
dnf -y install epel-release
3034
dnf clean all
35+
# check module version
36+
if [[ -z "${MODULE_VERSION}" ]]; then
37+
echo "Error: MODULE_VERSION is required for el8 or later"
38+
exit 1
39+
fi
3140
echo
32-
echo "Installing nginx:mainline/common"
3341
dnf -y module reset nginx
34-
dnf -y module install nginx:mainline/common
42+
echo "Installing nginx:${MODULE_VERSION}"
43+
dnf -y module install nginx:${MODULE_VERSION}/common
3544
else
3645
PACKAGE_MANAGER="yum"
3746
yum -y install epel-release
@@ -82,6 +91,9 @@ spectool -g -A "SPECS/${SPEC_FILE_NAME}" -C SOURCES/
8291

8392
echo "Building RPM:"
8493
RPM_DIST=$(egrep "\%dist" /etc/rpm/macros.dist | awk '{ print $2 }' | sed -E 's|^(\..*)\..*|\1|')
94+
if [[ ! -z "${MODULE_VERSION}" ]]; then
95+
RPM_DIST=$(echo "${RPM_DIST}" | sed -r "s/^\.(.*)/.module_\1.${MODULE_VERSION}/")
96+
fi
8597
rpmbuild \
8698
--define "%_topdir ${RPMBUILD_DIR}" \
8799
--define "%dist ${RPM_DIST}" \

rpmbuild/SPECS/nginx-module-fancyindex.spec.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Summary: Nginx module to use PAM for simple http authentication
77
Name: nginx-module-fancyindex
88
Version: 0.4.4
9-
Release: 1%{?dist}
9+
Release: 2%{?dist}
1010
License: BSD-2-Clause
1111
URL: https://github.com/sto/ngx_http_fancyindex_module
1212

@@ -58,5 +58,8 @@ make modules
5858
%doc CHANGELOG.md HACKING.md LICENSE README.rst
5959

6060
%changelog
61+
* Sat Sep 19 2020 Jun Futagawa <[email protected]> 0.4.4-2
62+
- Add support for module versions on el8 #1
63+
6164
* Sun Apr 19 2020 Jun Futagawa <[email protected]> 0.4.4-1
6265
- Initial release

0 commit comments

Comments
 (0)