1
0
Fork 0

Makefile: added support for nightly development builds

It is supported by 'nightly' makefile target. It creates
snapshot from the GIT HEAD, makes mockbuild,
creates repo and uploads result on the fedorapeople.

Also fixed makefile to support parallel builds, added
couple of hopefully useful targets, implemented local
RPM build target 'rpm'.

Other targets (e.g. 'srpm') can be also used to work
with snapshots. It is controlled by BUILD makefile
varible. If set to 'release' normal release is done.
If set to anything else (e.g. 'snapshot') snapshot
is done.

There is also support for GIT snapshots in the upstream
provided SPEC file. Snapshot build is done if
built with '--with snapshot', normal (release) build
is done otherwise.

Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
Jaroslav Škarvada 2015-05-29 16:51:20 +02:00
parent 516dc1c168
commit b1da643ad5
2 changed files with 62 additions and 22 deletions

View file

@ -1,39 +1,86 @@
NAME = tuned
# set to devel for nightly GIT snapshot
BUILD = release
# which config to use in mock-build target
MOCK_CONFIG = rhel-7-x86_64
VERSION = $(shell awk '/^Version:/ {print $$2}' tuned.spec)
RELEASE = $(shell awk '/^Release:/ {print $$2}' tuned.spec)
ifeq ($(BUILD), release)
RPM_ARGS += --without snapshot
MOCK_ARGS += --without=snapshot
RPM_VERSION = $(NAME)-$(VERSION)-1
else
RPM_ARGS += --with snapshot
MOCK_ARGS += --with=snapshot
GIT_SHORT_COMMIT = $(shell git rev-parse --short=8 --verify HEAD)
GIT_DATE = $(shell date +'%Y%m%d')
GIT_SUFFIX = $(GIT_DATE)git$(GIT_SHORT_COMMIT)
GIT_PSUFFIX = .$(GIT_SUFFIX)
RPM_VERSION = $(NAME)-$(VERSION)-1$(GIT_PSUFFIX)
endif
UNITDIR = $(shell rpm --eval '%{_unitdir}' 2>/dev/null || echo /usr/lib/systemd/system)
TMPFILESDIR = $(shell rpm --eval '%{_tmpfilesdir}' 2>/dev/null || echo /usr/lib/tmpfiles.d)
VERSIONED_NAME = $(NAME)-$(VERSION)
VERSIONED_NAME = $(NAME)-$(VERSION)$(GIT_PSUFFIX)
DOCDIR = /usr/share/doc/$(NAME)
PYTHON_SITELIB = $(shell python -c 'from distutils.sysconfig import get_python_lib; print get_python_lib();' || echo /usr/lib/python2.7/site-packages)
TUNED_PROFILESDIR = /usr/lib/tuned
BASH_COMPLETIONS = /usr/share/bash-completion/completions
archive: clean
release-dir:
mkdir -p $(VERSIONED_NAME)
cp AUTHORS COPYING INSTALL README $(VERSIONED_NAME)
release-cp: release-dir
cp -a AUTHORS COPYING INSTALL README $(VERSIONED_NAME)
cp tuned.py tuned.spec tuned.service tuned.tmpfiles Makefile tuned-adm.py \
cp -a tuned.py tuned.spec tuned.service tuned.tmpfiles Makefile tuned-adm.py \
tuned-adm.bash dbus.conf recommend.conf tuned-main.conf 00_tuned \
bootcmdline org.tuned.gui.policy tuned-gui.py tuned-gui.glade \
$(VERSIONED_NAME)
cp -a doc experiments libexec man profiles systemtap tuned contrib $(VERSIONED_NAME)
archive: clean release-cp
tar cjf $(VERSIONED_NAME).tar.bz2 $(VERSIONED_NAME)
srpm: archive
rpm-build-dir:
mkdir rpm-build-dir
srpm: archive rpm-build-dir
rpmbuild --define "_sourcedir `pwd`/rpm-build-dir" --define "_srcrpmdir `pwd`/rpm-build-dir" \
--define "_specdir `pwd`/rpm-build-dir" --nodeps -ts $(VERSIONED_NAME).tar.bz2
--define "_specdir `pwd`/rpm-build-dir" --nodeps $(RPM_ARGS) -ts $(VERSIONED_NAME).tar.bz2
build:
# nothing to build
build: archive rpm-build-dir
rpmbuild --define "_sourcedir `pwd`/rpm-build-dir" --define "_srcrpmdir `pwd`/rpm-build-dir" \
--define "_specdir `pwd`/rpm-build-dir" --nodeps $(RPM_ARGS) -tb $(VERSIONED_NAME).tar.bz2
install:
# library
clean-mock-result-dir:
rm -f mock-result-dir/*
mock-result-dir: clean-mock-result-dir
mkdir mock-result-dir
mock-build: srpm
mock -r $(MOCK_CONFIG) $(MOCK_ARGS) --resultdir=`pwd`/mock-result-dir `ls rpm-build-dir/*$(RPM_VERSION).*.src.rpm | head -n 1`&& \
rm -f mock-result-dir/*.log
mock-devel-build: srpm
mock -r $(MOCK_CONFIG) --with=snapshot --resultdir=`pwd`/mock-result-dir `ls rpm-build-dir/*$(RPM_VERSION).*.src.rpm | head -n 1`&& \
rm -f mock-result-dir/*.log
createrepo: mock-devel-build
createrepo mock-result-dir
nightly: createrepo
scp `mock-result-dir-dir/*` jskarvad@fedorapeople.org:/home/fedora/jskarvad/public_html/tuned/devel/repo/
install-dirs:
mkdir -p $(DESTDIR)$(PYTHON_SITELIB)
mkdir -p $(DESTDIR)$(TUNED_PROFILESDIR)
mkdir -p $(DESTDIR)/var/log/tuned
mkdir -p $(DESTDIR)/run/tuned
mkdir -p $(DESTDIR)$(DOCDIR)
install: install-dirs
# library
cp -a tuned $(DESTDIR)$(PYTHON_SITELIB)
# binaries
@ -56,18 +103,13 @@ install:
install -Dpm 0644 bootcmdline $(DESTDIR)/etc/tuned/bootcmdline
# profiles & system config
mkdir -p $(DESTDIR)$(TUNED_PROFILESDIR)
cp -a profiles/* $(DESTDIR)$(TUNED_PROFILESDIR)/
install -pm 0644 recommend.conf $(DESTDIR)$(TUNED_PROFILESDIR)/recommend.conf
# bash completion
install -Dpm 0644 tuned-adm.bash $(DESTDIR)$(BASH_COMPLETIONS)/tuned-adm
# log dir
mkdir -p $(DESTDIR)/var/log/tuned
# runtime directory
mkdir -p $(DESTDIR)/run/tuned
install -Dpm 0644 tuned.tmpfiles $(DESTDIR)$(TMPFILESDIR)/tuned.conf
# systemd units
@ -87,7 +129,6 @@ install:
install -Dpm 0644 $(file) $(DESTDIR)/usr/share/man/man$(man_section)/$(notdir $(file));))
# documentation
mkdir -p $(DESTDIR)$(DOCDIR)
cp -a doc/* $(DESTDIR)$(DOCDIR)
cp AUTHORS COPYING README $(DESTDIR)$(DOCDIR)

View file

@ -1,16 +1,15 @@
%bcond_with release
%bcond_with snapshot
%if %{without release}
%global git_commit %(git rev-parse --verify HEAD)
%if %{with snapshot}
%global git_short_commit %(git rev-parse --short=8 --verify HEAD)
%global git_date %(date +'%Y%m%d')
%global git_short_commit %(echo %{git_commit} | cut -c -8)
%global git_suffix %{git_date}git%{git_short_commit}
%endif
Summary: A dynamic adaptive system tuning daemon
Name: tuned
Version: 2.4.1
Release: 1%{!?with_release:.%{git_suffix}}%{?dist}
Release: 1%{?with_snapshot:.%{git_suffix}}%{?dist}
License: GPLv2+
Source: https://fedorahosted.org/releases/t/u/tuned/tuned-%{version}.tar.bz2
URL: https://fedorahosted.org/tuned/