Ubuntu 如何在基于Debian的发行版中列出所有已安装软件包的许可证?

Ubuntu 如何在基于Debian的发行版中列出所有已安装软件包的许可证?,ubuntu,copyright-display,Ubuntu,Copyright Display,我想在我的Ubuntu服务器上获得所有已安装的软件包许可证,我可以使用(): packages=$(dpkg——获取选择| awk'{print$1}') 以美元包装的包装;做 echo“$package:” cat/usr/share/doc/$package/版权所有 回声;回声 完成>/tmp/licenses.txt less/tmp/licenses.txt 但是输出是一个巨大的无用文件,包含每个包的所有版权数据。我需要像这样的东西: 包装:包装名称许可证:许可证名称 是否有解析器

我想在我的Ubuntu服务器上获得所有已安装的软件包许可证,我可以使用():

packages=$(dpkg——获取选择| awk'{print$1}')
以美元包装的包装;做
echo“$package:”
cat/usr/share/doc/$package/版权所有
回声;回声
完成>/tmp/licenses.txt
less/tmp/licenses.txt
但是输出是一个巨大的无用文件,包含每个包的所有版权数据。我需要像这样的东西:

包装:包装名称许可证:许可证名称

是否有解析器或其他工具来获取这样的数据?

目前对您尝试的内容支持不足,尽管正在努力在文件
/usr/share/doc/*/copyright
文件中提供机器可读的信息。例如,见:

格式:http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
上游名称:at
资料来源:git://anonscm.debian.org/collab-maint/at.git
注释:该软件包由其作者Thomas Koenig借记
,由Martin首先接管并重新包装
Schulze和Siggy Brentrup,
然后由Ryan Murray接管。
.
2009年8月,上游开发和Debian包装被接管
由安斯加·伯查特(Ansgar Burchardt)提供详细信息

如您所见,每个包必须有一个许可证的基本假设是错误的。每个文件可能有多个许可证——根据您试图解决的问题,当然可以忽略其中的许多许可证(例如,如果您想调查Apache许可证下是否有内容,对于已转换为这种新格式的包,这应该很容易做到)

这是Debian Jessie在2015年发布的新版本;Debian的旧版本没有类似的功能。如果您需要使用较旧的软件包审计系统,您所能做的最好的事情可能是将
版权
文件grep,查找类似GPL、BSD、MIT等的片段,然后希望您没有遗漏太多;但是,对于任何正当的法律工作来说,在一些脆弱的谎言之上的希望似乎都是一种诅咒,我想我们可以假设这就是你试图这样做的原因。更好的方法可能是为您正在审核的软件包找到当前的
版权
文件,其中包含大致的机器可读信息,并希望(还有这个词)它们也适用于您安装的旧版本

(为了便于比较,您也可以在上查看较旧的版本。)


我不再密切关注Ubuntu了,但我假设他们从一些版本回来后就开始接受这一变化。事实上,似乎拥有相同的
版权
文件。

通过非正式审查,我可以访问Jessie系统,该系统返回了
grep-l'^Format:'/usr/share/doc/*/copyright | wc-l
的248条,以及
grep-l
的569条。因此,我们安装的软件包中只有不到1/3转换为新格式。如果您有许多遗留软件包,那么数量可能会更低。嗯,请求的数据是用于法律工作的,3年后仍然是一个问题,这非常令人失望。谢谢你的全面回答。这是链接的副本,其答案包括非常有用的
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: at
Source: git://anonscm.debian.org/collab-maint/at.git
Comment: This package was debianized by its author Thomas Koenig
 <ig25@rz.uni-karlsruhe.de>, taken over and re-packaged first by Martin
 Schulze <joey@debian.org> and then by Siggy Brentrup <bsb@winnegan.de>,
 and then taken over by Ryan Murray <rmurray@debian.org>.
 .
 In August 2009 the upstream development and Debian packaging were taken over
 by Ansgar Burchardt <ansgar@debian.org> and Cyril Brulebois <kibi@debian.org>.
 .
 This may be considered the experimental upstream source, and since there
 doesn't seem to be any other upstream source, the only upstream source.

Files: *
Copyright: 1993-1997,  Thomas Koenig <ig25@rz.uni-karlsruhe.de>
           1993,       David Parsons
           2002, 2005, Ryan Murray <rmurray@debian.org>
License: GPL-2+

Files: getloadavg.c
Copyright: 1985-1995, Free Software Foundation Inc
License: GPL-2+

Files: posixtm.*
Copyright: 1989-2007, Free Software Foundation Inc
License: GPL-3+

Files: parsetime.pl
Copyright: 2009, Ansgar Burchardt <ansgar@debian.org>
License: ISC 

License: GPL-2+
 This program is free software; you can redistribute it
 and/or modify it under the terms of the GNU General Public
 License as published by the Free Software Foundation; either
 version 2 of the License, or (at your option) any later
 version.