如何在Ubuntu中列出所有已安装的软件包许可证?

时间:2016-01-27 18:05:45

标签: ubuntu

我想在我的服务器上获取所有已安装的软件包许可证,我可以使用(source is from 2013 post)将其全部转储:

packages=`dpkg --get-selections | awk '{ print $1 }'` for package in $packages; do echo "$package: "; cat /usr/share/doc/$package/copyright; echo ""; echo ""; done > ~/licenses.txt

但输出是一个巨大的无用文件,包含每个包的所有版权数据。我需要这样的东西:

package : package_name        licence: licence_name

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

1 个答案:

答案 0 :(得分:3)

目前您正在尝试的内容支持不足,但正在努力在文件 <Resource url="jdbc:mysql://99.99.99.99:3306/xxx_db?useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&autoReconnect=true" password="passs123" description="My conection pool" type="javax.sql.DataSource" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" auth="Container" name="jdbc/mysql" defaultAutoCommit="true" removeAbandoned="true" removeAbandonedTimeout="300" maxWaitMillis="10000" maxIdle="100" maxTotal="500" driverClassName="com.mysql.jdbc.Driver" username="user1"/> 文件中提供机器可读信息。请参阅示例this excerpt

/usr/share/doc/*/copyright

有关详细信息,请参阅http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/中的规范(上面链接)。

正如您所看到的,每个包必须有一个许可证的基本假设是错误的。每个文件可能有多个许可 - 取决于您尝试解决的问题,当然可以忽略其中的许多问题(例如,如果您想调查是否对于转换为这种新格式的软件包,在Apache许可下有一些东西应该很容易做到。

这是2015年发布的Debian Jessie的新功能;旧版本的Debian没有这样的东西。如果您需要使用较旧的软件包审核系统,那么您可以做的最好的事情可能是查看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. 文件中看起来像GPL,BSD,MIT等的片段,然后希望您不会错过太多;但希望除了一些脆弱的贪婪之外,似乎对任何适当的法律工作都是诅咒,我认为我们可以假设这是你试图这样做的原因。一种更好的方法可能是找到您正在审核的软件包的当前copyright文件,并使用大致机器可读的信息,并希望(再次有那个单词)它们适用于旧版本你也安装了。

(为了进行比较,也可以在http://metadata.ftp-master.debian.org/changelogs/main/a/at/找到旧版本供您检查。)

我不再非常密切地关注Ubuntu,但是假设他们从几个版本开始就接受了这个改变。实际上,http://packages.ubuntu.com/xenial/at似乎有相同的copyright文件。