splunk / splunk-shuttl

Splunk app for archive management, including HDFS support.
Apache License 2.0
36 stars 19 forks source link

audit all code to make sure Apache License boilerplate is applied #9

Closed borischen closed 12 years ago

petterik commented 12 years ago

Added Apache License to files without the license at the top of the file with:

find src test -name "*.java" | xargs head -n 1 | grep -B 1 package | grep -o "[A-Za-z]*/.*\.java" | while read file do ( echo "// Copyright (C) 2011 Splunk Inc. // // Splunk Inc. licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. " cat $file ) > $file.new && mv $file.new $file done

The add was verified by checking if there are any files that's either missing a license, or if there is one with to licenses: colordiff <(find src test -name "*.java") <(find src test -name "*.java" | xargs grep -H "// Copyright (C) 2011 Splunk Inc" | sed 's/:.*//')

I also found that there were some files that didn't have the license at the top. One file had the license starting at row three. I found the file and verified the change with:

grep_license() { find src test -name "*.java" | while read file; do echo -n "$file: "; head -n $1 $file | grep -o "// Copyright (C) 2011 Splunk Inc." done } colordiff <(grep_license 1) <(grep_license 3)

borischen commented 12 years ago

nice, maybe we should add a build target as a "test"

petterik commented 12 years ago

Yes. That should be simple enough. Creating issue