Skip to content

Commit

Permalink
Update license wording (dgraph-io#2384)
Browse files Browse the repository at this point in the history
Add a python script which can make the copyright notice update accurate.

Replace the older licenses still present in worker directory.
  • Loading branch information
manishrjain authored May 10, 2018
1 parent e09e8ec commit e6c3e76
Show file tree
Hide file tree
Showing 184 changed files with 297 additions and 433 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Dgraph Licensing

Copyright 2016-2018 Dgraph Labs, Inc. and Contributors
Copyright 2016-2018 Dgraph Labs, Inc.

Licensed under the Apache License, Version 2.0 (the "License") and the Commons
Clause Restriction; you may not use this file except in compliance with the
Expand Down
2 changes: 1 addition & 1 deletion algo/doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2016-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion algo/heap.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2016-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion algo/heap_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2016-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion algo/uidlist.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2016-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion algo/uidlist_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2016-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion conn/node.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion conn/pool.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2016-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
4 changes: 2 additions & 2 deletions contrib/integration/acctupsert/main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand All @@ -18,8 +18,8 @@ import (
"time"

"github.com/dgraph-io/dgo"
"github.com/dgraph-io/dgo/x"
"github.com/dgraph-io/dgo/protos/api"
"github.com/dgraph-io/dgo/x"
"github.com/dgraph-io/dgo/y"
"google.golang.org/grpc"
)
Expand Down
4 changes: 2 additions & 2 deletions contrib/integration/bank/main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand All @@ -21,8 +21,8 @@ import (
"time"

"github.com/dgraph-io/dgo"
"github.com/dgraph-io/dgo/x"
"github.com/dgraph-io/dgo/protos/api"
"github.com/dgraph-io/dgo/x"
"google.golang.org/grpc"
)

Expand Down
4 changes: 2 additions & 2 deletions contrib/integration/bigdata/main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018 Dgraph Labs, Inc. and Contributors
* Copyright 2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand All @@ -20,8 +20,8 @@ import (
"time"

"github.com/dgraph-io/dgo"
"github.com/dgraph-io/dgo/x"
"github.com/dgraph-io/dgo/protos/api"
"github.com/dgraph-io/dgo/x"
"google.golang.org/grpc"
)

Expand Down
4 changes: 2 additions & 2 deletions contrib/integration/mutates/main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand All @@ -15,8 +15,8 @@ import (
"log"

"github.com/dgraph-io/dgo"
"github.com/dgraph-io/dgo/x"
"github.com/dgraph-io/dgo/protos/api"
"github.com/dgraph-io/dgo/x"
"google.golang.org/grpc"
)

Expand Down
2 changes: 1 addition & 1 deletion contrib/integration/share/share_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion contrib/integration/share/stub.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
4 changes: 2 additions & 2 deletions contrib/integration/swap/main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand All @@ -20,8 +20,8 @@ import (
"time"

"github.com/dgraph-io/dgo"
"github.com/dgraph-io/dgo/x"
"github.com/dgraph-io/dgo/protos/api"
"github.com/dgraph-io/dgo/x"
"google.golang.org/grpc"
)

Expand Down
2 changes: 1 addition & 1 deletion contrib/integration/swap/words.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
4 changes: 2 additions & 2 deletions contrib/integration/testtxn/main_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand All @@ -19,8 +19,8 @@ import (
"time"

"github.com/dgraph-io/dgo"
"github.com/dgraph-io/dgo/x"
"github.com/dgraph-io/dgo/protos/api"
"github.com/dgraph-io/dgo/x"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
)
Expand Down
60 changes: 60 additions & 0 deletions contrib/scripts/license.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/python

import sys

notice = """
/*
* Copyright 2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
*/
"""

def addCopyright(file):
print("Add copyright to", file)
f = open(file, "r+")
lines = f.readlines()
lines.insert(0, notice)
f.seek(0)
for l in lines:
f.write(l)
f.close()

def update(file):
f = open(file, "r")
lines = f.readlines()
f.close()

found = False
for idx, l in enumerate(lines):
if "Copyright" in l and "Dgraph" in l:
start = idx - 1
found = True
break

if not found:
addCopyright(file)
return

for idx, l in enumerate(lines[start:]):
if "*/" in l:
end = start + idx
break

if end == 0:
print "ERROR: Couldn't find copyright:", file
return

updated = lines[:start]
updated.extend(lines[end+1:])
updated.insert(start, notice)
f = open(file, "w")
for l in updated:
f.write(l)
f.close()

if len(sys.argv) == 0:
sys.exit(0)

update(sys.argv[1])
26 changes: 6 additions & 20 deletions contrib/scripts/license.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,16 @@
files=$(find . ! -path "./vendor/*" ! -path "./bp128/*" -type f -name "*.go")

cat > /tmp/notice << EOF
/*
* Copyright 2018 Dgraph Labs, Inc. and Contributors
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
*/
EOF

echo "NOTICE IS:"
cat /tmp/notice

for f in $files; do
if ! grep -L "Copyright" $f; then
echo "Couldn't find copyright in $f. Adding it."
cat /tmp/notice > /tmp/codefile
cat $f >> /tmp/codefile
mv /tmp/codefile $f
fi
echo "Processing $f"
python2 contrib/scripts/license.py $f

# Start from year.
year=$(git log --format=%aD $f | tail -1 | awk '{print $4}')
echo $year, $f
if [ "$year" != "2018" ]; then
sed -i "s/Copyright 2018 Dgraph/Copyright $year-2018 Dgraph/g" $f
fi

# Format it.
gofmt -w $f
done

2 changes: 1 addition & 1 deletion contrib/stopwords/scraper.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/bulk/count_index.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/bulk/loader.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/bulk/mapper.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/bulk/merge_shards.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/bulk/metrics.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/bulk/progress.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/bulk/reduce.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/bulk/run.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/bulk/schema.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/bulk/shard_map.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/bulk/shuffle.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/bulk/ulimit_unix.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// +build !windows

/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/bulk/ulimit_windows.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// +build windows

/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/dgraph-converter/main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
2 changes: 1 addition & 1 deletion dgraph/cmd/live/batch.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2018 Dgraph Labs, Inc. and Contributors
* Copyright 2017-2018 Dgraph Labs, Inc.
*
* This file is available under the Apache License, Version 2.0,
* with the Commons Clause restriction.
Expand Down
Loading

0 comments on commit e6c3e76

Please sign in to comment.