Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ NAME = tuned
BUILD = release
# which config to use in mock-build target
MOCK_CONFIG = rhel-7-x86_64
# Allow users to build tuned without gui
INSTALL_GUI ?= 1
# scratch-build for triggering Jenkins
SCRATCH_BUILD_TARGET = rhel-7.5-candidate
VERSION = $(shell awk '/^Version:/ {print $$2}' tuned.spec)
Expand Down Expand Up @@ -74,8 +76,10 @@ release-cp: release-dir
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 \
92-tuned.install bootcmdline modules.conf com.redhat.tuned.policy \
tuned-gui.py tuned-gui.glade tuned-ppd.py \
tuned-gui.desktop functions compile_plugin_docs.py $(VERSIONED_NAME)
tuned-ppd.py functions compile_plugin_docs.py $(VERSIONED_NAME)
ifeq ($(INSTALL_GUI),1)
cp -a tuned-gui.py tuned-gui.glade tuned-gui.desktop $(VERSIONED_NAME)
endif
Comment on lines +79 to +82
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this is gonna break hard. release-cp is the target for creating the release tarball, it should NOT be conditional on INSTALL_GUI or anything else.

cp -a doc experiments libexec man profiles systemtap tuned contrib icons \
tests $(VERSIONED_NAME)

Expand Down Expand Up @@ -153,15 +157,19 @@ install: install-dirs
# binaries
$(call install_python_script,tuned.py,$(DESTDIR)$(SBINDIR)/tuned)
$(call install_python_script,tuned-adm.py,$(DESTDIR)$(SBINDIR)/tuned-adm)
ifeq ($(INSTALL_GUI),1)
$(call install_python_script,tuned-gui.py,$(DESTDIR)$(SBINDIR)/tuned-gui)
endif

$(foreach file, diskdevstat netdevstat scomes, \
install -Dpm 0755 systemtap/$(file) $(DESTDIR)$(SBINDIR)/$(notdir $(file));)
$(call install_python_script, \
systemtap/varnetload, $(DESTDIR)$(SBINDIR)/varnetload)

ifeq ($(INSTALL_GUI),1)
# glade
install -Dpm 0644 tuned-gui.glade $(DESTDIR)$(DATADIR)/tuned/ui/tuned-gui.glade
endif

# tools
$(call install_python_script, \
Expand Down Expand Up @@ -239,12 +247,14 @@ install: install-dirs
$(call install_python_script, \
$(file), $(DESTDIR)$(LIBEXECDIR)/tuned/$(notdir $(file))))

ifeq ($(INSTALL_GUI),1)
# icon
install -Dpm 0644 icons/tuned.svg $(DESTDIR)$(DATADIR)/icons/hicolor/scalable/apps/tuned.svg

# desktop file
install -dD $(DESTDIR)$(DATADIR)/applications
desktop-file-install --dir=$(DESTDIR)$(DATADIR)/applications tuned-gui.desktop
endif

install-ppd:
$(call install_python_script,tuned-ppd.py,$(DESTDIR)$(SBINDIR)/tuned-ppd)
Expand Down
9 changes: 8 additions & 1 deletion tuned.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
%bcond_with snapshot
%bcond_without gui

%if 0%{?rhel} && 0%{?rhel} < 10
%global user_profiles_dir %{_sysconfdir}/tuned
Expand Down Expand Up @@ -139,6 +140,7 @@ network and ATA harddisk devices are implemented.
%global docdir %{_docdir}/%{name}
%endif

%if %{with gui}
%package gtk
Summary: GTK GUI for tuned
Requires: %{name} = %{version}-%{release}
Expand All @@ -152,6 +154,7 @@ Requires: pygobject3-base

%description gtk
GTK GUI that can control tuned and provides simple profile editor.
%endif

%package utils
Requires: %{name} = %{version}-%{release}
Expand Down Expand Up @@ -299,7 +302,7 @@ to TuneD from power-profiles-daemon (PPD).
make html %{make_python_arg}

%install
make install DESTDIR="%{buildroot}" BINDIR="%{_bindir}" SBINDIR="%{_sbindir}" \
make install INSTALL_GUI="%{?gui}" DESTDIR="%{buildroot}" BINDIR="%{_bindir}" SBINDIR="%{_sbindir}" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use the %(with_foo} inline macro, with %bcond_{with,without} foo and %{with foo} / %{without foo}.

Suggested change
make install INSTALL_GUI="%{?gui}" DESTDIR="%{buildroot}" BINDIR="%{_bindir}" SBINDIR="%{_sbindir}" \
make install %{!?with_gui:INSTALL_GUI=0} DESTDIR="%{buildroot}" BINDIR="%{_bindir}" SBINDIR="%{_sbindir}" \

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might even be better to have a DISABLE_GUI option instead, no default value, and ifndef that in the Makefile. ifeq is a pain when testing optional configs.

DOCDIR="%{docdir}" %{make_python_arg} \
TUNED_USER_PROFILES_DIR="%{user_profiles_dir}" \
TUNED_SYSTEM_PROFILES_DIR="%{system_profiles_dir}"
Expand All @@ -324,8 +327,10 @@ mkdir -p %{buildroot}%{_var}/lib/tuned
mkdir -p %{buildroot}%{_sysconfdir}/modprobe.d
touch %{buildroot}%{_sysconfdir}/modprobe.d/kvm.rt.tuned.conf

%if %{with gui}
# validate desktop file
desktop-file-validate %{buildroot}%{_datadir}/applications/tuned-gui.desktop
%endif

# On RHEL-7 EPEL is needed, because there is no python-mock package and
# python-2.7 doesn't have mock built-in
Expand Down Expand Up @@ -526,6 +531,7 @@ fi
%ghost %{_sysconfdir}/modprobe.d/kvm.rt.tuned.conf
%{_prefix}/lib/kernel/install.d/92-tuned.install

%if %{with gui}
%files gtk
%{_sbindir}/tuned-gui
%if %{with python3}
Expand All @@ -536,6 +542,7 @@ fi
%{_datadir}/tuned/ui
%{_datadir}/icons/hicolor/scalable/apps/tuned.svg
%{_datadir}/applications/tuned-gui.desktop
%endif

%files utils
%doc COPYING
Expand Down