如何在不安装的情况下查看软件包版本?

Mes*_*sci 42 debian apt package-management

我想在安装之前查看软件包的版本。我怎样才能做到这一点?

Alo*_*dal 36

除了其他答案,如果你有一个 .deb 包文件,你可以做

$ dpkg-deb -I package.deb
Run Code Online (Sandbox Code Playgroud)

查看控制信息(名称、描述、版本、依赖项...)和基本统计​​信息,如大小

$ dpkg-deb -f package.deb Version
Run Code Online (Sandbox Code Playgroud)

仅打印版本。

例子:

  • 完整信息(请注意,前 4 行超出了典型的控制信息)

    me@here:~$ dpkg-deb -I in/sw/minutor_2.0_amd64.deb 
     new debian package, version 2.0.
     size 131594 bytes: control archive=682 bytes.
         534 bytes,    12 lines      control              
         386 bytes,     6 lines      md5sums              
     Package: minutor
     Version: 2.0
     Architecture: amd64
     Maintainer: Sean Kasun <REDACTED>
     Installed-Size: 340
     Depends: libc6 (>= 2.14), libgcc1 (>= 1:4.1.1), libqt5core5
    (>= 5.0.1+dfsg), libqt5gui5 (>= 5.0.1+dfsg), libqt5network5
    (>= 5.0.1+dfsg), libqt5widgets5 (>= 5.0.1+dfsg), libstdc++6
    (>= 4.1.1), zlib1g (>= 1:1.1.4)
     Section: utils
     Priority: extra
     Homepage: http://seancode.com/minutor/
     Description: Minecraft mapping tool
      Minutor lets you view and inspect your Minecraft worlds.
      It is designed for Minecraft 1.2 and later.
    me@here:~$
    
    Run Code Online (Sandbox Code Playgroud)
  • 仅版本

    me@here:~$ dpkg-deb -f in/sw/minutor_2.0_amd64.deb Version
    2.0
    me@here:~$ 
    
    Run Code Online (Sandbox Code Playgroud)


Ulr*_*gel 27

您的系统/离线已知的软件包

您可以使用apt-cache查询 APT 缓存。要显示系统已知的版本,请使用apt-cache policy. 例子:

apt-cache policy iceweasel  
iceweasel:                        
  Installed: 10.0.4esr-3
  Candidate: 10.0.4esr-3
  Version table:
     12.0-7 0
          1 http://ftp.us.debian.org/debian/ experimental/main amd64 Packages
 *** 10.0.4esr-3 0
        500 http://ftp.us.debian.org/debian/ sid/main amd64 Packages
        100 /var/lib/dpkg/status
     10.0.4esr-2 0
        500 http://ftp.us.debian.org/debian/ testing/main amd64 Packages
Run Code Online (Sandbox Code Playgroud)

这意味着 iceweasel 版本12.0-7可用于实验并具有优先级 1,版本10.0.4esr-3从 sid 安装并具有优先级 500 和10.0.4esr-2正在测试中。

有关优先级含义的详细说明,请查看apt_preferences(5)

您还可以使用以下命令显示有关包的简要说明和一些元信息

apt-cache show package-name
Run Code Online (Sandbox Code Playgroud)

有关所有 debian 软件包/在线的信息

如果您想获得所有可用的 debian 软件包的版本信息(基本上是http://packages.debian.org所做的),您可以使用rmadison(1)远程查询数据库。rmadison 位于 devscripts 包中,您必须通过apt-get install devscripts.

$ rmadison iceweasel
 iceweasel | 3.0.6-3             | lenny-security    | source, alpha, amd64, arm, armel, hppa, i386, ia64, mips, mipsel, powerpc, s390, sparc
 iceweasel | 3.0.6-3             | lenny             | source, alpha, amd64, arm, armel, hppa, i386, ia64, mips, mipsel, powerpc, s390, sparc
 iceweasel | 3.5.16-11~bpo50+1   | backports/lenny   | source, alpha, amd64, armel, i386, ia64, mips, mipsel, powerpc, s390, sparc
 iceweasel | 3.5.16-14           | squeeze           | source, amd64, armel, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390, sparc
 iceweasel | 3.5.16-15           | squeeze-p-u       | source, amd64, armel, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390, sparc
 iceweasel | 3.5.16-15           | squeeze-security  | source, amd64, armel, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390, sparc
 iceweasel | 10.0.4esr-2~bpo60+1 | squeeze-backports | source, amd64, i386, kfreebsd-amd64, kfreebsd-i386, s390
 iceweasel | 10.0.4esr-2         | wheezy            | source, amd64, armel, armhf, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390, s390x, sparc
 iceweasel | 10.0.4esr-3         | sid               | source, amd64, armel, armhf, hurd-i386, i386, ia64, kfreebsd-amd64, kfreebsd-i386, mips, mipsel, powerpc, s390, s390x, sparc
 iceweasel | 11.0-4              | experimental      | source, armel
 iceweasel | 12.0-3              | experimental      | source, mips
 iceweasel | 12.0-7              | experimental      | source, amd64, armhf, hurd-i386, i386, ia64, kfreebsd-amd64, kfreebsd-i386, powerpc, s390, s390x, sparc
Run Code Online (Sandbox Code Playgroud)

apt-cache 和 apt-cache 的区别在于 apt-cachermadison仅显示您系统已知的信息(但可以离线使用),而rmadison显示可用软件包的所有版本


rus*_*ush 9

aptitude因为squeeze 能够显示所有可用的版本。如果您有不同版本的存储库,这将非常有用:

 $ aptitude versions aptitude
i   0.6.3-3.2+squeeze1        stable               700
p   0.6.7-1                   testing,unstable     650
Run Code Online (Sandbox Code Playgroud)