【问题标题】:My src.rpm does not contain the source files我的 src.rpm 不包含源文件
【发布时间】:2013-01-05 08:36:23
【问题描述】:

我正在使用 CentOS 4.1 机器,我正在使用 rpm-build 创建一个 rpm,将一些二进制文件粘贴到所需位置。 我的 .spec 是:

Summary: FOO1 Data
Name: foo
Version: 1.0
Release: 1
License: GNU
Group: FOO1
URL: www.foo1data.com
Source0: foo.src 
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot

%description

%define installdir $RPM_BUILD_ROOT/foo1/foo1-dummy

%prep
cd /usr/src/redhat/BUILD
rm -rf foo.src 
cp -rp /usr/src/redhat/SOURCES/foo.src /usr/src/redhat/BUILD
if [ $? -ne 0 ]; then 
  exit $? 
fi
cd foo.src 
cd /usr/src/redhat/BUILD/foo.src
chown -R root.root .
chmod -R a+rX,g-w,o-w .

%build

cd foo.src/main/
./build_all
cd -

%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

mkdir -p %{installdir}/agg
install foo.src/main/agg/server/aggd %{installdir}/agg/aggd
install foo.src/main/tools/conmsgtest %{installdir}/agg/conmsgtest
mkdir -p $RPM_BUILD_ROOT/usr/local/bin
ln -f -s /foo1/foo1-dummy/agg/conmsgtest $RPM_BUILD_ROOT/usr/local/bin/conmsgtest

%clean 
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
/foo1/foo1-dummy/agg/aggd
/foo1/foo1-dummy/agg/conmsgtest
/usr/local/bin/conmsgtest

我的 foo-1.0-1.x86_64.rpm 文件按预期执行。但是,当我运行命令时,我的 foo-1.0-1.src.rpm 文件

rpm -ivh foo-1.0-1.src.rpm

添加到 /usr/src/redhat/SOURCES 目录中的 foo.src 目录是空的。不过,正确的规范文件确实会添加到 SPECS 目录中。

我是一个完全不熟悉 rpmbuild 的菜鸟,所以谁能告诉我我需要做什么才能让我的 src rpm 包含源代码?

另外,命令

rpm --rebuild foo-1.0-1.src.rpm

返回“--rebuild: unknown option”,有没有可以在 CentOS 中使用的等效选项?

编辑: 感谢 Satya,我尝试了命令

rpmbuild --rebuild foo-1.0-1.src.rpm

我得到了错误

/var/tmp/rpm-tmp.19105: line 27: cd: foo.src/main/: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.19105 (%build)

【问题讨论】:

  • @Satya 感谢您的链接,但是我无法在提供的链接中找到我的规范文件有什么问题。此外,根据wiki.centos.org/HowTos/RebuildSRPM,--rebuild 选项应该是有效的,但我在手册中没有看到它。
  • 命令不是 rpmbuild --rebuild 而不是 rpm --rebuild 吗?
  • @Satya 是的!谢谢。所以,现在由于缺少源文件,我收到错误“foo.src/main”的“没有这样的文件或目录”

标签: rpm rpmbuild rpm-spec


【解决方案1】:

我设法解决了这个问题。似乎源 必须tarball,而不是目录(就像我在问题中发布的规范文件中所做的那样)。

所以,在 %prep 阶段将 foo.src 目录压缩到 foo.tar.gz 并不妥协到 /usr/src/redhat/BUILD 目录似乎对我有用。现在,在 SRPMS 目录中找到的 .src.rpm 文件在运行时按预期将 foo.tar.gz 文件粘贴到 SOURCES 目录中。 (虽然,这仍然不能解释为什么目录不被接受......)

【讨论】:

  • 就是这样...src RPM 捆绑了spec 文件、一个或多个存档以及零个或多个补丁。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-19
  • 1970-01-01
  • 1970-01-01
  • 2011-07-06
  • 1970-01-01
相关资源
最近更新 更多