From 18528e563ce18fd04c727c225f35a659fa943c3b Mon Sep 17 00:00:00 2001 From: Michel Lind Date: Apr 17 2025 14:13:41 +0000 Subject: [PATCH 1/2] Allow overriding sbin directory This fixes the Koji build for Fedora 42+, where on an installed system, `/sbin` and `/usr/sbin` are symlinks to `/usr/bin`; see: https://fedoraproject.org/wiki/Changes/Unify_bin_and_sbin On a build root the symlink does not exist, so attempts in the spec to manipulate binaries in `%{_sbindir}/` fail as these binaries are installed to `%{buildroot}/usr/sbin` while the script is looking for `%{buildroot}/usr/bin` The default value is set to `/usr/sbin` so not passing `SBINDIR` when installing results in the current behavior being preserved. Signed-off-by: Michel Lind --- diff --git a/builder/Makefile b/builder/Makefile index 89656ed..c508624 100644 --- a/builder/Makefile +++ b/builder/Makefile @@ -2,6 +2,7 @@ PYVER_MAJOR := $(shell $(PYTHON) -c 'import sys; print(".".join(sys.version.spli BINFILES = kojid LIBEXECFILES = mergerepos +SBINDIR ?= /usr/sbin SYSTEMDSYSTEMUNITDIR = $(shell pkg-config systemd --variable=systemdsystemunitdir) _default: @@ -19,8 +20,8 @@ _install: exit 1; \ fi - mkdir -p $(DESTDIR)/usr/sbin - install -p -m 755 $(BINFILES) $(DESTDIR)/usr/sbin + mkdir -p $(DESTDIR)$(SBINDIR) + install -p -m 755 $(BINFILES) $(DESTDIR)$(SBINDIR) @if [ "$(PYVER_MAJOR)" -lt 3 ] ; then \ mkdir -p $(DESTDIR)/usr/libexec/kojid; \ diff --git a/util/Makefile b/util/Makefile index da48a44..d89ee89 100644 --- a/util/Makefile +++ b/util/Makefile @@ -1,4 +1,5 @@ BINFILES = kojira koji-gc koji-shadow koji-sweep-db koji-sidetag-cleanup +SBINDIR ?= /usr/sbin SYSTEMDSYSTEMUNITDIR = $(shell pkg-config systemd --variable=systemdsystemunitdir) _default: @@ -15,8 +16,8 @@ _install: echo "ERROR: A destdir is required"; \ exit 1; \ fi - mkdir -p $(DESTDIR)/usr/sbin - install -p -m 755 $(BINFILES) $(DESTDIR)/usr/sbin + mkdir -p $(DESTDIR)$(SBINDIR) + install -p -m 755 $(BINFILES) $(DESTDIR)$(SBINDIR) mkdir -p $(DESTDIR)/etc/kojira install -p -m 644 kojira.conf $(DESTDIR)/etc/kojira/kojira.conf diff --git a/vm/Makefile b/vm/Makefile index 4f2ea42..d8d3b47 100644 --- a/vm/Makefile +++ b/vm/Makefile @@ -1,5 +1,6 @@ BINFILES = kojivmd SHAREFILES = kojikamid +SBINDIR ?= /usr/sbin SYSTEMDSYSTEMUNITDIR = $(shell pkg-config systemd --variable=systemdsystemunitdir) _default: @@ -18,8 +19,8 @@ _install: kojikamid exit 1; \ fi - mkdir -p $(DESTDIR)/usr/sbin - install -p -m 755 $(BINFILES) $(DESTDIR)/usr/sbin + mkdir -p $(DESTDIR)$(SBINDIR) + install -p -m 755 $(BINFILES) $(DESTDIR)$(SBINDIR) mkdir -p $(DESTDIR)/usr/share/kojivmd install -p -m 644 $(SHAREFILES) $(DESTDIR)/usr/share/kojivmd From 52cecf06c8a42579ebeeeea6348ed0b97562f24c Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Apr 17 2025 14:13:41 +0000 Subject: [PATCH 2/2] Use make_with_dirs macro This effectively replaces most of https://pagure.io/koji/pull-request/4297 --- diff --git a/koji.spec b/koji.spec index 021511f..920a5e7 100644 --- a/koji.spec +++ b/koji.spec @@ -385,11 +385,7 @@ sed -e '/util\/koji/g' -e '/koji_cli_plugins/g' -i setup.py %install rm -rf $RPM_BUILD_ROOT -# The Makefiles hardcode /usr/sbin everywhere -%if "%{_sbindir}" == "%{_bindir}" -mkdir -p %{buildroot}%{_prefix} -ln -sf --relative %{buildroot}%{_bindir} %{buildroot}/usr/sbin -%endif +%define make_with_dirs make DESTDIR=$RPM_BUILD_ROOT SBINDIR=%{_sbindir} %if 0%{py2_support} < 2 && 0%{py3_support} < 2 echo "At least one python must be built with full support" @@ -405,19 +401,19 @@ cp cli/koji.conf %{buildroot}/etc/koji.conf %endif %if 0%{py2_support} == 1 pushd plugins -make DESTDIR=$RPM_BUILD_ROOT KOJI_MINIMAL=1 PYTHON=%{__python2} install +%{make_with_dirs} KOJI_MINIMAL=1 PYTHON=%{__python2} install popd %endif %if 0%{py2_support} > 1 for D in builder plugins vm ; do pushd $D - make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python2} install + %{make_with_dirs} PYTHON=%{__python2} install popd done %endif %else %if 0%{py2_support} -make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python2} install +%{make_with_dirs} PYTHON=%{__python2} install %endif %endif @@ -430,13 +426,13 @@ cp cli/koji.conf %{buildroot}/etc/koji.conf %endif %if 0%{py3_support} == 1 pushd plugins -make DESTDIR=$RPM_BUILD_ROOT KOJI_MINIMAL=1 PYTHON=%{__python3} install +%{make_with_dirs} KOJI_MINIMAL=1 PYTHON=%{__python3} install popd %endif %if 0%{py3_support} > 1 for D in kojihub builder plugins util www vm schemas ; do pushd $D - make DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python3} install + %{make_with_dirs} PYTHON=%{__python3} install popd done @@ -502,7 +498,6 @@ done rm -rf $RPM_BUILD_ROOT %files -%exclude /usr/sbin %config(noreplace) /etc/koji.conf %dir /etc/koji.conf.d %doc docs Authors COPYING LGPL