Skip to contentSkip to conversation

dists: add prep-debuild target

PATCH Kris Van Hees 1 participant 1 message Jun 15

lore
Share & tools
lore
#0 lore raw

Not adopting this patch for the reasons listed below.

Quoted 4 lines

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.)

The reason why I do not do this is because the steps I outline are to get to the initial state of having the files necessary to build DTrace for Debian. This is what needs to be done to go from the upstream dtrace git tree to what is needed to e.g. be able to use apt-src.

We are a non-native Debian package, so there is some work needed to go from the upstream tree to what Debian needs. I don't want to automate too much of it because it is certainly possible that the creation of the Debian package files is going to be done in a place other than where the git clone is located.

E.g. I create the tarball (make dist) on a non-Debian system, and then do the building on a very pristine Debian stable system to make sure that it ought to work in a clean-room environment.

Quoted 261 lines · Nick Alcock

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(-)
dists/Build +7 -1
index c75f933270fa3..f1ed1a4627176 100644
@@ -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
Signature · 2 lines
2.47.3
8<--------------------------------->8
Quoted 1 line

A couple of questions below.

Review

Quoted 5 lines
(quoted diff) +5 -0
+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.)

Quoted 6 lines
dists/debian/control new file +0 -0
new file mode 100644
index 00000000..56687a82

dists/debian/control line 9

Quoted 9 lines
dists/debian/control new file +9 -0
@@ -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.)

Quoted 5 lines
dists/debian/control new file +5 -0
+Homepage: https://github.com/oracle/dtrace-utils/
+Rules-Requires-Root: no
+
+Package: dtrace
+Architecture: any

dists/debian/control line 24

Quoted 10 lines
dists/debian/control new file +10 -0
+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.)

Quoted 39 lines
dists/debian/control new file +39 -0
+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)

dists/debian/control line 73

Quoted 10 lines
dists/debian/control new file +10 -0
+ 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.)

Quoted 15 lines
dists/debian/copyright new file +9 -0
new file mode 100644
index 00000000..1a5c8f64
@@ -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
+

dists/debian/copyright line 19

Quoted 10 lines
dists/debian/copyright new file +10 -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?

Quoted 16 lines
dists/debian/libdtrace2-dev.install new file +5 -0
@@ -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
dists/debian/libdtrace2.install new file +2 -0
new file mode 100644
index 00000000..36294de3
@@ -0,0 +1,12 @@
+usr/lib/${DEB_HOST_MULTIARCH}/dtrace/[0-9]*/
+usr/lib/${DEB_HOST_MULTIARCH}/dtrace/bpf_dlib.o

dists/debian/libdtrace2.install line 12

Quoted 10 lines
dists/debian/libdtrace2.install new file +10 -0
+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.

dists/debian/libdtrace2.install line 7

Quoted 9 lines

+++ b/dists/debian/mkChangelog

dists/debian/libdtrace2.install new file +7 -0
@@ -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!

Quoted 11 lines
dists/debian/patches/debian-configure.patch new file +5 -0
new file mode 100644
index 00000000..d4a89bb9
@@ -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

dists/debian/patches/debian-configure.patch line 15

Quoted 10 lines
dists/debian/patches/debian-configure.patch new file +10 -0
++++ 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.

dists/debian/patches/debian-interpreter-paths.patch line 2

Quoted 8 lines
dists/debian/patches/debian-interpreter-paths.patch new file +2 -0
new file mode 100644
index 00000000..58bea538
@@ -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.

dists/debian/rules line 5

Quoted 8 lines
dists/debian/rules new file +5 -0
@@ -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 :)

Signature · 1 line
NULL && (void)