Debmagic is for Debian/Ubuntu:
- create packages build instructions in Python with
debian/rules.py - tooling do perform packaging itself: building and testing in isolated container environments
Important
Debmagic's goal: make Debian packaging modern, robust & easy - while being backwards compatible.
Included features:
- for
debian/rules.py- language and buildsystem helper modules
- maintainer tools
debmagic build- isolated package building
Python debian/rules.py equivalent of Ubuntu 24.04 htop:
#!/usr/bin/env python3
from debmagic.v0 import Build, autotools, dh, package
pkg = package(
preset=[dh],
maint_options="hardening=+all",
)
if pkg.buildflags.DEB_HOST_ARCH_OS == "linux":
configure_params = ["--enable-affinity", "--enable-delayacct"]
else:
configure_params = ["--enable-hwloc"]
# hurd-i386 can open /proc (nothing there) and /proc/ which works
if pkg.buildflags.DEB_HOST_ARCH_OS == "hurd":
configure_params += ["--with-proc=/proc/"]
else:
configure_params += ["--enable-sensors"]
@pkg.stage
def configure(build: Build):
autotools.configure(
build,
["--enable-openvz", "--enable-vserver", "--enable-unicode", *configure_params],
)
pkg.pack()Debmagic can use dh and provides dh overrides as common in debian/rules Makefiles:
from debmagic.v0 import dh
# specify dh arguments:
dhp = dh.Preset("--with=python3 --builddirectory=build")
pkg = package(preset=dhp)
# define optional overrides:
@dhp.override
def dh_auto_install(build: Build):
print("dh override worked :)")
build.cmd("dh_auto_install --max-parallel=1")
pkg.pack()To add custom functions directly usable from CLI (like custom debian/rules targets for maintainers):
pkg = package(...)
@pkg.custom_function
def something_custom(some_param: int, another_param: str = "some default"):
print(f"you passed {some_param=} {another_param=}")
pkg.pack()This function can be directly called with:
./debian/rules.py something-custom --another-param=test 1337you passed some_param=test another_param=1337
And generates automatic help for:
./debian/rules.py something-custom --helpTo do packaging with debmagic, please read the documentation!.
Debmagic can always use more features and modules! You can also just request features or report bugs - this project is happy about your contributions!
To directly reach developers and other users, we have chat rooms. For questions, suggestions, problem support, please join and just ask!
| Contact | Where? |
|---|---|
| Issue Tracker | SFTtech/debmagic |
| Matrix Chat | #sfttech:matrix.org |
| Support us |
Released under the GNU General Public License version 2 or later, LICENSE for details.