我目前正在为 Fedora 18 打包我的程序 (roboJournal)。当我启动 rpmbuild 时,我的应用程序编译正确,但该过程在安装步骤总是失败,并且没有创建 RPM 包。这是发生错误时的终端输出:
+ 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)
看起来安装说明有冲突;该应用程序应该安装到 %_buildrootdir 但它也尝试在系统级别安装,就像正常构建一样。我什至尝试将 rpmbuild 作为 fakeroot 运行,但这并没有帮助(我知道我不应该将软件包构建为真正的超级用户,因为这会污染系统)。~/rpmbuild/BUILDROOT 目录在每次构建尝试后都包含一个“robojournal-0.4.1-1.fc18.x86_64”文件夹,但它始终为空。
这是我的 SPEC 文件:
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
根据 rpmlint,SPEC 文件没有错误。我以前从未为 Fedora 打包过,所以我不确定我做错了什么。
#更新(2013 年 5 月 12 日):
手动安装有效!这是我的 SPEC 文件的 %install 部分当前的样子:
%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
即使文件已正确安装,rpm 仍然无法构建,我不知道为什么。Rpmbuild 抱怨丢失的文件,即使我知道 100% 的文件存在于所需的位置:
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]$