Skip to content

Commit 42cfef8

Browse files
prakashsuryaclaude
andcommitted
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

File tree

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sdb (0.6.0) unstable; urgency=medium
2+
3+
* Bootstrap merge of sdimitro/sdb (Spec 0003 Phase 1).
4+
* Repackage as a self-contained dh-virtualenv .deb.
5+
6+
-- Delphix Engineering <eng@delphix.com> Tue, 05 May 2026 00:00:00 +0000

debian/compat

Lines changed: 0 additions & 1 deletion
This file was deleted.

debian/control

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
11
Source: sdb
2-
Section: misc
2+
Section: utils
33
Priority: optional
4-
Maintainer: Serapheim Dimitropoulos <serapheimd@gmail.com>
5-
Standards-Version: 4.1.2
6-
Build-Depends: debhelper (>= 9), dh-python, python3
4+
Maintainer: Delphix Engineering <eng@delphix.com>
5+
Build-Depends:
6+
debhelper-compat (= 13),
7+
dh-virtualenv (>= 1.2.2),
8+
python3,
9+
python3-dev,
10+
python3-pip,
11+
python3-setuptools,
12+
python3-venv
13+
Standards-Version: 4.6.2
14+
Homepage: https://github.com/sdimitro/sdb
715

816
Package: sdb
9-
Architecture: any
17+
Architecture: amd64
1018
Depends: ${shlibs:Depends}, ${python3:Depends}
11-
Description: The Slick/Simple Debugger
19+
Description: kernel debugger built on drgn
20+
sdb is a high-level kernel debugger built on top of drgn.
21+
.
22+
This package bundles drgn, kdumpling, pyelftools, and their
23+
transitive Python dependencies inside a self-contained virtualenv at
24+
/opt/venvs/sdb/. The /usr/bin/sdb entry point activates the
25+
venv. No external runtime dependency on libkdumpfile is required —
26+
drgn's manylinux wheel ships a bundled libkdumpfile.so via auditwheel
27+
with RPATH=$ORIGIN/drgn.libs.

debian/copyright

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
1-
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
22
Upstream-Name: sdb
3+
Upstream-Contact: Serapheim Dimitropoulos
34
Source: https://github.com/sdimitro/sdb
45

56
Files: *
6-
Copyright: 2024 Serapheim Dimitropoulos
7-
License: Apache-2.0
8-
9-
Files: *
10-
Copyright: 2016 - 2023 Delphix Corp.
11-
License: Apache-2.0
7+
Copyright: see upstream LICENSE
8+
License: see upstream LICENSE
129

10+
Files: debian/*
11+
Copyright: 2026 Delphix
1312
License: Apache-2.0
14-
Licensed under the Apache License, Version 2.0 (the "License");
15-
you may not use this file except in compliance with the License.
16-
You may obtain a copy of the License at
17-
.
18-
http://www.apache.org/licenses/LICENSE-2.0
19-
.
20-
Unless required by applicable law or agreed to in writing, software
21-
distributed under the License is distributed on an "AS IS" BASIS,
22-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23-
See the License for the specific language governing permissions and
24-
limitations under the License.
25-
.
26-
On Debian systems, the complete text of the Apache License can be found in
27-
the file `/usr/share/common-licenses/Apache-2.0'.

debian/links

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
opt/venvs/sdb/bin/sdb usr/bin/sdb

debian/rules

100644100755
Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,37 @@
11
#!/usr/bin/make -f
22

33
%:
4-
dh $@ --with python3 --buildsystem=pybuild
5-
6-
override_dh_auto_test:
7-
#
8-
# Don't run the tests when building the package. We'll enforce
9-
# testing via another mechanism, so running it during package
10-
# builds is unnecessary.
11-
#
4+
dh $@ --with python_virtualenv
5+
6+
# drgn's manylinux wheel bundles pre-stripped .so files in drgn.libs/.
7+
# dh_dwz tries to compress their debug info but most of them have no
8+
# .debug_info sections, so it fails with "Too few files for multifile
9+
# optimization." Skip dwz entirely for this venv-only package.
10+
override_dh_dwz:
11+
12+
# Skip dh_strip for the same reason — stripping bundled libs further
13+
# produces no meaningful size savings and risks breaking auditwheel's
14+
# RPATH setup.
15+
override_dh_strip:
16+
17+
# drgn's bundled libs in drgn.libs/ use auditwheel's $ORIGIN RPATH and
18+
# aren't in any Debian package, so dpkg-shlibdeps can't resolve them.
19+
# Skip shlibdeps — the venv is self-contained; ${python3:Depends}
20+
# (filled by dh_python3) covers the Python runtime requirement.
21+
override_dh_shlibdeps:
22+
23+
# dh_python3 doesn't know about the venv layout dh_virtualenv produces
24+
# and will complain about unmanaged files. The dh-virtualenv add-on
25+
# already wires the right Python deps; skip dh_python3.
26+
override_dh_python3:
27+
28+
# Python rewrites .pyc files at runtime when the bytecode header's
29+
# recorded source mtime/size doesn't match the .py on disk — which is
30+
# unavoidable for a venv built by dh-virtualenv (build-time path/mtime
31+
# rewrites desync the .pyc headers from their .py sources). The first
32+
# import after install regenerates the affected .pyc on disk, so its
33+
# md5 no longer matches what dh_md5sums recorded and `debsums -c`
34+
# flags it. Exclude bytecode from the md5sums file; .py sources and
35+
# native libs are still checksummed.
36+
override_dh_md5sums:
37+
dh_md5sums -X.pyc -X.pyo

debian/source/format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.0 (native)

0 commit comments

Comments
 (0)