From f84f7bf1b35efa793cb3ff893a97e8b65982c01b Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sat, 20 Jan 2018 13:59:12 +0100 Subject: Fixed repo location in license headers --- tools/check-license.rb | 18 ++++++++++++++++++ tools/gen_authors.rb | 18 ++++++++++++++++++ tools/gen_authors.sh | 20 -------------------- tools/hooks/pre-commit.rb | 19 ------------------- 4 files changed, 36 insertions(+), 39 deletions(-) create mode 100755 tools/check-license.rb create mode 100755 tools/gen_authors.rb delete mode 100755 tools/gen_authors.sh delete mode 100755 tools/hooks/pre-commit.rb (limited to 'tools') diff --git a/tools/check-license.rb b/tools/check-license.rb new file mode 100755 index 0000000..8eeb6bb --- /dev/null +++ b/tools/check-license.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + +result = 0 +files = Dir.glob("src/**/*.h") + Dir.glob("src/**/*.cpp") \ + + Dir.glob("lib/**/*.h") + Dir.glob("lib/**/*.cpp") \ + + Dir.glob("plugins/**/*.h") + Dir.glob("plugins/**/*.cpp") + +puts 'Checking licenses...' +files.each { |name| + File.open(name) { |file| + if file.grep(/SPDX-License-Identifier/).empty? then + puts "Missing or incorrect license header: #{name}" + result += 1 + end + } +} + +exit result diff --git a/tools/gen_authors.rb b/tools/gen_authors.rb new file mode 100755 index 0000000..96f2679 --- /dev/null +++ b/tools/gen_authors.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby +# Generate list of authors from repository commits + +log = `hg log --template='{author}'%` + +authors = Hash.new(0) +log.split('%').each do |i| + authors[i] += 1 +end + +# sort list by descending number of commits +authors = authors.sort_by {|k, v| v}.reverse + +# print out authors +authors.each do |k, v| + #print " #{k} (#{v})\n" + print " #{k}\n" +end diff --git a/tools/gen_authors.sh b/tools/gen_authors.sh deleted file mode 100755 index ed24634..0000000 --- a/tools/gen_authors.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# -# Generate a list of everyone who has contributed to the project merging those -# who commited under two names or email addresses. -# Original: https://github.com/Arora/arora/blob/master/generateAuthors -# -# To can pass an arg (which goes to git log) -# Example: to see everyone who contributed between tag 0.6 and now -# ./generateAuthors 0.6..HEAD -# -# Currently this is sorted based on # of commits, sorting contributions is not -# a simple topic as pointed out in this article http://lwn.net/Articles/222773/ -# - -# List of aliases -# Aqua, Aqua-sama , Xian Nox, xiannox - -hg log --template='{author}\n' \ - | sort | uniq -c | sort -n -r \ - | sed -e 's/^ *[0-9]* / /g' diff --git a/tools/hooks/pre-commit.rb b/tools/hooks/pre-commit.rb deleted file mode 100755 index 825a851..0000000 --- a/tools/hooks/pre-commit.rb +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env ruby - -result = 0 -files = Dir.glob("src/**/*.h") + Dir.glob("src/**/*.cpp") + Dir.glob("lib/**/*.h") + Dir.glob("lib/**/*.cpp") - -puts "pre-commit: #{`pwd`}" - -puts 'Checking licenses...' -files.each { |name| - File.open(name) { |file| - if file.grep(/SPDX-License-Identifier/).empty? then - puts "Missing or incorrect license header: #{name}" - result = 1 - end - } -} - -puts "pre-commit exit(#{result})" -exit result -- cgit v1.2.1