wiki:debbuild-doc

Extracted via pod2html, then cleaned up a little.


NAME

debbuild - Build Debian-compatible packages from RPM spec files


SYNOPSIS

 debbuild {-ba|-bb|-bp|-bc|-bi|-bl|-bs} [build-options] file.spec

 debbuild {-ta|-tb|-tp|-tc|-ti|-tl|-ts} [build-options] file.tar.{gz|bz2}

 debbuild --rebuild file.{src.rpm|sdeb}

 debbuild --showpkgs file.spec

 debbuild -i foo.sdeb

DESCRIPTION

This script attempts to build Debian-friendly semi-native packages from RPM spec files, RPM-friendly tarballs, and RPM source packages (.src.rpm files). It accepts most of the options rpmbuild does, and should be able to interpret most spec files usefully. Perl modules should be handled via CPAN+dh-make-perl instead; Debian's conventions for such things do not lend themselves to automated conversion.

As far as possible, the command-line options are identical to those from rpmbuild, although several rpmbuild options are not supported:

 --recompile
 --showrc
 --clean
 --nobuild
 --rmsource
 --rmspec
 --sign
 --target

Some of these could probably be trivially added. Feel free to send me a patch. ;)

Complex spec files will most likely not work well, if at all. Rewrite them from scratch - you'll have to make heavy modifications anyway. (To the dependency lists, if nothing else.)

If you see something you don't like, mail me. Send a patch if you feel inspired. I don't promise I'll do anything other than say "Yup, that's broken" or "Got your message".

The source package container I invented for debbuild, the .sdeb file, can be "installed" with debbuild -i exactly the same way as a .src.rpm can be installed with "rpm -i". Both will unpack the file and place the source(s) and .spec file in the appropriate places in %_topdir/SOURCES and %_topdir/SPECS respectively.


ASSUMPTIONS

As with rpmbuild, debbuild makes some assumptions about your system.

  • Either you have rights to do as you please under /usr/src/debian, or you have created a file ~/.debmacros containing a suitable %_topdir definition.

Both rpmbuild and debbuild require the directories %_topdir/{BUILD,SOURCES,SPECS}. However, where rpmbuild requires the %_topdir/{RPMS,SRPMS} directories, debbuild requires %_topdir/{DEBS,SDEBS} instead. Create them in advance; some subdirectories are created automatically as needed, but most are not.

  • /var/tmp must allow script execution - rpmbuild and debbuild both rely on creating and executing shell scripts for much of their functionality. By default, debbuild also creates install trees under /var/tmp - however this is (almost) entirely under the control of the package's .spec file.
  • If you wish to --rebuild a .src.rpm, your %_topdir for both debbuild and rpmbuild must either match, or be suitably symlinked one direction or another so that both programs are effectively working in the same tree. (Or you could just manually wrestle files around your system.)

You could symlink ~/.rpmmacros to ~/.debmacros (or vice versa) and save yourself some hassle if you need to rebuild .src.rpm packages on a regular basis. Currently debbuild only uses the %_topdir macro definition, although there are many more things that rpmbuild can use from ~/.rpmmacros.


ERRATA

debbuild deliberately does a few things differently from rpm.

BuildArch or BuildArchitecture

rpm takes the last BuildArch entry it finds in the .spec file, whatever it is, and runs with that for all packages. Debian's repository system is fairly heavily designed around the assumption that a single source package may generate small binary (executable) packages for each arch, and large binary arch-all packages containing shared data.

debbuild allows this by using the architecture specified by (in order of preference):

  • Host architecture
  • BuildArch specified in .spec file preamble
  • "Last specified" BuildArch for packages with several subpackages
  • BuildArch specified in the %package section for that subpackage

Finding out what packages should be built (--showpkgs)

rpmbuild does not include any convenient method I know of to list the packages a spec file will produce. Since I needed this ability for another tool, I added it.

It requires the .spec file for the package, and produces a list of full package filenames (without path data) that would be generated by one of --rebuild, -ta, -tb, -ba, or -bb. This includes the .sdeb source package.


AUTHOR

debbuild was written by Kris Deugau <kdeugau@…>. The current version should be available from https://secure.deepnet.cx/trac/debbuild/.


BUGS

Funky Things Happen if you forget a command-line option or two.

Many macro expansions are unsupported or incompletely supported.

The generated scriptlets don't quite match those from rpmbuild exactly. There are extra environment variables and preprocessing that I haven't needed (yet).

%_topdir and the five "working" directories under %_topdir could arguably be created by debbuild. However, rpmbuild doesn't create these directories either.

debbuild's %setup -q is arguably less buggy than rpmbuild's implementation; with rpmbuild it must appear before -a or -b at least to be effective. debbuild does not care.

%setup -c, -a, and -b should arguably throw errors if specified together; otherwise the results are almost certainly not what you want to happen.


SEE ALSO

rpm(8), rpmbuild(8), and pretty much any document describing how to write a .spec file.

Last modified 3 years ago Last modified on Jul 13, 2015, 9:29:47 PM