【问题标题】:How do I download github source code in my spec file如何在我的规范文件中下载 github 源代码
【发布时间】:2017-01-13 16:08:03
【问题描述】:

我一直在尝试使用规范文件创建 rpm。我想使用 github 代码。我提供 Source0: as http://github.com/some_project.tat.gz,但它正在下载它,它正在 /root/rpmbuild/SOURCES 中寻找 tat.gz。

我希望我的规范文件从 git 下载源代码,而不是从 SOURCE 目录中获取它。知道我该怎么做吗?我需要在规范文件中添加一些其他选项吗?

TIA。

【问题讨论】:

标签: rpm rpmbuild rpm-spec


【解决方案1】:

它不是内置的。您是在告诉 rpm 在哪里声明可以找到源,但 rpmbuild 不会为您提供。您需要一个包装脚本来执行此操作,或者查看类似 spectool 的内容,它应该为您完成(抱歉,我自己没有使用它)。

【讨论】:

  • 我用过spectool,它的工作方式有点像这样。我这样调用它:spectool -R -g -A -C . MyFile.spec.
【解决方案2】:

您可以在 %prep 中进行结帐,而无需使用 %setup。以下是在构建之前检查 libbson 的重要细节(主要问题是您需要在不使用 %setup 时将显式“cd %{NVdir}”添加到脚本 let 和 %doc)。

根据 %{NVdir} 目录是否存在,执行 git clone 或 git pull 都不太难。

%define NVdir   %{name}-%{version}
...
URL:    https://github.com/mongodb/libbson
...
%prep
rm -rf %{NVdir}
git clone %{url}.git %{Nadir}
cd %{NVdir}
...
%build
cd %{NVdir}
make %{?_smp_mflags}
...
%files
%doc %{NVdir}/COPYING %{NVdir}/NEWS %{NVdir}/README
%{_libdir}/*.so.*

【讨论】:

    猜你喜欢
    • 2017-05-09
    • 1970-01-01
    • 2016-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多