Sample Header Ad - 728x90

rpmbuild - how to force /usr prefix in install phase?

0 votes
1 answer
164 views
I have a very small app that I intend to package in deb and rpm files. The project is here: https://github.com/eantoranz/gitmod I have moved forward locally from what I have in the repo but it's not that different. When running make (on my local version) I get a single binary at the root of the project: gitmod. I have been able to package it in deb files:
$ dpkg -c packages/files/gitmod-0.10/debian-bookworm/gitmod_0.10-1_amd64.deb 
drwxr-xr-x root/root         0 2024-06-03 20:56 ./
drwxr-xr-x root/root         0 2024-06-03 20:56 ./usr/
drwxr-xr-x root/root         0 2024-06-03 20:56 ./usr/bin/
-rwxr-xr-x root/root     31408 2024-06-03 20:56 ./usr/bin/gitmod
drwxr-xr-x root/root         0 2024-06-03 20:56 ./usr/share/
drwxr-xr-x root/root         0 2024-06-03 20:56 ./usr/share/doc/
drwxr-xr-x root/root         0 2024-06-03 20:56 ./usr/share/doc/gitmod/
-rw-r--r-- root/root       149 2024-06-03 20:56 ./usr/share/doc/gitmod/changelog.Debian.gz
-rw-r--r-- root/root        45 2024-06-03 20:56 ./usr/share/doc/gitmod/copyright
Notice how the binary is in /usr/bin. I think that in order for this to work, I had to use this in rules file:
override_dh_auto_install:
	$(MAKE) DESTDIR=$$(pwd)/debian/gitmod prefix=/usr install
I have this spec file:
Name:           gitmod
Version:        0.10
Release:        1%{?dist}
Summary:        fuse-based linux kernel module to display a committish from a git repo on a mount point.

License:        GPLv2
URL:            https://github.com/eantoranz/gitmod 
Source0:        https://github.com/eantoranz/gitmod 

BuildRequires:  fuse3-devel, libgit2-devel, glib2-devel
Requires:       fuse3, libgit2, glib2

%description
fuse-based linux kernel module to display a treeish from a git repo
 onto a mount point. The content displayed on the file system is read-only.

%prep
%autosetup


%build
%make_build


%install
%make_install


%files
%{_bindir}/*


%changelog
* Wed Jun 05 2024 Edmundo Carmona Antoranz
- Initial release using v0.10
When I run rpmbuild -ba the-spec-file I see that the project is built, but it fails like this, running on a fedora 41 docker container:
Reading /root/rpmbuild/BUILD/gitmod-0.10-build/SPECPARTS/rpm-debuginfo.specpart
Processing files: gitmod-0.10-1.fc41.x86_64
error: File not found: /root/rpmbuild/BUILD/gitmod-0.10-build/BUILDROOT/usr/bin/*

RPM build errors:
    File not found: /root/rpmbuild/BUILD/gitmod-0.10-build/BUILDROOT/usr/bin/*
I can see this in the rpmbuild process output:
mkdir -p /root/rpmbuild/BUILD/gitmod-0.10-build/BUILDROOT/bin
install gitmod /root/rpmbuild/BUILD/gitmod-0.10-build/BUILDROOT/bin
I checked and the file is indeed in /root/rpmbuild/BUILD/gitmod-0.10-build/BUILDROOT/bin:
# ls -l /root/rpmbuild/BUILD/gitmod-0.10-build/BUILDROOT/bin
total 36
-rwxr-xr-x 1 root root 33064 Jun  6 05:23 gitmod
What do I need to do in the spec file to do the installation in /usr/bin instead of /bin?
Asked by eftshift0 (707 rep)
Jun 6, 2024, 05:37 AM
Last activity: Jun 6, 2024, 06:03 AM