Fedora打包时的安装问题

时间:2013-05-11 23:30:08

标签: fedora rpmbuild specifications

我目前正在为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年12月5日):

手动安装有效!以下是我的SPEC文件的%安装部分目前的样子:

%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]$ 

1 个答案:

答案 0 :(得分:-2)

我认为我终于有了这个功能(足以构建可行的RPMS,至少)。事实证明,%files部分有一些不正确的路径名。