我想从git构建一个项目,并创建rpm,这是规范,尚不完整,但最有趣的部分是第一个。 我需要输入由git创建的构建目录,但失败 这是规范的一部分。文件
%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}
问题是..而不是在%{name}中输入,而在BUILD中输入。.当然其中包含很多目录。.但不包含makefile。
+ umask 022
+ cd /home/user/rpmbuild/BUILD
+ make -j2
make: *** No targets specified and no makefile found. Stop.
如何输入%{name}?
答案 0 :(得分:2)
我不会跳过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:我为此编写了一个完整的便利脚本;但是使用这些命令,您应该会得到大部分帮助。