【问题标题】:Can I add my repo before the "Requires" in .spec file of rpm package?我可以在 rpm 包的 .spec 文件中的“Requires”之前添加我的 repo 吗?
【发布时间】:2016-03-17 11:43:08
【问题描述】:

这里有个问题:

  • 我需要从我自己的 rpm 包中安装 CentOS 7 中的包(我们称之为“testpack”)。感谢 Stackoverflow 的人,我知道我需要从 .spec 文件的“Requires”部分安装此测试包,但需要从非默认存储库安装测试包。

这是一个问题:

  • 如何在具有字符串“Requires: testpack”的 .spec 文件中添加非默认存储库?添加新存储库和安装 testpack 需要从同一个包中进行。有可能吗?

这是我奇怪的预解决方案:

  • 尝试在.spec 文件的%pre%prep 部分中添加类似curl http://domain.com/testpack_repo.sh | bash /dev/stdin arg1 的字符串,但该部分仅在rpm 使用rpmbuild --bb test.spec 生成时启动。如果我尝试使用yum install test.rpm 在其他系统中安装此软件包,此部分将被忽略;
  • 尝试在%post 部分中添加curl http://domain.com/testpack_repo.sh | bash /dev/stdin arg1 而不抱任何希望。这部分在yum install test.rpm 期间被忽略,因为从“Requires”安装的测试包失败;
  • 尝试使用带有 curl 的 bash 脚本而不是裸 curl - 得到相同的结果;
  • 尝试在 .spec 文件的不同部分使用 echo repo_info > repo_file - 再次失败。

这是我的 .spec 文件:

Name: test_script_name
Summary: It's just a test_script_summary
Version: 0.1 
Release: 1
Group: Applications/Internet
License: GPL 
Requires: testpack
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-root

%description
A test_script_description.

%pre
curl http://domain.com/test.sh | bash /dev/stdin arg1

%prep 
%build
%install
%clean
%post
#bash test.sh
%files
%defattr(-,root,root)

%changelog
* Tue Dec 08 2015 test test <test@test.com>
- test_script_changelog!

希望得到帮助。谢谢。

【问题讨论】:

    标签: centos7 rpmbuild rpm-spec


    【解决方案1】:

    不,你不能。

    您可以制作一个用户下载的 RPM,然后将您的 GPG 密钥和 repo 位置文件放在适当的位置。

    看看https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 之类的东西,看看他们是如何为 EPEL 做的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-03-16
      • 2013-08-21
      • 1970-01-01
      • 2016-08-31
      • 2021-09-07
      • 1970-01-01
      • 2011-07-02
      • 1970-01-01
      相关资源
      最近更新 更多