hrev51629 adds 1 changeset to branch 'master'
old head: 8f087d87f9d334aaf43de5fec4a6253918332eae
new head: ef854aff3a5d27191a6dfafc8c248d95fe67a33d
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=ef854aff3a5d+%5E8f087d87f9d3
----------------------------------------------------------------------------
ef854aff3a5d: 3rdparty/kallisti5: License Guess Tool
* Pair it with a find, and pretty handy to
highlight sources which have a non-standard,
missing, or incompatible license.
[ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev51629
Commit: ef854aff3a5d27191a6dfafc8c248d95fe67a33d
URL: http://cgit.haiku-os.org/haiku/commit/?id=ef854aff3a5d
Author: Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date: Tue Nov 28 16:25:54 2017 UTC
----------------------------------------------------------------------------
1 file changed, 38 insertions(+)
3rdparty/kallisti5/licenseReport.rb | 38 +++++++++++++++++++++++++++++++++
----------------------------------------------------------------------------
diff --git a/3rdparty/kallisti5/licenseReport.rb
b/3rdparty/kallisti5/licenseReport.rb
new file mode 100755
index 0000000..09b8269
--- /dev/null
+++ b/3rdparty/kallisti5/licenseReport.rb
@@ -0,0 +1,38 @@
+#!/bin/env ruby
+#
+# Source Code License Guesser.
+# Copyright, 2017 Alexander von Gluck IV. All Rights Reserved
+# Released under the terms of the MIT license.
+#
+# Give a file, and I guess the license.
+#
+# Example Usage:
+#
+# haiku $ find src -name "*.cpp" -exec
./3rdparty/kallisti5/licenseReport.rb {} \;
+#
+
+@file = ARGV.first
+@licenses = [
+ {"MIT" => ["MIT License", "MIT Licence", "Haiku License", "X11
license"]},
+ {"BSD" => ["express or implied warranties", "provided by the author
``AS IS''", "the software is provided \"AS IS\"", "BSD license", "provided by
the author \"as is\""]},
+ {"BeOS Sample Code" => ["be sample code license"]},
+ {"GPL" => ["terms of the GNU General Public License", "GNU L-GPL
license", "GPL license"]},
+]
+
+def check_license(filename)
+ license = "unknown"
+ lines = File.foreach(filename).first(30).join("\n")
+ return "empty file" if lines == nil
+ @licenses.each do |entry|
+ entry.values.first.each do |pattern|
+ if lines.downcase.include?(pattern.downcase)
+ license = entry.keys.first
+ break
+ end
+ end
+ break if license != "unknown"
+ end
+ license
+end
+
+puts "#{@file}: #{check_license(@file)}"