如何在 Debian 中查看本地/下载的 .deb 文件的元数据

如何在 Debian 中查看本地/下载的 .deb 文件的元数据

虽然可以使用下载 .deb 包,但apt download $package.deb似乎没有任何方法可以查看该文件的元数据。我的意思是元数据类似 -

[$] aptitude show dgit                                                                                                             
Package: dgit                            
Version: 3.10
State: not installed
Priority: optional
Section: devel
Maintainer: Ian Jackson <[email protected]>
Architecture: all
Uncompressed Size: 309 k
Depends: perl, libwww-perl, libdpkg-perl, git-core, devscripts, dpkg-dev, git-buildpackage, liblist-moreutils-perl, coreutils (>= 8.23-1~) | realpath, libdigest-sha-perl, dput, curl, apt, libjson-perl, ca-certificates, libtext-iconv-perl, libtext-glob-perl
Recommends: ssh-client
Suggests: sbuild
Description: git interoperability with the Debian archive
 dgit (with the associated infrastructure) makes it possible to treat the Debian archive as a git repository. 

 dgit push constructs uploads from git commits 

 dgit clone and dgit fetch construct git commits from uploads.

希望有一种方法可以查看依赖、推荐等。

我也曾在各种论坛中使用 less 来完成同样的事情,但无法让它正常工作。

答案1

dpkg-deb,它是 的一部分dpkg,因此始终可用,可以仅使用其文件显示二进制包的所有控制信息.deb

$ dpkg-deb -I joystick_1.6.0-2_amd64.deb
 new debian package, version 2.0.
 size 49454 bytes: control archive=1509 bytes.
     892 bytes,    24 lines      control              
    1887 bytes,    30 lines      md5sums              
 Package: joystick
 Version: 1:1.6.0-2
 Architecture: amd64
 Maintainer: Stephen Kitt <[email protected]>
 Installed-Size: 176
 Depends: libc6 (>= 2.15), libsdl1.2debian (>= 1.2.11)
 Recommends: evtest, inputattach
 Breaks: stella (<< 4.7.2)
 Replaces: stella (<< 4.7.2)
 Section: utils
 Priority: extra
 Homepage: https://sourceforge.net/projects/linuxconsole/
 Description: set of testing and calibration tools for joysticks
  Some useful tools for using joysticks:
   evdev-joystick(1) - joystick calibration tool
   ffcfstress(1)     - force-feedback stress test
   ffmvforce(1)      - force-feedback orientation test
   ffset(1)          - force-feedback configuration tool
   fftest(1)         - general force-feedback test
   jstest(1)         - joystick test
   jscal(1)          - joystick calibration tool
  .
  evtest and inputattach, which used to be part of this package, are now
  available separately.

有很多不同的选项可以选择要显示的内容,从包的文件列表到特定的(二进制)控制文件;看man dpkg-deb了解详情。

答案2

查看 Debian 二进制包元数据的最简单方法是在二进制包上使用less(准确地说是预处理器)。less换句话说:

less pkgname...deb

以下是相关内容/bin/lesspipe

            *.deb|*.udeb|*.ddebi|*.ipk)
                        echo "$1:"; dpkg --info "$1"
                        echo
                        echo '*** Contents:'; dpkg-deb --contents "$1"
                            ;;

为了使其工作,您需要在来源处添加以下内容。~/.bashrc是个好地方。

export LESSOPEN="|/usr/bin/lesspipe %s"

相关内容