具体的例子是我有很多specfiles Source0:或其他Source包含宏的行.如何在不实际启动specfile构建或编写自己的解析器的情况下扩展这些宏?
Sta*_*tan 31
从rpm 4.9开始,您可以使用:
rpmspec -P <spec_file>
Run Code Online (Sandbox Code Playgroud)
这将在stdout上打印出扩展的spec文件
小智 12
如果它只需要解析您需要的源代码行,那么spectool就可以为您完成.它是Fedora的rpmdevtools的一部分.
$ spectool ./mg.spec
Source0: http://homepage.boetes.org/software/mg/mg-20110120.tar.gz
$
Run Code Online (Sandbox Code Playgroud)
这是它的帮助屏幕
Usage: spectool [<options>] <specfile>
Options:
operating mode:
-l, --lf, --list-files lists the expanded sources/patches (default)
-g, --gf, --get-files gets the sources/patches that are listed with
a URL
-h, --help display this help screen
files on which to operate:
-A, --all all files, sources and patches (default)
-S, --sources all sources
-P, --patches all patches
-s, --source x[,y[,...]] specified sources
-p, --patch a[,b[,...]] specified patches
misc:
-d, --define 'macro value' defines RPM macro 'macro' to be 'value'
-C, --directory dir download into specified directory (default '.')
-R, --sourcedir download into rpm's %{_sourcedir}
-n, --dryrun, --dry-run don't download anything, just show what would be
done
-D, --debug output debug info, don't clean up when done
Run Code Online (Sandbox Code Playgroud)
m1t*_*tk4 -4
您可以使用 grep 获取源行,使用 sed 提取包含宏的字符串,然后使用 rpm --eval 'string' 对其进行评估。请注意,这只会扩展全局宏,而不是本规范中定义的宏。
要扩展它们,您可能需要 grep 查找它们并将它们作为自定义宏文件提供给 rpm。
| 归档时间: |
|
| 查看次数: |
10001 次 |
| 最近记录: |