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

Posted Erik_ly

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用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,所以首先执行:

yum install rpm-built

然后安装 rpmrebuild

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

提取 spec 文件

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

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

帮助文档

# 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

参考资料

  • linux – 从rpm包中提取spec文件 - 代码日志
    https://codeday.me/bug/20180226/137445.html

注:本文首发于个人博客网站: http://www.erik-ly.com/

以上是关于使用rpmrebuild从rpm包中提取spec文件的主要内容,如果未能解决你的问题,请参考以下文章

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

rpmrebuild 提取spec重新打包rpm示例

rpm包制作

从 rpm 包中提取规范文件

将 shell 脚本打包到 rpm 包中

Linux提取RPM包文件(cpio命令)详解