Skip to content
Snippets Groups Projects
Commit 9bc04655 authored by Meisam Farzalipour Tabriz's avatar Meisam Farzalipour Tabriz
Browse files

use make for building rpm packages

parent 342b8eda
No related branches found
No related tags found
No related merge requests found
Pipeline #240841 failed
Makefile 0 → 100644
GIT_DESC := $(shell git describe)
VERSION := $(subst -,.,$(GIT_DESC))
DIR := $(shell pwd)
STASH_REF = $(shell git stash create)
.PHONY: release-rpm dev-rpm clean
release-rpm:
spectool --get-files check_dnf_automatic.spec
rpmbuild -bb check_dnf_automatic.spec --define "_topdir $(DIR)/rpmbuild" --define "_sourcedir $(DIR)"
dev-rpm:
@sed -i 's/^Version:.*/Version:'" $(VERSION)"'/g' check_dnf_automatic.spec
@sed -i 's/^_version=.*/_version='"$(VERSION)"'/g' script/check_dnf_automatic
git archive --format=tar.gz -o "$(DIR)/check_dnf_automatic-$(VERSION).tar.gz" --prefix="check_dnf_automatic-$(VERSION)/" "$(STASH_REF)"
rpmbuild -bb check_dnf_automatic.spec --define "_topdir $(DIR)/rpmbuild" --define "_sourcedir $(DIR)"
clean:
rm -f "$(DIR)/check_dnf_automatic-$(VERSION).tar.gz"
rm -fr "$(DIR)/rpmbuild"
...@@ -52,23 +52,18 @@ An Icinga plugin for monitoring the number of pending dnf-automatic security upd ...@@ -52,23 +52,18 @@ An Icinga plugin for monitoring the number of pending dnf-automatic security upd
### Development version ### Development version
Extract the package version from git. Set version in the spec file and the script. Create the source archive and build the RPM package. Extracts the package version from git. Sets version in the spec file and the script. Creates the source archive and builds the RPM package.
```bash ```bash
_git_desc=$(git describe) && _version=${_git_desc//-/.} && echo "$_version" make dev-rpm
sed -i 's/^Version:.*/Version:'" ${_version}"'/g' check_dnf_automatic.spec
sed -i 's/^_version=.*/_version='"${_version}"'/g' script/check_dnf_automatic
git archive --format=tar.gz -o "$(pwd)/check_dnf_automatic-${_version}.tar.gz" --prefix="check_dnf_automatic-${_version}/" HEAD
rpmbuild -bb check_dnf_automatic.spec --define "_topdir $(pwd)/rpmbuild" --define "_sourcedir $(pwd)"
``` ```
### Latest release ### Latest release
Fetch the latest release and build the RPM package. Fetches the latest release and builds the RPM package.
```bash ```bash
spectool --get-files check_dnf_automatic.spec make release-rpm
rpmbuild -bb check_dnf_automatic.spec --define "_topdir $(pwd)/rpmbuild" --define "_sourcedir $(pwd)"
``` ```
## Releasing a new version ## Releasing a new version
......
.build:check_dnf_automatic:release: .build:check_dnf_automatic:release:
stage: build stage: build
before_script: before_script:
- dnf install -y rpmdevtools rpm-build git - dnf install -y rpmdevtools rpm-build git make
script: script:
- spectool --get-files check_dnf_automatic.spec - make release-rpm
- rpmbuild -bb check_dnf_automatic.spec --define "_topdir $(pwd)/rpmbuild" --define "_sourcedir $(pwd)"
- mv rpmbuild/RPMS ./ - mv rpmbuild/RPMS ./
artifacts: artifacts:
paths: paths:
...@@ -13,14 +12,9 @@ ...@@ -13,14 +12,9 @@
.build:check_dnf_automatic:development: .build:check_dnf_automatic:development:
stage: build stage: build
before_script: before_script:
- dnf install -y rpmdevtools rpm-build git - dnf install -y rpmdevtools rpm-build git make
script: script:
- export _git_desc=$(git describe) && export _version=${_git_desc//-/.} && echo "$_version" - make dev-rpm
- sed -i 's/^Version:.*/Version:'" ${_version}"'/g' check_dnf_automatic.spec
- sed -i 's/^_version=.*/_version='"${_version}"'/g' script/check_dnf_automatic
- export _stash_ref=$(git stash create)
- git archive --format=tar.gz -o "$(pwd)/check_dnf_automatic-${_version}.tar.gz" --prefix="check_dnf_automatic-${_version}/" "$_stash_ref"
- rpmbuild -bb check_dnf_automatic.spec --define "_topdir $(pwd)/rpmbuild" --define "_sourcedir $(pwd)"
- mv rpmbuild/RPMS ./ - mv rpmbuild/RPMS ./
artifacts: artifacts:
paths: paths:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment