Skip to content

Conversation

sourabhtk37
Copy link

Allow users to control whether they want to install tuned gui or not.

Having gui in tuned is not beneficial in cloud environment and we can reduce the footprint by removing the files which are not needed. This ensure various Linux distributions to control whether a gui is needed or not.

@sourabhtk37
Copy link
Author

@yarda Could I get some opinion on this change?

It would be really beneficial if we can add an option to add an option to specify whether the user wants to build tuned with GUI or not. This is what I'm trying to address with this change.

@adriaan42
Copy link
Contributor

I'm not sure I understand the problem here.

This ensure various Linux distributions to control whether a gui is needed or not.

Which distribution are you using? I quickly checked Fedora, RHEL, Debian, Ubuntu, Alpine; all of them ship the GUI in a separate package (tuned-gtk). So users who don't want the GUI can just not install the GUI package.

Also, with your proposed changes, the build breaks on make install (output from CI):

+ make install INSTALL_GUI= DESTDIR=/builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT BINDIR=/usr/bin SBINDIR=/usr/bin DOCDIR=/usr/share/doc/tuned PYTHON=/usr/bin/python3 TUNED_USER_PROFILES_DIR=/etc/tuned/profiles TUNED_SYSTEM_PROFILES_DIR=/usr/lib/tuned/profiles
mkdir -p /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/usr/lib/python3.13/site-packages
mkdir -p /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/usr/lib/tuned/profiles
mkdir -p /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/var/lib/tuned
mkdir -p /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/var/log/tuned
mkdir -p /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/run/tuned
mkdir -p /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/usr/share/doc/tuned
mkdir -p /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/etc
mkdir -p /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/etc/tuned/profiles
mkdir -p /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/usr/lib/tuned/recommend.d
mkdir -p /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/etc/tuned/recommend.d
# library
cp -a tuned /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/usr/lib/python3.13/site-packages
# binaries
install -Dm 0755 tuned.py /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/usr/bin/tuned && sed -i -r -e '1s|^#!/usr/bin/\<python3\>|#!/usr/bin/python3|' /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/usr/bin/tuned && touch -r tuned.py /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/usr/bin/tuned;
install -Dm 0755 tuned-adm.py /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/usr/bin/tuned-adm && sed -i -r -e '1s|^#!/usr/bin/\<python3\>|#!/usr/bin/python3|' /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/usr/bin/tuned-adm && touch -r tuned-adm.py /builddir/build/BUILD/tuned-2.25.1-build/BUILDROOT/usr/bin/tuned-adm;
ifeq (,1)
/bin/sh: -c: line 1: syntax error near unexpected token `,1'
/bin/sh: -c: line 1: `ifeq (,1)'
make: *** [Makefile:159: install] Error 2

Copy link
Contributor

@ferdnyc ferdnyc left a comment

Choose a reason for hiding this comment

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

Like @adriaan42 I really don't see the point of this, for the reasons given, but even if it is going to be done I'm not sure this is the right way. For one thing, this will still include all of the %{python_sitelib}/tuned/gtk/ files in the install.

The packaging separates those out into a GUI subpackage, but they're not easily separated from the base install. Which is why it doesn't really make sense to have a "non-gui" install mode. (Nor, fortunately, is it really necessary.)

Comment on lines +79 to +82
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
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.


%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.

@ferdnyc
Copy link
Contributor

ferdnyc commented Jun 29, 2025

The other thing is, the GUI portion of tuned is insignificant. It has no meaningful "footprint". The main tuned package on Fedora is 1678860 bytes (1.68 MB) installed. tuned-gtk is 166601 (167 KB), or under 10% of that size. The primary reason the GTK portion is split out in packaging is because it creates a user-facing application, which distros prefer to avoid unless explicitly requested.

@yarda
Copy link
Contributor

yarda commented Jul 28, 2025

I agree:

  • the footprint of the GUI is insignificant, only cca. 163 kB
  • even with the patch and GUI disabled it still installs %{python_sitelib}/tuned/gtk/ content
  • you can usually drop the GUI and the deps by simply omitting the resulting subpackage (when used with some distro)

Nevertheless, I am not against support in the Makefile (although I don't see much benefit), but I would prefer using different targets over the variables, i.e. something like the following (which IMHO is more make-like):

install-core: ....
install-profiles: ...
install-gui:...
install: install-core install-profiles install-gui

But I think in the future we will need to switch to toml/setuptools which is more pythonic and can help to spread the project and we could also get rid of some nasty hacks we currently have in the Makefile.

@sourabhtk37
Copy link
Author

sourabhtk37 commented Sep 16, 2025

Thank you for the comments. This PR can be closed. tuned-gtk as separate package should suffice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants