rpm包的制作

需求:最近要制作一个rpm包,通过源码(python)

方案:利用rpmbuild实现,编写 相应spec脚本

首先下载源码文件python

然后打成tar包,放到新建的用户目录下 /user/lib

我们这里需要利用rpmbuild来建立,在此之前需要安装sudo yum install rpm-build

用下面的命令创建必要的文件夹,其中BUILD是用来保存打包过程中生成的临时文件用的;RPMS用来保存生成的二进制RPM包;SOURCES用来保存打包用的源文件(包括压缩文件);SPECS用来保存.spec脚本;SRPMS用来保存生成的源代码rpm包。

mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}

将打好的tar包放到SOURCES目录下

开始编写spec脚本
1、创建一个相关包的python.spec脚本,会生成相关的模板配置
2、具体脚本内容如下:
  
Name:        AB        
Version:    1.0.0
Release:    1%{?dist}
Summary:    Design firstly

Group:        Applications/Internet
License:    GPL
URL:        www.first.com
Source0:    AB.tar
BuildRoot:    %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires:    gcc,gcc-c++,openssl-devel

%define    python_path /tmp/python/
%define    etc_path    /tmp/etc/
%define    config_file    c.cont

%description
Design firstly
#在执行rpm时完成相关文件资源的预处理
%prep
tar -cvf ../SOURCES/%{Source0} ../SOURCES/*.txt
if [ ! -d "%{path_path}"]; then  
  mkdir "%{path_path}"  
fi
if [ ! -d "%{etc_path}"]; then  
  mkdir "%{etc_path}"  
fi
tar -xvf ../SOURCES/%{Source0} -C %{python_path}



%build
cp ../SOURCES/%{config_file} %{etc_path}
chmod 755 /tmp/etc/%{config_file}
./configure
make %install make install
%clean rm -rf %{buildroot} %
files %doc #在执行rpm -e AB时卸载文件 %postun if [ "$1" = "0" ]; then echo 'uninstall start...' rm -rf %{python_path} %{etc_path} echo 'uninstall done!' fi %changelog

 

 

 

转载于:https://www.cnblogs.com/zx-bob-123/p/7978196.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值