![apt-cache 从 /var/lib/dpkg/status 中提取 - 我该如何防止这种情况?](https://linux22.com/image/912306/apt-cache%20%E4%BB%8E%20%2Fvar%2Flib%2Fdpkg%2Fstatus%20%E4%B8%AD%E6%8F%90%E5%8F%96%20-%20%E6%88%91%E8%AF%A5%E5%A6%82%E4%BD%95%E9%98%B2%E6%AD%A2%E8%BF%99%E7%A7%8D%E6%83%85%E5%86%B5%EF%BC%9F.png)
我正在尝试从旧版本的 Ubuntu (Artful) 编译一些依赖项信息。基本上,我通过将以下几行添加到我的 /etc/var/sources.list 来下载旧版本的内容:
deb http://old-releases.ubuntu.com/ubuntu/ artful main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ artful-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ artful-security main restricted universe multiverse
然后,在我执行 sudo apt-get update 之后,这些文件就出现在我的 /var/lib/apt/lists 目录中。一切都很好。然后我将这些行移动到它们自己的文件中,我将其称为 artful_sources.list,并在源文件目录已更改的包上运行 apt-cache:
apt-cache -o Dir::Etc::SourceList=/etc/apt/artful_sources.list showpkg accountsservice > accountsservice.txt
当我查看结果时,我当然会看到 Artful 的版本,但我还会看到 Bionic(我已将其安装在我的系统上)的最新版本,它似乎是从 /var/lib/dpkg/status 中提取的。我只想要 Artful 软件包中的依赖项。这是怎么回事?我还可以更改哪些其他选项以使 apt-cache 不出现在状态文件中?
该示例的结果如下:
Package: accountsservice
Versions:
0.6.45-1ubuntu1 (/var/lib/dpkg/status)
Description Language:
File: /var/lib/apt/lists/old-releases.ubuntu.com_ubuntu_dists_artful_main_binary-amd64_Packages
MD5: 8aeed0a03c7cd494f0c4b8d977483d7e
Description Language: en
File: /var/lib/apt/lists/old-releases.ubuntu.com_ubuntu_dists_artful_main_i18n_Translation-en
MD5: 8aeed0a03c7cd494f0c4b8d977483d7e
Description Language:
File: /var/lib/apt/lists/old-releases.ubuntu.com_ubuntu_dists_artful-updates_main_binary-amd64_Packages
MD5: 8aeed0a03c7cd494f0c4b8d977483d7e
Description Language:
File: /var/lib/dpkg/status
MD5: 8aeed0a03c7cd494f0c4b8d977483d7e
0.6.42-0ubuntu3.1 (/var/lib/apt/lists/old-releases.ubuntu.com_ubuntu_dists_artful-updates_main_binary-amd64_Packages)
Description Language:
File: /var/lib/apt/lists/old-releases.ubuntu.com_ubuntu_dists_artful_main_binary-amd64_Packages
MD5: 8aeed0a03c7cd494f0c4b8d977483d7e
Description Language: en
File: /var/lib/apt/lists/old-releases.ubuntu.com_ubuntu_dists_artful_main_i18n_Translation-en
MD5: 8aeed0a03c7cd494f0c4b8d977483d7e
Description Language:
File: /var/lib/apt/lists/old-releases.ubuntu.com_ubuntu_dists_artful-updates_main_binary-amd64_Packages
MD5: 8aeed0a03c7cd494f0c4b8d977483d7e
Description Language:
File: /var/lib/dpkg/status
MD5: 8aeed0a03c7cd494f0c4b8d977483d7e
0.6.42-0ubuntu3 (/var/lib/apt/lists/old-releases.ubuntu.com_ubuntu_dists_artful_main_binary-amd64_Packages)
Description Language:
File: /var/lib/apt/lists/old-releases.ubuntu.com_ubuntu_dists_artful_main_binary-amd64_Packages
MD5: 8aeed0a03c7cd494f0c4b8d977483d7e
Description Language: en
File: /var/lib/apt/lists/old-releases.ubuntu.com_ubuntu_dists_artful_main_i18n_Translation-en
MD5: 8aeed0a03c7cd494f0c4b8d977483d7e
Description Language:
File: /var/lib/apt/lists/old-releases.ubuntu.com_ubuntu_dists_artful-updates_main_binary-amd64_Packages
MD5: 8aeed0a03c7cd494f0c4b8d977483d7e
Description Language:
File: /var/lib/dpkg/status
MD5: 8aeed0a03c7cd494f0c4b8d977483d7e
Reverse Depends:
unity-settings-daemon,accountsservice 0.6.34
mugshot,accountsservice
liblightdm-gobject-1-0,accountsservice
indicator-sound,accountsservice
libaccountsservice0,accountsservice 0.6.5
gnome-control-center,accountsservice
gdm3,accountsservice 0.6.35
language-selector-common,accountsservice 0.6.29-1ubuntu6
unity-settings-daemon,accountsservice 0.6.34
libaccountsservice0,accountsservice 0.6.5
language-selector-common,accountsservice 0.6.29-1ubuntu6
gnome-control-center,accountsservice
等等。在本例中,0.6.45-1ubuntu1 当前安装在 Bionic 上,其他版本 0.6.42-0ubuntu3 和 3.1 分别来自 artful 和 artful-updates。