Re: [DTrace-devel] [PATCH v4] Add packaging configuration for Debian
Nick Alcock <[email protected]> Fri, 13 Feb 2026 15:14:13 +0000
| Newsgroups | dev.linux.lists.dtrace |
|---|---|
| Message-ID | <[email protected]> |
On 10 Feb 2026, Kris Van Hees via DTrace-devel outgrape: > Packaging configuration files for Debian are provided in dists/debian. Nice! Seems to work, even on Debian stable (I was sure I'd need at least testing, but no!). > Sample steps to build DEB packages: > > - make dist > - cp dtrace-x.y.z.tar.bz2 $D/dtrace_x.y.z.orig.tar.bz2 This... > - cd $D > - tar -jxpSf dtrace_x.y.z.orig.tar.bz2 ... seems rather duplicative with this. See below for a patch with a make prep-debuild target that does this for you. > - cd dtrace-x.y.z > - make prep-debian > - debuild It is a bit annoying that you have to do a prep-debian before doing a build, because this prevents you doing a normal apt-src or any other large-scale build command unless you already have a source deb that this was done to. (The changelog generation is nice though!) I would be inclined to use git-buildpackage here. See https://honk.sigxcpu.org/projects/git-buildpackage/manual-html/gbp.import.upstream-git.html I tried for a minimal approach using the postexport hook, but alas gbp wants a debian/ directory before it'll even run that :( so for now this seems to be the best we can do. Here's a tiny patch to let you avoid the make dist in favour of a simple 'make prep-debuild'. (I didn't fold it into make prep-debian because some package building tools, like apt-src, don't need the .orig.tar.bz2 at all.) 8<--------------------------------->8 From 472a6c863d06f8e419827842e0e455d8f13f6edd Mon Sep 17 00:00:00 2001 From: Nick Alcock <[email protected]> Date: Fri, 13 Feb 2026 14:29:05 +0000 Subject: [PATCH] dists: add prep-debuild target This does the creation of the .orig.tar.bz2 in the parent of the source tree for you. --- dists/Build | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dists/Build b/dists/Build index c75f933270fa3..f1ed1a4627176 100644 --- a/dists/Build +++ b/dists/Build @@ -9,8 +9,14 @@ dists_DIR := $(current-dir) # Prepare package building on Debian (copy ./dists/debian in ./debian, and # generate the debian/changelog file. -prep-debian:: +prep-debian:: dist $(call describe-target,DIST-PREP,Debian) rm -rf debian cp -rp $(dists_DIR)/debian . debian/mkChangelog debian/control dtrace.spec > debian/changelog + +# Prepare for debuild, which needs a tarball to already be present. +# Many wrappers around debuild already do this for you. + +prep-debuild:: + mv dtrace-$(VERSION).tar.bz2 ../dtrace_$(VERSION).orig.tar.bz2 -- 2.47.3 8<--------------------------------->8 > Signed-off-by: Kris Van Hees <[email protected]> A couple of questions below. > +prep-debian:: > + $(call describe-target,DIST-PREP,Debian) > + rm -rf debian > + cp -rp $(dists_DIR)/debian . > + debian/mkChangelog debian/control dtrace.spec > debian/changelog (I have a tiny patch for this.) > diff --git a/dists/debian/control b/dists/debian/control > new file mode 100644 > index 00000000..56687a82 > --- /dev/null > +++ b/dists/debian/control > @@ -0,0 +1,74 @@ > +Source: dtrace > +Section: utils > +Priority: optional > +Maintainer: Kris Van Hees <[email protected]> > +Build-Depends: debhelper-compat (= 13), > + bison, flex, gawk, gcc-bpf, binutils-bpf, valgrind, binutils-dev, login.defs, > + libbpf-dev, libc-dev (>= 2.34), libelf-dev, libfuse3-dev, libpcap-dev, > + libpfm4-dev, libsystemd-dev, libz-dev > +Standards-Version: 4.5.1 Why 4.5.1? I guess it's what debhelper writes right now. (The current version of Debian Policy is 4.7.3. It looks to me like we're compatible with it.) > +Homepage: https://github.com/oracle/dtrace-utils/ > +Rules-Requires-Root: no > + > +Package: dtrace > +Architecture: any > +Depends: ${misc:Depends}, ${shlibs:Depends} > +Description: Dynamic tracing for Linux (DTrace) > + This is the official Linux port of the advanced tracing tool DTrace. > + . > + DTrace is a high-level dynamic tracing tool for Linux, built on kernel > + tracing features (tracepoints, function probes (fentry/fexit), dynamic > + kernel probes (kprobes), dynamic userspace probes (uprobes), ... and > + leveraging BPF as execution engine. It features an integrated compiler > + for its high-level tracing language and native support for interacting > + with the BPF engine, significantly reducing runtime dependencies Full stop at end of sentence (and for all the others below.) > +Package: libdtrace2 > +Architecture: any > +Depends: ${misc:Depends}, ${shlibs:Depends}, > + fuse3, libctf0, libelf1t64, libfuse3-4, libpcap0.8t64, libpfm4, libz1 > +Description: Dynamic tracing for Linux (DTrace) (library) > + This is the official Linux port of the advanced tracing tool DTrace. > + . > + DTrace is a high-level dynamic tracing tool for Linux, built on kernel > + tracing features (tracepoints, function probes (fentry/fexit), dynamic > + kernel probes (kprobes), dynamic userspace probes (uprobes), ... and > + leveraging BPF as execution engine. It features an integrated compiler > + for its high-level tracing language and native support for interacting > + with the BPF engine, significantly reducing runtime dependencies > + . > + This package contains the shared library. > + > +Package: libdtrace2-dev > +Architecture: any > +Depends: ${misc:Depends}, > + libdtrace2 (= ${binary:Version}) > +Description: Dynamic tracing for Linux (DTrace) (development) > + This is the official Linux port of the advanced tracing tool DTrace. > + . > + DTrace is a high-level dynamic tracing tool for Linux, built on kernel > + tracing features (tracepoints, function probes (fentry/fexit), dynamic > + kernel probes (kprobes), dynamic userspace probes (uprobes), ... and > + leveraging BPF as execution engine. It features an integrated compiler > + for its high-level tracing language and native support for interacting > + with the BPF engine, significantly reducing runtime dependencies > + . > + This package contains the development files necessary to develop > + alternative implementations of the user interface for libdtrace, i.e. > + replacements for dtrace(1) itself. > + > +Package: dtrace-tests > +Architecture: any > +Depends: ${misc:Depends}, ${shlibs:Depends}, ${perl:Depends}, > + binutils, cpp, gawk, gcc, make, pkgconf, tshark, bpftool > +Description: Dynamic tracing for Linux (DTrace) (testsuite) > + This is the official Linux port of the advanced tracing tool DTrace. > + . > + DTrace is a high-level dynamic tracing tool for Linux, built on kernel > + tracing features (tracepoints, function probes (fentry/fexit), dynamic > + kernel probes (kprobes), dynamic userspace probes (uprobes), ... and > + leveraging BPF as execution engine. It features an integrated compiler > + for its high-level tracing language and native support for interacting > + with the BPF engine, significantly reducing runtime dependencies > + . > + This package contains the testsuite. (... up to here.) > diff --git a/dists/debian/copyright b/dists/debian/copyright > new file mode 100644 > index 00000000..1a5c8f64 > --- /dev/null > +++ b/dists/debian/copyright > @@ -0,0 +1,103 @@ > +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ > +Upstream-Name: dtrace > +Upstream-Contact: Kris Van Hees <[email protected]> > +Source: https://github.com/oracle/dtrace-utils/ > + > +Files: * > +Copyright: Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved. > +License: UPL-1.0 > + > +Files: include/linux/bpf.h > +Copyright: Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com > +License: GPL-2 with Linux-syscall-note exception > + > +Files: include/linux/btf.h > +Copyright: Copyright (c) 2018 Facebook > +License: GPL-2 with Linux-syscall-note exception > + > +Files: include/sys/auxv.h include/sys/bitmap.h > +Copyright: copyright (c) 1984, 1986, 1987, 1988, 1989 at&t AT&T, surely? > --- /dev/null > +++ b/dists/debian/libdtrace2-dev.install > @@ -0,0 +1,5 @@ > +usr/lib/${DEB_HOST_MULTIARCH}/libdtrace.so > +usr/include/dtrace > +usr/include/dtrace.h > +usr/include/sys/dtrace.h > +usr/include/sys/dtrace_types.h > diff --git a/dists/debian/libdtrace2.install b/dists/debian/libdtrace2.install > new file mode 100644 > index 00000000..36294de3 > --- /dev/null > +++ b/dists/debian/libdtrace2.install > @@ -0,0 +1,12 @@ > +usr/lib/${DEB_HOST_MULTIARCH}/dtrace/[0-9]*/ > +usr/lib/${DEB_HOST_MULTIARCH}/dtrace/bpf_dlib.o > +usr/lib/${DEB_HOST_MULTIARCH}/dtrace/drti/ > +usr/lib/${DEB_HOST_MULTIARCH}/dtrace/include/ > +usr/lib/${DEB_HOST_MULTIARCH}/libdtrace.so.* > +usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig/dtrace.pc > +usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig/dtrace_sdt.pc > +usr/lib/systemd/system/dtprobed.service > +usr/lib/systemd/system/dtrace-usdt.target > +usr/lib/systemd/system-preset/50-dtprobed.preset > +usr/lib/udev/rules.d/60-dtprobed.rules > +usr/sbin/dtprobed I've always been worried that these lists would be hard to maintain. It's a shame we can't autogenerate them, though it's hard to imagine from what. Maybe in the future we should do like we did for the version numbers, and have a centralized list of files from which we can generate things like this *and* the install commands in the Build files. > +++ b/dists/debian/mkChangelog > @@ -0,0 +1,174 @@ > +#!/usr/bin/awk -f > + > +# > +# This script can be used to convert the dtrace.spec into a Debian changelog > +# file. It is intended to be invoked from the 'prep-debian' make target, but > +# it can be used manually as well: > +# mkChangelog debian/control dtrace.spec > debian/changelog This is really nifty! > diff --git a/dists/debian/patches/debian-configure.patch b/dists/debian/patches/debian-configure.patch > new file mode 100644 > index 00000000..d4a89bb9 > --- /dev/null > +++ b/dists/debian/patches/debian-configure.patch > @@ -0,0 +1,17 @@ > +Description: issue a warning for unknown configure options > + The Debian build system specifies configure options that are not known to > + the DTrace configure script. They should not cause the configure script > + to abort. > +--- dtrace-2.0.4.orig/configure > ++++ dtrace-2.0.4/configure > +@@ -172,8 +172,7 @@ for option in "$@"; do > + HAVE_VALGRIND=*) write_config_var VALGRIND "$option";; > + HAVE_BPFV3=*) write_config_var BPFV3 "$option";; > + HAVE_BPFMASM=*) write_config_var BPFMASM "$option";; > +- *) echo "Unknown option $option" >&2 > +- exit 1;; > ++ *) echo "Unknown option $option" >&2;; > + esac > + done I assumed you could just stuff an || true in there, but this is being invoked by dh_auto_configure, so that option isn't available (plus, of course, if there's an actual error other than unknown args, we don't want to fail). Maybe we should just not exit with exitcode 1 on unknown configure options, only IIRC Gentoo actually wants us to. This may be the best we can do. > diff --git a/dists/debian/patches/debian-interpreter-paths.patch b/dists/debian/patches/debian-interpreter-paths.patch > new file mode 100644 > index 00000000..58bea538 > --- /dev/null > +++ b/dists/debian/patches/debian-interpreter-paths.patch > @@ -0,0 +1,107 @@ > +Description: fix interpreter paths in tests > + Lintian prefers /bin/bash and /bin/sed over /usr/bin/bash and /usr/bin/sed. Honestly this one I think we should do upstream. I always thought that /bin/bash is universal and /usr/bin/bash less so. > --- /dev/null > +++ b/dists/debian/rules > @@ -0,0 +1,24 @@ > +#!/usr/bin/make -f > +# You must remove unused comment lines for the released package. > +export DH_VERBOSE = 1 > +export DEB_BUILD_MAINT_OPTIONS = hardening=+all > +export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic I suppose without -Werror this is safe :) -- NULL && (void)