-1

I've a special/very slim version of debian. I want to install a custom version av zlib and I only want one zlib version on my system. Let's say I update zlib, then I also need to recompile and update (for example) openssh since it has zlib as one of its dependencies. Do I need to list those dependencies manually or is there a tool that will recompile all packages with reverse dependencies (something like bitbake does for yocto). How does upstream debian developer handle those cases?

iveqy
  • 19,951
  • 1
  • 15
  • 20
  • This is very much a question about programming, more specific on how to handle distribution of software libraries and which dependency issues might arise in a shared lib system. – iveqy Sep 27 '19 at 09:48

1 Answers1

0

If you install it as a .deb file via dpkg, I'd expect you'll be fine since those other packages are linked to the zlib package ... unless there are items you're removing that other packages will fail upon not getting. If that's the case, you probably want Alpine Linux or some other minimalist distro.

I'm a bit rusty, but I believe the process is something like this:

$ apt source zlib
$ cd zlib*/debian
[ make your changes in new diffs in the `patches` subdirectory]
$ dpkg-buildpackage -rfakeroot

This creates a .deb file and IIRC also installs it. If it doesn't also install it, then you can do that with a command like dpkg -i zlib*.deb

See also Debian's Building the Package documentation.


If all you need is a newer version of a particular package, you can add it from Debian Testing or Unstable in three steps:

1. Edit /etc/apt/sources.list or something in /etc/apt/sources.list.d/ to include

deb http://deb.debian.org/debian/ testing main non-free contrib

2. Edit /etc/apt/preferences or something in /etc/apt/preferences.d/ to include

Explanation: Don't use testing by default
Package: *
Pin: release a=testing
Pin-Priority: 1

3a. Install it manually:

$ sudo apt install -t testing zlib1g

3b. Alternatively, ensure it always installs from testing with another preferences stanza:

Explanation: Use zlib from testing
Package: zlib1g
Pin: release a=testing
Pin-Priority: 500
Adam Katz
  • 14,455
  • 5
  • 68
  • 83
  • If openssh is linked to zlib 1.0.0 and I remove that version of zlib and install zlib 1.2.0, I won't be fine even if I use dpkg. Or do I miss something? – iveqy Sep 27 '19 at 09:47
  • If you're using a dpkg-controlled package that provides zlib, I don't see why you'd have problems. Some packages list specific versions on their dependencies, but I do not know of this being done for zilb (since zlib should be fully backwards-compatible), so your 1.2.0 package should work just fine with dpkg. – Adam Katz Oct 02 '19 at 19:49
  • I've appended my answer to demonstrate how to upgrade a specific package using a different repository. At the moment, Debian Testing offers zlib1g 1.2.11 – Adam Katz Oct 02 '19 at 21:09
  • Let's say that I introduce a breaking change in zlib 1.2.0 (my own version), how do I know which other applications (for example openssh) that I need to rebuild? – iveqy Oct 03 '19 at 11:20
  • That would depend on your "breaking change." I'd expect that sort of thing would have to be done on a case-by-case basis. I highly recommend against such a tactic. Consider using a different compression library (like [xz-utils](https://en.wikipedia.org/wiki/XZ_Utils) or [zstd](https://en.wikipedia.org/wiki/Zstandard)) or else changing the name of your zlib fork so it doesn't conflict with anything. Then tweak items you want to use it as needed. – Adam Katz Oct 03 '19 at 14:24