我一直在为这个程序构建一个 RPM 文件,而这个规范文件在大多数情况下都可以工作:
Name: unix-runescape-client
Version: 4.3.5
Release: 1
License: GPL-2.0
Summary: A lightweight wrapper for the legacy Java client of RuneScape
Group: Amusements/Games
Packager: Brenton Horne
Source: https://github.com/HikariKnight/rsu-client/archive/v%{version}.tar.gz
Requires: perl perl(List::MoreUtils) perl(Config::IniFiles) perl(Archive::Extract) perl-Wx java-1.8.0-openjdk
%description
The Unix RuneScape Client developed by HikariKnight on GitHub. It is an
open-source wrapper for the old legacy Java client of RuneScape.
%prep
%setup -q -n rsu-client-%{version}
%install
_instdir=%{buildroot}/usr/share/runescape
cd runescape
mkdir -p "$_instdir" "%{buildroot}"/usr/{bin,share/applications}
# copy the stuff
cp -t "$_instdir" *.txt runescape updater rsu-settings AUTHORS
cp -Rt "$_instdir" share rsu
cp -Rt %{buildroot}/usr/bin templates/packaging/usr/games/*
cp -Rt %{buildroot}/usr templates/packaging/usr/share
# these libraries are old, and they are not needed anymore with current cairo
rm -rf "$_instdir"/rsu/3rdParty/linux/cairo-nogl
%files
%{_datadir}/applications/runescape*.desktop
%{_datadir}/runescape/*
%{_datadir}/kde4/services/jagex-jav.protocol
%{_bindir}/runescape*
%{_bindir}/rsu-settings
%{_bindir}/update-runescape-client
在构建 RPM 文件时,每当我尝试安装此 RPM 文件时,都会收到错误:
Last metadata expiration check: 0:35:12 ago on Mon Jan 2 15:10:06 2017.
Error: nothing provides perl(JSON::backportPP) needed by unix-runescape-client-4.3.5-1.x86_64
(try to add '--allowerasing' to command line to replace conflicting packages)
使用该--allowerasing
选项安装无法修复此错误。我使用旧的 Google 进行搜索,perl(JSON::backportPP)
发现至少对于 Mageia,perl-JSON 提供了此要求(来源:ftp://www.rpmfind.net/linux/RPM/mageia/cauldron/i586/media/core/release/perl-JSON-2.900.0-5.mga6.noarch.html),所以我运行sudo dnf install -y perl-JSON
(如果相关,我在 Fedora 25 上运行)却发现它perl-JSON
已经安装了...我还尝试将perl-JSON
依赖项添加到上述规范文件并重建 RPM 包,但这也未能解决此依赖项问题。
我已经使用通用安装程序安装了这个客户端,它运行良好,所以我知道运行它实际上并不需要 perl(JSON:backportPP) ...
答案1
我找到了解决方案。只需添加以下行:
Provides: perl(JSON::backportPP)
按照规范修复了问题。这是我目前的规格文件:
Name: unix-runescape-client
Version: 4.3.5
Release: 1
License: GPL-2.0
Summary: A lightweight wrapper for the legacy Java client of RuneScape
Group: Amusements/Games
Packager: Brenton Horne
Url: https://github.com/HikariKnight/rsu-client
Source: https://github.com/HikariKnight/rsu-client/archive/v%{version}.tar.gz
Requires: perl perl(List::MoreUtils) perl(Config::IniFiles) perl(Archive::Extract) perl-Wx java-1.8.0-openjdk
Provides: unix-runescape-client
Provides: perl(JSON::backportPP)
%description
The Unix RuneScape Client developed by HikariKnight on GitHub. It is an
open-source wrapper for the old legacy Java client of RuneScape.
%prep
%setup -q -n rsu-client-%{version}
%install
_instdir=%{buildroot}/usr/share/runescape
cd runescape
mkdir -p "$_instdir" "%{buildroot}"/usr/{bin,share/{applications,pixmaps}}
# copy the stuff
cp -t "$_instdir" *.txt runescape updater rsu-settings AUTHORS
cp -Rt "$_instdir" share rsu
cp -Rt %{buildroot}/usr/bin templates/packaging/usr/games/*
cp -Rt %{buildroot}/usr templates/packaging/usr/share
# these libraries are old, and they are not needed anymore with current cairo
rm -rf "$_instdir"/rsu/3rdParty/linux/cairo-nogl
sed -i -e 's|/opt/runescape/share/img/runescape.png|runescape|g' %{buildroot}/usr/share/applications/*.desktop
sed -i -e 's|/opt/runescape||g' %{buildroot}/usr/{bin/*,share/applications/*.desktop,share/runescape/*.txt}
mv %{buildroot}/usr/share/runescape/share/img/runescape* %{buildroot}/usr/share/pixmaps
rm -rf %{buildroot}/usr/share/runescape/share/img/
%files
%{_datadir}/applications/runescape*.desktop
%{_datadir}/runescape/*
%{_datadir}/kde4/services/jagex-jav.protocol
%{_datadir}/pixmaps/*
%{_bindir}/runescape*
%{_bindir}/rsu-settings
%{_bindir}/update-runescape-client