Commit 42cfef8
Replace debian/ with dh-virtualenv packaging
This is the meat of Spec 0003 Phase 1: turn the `sdb` `.deb` into a
self-contained `dh-virtualenv` build that bundles drgn, kdumpling,
pyelftools, and all transitive Python deps inside a venv at
`/opt/venvs/sdb/`, instead of relying on system-installed drgn /
libkdumpfile (which previously required maintaining the `delphix/drgn`
and `delphix/libkdumpfile` Delphix forks just to keep
ABI-compatible versions pinned to whatever sdb expected).
The `/opt/venvs/<pkg>` install root is dh-virtualenv 1.2+'s default,
which the project deliberately moved to (from `/usr/share/python/<pkg>`)
to avoid clashes with Debian-shipped Python tooling living under
`/usr/share/python/`. It's also the FHS 3.0-correct home for an
add-on application package (FHS §3.13: `/opt` is "reserved for the
installation of add-on application software packages" with
self-contained per-package directory layout) — exactly matching what
a self-contained venv bundle is. The previous `delphix/sdb` `debian/`
referenced `/usr/share/python/sdb/` from a stale legacy convention
predating the dh-virtualenv 1.0 default change; this commit also
fixes that reference in `debian/control`'s package description.
Why the venv approach works at all: drgn's manylinux PyPI wheel is
fully self-contained — `drgn.libs/libkdumpfile.so.12` ships inside
the wheel and is loaded via auditwheel-injected
`RPATH=$ORIGIN/drgn.libs`. So there's nothing to link against on the
system; the venv carries its own ABI-pinned copy. After this lands,
`sdb` no longer consumes system drgn at all (verified during Phase 1
acceptance: `sudo dpkg -r --force-depends drgn` and `sdb stacks`
against a vmcore still works, identical output, exit 0).
Highlights of the diff:
- `debian/rules` switches to the `dh-virtualenv` sequencer
(`dh $@ --with python_virtualenv`) plus several hygiene overrides:
- `override_dh_dwz:` — drgn's manylinux .so files in `drgn.libs/`
arrive pre-stripped, with most having no `.debug_info` sections.
`dh_dwz` would fail with "Too few files for multifile
optimization." Skip dwz entirely for this venv-only package.
- `override_dh_strip:` — same reason; further stripping the
bundled libs produces no real savings and risks breaking
auditwheel's RPATH setup.
- `override_dh_shlibdeps:` — drgn's bundled libs use $ORIGIN
RPATH and aren't tracked by dpkg, so dpkg-shlibdeps can't
resolve them. ${python3:Depends} (filled by dh_python3) covers
the Python runtime requirement; the venv handles the rest.
- `override_dh_python3:` — dh_python3 doesn't understand the venv
layout dh_virtualenv produces and complains about unmanaged
files. dh-virtualenv already wires the right Python deps.
- `override_dh_md5sums: dh_md5sums -X.pyc -X.pyo` — Python rewrites
.pyc files at runtime when a bytecode header's recorded source
mtime/size doesn't match the .py on disk (unavoidable for
dh-virtualenv-built venvs, since build-time path/mtime rewrites
desync the .pyc headers). The first import after install
regenerates the affected .pyc, breaking the recorded md5 and
triggering false positives in dcenter's `debsums -c`. Excluding
bytecode keeps the integrity check meaningful — .py source and
native libs still get checksummed.
- `debian/control` Build-Depends adds `dh-virtualenv (>= 1.2.2)`;
runtime Depends carries no explicit `libkdumpfile` (drgn's wheel
handles it) — only ${python3:Depends} plus an empty
${shlibs:Depends}.
- `debian/links` creates `/usr/bin/sdb -> /opt/venvs/sdb/bin/sdb` so
`sdb` is on the standard path despite the venv living under
`/opt`.
- `debian/source/format` switches to `3.0 (native)`; `debian/compat`
is removed (the modern `debhelper-compat (= 13)` virtual-package
approach in Build-Depends is preferred).
- `debian/changelog` opens at version `0.6.0` (matching the upstream
tag we boot from); linux-pkg appends `-1delphix.<ts>` at build
time so successive builds are uniquely ordered for upgrades.
This indirectly unblocks Phase 3 of Spec 0003 (decommissioning
`delphix/drgn` and `delphix/libkdumpfile`), although Phase 3 is
deferred — other appliance consumers (`crash-python`, `savedump`,
`/usr/bin/drgn`, `delphix-platform-aws`'s diagnostics dep set) still
need the system packages today.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent a4f9323 commit 42cfef8
7 files changed
Lines changed: 70 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
7 | 15 | | |
8 | 16 | | |
9 | | - | |
| 17 | + | |
10 | 18 | | |
11 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 7 | + | |
| 8 | + | |
12 | 9 | | |
| 10 | + | |
| 11 | + | |
13 | 12 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments