如何列出/下载Debian软件包的递归依赖项? [英] How to list/download the recursive dependencies of a debian package?

查看:276
本文介绍了如何列出/下载Debian软件包的递归依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要列出/下载debian软件包的所有递归依赖项.

I need to list/download all the recursive dependencies of a debian package.

假设我需要安装软件包a.deb,它取决于软件包b.deb,再次软件包b.deb取决于软件包c.deb.

Suppose i need to install package a.deb and it depends on package b.deb and again package b.deb depends on package c.deb.

我需要下载所有与递归相关的软件包,以便可以在没有任何Internet访问的情况下将它们安装在其他计算机上.

I need to download all the recursive dependent packages so that they can be installed on some other machine without any internet access.

谢谢.

推荐答案

由于某些原因,apt-rdepends对我不起作用(在搜索"docker-engine"软件包时,它错过了对引入的libltdl7的依赖)和docker-engine 1.11.1-0). UPD 据推测是由于以下事实:apt-rdepends不遵循并且默认情况下未列出推荐".并且不遵循虚拟软件包.

For some reason apt-rdepends did not work for me (when searching the 'docker-engine' package, it missed the dependency onto libltdl7 which was introduced with docker-engine 1.11.1-0). UPD Supposedly owing to the fact that apt-rdepends doesn't follow and doesn't list Recommends by default. And doesn't follow virtual packages.

所以我想出了以下命令套件.

So I came up with following command suite.

$ apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances <your-package-here> | grep "^\w" | sort -u

(显然,您必须在要分析的软件包的行尾更改<your-package-here>)

(you obviously have to change <your-package-here> at the end of the line with the package you want to analyze)

这里的关键是--recurse选项.不幸的是,您无法指定所需的内容(或者我找不到方法),因此您需要关闭所有不需要的依赖项以仅保留依赖项".这有点冗长且难以记住!

The key here is the --recurse option. Unfortunately, you cannot specify the content you want (or I did not find the way) so you need to turn off all unwanted dependencies to keep only "dependencies". It is a bit verbose and hard to remember!

在apt-cache手册页中:

From the apt-cache man page:

默认情况下,depends和rdepends打印所有依赖项

Per default the depends and rdepends print all dependencies

下载那些依赖项

因此,要下载这些依赖项,请运行以下命令,将其下载到当前工作目录中:

Download those dependencies

So in order to download those dependencies, run following command which will download them into the current working directory:

$ apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances <your-package-here> | grep "^\w" | sort -u)

(可选)安装这些依赖项

这稍微扩展了所提出的问题,但似乎与问题的意图相符.

您需要为刚刚下载的软件包建立 index .这是从下载所有.deb的同一文件夹中完成的:

You need to build the index of the just downloaded packages. This is done from the same folder where all .deb where downloaded:

$ dpkg-scanpackages . | gzip -9c > Packages.gz

然后只需将该文件夹(所有.deb + Packages.gz文件)复制到无法访问Internet的目标系统,然后将该文件夹添加到APT来源列表中.

Then just copy that folder (all .deb + the Packages.gz file) to the target system which does not have Internet access and add the folder to the APT source list.

$ echo "deb file:<your folder here> ./" | sudo tee -a /etc/apt/sources.list
$ sudo apt-get update

Etvoilà

在没有Internet访问的系统上,我可以安装一个软件包(在我的示例中为Docker)及其依赖项:

Et voilà

On a system w/o Internet access, I can install a package (Docker in my example) and its dependencies:

$ sudo apt-get install docker-engine

这篇关于如何列出/下载Debian软件包的递归依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆