【问题标题】:How to compare installed Linux packages between two machines如何比较两台机器上安装的 Linux 包
【发布时间】:2014-12-22 22:48:39
【问题描述】:

我需要显示一个 Linux 软件包列表,这些软件包的版本在“构建机器”和各种“开发者机器”之间会随着时间的推移与构建 VM 不同。

我可以通过执行“dpkg -l”来获取安装在黄金 VM 上的软件包与其他机器上的包的文本转储,然后在两者上执行“diff”或“awk grep”之类的操作,从而取得相当大的进展列表,但我想知道是否已经有一个工具比我为这项工作编写脚本做得更好。

你们是怎么做到的?

让-皮埃尔

【问题讨论】:

    标签: linux versioning packages apt-get aptitude


    【解决方案1】:

    我刚刚编写了这个脚本,它还比较了包版本:

    https://github.com/lepe/scripts/blob/master/compare_ubuntu_apt.pl

    用法:

    1) 在两台电脑上生成包列表,如:

    apt --installed list | tail -n+2 > that_server.lst
    

    2) 执行 perl 脚本:

    ./compare_ubuntu_apt.pl this_server.lst that_server.lst
    

    结果:(示例)

    ----------------------------------
     DIFFERENCES 
    ----------------------------------
     @ apparmor : 2.8.95~2430-0ubuntu5.2 -> 2.8.95~2430-0ubuntu5.3
     @ apt : 1.0.1ubuntu2.8 -> 1.0.1ubuntu2.10
     @ apt-transport-https : 1.0.1ubuntu2.8 -> 1.0.1ubuntu2.10
     @ apt-utils : 1.0.1ubuntu2.8 -> 1.0.1ubuntu2.10
     @ base-files : 7.2ubuntu5.2 -> 7.2ubuntu5.3
     @ bash-completion : 1:2.1-4 -> 1:2.1-4ubuntu0.1
    ----------------------------------
     MISSING IN this_server.lst
    ----------------------------------
     + acl : 2.2.52-1
     + acpid : 1:2.0.21-1ubuntu2
     + apport : 2.14.1-0ubuntu3.11
     + apport-symptoms : 0.20
     + at : 3.1.14-1ubuntu1
     + at-spi2-core : 2.10.2.is.2.10.1-0ubuntu1
     + attr : 1:2.4.47-1ubuntu1
     + autotools-dev : 20130810.1
    ----------------------------------
     MISSING IN that_server.lst
    ----------------------------------
     - apcupsd : 3.14.10-2build1
     - apcupsd-doc : 3.14.10-2build1
     - beep : 1.3-3
     - btrfs-tools : 3.12-1
     - discover : 2.1.2-5.2ubuntu1
    

    【讨论】:

    • 非常感谢你。有趣的方法。非常有用:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-15
    • 2017-08-22
    • 2017-09-21
    • 1970-01-01
    • 1970-01-01
    • 2017-11-17
    相关资源
    最近更新 更多