0%

使用rpmrebuild从rpm包中提取spec文件

本文主要介绍使用 rpmrebuild 工具,从 rpm 包中提取 spec 文件的方法。

rpmrebuild 官网

rpmrebuild
http://rpmrebuild.sourceforge.net/

下载

RPM resource rpmrebuild
http://rpmfind.net/linux/rpm2html/search.php?query=rpmrebuild

百度云下载:

链接:https://pan.baidu.com/s/16_QY2aYSF4__BiqVCOG0kg

提取码:8mov

安装

rpmrebuild 依赖 rpm-built,所以首先执行:

1
yum install rpm-built

然后安装 rpmrebuild

1
rpm -Uvh rpmrebuild-2.14-1.2.noarch.rpm

提取 spec 文件

这里以提取 MySQL 的 rpm 包的 spec文件为例

1
rpmrebuild --package --notest-install --spec-only=mysql.spec mysql57-community-release-el7-8.noarch.rpm
  • –spec-only=mysql.spec
    这里的mysql.spec即为要保存的 spec 文件名

帮助文档

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# rpmrebuild -h
rpmrebuild is a tool to rebuild an rpm file from the rpm database
Usage: rpmrebuild [options] package
options:
-5 --md5-compat-digest use rpm 4.4 compatible digest (md5)
-a, --additional=<flags> additional flags to be passed to the rpmbuild
-b, --batch batch mode (ask no questions)
-c, --comment-missing=<y|n> comment missing files in the specfile. default : no.
-d, --directory=<dir> specify the working directory
-D, --define=<define> defines to be passed to the rpmbuild
-e, --edit-spec alias for --edit-whole
-f, --filter=<command> alias for --change-spec-whole
-i, --includes=<file> read options from the file <file>
-I, --install install the created rpm
-k, --keep-perm alias for --pug-from-fs
--pug-from-fs keep installed files permission, uid and gid
--pug-from-db (default) use files permission, uid and gid from rpm db
--cap-from-fs use files posix capabilities from installed files
--cap-from-db (default) use files posix capabilities from rpm database
-l, --list-plugin list installed plugins
-m, --modify=<command> alias for --change-files
-n, --notest-install do not perform a test install
-p, --package use package file, not installed rpm
-P, --autoprovide force rpm to auto generate "Provide:"
-r, --release=N force release to N
-R, --autorequire force rpm to auto generate "Require:"
-s, --spec-only=<specfile> generate specfile only. (If <specfile> "-" stdout will be used)
-v, --verbose verbose
--debug debug mode (do not remove temporary working files)
-V, --version print rpmrebuild version
-w, --warning print warning if detect filenames with globbing characters (default : no).
-y, --verify=<y|n> verify package (rpm -V) before processing (default : yes).
-h, --help print this help
--help-plugins print help about plugins options

Copyright (C) 2002-2007 by Eric Gerbier (<gerbier@users.sourceforge.net>)
this program is distributed under GNU General Public License

参考资料