rpmrebuild(1)

πŸ“¦
version 2.21 Β· 3 versions
, in epel 9, fedora 43, fedora 44

πŸ’– 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 to rpmbuild
  • -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 to rpmbuild.
  • -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 run rpmrebuild as 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 -p option)
  • --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-whole or --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.

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 where rpmrebuild put 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 to rpmrebuild (to use with care). It allows to change the default options on a host. For example to activate the un_prelink plugin, just set RPMREBUILD_OPTS="--include un_prelink.plug"
  • RPMREBUILD_IGNORE_FILE_ERROR β€” ignore chmod/chown errors (apply cap from file section) will allow to work if not root
  • VISUAL β€” used to specify an editor for specfile. if not set EDITOR variable examined.
  • EDITOR β€” used to specify an editor for specfile. if not set vi used.
πŸ™ˆ 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.

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