我的目标是将 Debian 包翻译成 RPM 包,以便将其安装在 CentOS Linux 7(Red Hat)上。我用外星人来完成它:alien --to-rpm --scripts --keep-version --generate debian_pkg.deb
。我使用该--generate
标志创建一个用于构建包的目录,因为我想将运行时依赖项添加到规范文件中。为此,我添加了这一行:Requires: nodejs tomcat8 java-1.8.0-openjdk java-1.8.0-openjdk-devel
. 然后我尝试创建 package: rpmbuild -ba <package_name>.spec
,但它突然以这个错误结束:
Processing files: <package_name>
error: Directory not found: /root/rpmbuild/BUILDROOT/<package_name>/srv
error: Directory not found: /root/rpmbuild/BUILDROOT/<package_name>/srv/tmp
error: File not found: /root/rpmbuild/BUILDROOT/<package_name>/srv/tmp/file.tar.gz
error: File not found: /root/rpmbuild/BUILDROOT/<package_name>/usr/share/doc/frontend/README.Debian
error: File not found: /root/rpmbuild/BUILDROOT/<package_name>/usr/share/doc/frontend/changelog.Debian.gz
error: File not found: /root/rpmbuild/BUILDROOT/<package_name>/usr/share/doc/frontend/copyright
RPM build errors:
Directory not found: /root/rpmbuild/BUILDROOT/<package_name>/srv
Directory not found: /root/rpmbuild/BUILDROOT/<package_name>/srv/tmp
File not found: /root/rpmbuild/BUILDROOT/<package_name>/srv/tmp/file.tar.gz
File not found: /root/rpmbuild/BUILDROOT/<package_name>/usr/share/doc/frontend/README.Debian
File not found: /root/rpmbuild/BUILDROOT/<package_name>/usr/share/doc/frontend/changelog.Debian.gz
File not found: /root/rpmbuild/BUILDROOT/<package_name>/usr/share/doc/frontend/copyright
我搜索了互联网,发现它链接到该%install
部分,更具体地说%{buildroot}
,但我无法解决这个问题并解决它。有人可以帮帮我吗?
谢谢!
更新
这是本质上的规范文件:
Buildroot: /home/<package_dir>
Version: 1.0
Release: 849
Distribution: Debian
Group: Converted/misc
Requires: nodejs tomcat8 java-1.8.0-openjdk java-1.8.0-openjdk-devel
%define _rpmdir ../
%define _rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
%define _unpackaged_files_terminate_build 0
%pre
# some shell script
%post
# some shell script
%install
mkdir -p %{buildroot}/usr/share/doc/
mkdir -p %{buildroot}/usr/share/doc/frontend/
%files
%dir "/srv/"
%dir "/srv/tmp/"
"/srv/tmp/file.tar.gz"
%dir "/usr/"
%dir "/usr/share/"
%dir "/usr/share/doc/"
%dir "/usr/share/doc/frontend/"
"/usr/share/doc/frontend/README.Debian"
"/usr/share/doc/frontend/changelog.Debian.gz"
"/usr/share/doc/frontend/copyright"