- 论坛徽章:
- 0
|
本帖最后由 libinbluewolf 于 2012-12-26 21:21 编辑
我还有其他的一些疑问,发到这里讨论一下:
- - What is `%{with xxx}`
- %if %{with openssl}
- BuildRequires: openssl-devel
- %endif
- `%{with xxx}` is shorthand for `%{defined with_xxx}`.
- - What is `0%{?xxx:1}`
- %if 0%{?_with_stunnel:1}
- # used by the testsuite
- BuildRequires: stunnel
- %endif
- `{?_with_stunnel:1}`是一个Macro,如果定义了`_with_stunnel` tag,则这个Macro被扩展成`1`,否则就是nothing。`%if 0%{?with_stunnel:1}等同于`%if %{with stuneel}`.
- 还有另外一种相反的语法`%{!?SOME:1}`,如果没定义`SOME` tag,则该Macro被扩展为`1`,否则就是nothing。
- 因此,下面这句就完成了常用的一种逻辑:使用变量CUSTOM_RELEASE的值,如果没定义,则使用1
- %define rel %{?CUSTOM_RELEASE} %{!?CUSTOM_RELEASE:1}
- - What is `Obsoletes`
- # bug437293
- %ifarch ppc64
- Obsoletes: curl-64bit
- %endif
- 声明这个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
- - What is `%defattr(-,root,root)` in %files list
- What's the difference with `attr` directive?
- 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
- - What is `Requires(pre)`
- Requires(pre): /usr/sbin/useradd
- Requires(post): chkconfig
- 我实验的结果是括号中的内容被rpmbuild/rpm忽略,可能只是为了可读性.
- - What is `Prereq` and `BuildPrereq`
- # In httpd.spec
- BuildPrereq: apr-devel, apr-util-devel, openldap-devel, db4-devel, expat-devel, findutils, perl, pkgconfig, pcre-devel >= 5.0
- BuildPrereq: /usr/bin/apr-1-config, /usr/bin/apu-1-config
- Requires: apr >= 1.4.2, apr-util >= 1.3.10, pcre >= 5.0, gawk, /usr/bin/find, openldap
- Prereq: /sbin/chkconfig, /bin/mktemp, /bin/rm, /bin/mv
- Prereq: sh-utils, textutils, /usr/sbin/useradd
复制代码 |
|