Page 1 of 1

HowTo find which Ubuntu package a library is in?

Posted: Wed 09 Jan 2013, 05:08
by sunburnt
I`m writing an Ubuntu library downloader in Bash.
I have it parsing the web files for the FTP dirs.

Example: libavcodec.so.52 is needed for Kino and mPlayer.

These are the relevant links from the Ubuntu web page:

Code: Select all

libavcodec52_0.6.2-1ubuntu1_amd64.deb
libavcodec52_0.6.2-1ubuntu1_i386.deb
libavcodec52_0.6.6-0ubuntu0.11.04.1_amd64.deb
libavcodec52_0.6.6-0ubuntu0.11.04.1_i386.deb
libavcodec53_0.7.2-1ubuntu1_amd64.deb 
This command shows the real library Puppy has:

Code: Select all

realpath `ldd /root/.usr/bin/mplayer |awk '{print $3}'`
The needed library is: /usr/lib/libavcodec.so.52.72.2

### How to know what package contains the needed library?
This is a problem for finding any dependency.

Posted: Fri 11 Jan 2013, 00:46
by postfs1

Code: Select all

find /mnt/sr0/_Files/GParted/Ubuntu-Karmic_files -type f -exec dpkg-deb --contents {} \; -print|sed -n '/libparted-1.8.so.12/,/.deb/p'|sed '/libparted-1.8.so.12/b;/.deb/b;d' ;

Posted: Fri 11 Jan 2013, 03:27
by sunburnt
postfs1; I see what you`re doing, but I`m not sure how it applies to web.
I suppose if I download an Ubuntu CD and use "find" to generate a list...
A list search is much faster than extracting Deb. files from a CD.

# The perfect thing would be a list of: files and libs. => package.

# I`m really surprised ( and disappointed...) Ubuntu doesn`t have this.
It seems that a file manifest list like this would be part of the Ubuntu CD.

So ldd shows missing libs. and the list shows what packages they`re in.
Then awk could find the package in one command.
Then it`s easy to find and download the packages from a Ubuntu mirror.

I have several Ubuntu files of lists, but none that are: file => package.
One I have is package descriptions, but no package contense is listed,
and it doesn`t contain all of the available packages.

Posted: Fri 11 Jan 2013, 07:10
by amigo
I think you need to be looking elsewhere for the info. rather than using ldd. When you download and install some deb/ubuntu package, it contains a file called 'control' which will list the other packages needed by the package.

I guess there is a way to do what you want, but the info you get may not be accurate -you may find the wrong version before finding the right one. Only the control file will tell you all the info you need.

Re: HowTo find which Ubuntu package a library is in?

Posted: Fri 11 Jan 2013, 09:07
by postfs1

Posted: Fri 11 Jan 2013, 20:50
by sunburnt
postfs1; I have the first link`s file. But none of them list package contents.

amigo; I have many Ubuntu app. .deb packages, none have a "control" file.

This should ( but doesn`t ) give control info.: dpkg-deb -e ( .deb file )
I can only assume it doesn`t work because the packages don`t have a control file.

Code: Select all

Usage: dpkg-deb [<option> ...] <command>
Commands:
  -b|--build <directory> [<deb>]   Build an archive.
  -c|--contents <deb>              List contents.
  -I|--info <deb> [<cfile> ...]    Show info to stdout.
  -W|--show <deb>                  Show information on package(s)
  -f|--field <deb> [<cfield> ...]  Show field(s) to stdout.
  -e|--control <deb> [<directory>] Extract control info.
  -x|--extract <deb> <directory>   Extract files.
  -X|--vextract <deb> <directory>  Extract & list files.
This shows info.: dpkg-deb -I ( .deb file )
But then you have to get the correct links for the deps. listed.

Any method of getting contents probably won`t guarantee the correct lib.
ldd will show the correct lib., but not the package that has it.

The only other way is to parse the apps. web page for it`s dep. links.
And that has been made rather difficult to do also.

What`s apparent is that Debian and Ubuntu made it difficult to do this.
.

Posted: Fri 11 Jan 2013, 21:47
by pemasu
This in Precise Puppy based Upup Precise:
dpkg-deb -e /mnt/sda6/woof-january/woof-out_x86_x86_ubuntu_precise/packages-deb-precise/autoconf_2.68-1ubuntu2_all.deb /root/testing

# ls /root/testing
conffiles control md5sums

control file content:
Version: 2.68-1ubuntu2
Architecture: all
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Installed-Size: 1858
Depends: perl (>> 5.005), m4 (>= 1.4.13), debianutils (>= 1.8)
Recommends: automake | automaken
Suggests: autoconf2.13, autoconf-archive, gnu-standards, autoconf-doc, libtool, gettext
Conflicts: autoconf2.13 (<< 2.13-47), gettext (<< 0.10.39), pkg-config (<< 0.25-1.1)
Section: devel
Priority: optional
Multi-Arch: foreign
Homepage: http://www.gnu.org/software/autoconf
Description: automatic configure script builder
The standard for FSF source packages. This is only useful if you
write your own programs or if you extensively modify other people's
programs.
.
For an extensive library of additional Autoconf macros, install the
`autoconf-archive' package.
.
The Debian project regards the full documentation for autoconf to be
non-free, so it is not included in Debian. Nevertheless, the
non-free distribution that accompanies Debian includes the manual in
its `autoconf-doc' package.
.
This version of autoconf is not compatible with scripts meant for
Autoconf 2.13 or earlier. If you need support for such scripts,
you must also install the autoconf2.13 package.
Original-Maintainer: Ben Pfaff <pfaffben@debian.org>

Posted: Fri 11 Jan 2013, 22:51
by sunburnt
pemasu; That looks like the description file I have.
This give the same description:

Code: Select all

dpkg-deb -I /mnt/sda3/ubuntu_bin/xtightvncviewer_1.3.9-6.2ubuntu2_i386.deb
 new debian package, version 2.0.
 size 57996 bytes: control archive= 1526 bytes.
      32 bytes,     1 lines      conffiles            
    1426 bytes,    30 lines      control              
     355 bytes,     5 lines      md5sums              
     601 bytes,    25 lines   *  postinst             #!/bin/sh
     160 bytes,     5 lines   *  postrm               #!/bin/sh
     146 bytes,    13 lines   *  prerm                #!/bin/sh
 Package: xtightvncviewer
 Source: tightvnc
 Version: 1.3.9-6.2ubuntu2
 Architecture: i386
 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
 Installed-Size: 171
 Depends: libc6 (>= 2.4), libjpeg8 (>= 8c), libx11-6, libxaw7, libxext6, libxmu6, libxt6, zlib1g (>= 1:1.1.4)
 Recommends: xfonts-base
 Suggests: tightvncserver, ssh
 Provides: vnc-viewer, vncviewer
 Section: x11
The "Depends:" line lists deps., but it doesn`t have links for download.
As amigo said, the dep. info. doesn`t guarantee you`ll get the right lib.

### If you can show me how to get the actual package and file name from this info.

So far the only reliable method would be the Ubuntu web site`s pages.
Like this deps. section of an app`s. web page:

Code: Select all

    avidemux-common
        a free video editor - Internationalization files 

# Depends:
    libatk1.0-0 (>= 1.12.4)
        ATK accessibility toolkit 
    libavidemux0 (>= 1:2.5.4)
        a free video editor - shared libraries 
    libc6 (>= 2.14) [amd64]
        Embedded GNU C Library: Shared libraries
        also a virtual package provided by libc6-udeb 
    libc6 (>= 2.4) [i386]
    libcairo2 (>= 1.2.4)
        The Cairo 2D vector graphics library 
    libgcc1 (>= 1:4.1.1)
        GCC support library 
    libgdk-pixbuf2.0-0 (>= 2.22.0)
        GDK Pixbuf library 
    libglib2.0-0 (>= 2.14.0)
        GLib library of C routines 
    libgtk2.0-0 (>= 2.24.0)
        GTK+ graphical user interface library
    libsdl1.2debian (>= 1.2.10-1)
        Simple DirectMedia Layer
    libstdc++6 (>= 4.6)
        GNU Standard C++ Library v3 
    libvpx1 (>= 1.0.0)
        VP8 video codec (shared library) 
    libx11-6
        X11 client-side library 
    libxext6
        X11 miscellaneous extension library 
    libxml2 (>= 2.7.4)
        GNOME XML library 
    libxv1
        X11 Video extension library 

# Recommends:
    avidemux-plugins-gtk
        a free video editor - GTK plugins 
So follow the links, page to page to get a mirror`s: /SubDir./Package.deb
.

Posted: Thu 17 Jan 2013, 20:13
by amigo
You are using dpkg, so it should find the right package with just the name -if you have the repos configured correctly. If you are installing packages from contribs repo, then that will have to in the repos configuration. If a package needs updates of normal packages, then the updates should be in the same repo as the original extra/updated program.

Are we having fun yet, working with dependency-management? If not, try coming up with a better system than debian/dpkg. The only more-complete system would be what nix OS is doing -by providing multi-version capability for everything. A real nightmare for the devs!

Sorry if I'm being hard -it's been below freezing for days here and I am getting grumpy and ornery...

Posted: Thu 17 Jan 2013, 21:01
by pemasu
-it's been below freezing for days here and I am getting grumpy and ornery...
T-shirt weather here: Just - 25 c atm.

Posted: Thu 17 Jan 2013, 21:30
by sunburnt
pemasu; That`s a little chilly! The southwest U.S. here got Alaska`s weather, and Alaskan`s are wearing sweaters I hear ( warmish ). :?

amigo; No need to apologize, I remember how cold it was in Pennsylvania. And I remember how quickly you get use to the warmth here in the desert.
Tuesday night it actually got down to 27F ( ~ -2C ), the lowest it`s been. Any desert has greater temperature extremes than moist areas.
When the sun goes down the temp. can drop 10F to 20F in an hour.

If dpkg requires lots of configuration, then it`s no better than parsing web pages. Providing mirror URLs is easy, but I`m still not sure about using it.

About 2 to 3 web pages need to be parsed for the links to the dep. page. Then loop to check the dep. list for installed libs. or if it`s on a local drive.

I have an option to warehouse libs. in the AppPkg build dir. to keep from downloading libs. repeatedly in making AppPkgs.
At this point why not include it in the lib. path ( ld.so.conf ) so eventually no more downloading of libs. needs to be done.
That is, until the next major upgrade when you dump the whole mess and start downloading the next batch of newer libs.

### dpkg is the best way to manage this, but is it the easiest?