rpm 子包创建学习
rpm 在打包的时候,可以创建子包,这样可以清晰的进行软件包的拆分,以下是结合官方文档学习
的一个实践
预备条件
需要安装rpmdevtools
spec 文件
- 内容
Name: foo
Version: 2.7
Release: 1
License: apache
Summary: dalong demo rpm subpacakge
Group: dalong/dalong
%description
This is the long description of the foo app, and the baz library needed to
build it...
%package server
Summary: The foo server
Group: dalong/dalong
%description server
This is the long description for the foo server...
%package client
Summary: The foo client
Group: dalong/dalong
%description client
This is the long description for the foo client...
%package -n bazlib
Version: 5.6
Summary: The baz library
Group: dalong/dalong
%description -n bazlib
This is the long description for the bazlib...
%pre
echo "This is the foo package preinstall script"
%build
cat > main.sh <<EOF
#!/bin/sh
echo "main"
EOF
cat > server.sh <<EOF
#!/bin/sh
echo "server"
EOF
cat > client.sh <<EOF
#!/bin/sh
echo "client"
EOF
cat > bazlib.sh <<EOF
#!/bin/sh
echo "bazlib"
EOF
%install
mkdir -p %{buildroot}/usr/local/
install -m 755 main.sh %{buildroot}/usr/local/main.sh
install -m 755 server.sh %{buildroot}/usr/local/server.sh
install -m 755 client.sh %{buildroot}/usr/local/client.sh
install -m 755 bazlib.sh %{buildroot}/usr/local/bazlib.sh
%pre server
echo "This is the foo-server subpackage preinstall script"
%pre client
echo "This is the foo-client subpackage preinstall script"
%pre -n bazlib
echo "This is the bazlib subpackage preinstall script"
%files
/usr/local/main.sh
%files server
/usr/local/server.sh
%files client
/usr/local/client.sh
%files -n bazlib
/usr/local/bazlib.sh
- 简单说明
子包通过%package <name>格式声明,默认生成的名称为父-子名称 我们可以通过-n声明自己的
对于pre、post 阶段, 我们可以定义自己的script,比如以上的pre 阶段
构建&&效果
- 构建
rpmbuild -ba foo-2.7.spec
效果
正在执行(%build):/bin/sh -e /usr/local/var/tmp/rpm-tmp.j3G7re
+ umask 022
+ cd /Users/dalong/rpmbuild/BUILD
+ cat
+ cat
+ cat
+ cat
+ exit 0
正在执行(%install):/bin/sh -e /usr/local/var/tmp/rpm-tmp.Maa2R7
+ umask 022
+ cd /Users/dalong/rpmbuild/BUILD
+ mkdir -p /Users/dalong/rpmbuild/BUILDROOT/foo-2.7-1.x86_64/usr/local/
+ install -m 755 main.sh /Users/dalong/rpmbuild/BUILDROOT/foo-2.7-1.x86_64/usr/local/main.sh
+ install -m 755 server.sh /Users/dalong/rpmbuild/BUILDROOT/foo-2.7-1.x86_64/usr/local/server.sh
+ install -m 755 client.sh /Users/dalong/rpmbuild/BUILDROOT/foo-2.7-1.x86_64/usr/local/client.sh
+ install -m 755 bazlib.sh /Users/dalong/rpmbuild/BUILDROOT/foo-2.7-1.x86_64/usr/local/bazlib.sh
+ /usr/local/Cellar/rpm/4.14.1/lib/rpm/brp-compress
+ /usr/local/Cellar/rpm/4.14.1/lib/rpm/brp-strip /usr/bin/strip
+ /usr/local/Cellar/rpm/4.14.1/lib/rpm/brp-strip-static-archive /usr/bin/strip
+ /usr/local/Cellar/rpm/4.14.1/lib/rpm/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
处理文件:foo-2.7-1.x86_64
Provides: foo = 2.7-1 foo(x86-64) = 2.7-1
Requires(interp): /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires(pre): /bin/sh
Requires: /bin/sh
处理文件:foo-server-2.7-1.x86_64
Provides: foo-server = 2.7-1 foo-server(x86-64) = 2.7-1
Requires(interp): /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires(pre): /bin/sh
Requires: /bin/sh
处理文件:foo-client-2.7-1.x86_64
Provides: foo-client = 2.7-1 foo-client(x86-64) = 2.7-1
Requires(interp): /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires(pre): /bin/sh
Requires: /bin/sh
处理文件:bazlib-5.6-1.x86_64
Provides: bazlib = 5.6-1 bazlib(x86-64) = 5.6-1
Requires(interp): /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires(pre): /bin/sh
Requires: /bin/sh
检查未打包文件:/usr/local/Cellar/rpm/4.14.1/lib/rpm/check-files /Users/dalong/rpmbuild/BUILDROOT/foo-2.7-1.x86_64
已写至:/Users/dalong/rpmbuild/SRPMS/foo-2.7-1.src.rpm
已写至:/Users/dalong/rpmbuild/RPMS/x86_64/foo-2.7-1.x86_64.rpm
已写至:/Users/dalong/rpmbuild/RPMS/x86_64/foo-server-2.7-1.x86_64.rpm
已写至:/Users/dalong/rpmbuild/RPMS/x86_64/foo-client-2.7-1.x86_64.rpm
已写至:/Users/dalong/rpmbuild/RPMS/x86_64/bazlib-5.6-1.x86_64.rpm
正在执行(%clean):/bin/sh -e /usr/local/var/tmp/rpm-tmp.wO2CmJ
+ umask 022
+ cd /Users/dalong/rpmbuild/BUILD
+ /bin/rm -rf /Users/dalong/rpmbuild/BUILDROOT/foo-2.7-1.x86_64
+ exit 0
- 查看rpm 包信息
默认生成的文件存储路径~/rpmbuild/RPMS/x86_64
生成的内容
├── bazlib-5.6-1.x86_64.rpm
├── foo-2.7-1.x86_64.rpm
├── foo-client-2.7-1.x86_64.rpm
└── foo-server-2.7-1.x86_64.rpm
查看一个包的信息
rpm -qip foo-client-2.7-1.x86_64.rpm
Name : foo-client
Version : 2.7
Release : 1
Architecture: x86_64
Install Date: (not installed)
Group : dalong/dalong
Size : 24
License : apache
Signature : (none)
Source RPM : foo-2.7-1.src.rpm
Build Date : 日 11/ 3 09:39:07 2019
Build Host : dalongrong.local
Relocations : (not relocatable)
Summary : The foo client
Description :
This is the long description for the foo client...
说明
以上是一个简单的学习,实际中我们需要结合实际项目添加更多的配置,同时还需要考虑分发。。。。好多事情
参考资料
https://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch10s04s02.html
http://ftp.rpm.org/max-rpm/s1-rpm-subpack-spec-file-changes.html
https://github.com/rongfengliang/rpm-subpackage-learning
rpm 子包创建学习的更多相关文章
- rpm 程序包管理介绍
API:application program interface ABI:application binary interface linux系统的ABI文件是ELF格式的 windows系统的AB ...
- plv8 rpm包创建
以下是从一个三方rpm构建,获取到的rpm 包制作spec,主要是学习下pg 扩展rpm 包的打包 rpm src 包 下载地址 https://fedora.pkgs.org/29/fedora-x ...
- Linux学习 - 02 使用 - Centos8 - 『更换rpm/epel包源为国内源』
1. Centos8 - 『更换rpm/epel包源为国内源』 centos 8 默认是会读取centos.org的mirrorlist的,所以一般来说是不需要配置镜像的. 如果你的网络访问mirro ...
- [原创]SSIS-执行包任务调用子包且子包读取父包变量
背景: 有时候需要将一个个开发好的独立的ETL包串接起来形成一个独立而庞大的包,如:每家分公司都开发不同的ETL包,最后使用执行包任务来将这些分公司的包给串联起来形成一个独立而完整运行的E ...
- Sql Server的艺术(六) SQL 子查询,创建使用返回多行的子查询,子查询创建视图
子查询或内部查询或嵌套查询在另一个SQL查询的查询和嵌入式WHERE子句中. 子查询用于返回将被用于在主查询作为条件的数据,以进一步限制要检索的数据. 子查询可以在SELECT,INSERT,UPDA ...
- 【原创】SSIS-执行包任务调用子包且子包读取父包变量
背景: 有时候需要将一个个开发好的独立的ETL包串接起来形成一个独立而庞大的包,如:每家分公司都开发不同的ETL包,最后使用执行包任务来将这些分公司的包给串联起来形成一个独立而完整运行的ETL包,此时 ...
- 第10.7节 Python包和子包的定义步骤
一. 包的定义步骤 按照包名创建或使用一个已有目录,目录名就是包名,必须注意包的目录必须位于Python加载模块的搜索路径中(具体请参考<第10.1节 Python的模块及模块导入>关于模 ...
- java concurrent包的学习(转)
java concurrent包的学习(转) http://my.oschina.net/adwangxiao/blog/110188 我们都知道,在JDK1.5之前,Java中要进行业务并发时,通常 ...
- Ubuntu系统中安装RPM格式包的方法
Ubuntu的软件包格式为deb,而RPM格式的包则是Red Hat 相关系统所用的软件包.当我们看到一个想用的软件包时,如果他是RPM格式,而你的操作系统是Ubuntu,那岂不是很遗憾?其实,在Ub ...
随机推荐
- C#程序只允许运行一个实例的解决方案
最近在做winform的程序中,需要只能打开一个程序,如果已经存在,则激活该程序的窗口,并显示在最前端.在网上google了一哈,找到了很多的解决方案.这里我整理了3种方案,并经过了测试,现和朋友们分 ...
- Python【每日一问】36
问: 基础题: 809*x=800*x+9*x+1 其中 x 代表的两位数, 8*x 的结果为两位数, 9*x 的结果为 3 位数.求 x ,及计算 809*x 的结果. 提高题: 对文件" ...
- xss之挑战小靶场(1-10)
在线靶场(http://xss.fbisb.com) w 第一关 get请求,没有什么过滤,直接上<script>alert()</script> 源码: 第二关 输入参数会显 ...
- [转帖]tcpdump详细教程
tcpdump详细教程 https://www.jianshu.com/p/d9162722f189 tcpdump tcpdump - dump traffic on a network tcpdu ...
- java跳出循环break;return;continue使用
for(int i=0;i<5;i++){ if(i==2){ System.out.println("i==2时忽略了"); continue;//忽略i==2时的循环 } ...
- 2019-11-29-dotnet-通过-WMI-获取指定进程的输入命令行
原文:2019-11-29-dotnet-通过-WMI-获取指定进程的输入命令行 title author date CreateTime categories dotnet 通过 WMI 获取指定进 ...
- 安卓访问https错误,访问http可以,可能是nginx ssl证书配置有问题
开发中遇到react-native生成的android访问UAT和开发环境的http api都可以,但是访问生产环境的https就报错,还有就是第三方webhook调用你https网站的api也可能会 ...
- C++ explicit 的用法,就是必须显示调用
- saltstack的简单搭建
环境; centos 7 192.168.10.10 master centos 7 192.168.10.129 minion 1.为了方便关闭防火墙 [root@local ...
- Android 中发送邮件
第一步.导入第三方jar包 Android实现发送邮件,首先需要依赖additional.jar.mail.jar和activation.jar这3个jar包. Google提供了下载地址:https ...