Skip to content

Commit 6966a3a

Browse files
authored
Merge pull request #8 from TheJJ/logo
add logo
2 parents 3062c4e + d4bc617 commit 6966a3a

File tree

2 files changed

+738
-18
lines changed

2 files changed

+738
-18
lines changed

README.md

Lines changed: 114 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,112 @@
11
# Debmagic
22

3-
Debian build instructions written in Python.
3+
<img align="right" style="float: right; width: 25%;" src="assets/debmagic-logo.svg" alt="debmagic logo"/>
44

5-
> Explicit is better than implicit.
5+
Debmagic is for [Debian](https://debian.org)/[Ubuntu](https://ubuntu.com):
6+
- create packages **build instructions** in Python with `debian/rules.py`
7+
- tooling do perform packaging itself: **building** and **testing** in isolated container environments
8+
9+
10+
[![GitHub Actions Status](https://github.com/SFTtech/debmagic/actions/workflows/ci.yml/badge.svg)](https://github.com/SFTtech/debmagic/actions/workflows/ci.yml)
11+
12+
> [!IMPORTANT]
13+
> Debmagic's goal: make Debian packaging modern, robust & easy - while being backwards compatible.
14+
15+
---
16+
17+
Included features:
18+
19+
- for `debian/rules.py`
20+
- language and buildsystem [helper modules](src/debmagic/_module)
21+
- maintainer tools
22+
- `debmagic build` - isolated package building
23+
24+
25+
## Example debian/rules.py
26+
27+
Python `debian/rules.py` equivalent of [Ubuntu 24.04 htop](https://git.launchpad.net/ubuntu/+source/htop/tree/debian/rules?h=ubuntu/noble):
628

729
```python
830
#!/usr/bin/env python3
931

10-
from debmagic.v0 import Build, package
11-
from debmagic.v0 import autotools as autotools_mod
12-
from debmagic.v0 import dh as dh_mod
13-
14-
autotools = autotools_mod.Preset()
15-
dh = dh_mod.Preset()
32+
from debmagic.v0 import Build, autotools, dh, package
1633

1734
pkg = package(
18-
preset=[dh, autotools],
35+
preset=[dh],
1936
maint_options="hardening=+all",
2037
)
2138

39+
if pkg.buildflags.DEB_HOST_ARCH_OS == "linux":
40+
configure_params = ["--enable-affinity", "--enable-delayacct"]
41+
else:
42+
configure_params = ["--enable-hwloc"]
43+
44+
# hurd-i386 can open /proc (nothing there) and /proc/ which works
45+
if pkg.buildflags.DEB_HOST_ARCH_OS == "hurd":
46+
configure_params += ["--with-proc=/proc/"]
47+
else:
48+
configure_params += ["--enable-sensors"]
49+
50+
2251
@pkg.stage
2352
def configure(build: Build):
24-
autotools_mod.autoreconf(build)
2553
autotools.configure(
2654
build,
27-
["--enable-something"],
55+
["--enable-openvz", "--enable-vserver", "--enable-unicode", *configure_params],
2856
)
2957

58+
pkg.pack()
59+
```
60+
61+
### debhelper compatibility
62+
63+
Debmagic can use `dh` and provides **dh overrides** as common in `debian/rules` Makefiles:
64+
65+
```python
66+
from debmagic.v0 import dh
67+
68+
# specify dh arguments:
69+
dhp = dh.Preset("--with=python3 --builddirectory=build")
70+
pkg = package(preset=dhp)
71+
72+
# define optional overrides:
73+
@dhp.override
74+
def dh_auto_install(build: Build):
75+
print("dh override worked :)")
76+
build.cmd("dh_auto_install --max-parallel=1")
77+
78+
pkg.pack()
79+
```
3080

31-
@dh.override
32-
def dh_installgsettings(build: Build):
33-
print("test dh override works :)")
34-
build.cmd("dh_installgsettings")
81+
### Custom functions
3582

83+
To add custom functions directly usable from CLI (like custom `debian/rules` targets for maintainers):
84+
85+
``` python
86+
pkg = package(...)
3687

3788
@pkg.custom_function
3889
def something_custom(some_param: int, another_param: str = "some default"):
39-
print(f"you called {some_param=} {another_param=}")
40-
90+
print(f"you passed {some_param=} {another_param=}")
4191

4292
pkg.pack()
4393
```
4494

95+
This function can be directly called with:
96+
97+
``` console
98+
./debian/rules.py something-custom --another-param=test 1337
99+
```
100+
``` text
101+
you passed some_param=test another_param=1337
102+
```
103+
104+
And generates automatic help for:
105+
``` console
106+
./debian/rules.py something-custom --help
107+
```
108+
109+
45110
## Developing
46111

47112
Prerequisites:
@@ -64,4 +129,35 @@ Build the documentation
64129
uv run sphinx-build docs docs/_build
65130
# continous serving
66131
uv run sphinx-autobuild docs docs/_build
67-
```
132+
```
133+
134+
135+
## Documentation
136+
137+
To do packaging with debmagic, please **[read the documentation!](https://debmagic.readthedocs.io)**.
138+
139+
140+
## Contributing
141+
142+
Debmagic can always use more features and modules!
143+
You can also just request features or report bugs - this project is happy about your contributions!
144+
145+
- [Issue tracker](https://github.com/SFTtech/debmagic/issues)
146+
- [Code contributions](https://github.com/SFTtech/debmagic/pulls)
147+
- [Development roadmap](https://github.com/SFTtech/debmagic/projects)
148+
149+
## Contact
150+
151+
To directly reach developers and other users, we have chat rooms.
152+
For questions, suggestions, problem support, please join and just ask!
153+
154+
| Contact | Where? |
155+
|---------------|------------------------------------------------------------------------------------------------|
156+
| Issue Tracker | [SFTtech/debmagic](https://github.com/SFTtech/debmagic/issues) |
157+
| Matrix Chat | [`#sfttech:matrix.org`](https://app.element.io/#/room/#sfttech:matrix.org) |
158+
| Support us | [![donations](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/SFTtech) |
159+
160+
161+
## License
162+
163+
Released under the **GNU General Public License** version 2 or later, [LICENSE](legal/GPL-2) for details.

0 commit comments

Comments
 (0)