sudipm-mukherjee / trace-cmd

Other
0 stars 1 forks source link

trace-cmd v3.3: Python bindings #3

Closed adriaan42 closed 2 months ago

adriaan42 commented 3 months ago

Upstream master recently repaired the Python bindings for trace-cmd (https://lore.kernel.org/linux-trace-devel/20240724131428.43b0d264@gandalf.local.home/T/#t).

It would be great if those could be included in the Debian package of that upcoming release. Here's what works for me:

diff --git a/debian/control b/debian/control
index 5ef7a24a..57fe0d58 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,8 @@ Priority: optional
 Maintainer: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
 Build-Depends:
  debhelper-compat (= 13), asciidoc, docbook-xsl, xsltproc, libcunit1-dev,
- xmlto, pkg-config, libtraceevent-dev, libtracefs-dev, libzstd-dev, source-highlight
+ xmlto, pkg-config, libtraceevent-dev, libtracefs-dev, libzstd-dev, source-highlight,
+ python3-dev, swig
 Standards-Version: 4.6.2
 Rules-Requires-Root: no
 Vcs-Browser: https://github.com/sudipm-mukherjee/trace-cmd.git
diff --git a/debian/rules b/debian/rules
index 6a22c7f7..7e496d57 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,6 +2,7 @@

 include /usr/share/dpkg/default.mk
 export DEB_DESTDIR ?= $(CURDIR)/debian/tmp/
+export PYTHON_VERS = python3

 %:
        dh $@
diff --git a/debian/trace-cmd.install b/debian/trace-cmd.install
index 37fcb788..44162074 100644
--- a/debian/trace-cmd.install
+++ b/debian/trace-cmd.install
@@ -1,2 +1,3 @@
 usr/bin/trace-cmd
 etc/bash_completion.d/trace-cmd.bash /usr/share/bash-completion/completions
+usr/lib/*/trace-cmd/python/* /usr/lib/python3/dist-packages
sudipm-mukherjee commented 2 months ago

Sure. do you have any python script I can use to test? dont worry, if you dont have any, I can make one.

adriaan42 commented 2 months ago

Sure. do you have any python script I can use to test? dont worry, if you dont have any, I can make one.

python/trace-cmd.py has a builtin test at the bottom to simply dump a trace, which should be enough to verify a correct build.

sudipm-mukherjee commented 2 months ago

This has been done and is now available as python3-trace-cmd package in Debian.