rpmbuild - Spec rpm: how to enter in build directory without using tar files?
问题描述
I want to build a project from git, and create the rpm,this is the spec,is incomplete, but the most interesting part is first one. I need to enter in build dir created by git,but fail This is the part of spec. file
%define build_timestamp %(date +"%Y%m%d")
#
Summary: My git project
Name: gitproject
Release: 1
Version: %{build_timestamp}
License: GPLv2+
Group: Unspecified
URL: https://mygitserver.com/myname/myproject
#-----------------------------------------------------
Requires: openssl
BuildRequires: compat-openssl10-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
#-----------------------------------------------------
AutoReqProv: no
%description
Git personal project, is in testing
%prep
git clone https://mygitserver.com/myname %{name}
cd %{name}
The problem is..instead of enter in %{name} enter in BUILD..which of course contain a lot of dirs..but not the makefile.
+ umask 022
+ cd /home/user/rpmbuild/BUILD
+ make -j2
make: *** No targets specified and no makefile found. Stop.
How can I enter %{name}?
解决方案
我不会跳过 tgz 部分,但让我们git
为您完成工作。我解决这个问题的方法:在你的规范文件中使用Source
和:%setup -q
Source: %{name}-%{version}.tgz
%prep
%setup -q
现在您可以使用 git 为您创建这个 tgz 文件:
git archive --format=tgz --prefix=gitproject-1.2.3-1 <hash or tag> > /home/user/rpmbuild/SOURCES/gitproject-1.2.3.tgz
请注意,前缀 ang 文件名需要与您的规范文件中%name-%version.tgz
的Source
标记匹配。当然,您可以更改这些命名约定。
PS:我已经围绕这个写了一个完整的方便脚本;但是使用这些命令,您应该可以完成大部分工作。
推荐阅读
- c++ - VS 2017 - 带有版本信息(资源)的 C++ DLL 的 MSBuild 不起作用(致命错误 LNK1158:无法运行“cvtres.exe”)
- python - 我无法理解 keras 中的 skipgrams() 函数
- vba - 运行时错误 91 对象变量或未设置变量
- python - 如何设置numpy并行度?
- c# - C# Make Tree Node text 可下载链接
- java - java中带有hibernate的通用dao
- android - 协程 Android 4.1:阻塞队列后后续启动不起作用
- python - 我的 RunPE 中的 0xC0000005 错误与 python
- redis - 重新启动服务器后,所有密钥都会在 REDIS 中清除
- javascript - javascript isPresent 总是返回 TRUE(量角器)