Skip to content

debreate/debreate

Repository files navigation

Debreate - Debian Package Builder

Debreate is a utility to aid in creating Debian (.deb) packages. Currently it only supports binary packaging (note that the term "binary package" is used loosely, as such packages can contain scripts & non-code items such as media images, audio, & more) for personal distribution. Plans for using backends such as dh_make & debuild for creating source packages are in the works. But source packaging can be quite different & is a must if you want to get your packages into a distribution's official repositories or a Launchpad Personal Package Archive (PPA). The latter from which Debreate is available.

Debreate & libdbr are licensed under MIT.

The definition of "Debian source package" may be a little confusing, as it was for me, for those that are new to the Debian format, or perhaps new to packaging in general. Debian source packages are essentially no different than common tarballed source archives & they can be available in many of the popular formats such as Gzip (.tar.gz), BZip2 (.tar.bz2), XZ (tar.xz), Lzip (tar.lzip), et al.

To build Debian binary packages (.deb) from source, it must first be "debianized". A source package can be debianized using one of two methods:

  1. internal/native:

    Instructions for the build utilities are included within the source package in a directory labelled "debian".

  2. external:

    Instructions are contained within a separate package distributed alongside the original source.

The debian directory, or package, contains files with instructions & meta data on how the source is to be patched, compiled, & built into a binary format.

Source packaging is a must for inclusion of software in official repositories or PPAs. The debianized package is uploaded to repo/PPA host server where it is built into a binary package & published for release in .deb format. This differs from systems such as Arch's ABS & FreeBSD's Ports build systems where only the instructions files are stored on the host server. Downloading of source packages from the upstream maintainer is done as part of the build process.

Debreate requires the following software:

These packages are recommended to enable some features:

The software comes bundled with a build.py script to facilitate the build process & other tasks. Note that Debreate is written in a scripting language, so building does not include any compiling of source code. The build script is used for staging the necessary files into a directory structure for packaging & installation.

The build script is invoked as python3 build.py [args] or ./build.py [args].

Arguments:
  • -h|--help
    • Show help information.
  • -v|--version
    • Show Debreate version.
  • -V|--verbose
    • Include detailed task information when printing to stdout.
  • -l|--log-level <level>
    • Logging output verbosity.
    • Levels are 0 (silent), 1 (error), 2 (warn), 3 (info), & 4 (debug).
  • -t|--task <task>
  • -p|--prefix <directory>
    • Path prefix to directory where files are to be installed.
  • -d|--dir <directory>
    • Target directory (defaults to system root). This is useful for directing the script to place files in a temporary directory rather than the intended installation path. It is equivalent to the "DESTDIR" environment variable used by GNU make.
Build Tasks:
  • stage
    • Prepare files for installation or distribution.
  • install
    • Install files to directory specified by --prefix argument.
  • uninstall
    • Uninstall files from directory specified by by --prefix argument.
  • dist-source
    • Build a source distribution package.
  • dist-bin
    • Build a portable binary .zip distribution package.
  • dist-deb
    • Build a binary Debian distribution package.
  • clean
    • Remove all temporary build files.
  • clean-stage
    • Remove temporary build files from 'build/stage' directory.
  • clean-deb
    • Remove temporary build files from 'debian' directory.
  • clean-dist
    • Remove built packages from 'build/dist' directory.
  • update-version
    • Update relevant files with version information from 'build.conf'.
  • test
    • Run configured unit tests from 'tests' directory.
  • check-code
  • changes
    • Print most recent changes from 'doc/changelog' to stdout.

A generic Makefile is included for building with a GNU compliant make command. It is simply a wrapper for the targets executed by the build.py script. Open a terminal in the directory where the source code is located & execute make install with superuser privileges. To uninstall, execute make uninstall. Use the environment variables prefix & DESTDIR to control the installation target directory.

If you have devscripts installed, you can execute python3 build.py dist-deb to build the debian package (.deb). The package will be located in the 'build/dist' directory. To install execute dpkg --install build/dist/debreate_\<version\>_all.deb with superuser privileges. Or open the package with a GUI installer such as gdebi or QAPT.

To run without installation simply execute the file named "init.py" (from a terminal ./init.py or python3 init.py).

Sorry, not up-to-date usage information yet. But you can have a look at this old PDF document if you like.