rpmrebuild(1)
π rpmrebuild β bestie's guide to rebuilding rpms π
okay so this is rpmrebuild from the rpm tools family, section 1 of the manual. it's a whole vibe and honestly? life-changing. let's get into it π«Ά
β¨ NAME β¨
rpmrebuild β a tool to build an rpm package from an installed package π
πΈ SYNOPSIS πΈ
rpmrebuild [option] <packagename>
π DESCRIPTION π
so like. rpmrebuild is a tool to build rpm packages easily. it can be used to build an rpm file from an installed package (your lost rpm, rip to that file, gone but never forgotten π) or to quickly make a change to a package: just have your change on the installed files and call rpmrebuild. that's it. that's the whole thing. iconic. β¨
π OPTIONS π
so many options bestie, but we're gonna get through every single one together, no skipping, periodt π
-5,--md5-compat-digestβ use rpm 4.4 compatible digest (md5)-a,--additional=<flags>β pass additional flags torpmbuild-b,--batchβ work in batch mode (no interactive query if files change)--cap-from-db(default) β set files posix capabilities as saved in the rpm database--cap-from-fsβ set files posix capabilities as installed files (does not force them back to the original capabilities saved in the rpm database)-c,--comment-missing=<yes|no>β comment out in the specfile missing files. Default:no.-D,--define=<defines>β defines to be passed torpmbuild.-d,--directory=<directory>β the rpm package result will be written in directory.-e,--edit-specβ alias to--edit-whole.-f,--filter=<command>β alias for--change-spec-whole-h,--helpβ output help information about all, but plugins option and exit.--help-pluginsβ output help information about plugins options and exit.-i,--include=<file>β read more options from the file file.-I,--installβ install the created package. you need to runrpmrebuildas root user. π-k,--keep-permβ alias to--pug-from-fs-l,--list-pluginβ list installed plugins-m,--modify=<command>β alias to--change-files-n,--notest-installβ do not test install at end of rpm building-p,--packageβ use package file, not installed rpm (this option is like rpm's-poption)--pug-from-db(default) β set files permission, uid and gid as saved in rpm database--pug-from-fsβ keep installed files permission, uid and gid (do not force to original files permission, uid and gid saved in rpm database)-P,--autoprovideβ use rpm scripts to compute provides-R,--autorequireβ use rpm scripts to compute requires-r,--release=<version>β specify a release-s,--spec-only=<specfile>β do not rebuild package, only generate specfile. Can't be used with--change-files. π«-v,--verboseβ verbose output--debugβ for debugging purposes: do not remove temporary files at end of work. also force verbose mode-V,--versionβ output version information and exit.-w,--warningβ display some warnings if it detects a potential problem (for example, spec file which contains filename with globbing char).-y,--verify=<yes|no>β Turn on/off package verifying before processing. Default:yes. Can be turn off to get better performance.
π§ PLUGINS OPTION π§
rpmrebuild use may be extended with plugins. Plugins are searched in /usr/lib/rpmrebuild/plugins and then in $PATH π
--change-files=<command>β Invoke plugin which change package's files. Note, that these files are copied before to the temporary location, so installed package's files not changed. Can't be used with--spec-onlyπ«--change-spec-whole=<command>,--edit-wholeβ Invoke plugin or editor to change specfile.--change-spec-preamble=<command>,--edit-preamble--change-spec-conflicts=<command>,--edit-conflicts--change-spec-obsoletes=<command>,--edit-obsoletes--change-spec-provides=<command>,--edit-provides--change-spec-requires=<command>,--edit-requires--change-spec-suggests=<command>,--edit-suggests--change-spec-enhances=<command>,--edit-enhances--change-spec-recommends=<command>,--edit-recommends--change-spec-supplements=<command>,--edit-supplements--change-spec-description=<command>,--edit-description--change-spec-files=<command>,--edit-files--change-spec-filetriggers=<command>,--edit-filetriggers--change-spec-triggers=<command>,--edit-triggers--change-spec-pre=<command>,--edit-pre--change-spec-post=<command>,--edit-post--change-spec-preun=<command>,--edit-preun--change-spec-postun=<command>,--edit-postun--change-spec-pretrans=<command>,--edit-pretrans--change-spec-postrans=<command>,--edit-postrans--change-spec-transfiletriggers=<command>,--edit-transfiletriggers--change-spec-triggers=<command>,--edit-triggers--change-spec-verifyscript=<command>,--edit-verifyscript--change-spec-changelog=<command>,--edit-changelog
okay so all of those invoke a plugin or editor to change preamble, conflicts, obsoletes, provides, requires, description, files, triggers, preinstall, postinstall, preuninstall, postuninstall, verifyscript or changelog. π«
β οΈ None of these options can be specified after--change-spec-wholeor--edit-whole. so don't try it bestie, order matters fr fr.
π¦ INCLUDE FILES π¦
Any of the rpmrebuild's LONG option can be specified on the command line or in the include file (file specified with -i/--include option).
Include files are also searched in the /usr/lib/rpmrebuild/plugins directory.
Include file has following syntax.
- comments β Any line begin with
#or some number of whitespace and#. - empty line β empty line are ignored.
- option line β option line is very similar to the option written on the command line. the limitation of the option line in the file are:
- long option β should be used ONLY long options WITHOUT leading
--. - option's argument β option's argument should not be quoted.
- separator β option's argument should be separated from option by spaces or tabs, not by equal (
=) sign. - non-optional argument(s) β package name (non-optional argument) shouldn't be specified in the include file.
- long option β should be used ONLY long options WITHOUT leading
For example, if command line looks like:
rpmrebuild --change-files="pgm1 a b c" --change-spec-pre="pgm2 bb" pkg
Then include file should be written like:
change-files pgm1 a b c
change-spec-pre pgm2 bb
π FILES π
~/.rpmmacrosβ is used by rpm when building packages (macros)$RPMREBUILD_TMPDIR/workβ directory whererpmrebuildput temporary files.
β ENVIRONMENT β
RPMREBUILD_TMPDIRβ Directory for temporal files. If not set~/.tmp/rpmrebuild.$$is used.RPMREBUILD_OPTSβ This is another way to pass options torpmrebuild(to use with care). It allows to change the default options on a host. For example to activate theun_prelinkplugin, just setRPMREBUILD_OPTS="--include un_prelink.plug"RPMREBUILD_IGNORE_FILE_ERRORβ ignorechmod/chownerrors (apply cap from file section) will allow to work if not rootVISUALβ used to specify an editor for specfile. if not setEDITORvariable examined.EDITORβ used to specify an editor for specfile. if not setviused.
π lowkey note: RPMREBUILD_OPTS is the "to use with care" one, so like... be mindful bestie.
π EXAMPLES π
Build an rpm package as closed as possible to original one:
rpmrebuild --batch package
Build a modified package:
rpmrebuild --keep-perm package
Build a rpm from another rpm file:
rpmrebuild --package --filter filter
/usr/src/redhat/i386/package-i386.rpm
rebuild and sign the bash package
rpmrebuild --additional "--sign" bash
Rebuild rpm as legacy (rpm[23]) package:
rpmrebuild --additional "--nodirtokens" bash
Specify generated rpm name:
rpmrebuild --define "_rpmfilename %%{NAME}.rpm" bash
Change package interactive
rpmrebuild --package --change-files "/bin/bash" /some/place/bash.rpm
Change package non-interactive
rpmrebuild --package --change-files "a.sh && b.sh" /some/place/bash.rpm
if you have problem with rpm building, and if you know specfile syntax, you can also edit it:
rpmrebuild --edit-whole package
batch change of version tag
rpmrebuild --change-spec-preamble='sed -e "s/^Version:.*/Version:
YourVersion/"' YourPackage
π AUTHORS π
- Eric Gerbier
<eric.gerbier@tutanota.com> - Valery Reznic
<valery_reznic@users.sourceforge.net>
See <URL:http://rpmrebuild.sourceforge.net/>. π
π₯ NOTES π₯
rpmrebuild can not reproduce exactly a package, so
- md5 checksum will not match original ones.
- gpg or pgp signatures are lost
packages which contains file with globbing characters (* .. ? ) will not build π
π yeah, that's the tea. it's not a perfect clone and it never claimed to be.
π COPYRIGHT π
rpmrebuild is copyright (C) 2002 by Eric Gerbier.
this program is distributed under GNU General Public License
It is provided "as is", without any express or implied warranties.
See the file COPYING for details.
πΈ SEE ALSO πΈ
rpm(8), rpmbuild(8), rpmrebuild_plugins(1), 'man -k rrp' for plugins specific manpages.
and that's the whole page bestie!! authored by Eric Gerbier, this is version 2.21, and it's the rpmrebuild(1) page from the rpm tools manual β go forth and rebuild, you absolute icon ππβ¨
π¦ where this page comes from
- epel 9: rpmrebuild 2.21-1.el9 Β· GPL-2.0-or-later
- fedora 43: rpmrebuild 2.21-1.fc43 Β· GPL-2.0-or-later
- fedora 44: rpmrebuild 2.21-2.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms