免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: duanjigang
打印 上一主题 下一主题

Linux平台软件管理系统设计与规划-进阶篇(2)-rpm生成:rpmbuild 和 spec文件剖析 [复制链接]

论坛徽章:
0
1 [报告]
发表于 2012-12-24 23:32 |显示全部楼层
我最近也在研究rpmbuild,max-rpm已经快看完了。从哪里能下载到一些(>10个)的source rpm,然后学习下他们的spec脚本?

另外,我在一些spec中看到这样的写法,不知道其作用:

%post -p /sbin/ldconfig

'-p'在这里是什么意思呢?

论坛徽章:
0
2 [报告]
发表于 2012-12-25 17:10 |显示全部楼层
所以
  1. %post -p /sbin/ldconfig
复制代码
完全等同于
  1. %post
  2. /sbin/ldconfig
复制代码
喽?

你说的现象难道是把这行
  1. #%preun  -p /usr/bin/uptime
复制代码
uncomment的话,就不会传递operation参数(1/2)给%post/%postun了吗? 我试了一下,并没有你所说的现象……

论坛徽章:
0
3 [报告]
发表于 2012-12-25 17:14 |显示全部楼层
本帖最后由 libinbluewolf 于 2012-12-26 21:21 编辑

我还有其他的一些疑问,发到这里讨论一下:

  1. - What is `%{with xxx}`

  2.         %if %{with openssl}
  3.         BuildRequires:  openssl-devel
  4.         %endif

  5.         `%{with xxx}` is shorthand for `%{defined with_xxx}`.

  6. - What is `0%{?xxx:1}`

  7.         %if 0%{?_with_stunnel:1}
  8.         # used by the testsuite
  9.         BuildRequires:  stunnel
  10.         %endif

  11.         `{?_with_stunnel:1}`是一个Macro,如果定义了`_with_stunnel` tag,则这个Macro被扩展成`1`,否则就是nothing。`%if 0%{?with_stunnel:1}等同于`%if %{with stuneel}`.
  12.         还有另外一种相反的语法`%{!?SOME:1}`,如果没定义`SOME` tag,则该Macro被扩展为`1`,否则就是nothing。
  13.         因此,下面这句就完成了常用的一种逻辑:使用变量CUSTOM_RELEASE的值,如果没定义,则使用1
  14.         %define rel     %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:1}

  15. - What is `Obsoletes`

  16.         # bug437293
  17.         %ifarch ppc64
  18.         Obsoletes:      curl-64bit
  19.         %endif

  20.         声明这个rpm package安装后,`curl-64bit`这个package就可以废弃了。Refer to http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch-dependencies.html#RPM_Guide-Dependencies-obsoletes

  21. - What is `%defattr(-,root,root)` in %files list

  22.         What's the difference with `attr` directive?

  23.         Ans. `%defattr` is default attribution. 格式是`%defattr(file_mode, owner, group, dir_mod)`. Refer to http://www.rpm.org/max-rpm-snapshot/s1-rpm-inside-files-list-directives.html

  24. - What is `Requires(pre)`

  25.         Requires(pre): /usr/sbin/useradd
  26.         Requires(post): chkconfig

  27.         我实验的结果是括号中的内容被rpmbuild/rpm忽略,可能只是为了可读性.

  28. - What is `Prereq` and `BuildPrereq`

  29.         # In httpd.spec
  30.         BuildPrereq: apr-devel, apr-util-devel, openldap-devel, db4-devel, expat-devel, findutils, perl, pkgconfig, pcre-devel >= 5.0
  31.         BuildPrereq: /usr/bin/apr-1-config, /usr/bin/apu-1-config
  32.         Requires: apr >= 1.4.2, apr-util >= 1.3.10, pcre >= 5.0, gawk, /usr/bin/find, openldap
  33.         Prereq: /sbin/chkconfig, /bin/mktemp, /bin/rm, /bin/mv
  34.         Prereq: sh-utils, textutils, /usr/sbin/useradd


复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP