4

For a build tool I'm writing (for which I'd like to implement a sort of dependency-caching system) I'd like to know what the missing dependencies for a .deb package are, without resorting to installing it (possibly) and reading apt-get output, i.e.: I must be able to do it non-interactively in a software, it's not something that a human should do

The manual procedure would be something like:

dpkg -i something.deb || true apt-get -f install 

At this point, apt prints something like:

The following extra packages will be installed: ca-certificates git git-man krb5-locales libasn1-8-heimdal libcurl3-gnutls libedit2 liberror-perl libgssapi-krb5-2 libgssapi3-heimdal libhcrypto4-heimdal libheimbase1-heimdal libheimntlm0-heimdal libhx509-5-heimdal libidn11 libk5crypto3 libkeyutils1 libkrb5-26-heimdal libkrb5-3 libkrb5support0 libldap-2.4-2 libroken18-heimdal librtmp0 libruby1.9.1 libsasl2-2 libsasl2-modules libsasl2-modules-db libwind0-heimdal libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxmuu1 libyaml-0-2 openssh-client openssl patch rsync ruby ruby1.9.1 xauth 

I would like to reliably obtain such list without installing the .deb (possibly, because I can remove the package after having installed and have a system just like before, after-all) but especially without needing to manually and interactively parse apt-get output for package listing.

I can use apt-get, apt-cache, aptitude or whatever package is available in Debian and/or Ubuntu for performing such tasks.

2
  • Isn't the information provided by dpkg -I $package what you are looking for? Commented Jun 19, 2015 at 14:32
  • dpkg only tells the dependencies from the file, not what would be installed when running apt-get (what if the dependency is satisfied by a meta-package?) and it shows all the dependencies, including those that are already installed. I need to filter those out. Commented Jun 22, 2015 at 14:44

2 Answers 2

1

dpkg -I package.deb

It's command show package info. You can find depends in.

1
  • 2
    dpkg only tells the dependencies from the file, not what would be installed when running apt-get (what if the dependency is satisfied by a meta-package?) and it shows all the dependencies, including those that are already installed. I need to filter those out. Commented Jun 22, 2015 at 14:44
0

It's not perfect as it needs you to install something, but try apt-rdepends

1
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review Commented Jul 16 at 6:45

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.