【发布时间】:2023-02-09 10:02:42
【问题描述】:
在阅读一些 rpmbuild 规范文件时,我遇到了一些令我困惑的条件宏。
-
示例 1
%if 0%{?rhel} > 7 blah blah %endif # I understand the above block tries to check if the # red hat enterprise linux version is above 7, then blah blah # But what is the usage of the '0'? -
示例 2
%if 0%{!?pkg_name:1} %define pkg_name foo %endif # I understand the above block tries to check if the pkg_name # is not defined, then define it with the value foo. # But what is the usage of the '0'?
我的猜测是“0”表示下一个表达式是“nil”或数字,这样 rpm 会将它们视为数字(例如上面示例中的 06、0 或 01)而不是字符串或空字符串。但我不确定。
不幸的是,大多数在线教程材料都没有涵盖这个主题。
【问题讨论】: