I'm currently packaging my program (roboJournal) for Fedora 18. When I start rpmbuild, my app compiles correctly but the process always fails at the installation step and no RPM packages are created. Here's the terminal output when the error happens:
+ strip robojournal
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.G9PU49
+ umask 022
+ cd /home/will/rpmbuild/BUILD
+ '[' /home/will/rpmbuild/BUILDROOT/robojournal-0.4.1-1.fc18.x86_64 '!=' / ']'
+ rm -rf /home/will/rpmbuild/BUILDROOT/robojournal-0.4.1-1.fc18.x86_64
++ dirname /home/will/rpmbuild/BUILDROOT/robojournal-0.4.1-1.fc18.x86_64
+ mkdir -p /home/will/rpmbuild/BUILDROOT
+ mkdir /home/will/rpmbuild/BUILDROOT/robojournal-0.4.1-1.fc18.x86_64
+ cd robojournal-0.4.1
+ make DESTDIR=/home/will/rpmbuild/BUILDROOT/robojournal-0.4.1-1.fc18.x86_64 install
install -m 755 -p "robojournal" "/usr/bin/robojournal"
install: cannot create regular file '/usr/bin/robojournal': Permission denied
make: [install_target] Error 1 (ignored)
install -m 644 -p /home/will/rpmbuild/BUILD/robojournal-0.4.1/menus/robojournal.desktop /usr/share/applications/
install: cannot create regular file '/usr/share/applications/robojournal.desktop': Permission denied
make: [install_shortcut] Error 1 (ignored)
install -m 644 -p /home/will/rpmbuild/BUILD/robojournal-0.4.1/robojournal64.png /usr/share/icons/
install: cannot create regular file '/usr/share/icons/robojournal64.png': Permission denied
make: [install_icon] Error 1 (ignored)
mkdir: cannot create directory '/usr/share/menu/': Permission denied
make: *** [install_shortcut-deb] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.G9PU49 (%install)
It looks like the installation instructions are conflicting; the app is supposed to install to %_buildrootdir but it also tries to install at the system level like it would for a normal build. I even tried running rpmbuild as fakeroot but that didn't help (I know I'm not supposed build packages as a real superuser because that can contaminate the system). The ~/rpmbuild/BUILDROOT dir contains a "robojournal-0.4.1-1.fc18.x86_64" folder after each build attempt but it is always empty.
Here's my SPEC file:
Summary: Free journal software for everyone
Name: robojournal
Version: 0.4.1
Release: 1%{?dist}
License: GPLv3
Group: Applications/Productivity
Source: http://sourceforge.net/projects/robojournal/files/Source/%{name}-%{version}.tar.gz
URL: http://sourceforge.net/projects/robojournal
BuildRequires: qt, qt-assistant, qt-mysql, qt-devel, qt-webkit, qt-webkit-devel, patch
Requires: qt, qt-assistant, qt-mysql, qt-devel, qt-webkit, qt-webkit-devel
%description
RoboJournal is a cross-platform journal/diary tool written in Qt/C++.
Right now, RoboJournal only supports MySQL but support for SQLite
(and possibly Postgres) will be added in future releases. RoboJournal
runs on Windows and Linux.
%prep
%setup -q -n %{name}-%{version}
%build
qmake-qt4 CONFIG+=package robojournal.pro
patch Makefile < fedora_build.patch
make
strip robojournal
%install
make DESTDIR=%{buildroot} install
%clean
make clean
%files
%{_bindir}/robojournal
%{_datadir}/applications/robojournal.destop
%{_datadir}/icons/robojournal64.png
%{_datadir}/pixmaps/robojournal.xpm
%{_datadir}/menu/robojournal
%changelog
* Thu Apr 25 2013 Will Kraft <pwizard@gmail.com>.
- Version 0.4.1
The SPEC file is error-free according to rpmlint. I've never packaged for Fedora before so I'm not sure what I'm doing wrong.
#UPDATE (5/12/13):
Manual installation works! Here's what the %install portion of my SPEC file currently looks like:
%install
#install files manually because "make install" doesn't work with rpmbuild in this case.
# create directory tree in buildroot:
mkdir -p %{buildroot}%{_bindir}/
mkdir -p %{buildroot}%{_datadir}/
mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/icons
mkdir -p %{buildroot}%{_datadir}/menu
mkdir -p %{buildroot}%{_datadir}/pixmaps
# install the files where they need to go
cp -p robojournal %{buildroot}%{_bindir}/
cp -p robojournal64.png %{buildroot}%{_datadir}/icons
cp -p %{_builddir}/%{buildsubdir}/menus/robojournal.desktop %{buildroot}%{_datadir}/applications
cp -p %{_builddir}/%{buildsubdir}/menus/robojournal %{buildroot}%{_datadir}/menu
cp -p %{_builddir}/%{buildsubdir}/menus/robojournal.xpm %{buildroot}%{_datadir}/pixmaps
Even though the files are installed properly, the rpm still won't build and I'm not sure why. Rpmbuild complains about missing files even though I know 100% for certain the file exists in the required location:
Processing files: robojournal-0.4.1-1.fc18.x86_64
error: File not found: /home/will/rpmbuild/BUILDROOT/robojournal-0.4.1-1.fc18.x86_64/usr/share/applications/robojournal.destop
RPM build errors:
File not found: /home/will/rpmbuild/BUILDROOT/robojournal-0.4.1-1.fc18.x86_64/usr/share/applications/robojournal.destop
[will@localhost SPECS]$ ls /home/will/rpmbuild/BUILDROOT/robojournal-0.4.1-1.fc18.x86_64/usr/share/applications/
robojournal.desktop
[will@localhost SPECS]$