Friday, April 19, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 719  / 2 Years ago, wed, august 17, 2022, 3:13:21

I'm absolutely new to packaging, so forgive me if I am asking something obvious for an experienced packager...



How can I be sure that mentioned all the dependencies correctly in my package?



Say that my application make use of lib library-xyz which is not installed by default. If I build the package and install it on my developing machine, library-xyz will be installed already, so - even if I failed to mention it as a dependency - the program will still run correctly. But another user on a fresh install of ubuntu won't have library-xyz installed and the program will likely crash for him.



The way I am testing now is having a fresh ubuntu install running in a VM and installing the package there, but since it seems like a common problem, I wonder if there is a better way to test, something adopting the same philosophy of chroot but that - instead of "cutting out" parts of the filesystem would "cut out" all those installed packages that are not "default" in a clean ubuntu installation.



I'm packaging python programs.


More From » python

 Answers
0

The lintian program runs after building a package using debuild and should warn you for missing libraries when building a binary package. The ldd command can be used to check which libraries are needed for a package.



I use the below script for fetching library package dependencies quickly:



#!/bin/sh
# Save it as executable ~/bin/pkglibs
# Usage: pkglibs directory
# pkglibs file
list_lib_pkgnames() {
local lib="$1" libs
# get the libraries for given "$lib", stripping out linker libraries
libs=$(ldd "$lib" | awk '/=/{print $1}' | grep -vE '^(linux-vdso|linux-gate).so.1$')
# if there are libraries, find the matching packages for it
[ -n "$libs" ] && dpkg -S $libs | sed 's/: .*//'
}
search="$1"
if [ -d "$search" ]; then
# for directories, recursively search for library dependencies
find "$search" -type f -exec "$0" {} ; | sort -u
else
list_lib_pkgnames "$search"
fi


The command may take a while for large directories since it test each file separatedly. It can be optimized to generate a list of libraries first, and then passing the unique entries to the dpkg -S command, but that is an exercise for the reader.



Example: pkglibs /usr/lib/mesa/:



ia32-libs
lib32gcc1
lib32stdc++6
libc6
libc6-i386
libdrm2
libgcc1
libstdc++6
libx11-6
libxau6
libxcb1
libxdamage1
libxdmcp6
libxext6
libxfixes3
libxxf86vm1

[#43805] Thursday, August 18, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
naldis

Total Points: 257
Total Questions: 101
Total Answers: 111

Location: Kenya
Member since Sat, Feb 25, 2023
1 Year ago
naldis questions
;