#4324 Allow overriding sbin directory
Opened 2 months ago by salimma. Modified 2 months ago
salimma/koji unify-bin-sbin  into  master

Allow overriding sbin directory
Michel Lind • 2 months ago  
file modified
+3 -2
@@ -2,6 +2,7 @@ 

  

  BINFILES = kojid

  LIBEXECFILES = mergerepos

+ SBINDIR ?= /usr/sbin

  SYSTEMDSYSTEMUNITDIR = $(shell pkg-config systemd --variable=systemdsystemunitdir)

  

  _default:
@@ -19,8 +20,8 @@ 

  		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; \

file modified
+3 -2
@@ -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 @@ 

  		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

file modified
+3 -2
@@ -1,5 +1,6 @@ 

  BINFILES = kojivmd

  SHAREFILES = kojikamid

+ SBINDIR ?= /usr/sbin

  SYSTEMDSYSTEMUNITDIR = $(shell pkg-config systemd --variable=systemdsystemunitdir)

  

  _default:
@@ -18,8 +19,8 @@ 

  		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

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 salimma@fedoraproject.org

It doesn't look like you are actually passing the sbindir value to make in this PR. If I try to build with a redefined_sbindir I still get the error.

We run make on 6 separate lines in the spec. Perhaps worth putting these args in a macro, esp if we ever want to instrument other dirs from macro values.

Perhaps something like this?
https://pagure.io/fork/mikem/koji/commits/pr4324updates

Easier to extend for other directory macros