btdu icon indicating copy to clipboard operation
btdu copied to clipboard

Packaging in Debian and derivates

Open Fantu opened this issue 10 months ago • 9 comments

Hi, this is a very useful tool and I think is good to have in official repository of Debian and derivates.

There is an RFP opened 3 years ago but nobody worked on it, so I'm trying to package it, even if I don't have any experience for D language.

Unfortunately even the essential packages for the dlang build are recently poorly maintained and were dropped from testing due to RC errors, they have just been fixed and returned to testing. Remains uninstallable dub even in unstable, with the new version waiting for upload, I build manually to proceed.

I did a very fast test to see if can build btdu and was successful create first very basic package btdu with binary and man and another automatic for debug: https://salsa.debian.org/fantu/btdu

Now there is all packaging to do good following the Debian policy, I'm working on uploading other packages I maintain, so I'm not sure if I'll have time today.

On build log I saw that build also containers, out of btdu so I think I'll need to use it from the Debian package instead: https://tracker.debian.org/pkg/dcontainers Also this has RC bug for fails to build and I'll need to check. Unfortunately, with the main maintainer seemingly inactive the Dlang packages don't seem to be supported enough, although someone is doing some fixes. I hope they are all ok before the freeze for Debian 13.

Outside the Debian packaging itself which I should have enough experience with, given my experience with D language is nothing could be useful some advice on possible improvements. For example on the first test I did very fast I used dub with some override on d/rules, I didn't find other Debian packages using it so I suppose will need improvement: https://salsa.debian.org/fantu/btdu/-/blob/debian/latest/debian/rules?ref_type=heads

Any advice and opinion is welcome, thanks for any reply and sorry for my bad english.

Fantu avatar Jan 19 '25 16:01 Fantu

Hi, thank you for working on this!

I don't have much experience with Debian packaging. Looking at the rules file, the only thing I can suggest is to replace dub build with dub build -b release, so that it builds the release and not the debug version.

One source of reference you may find useful is the package definitions that have been written so far for other distributions (Arch Linux, NixOS, and Void Linux).

CyberShadow avatar Jan 19 '25 16:01 CyberShadow

Thanks for reply, debhelper normally already strip the binaries and create the dbgsym package and seems created it successful, anyway I'll try to recheck next build I'll try, because I have not tried to install and do deep check.

I saw the arch one but I am not sure if there is something that can help, I should try to build with at least containers from Debian packages: https://packages.debian.org/sid/amd64/libdcontainers-dev/filelist Probably also other 3 things will need to be packaged for Debian (from a fast look I don't found them in repository) to make btdu package acceptable but this will require other time that I'm not sure to have :(

Is there someone that can help packaging other components? I'm not DD so I can't upload new package directly (I'm only DM with upload permission on packages that I maintain) but if I'll have time I can help to review and fix general packaging thing to make help find a sponsor (I suppose difficult with low interest in D lang packages) if major of work is done.

Fantu avatar Jan 19 '25 17:01 Fantu

Thanks for reply, debhelper normally already strip the binaries and create the dbgsym package and seems created it successful, anyway I'll try to recheck next build I'll try, because I have not tried to install and do deep check.

There are more differences between debug and release than whether debug symbols are present. For example, the release build is built with compiler optimizations enabled, so it may be faster.

Is there someone that can help packaging other components?

In Debian? I don't know.

For Arch we don't bother packaging them. It's 1 package with multiple sources. It also avoids version conflicts. But maybe this goes against Debian policy, I don't know.

For Nix there is a D helper which automates packaging D packages. They have helpers for every language. I don't know if Debian has a D helper, or generally uses a system like that.

CyberShadow avatar Jan 19 '25 18:01 CyberShadow

About optimization and other flags I'll need to check, on other languages on packages I maintain are applied by default I'm not sure if dub apply the one from dh-dlang. I'll need to check if are used by dub and if not see if dub can accept all flags as parameters.

Also Debian have a packaging helper (debhelper), there is also for D lang a specific part (dh-dlang) even I don't know how is good and complete, I overrided some default operation for use dub, I saw use it in readme and arch packaging and not another buildsystem (like meson), I'm not sure if there is another way, or is there?

Fantu avatar Jan 19 '25 19:01 Fantu

I am looking at https://salsa.debian.org/d-team/dh-dlang and I don't see anything related to Dub, so it looks like it doesn't have anything for Dub.

It's possible that dh-dlang is very very old, from before everyone started using Dub to build D programs, and it has never been updated for Dub.

CyberShadow avatar Jan 19 '25 19:01 CyberShadow

from a fast look dh-dlang don't support all default Debian optimization and there is a MR for improve it: https://salsa.debian.org/d-team/dh-dlang/-/merge_requests/3

About dub I don't know since I don't saw packaging in official repository using it to try to understand from a fast look.

Dub seems to me more that a build system but also download source from external source, normally thing like this in Debian is used mainly by users and official packages have all deps in repository (this can unfortunately make packaging a lot longer when the dependencies are not already packaged) btdu must be compiled with dub and not another buildsystem (I don't see other), right?

Fantu avatar Jan 19 '25 19:01 Fantu

btdu must be compiled with dub and not another buildsystem (I don't see other), right?

It can be compiled by providing all dependencies manually, and then invoking the compiler directly.

You can look at ci/build-inside-docker.sh which does this.

By the way, there is this nice long write-up, though from many years ago, about packaging D in Debian:

https://gist.github.com/ximion/fe6264481319dd94c8308b1ea4e8207a

The author lists many problems, and I think today many of those problems have been solved, but possibly some remain.

CyberShadow avatar Jan 19 '25 20:01 CyberShadow

Thanks for reply, unfortunately I fear that the D packaging on Debian will take much longer than I supposed, but I have not had time to read the discussion of the link for now.

At the moment I have done some things regarding the basic packaging (visible here), not yet complete even if the basic one works (or at least build, I have not tried to use it) it will still need to be checked regarding the flags and the compilation with the Debian packages present, I have found only 1 (dcontainers), maybe some of the other 3 are present but under a different name that I have not found, if someone else wants to try to look for them.

Maybe the creation of this "issue" will help to give visibility, if there was someone else interested in helping in being able to have btdu in the Debian repositories and derivatives.

Fantu avatar Jan 19 '25 21:01 Fantu

FWIW, I too would be interested in a debian package of this super useful tool (which recently saved my day if not my life)!

Sadly, I bring zero expertise with debian packaging (other than using deb). And even less experience with D. But maybe there is something I still can help with (though not sure yet what that could be -- I read through https://gist.github.com/ximion/fe6264481319dd94c8308b1ea4e8207a and most of it is over my head).

wschildbach avatar Apr 03 '25 10:04 wschildbach