Skip to content

Commit

Permalink
📄 Add NOTICE file and CI check, update README
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Tale-Yazdi <[email protected]>
  • Loading branch information
ggwpez committed Jul 23, 2020
1 parent 4640c10 commit af7ff17
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ code_quality:
copyright_notice:
<<: *only-default
stage: vetting
script: ".scripts/check-copyright-notice.sh"
script:
- .scripts/check-copyright-notice.sh
- .scripts/check-notice-authors.sh origin/dev

vanity_import:
<<: *only-default
Expand Down
71 changes: 71 additions & 0 deletions .scripts/check-notice-authors.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash

# Copyright 2020 - See NOTICE file for copyright holders.
#
# Licensed 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.

set -e
exit_code=0

# This script checks that all new commiters email adresses are contained in the NOTICE
# file.
# To check all commits on the current branch: ./check-notice-authors.sh
# To check all commits newer than base: ./check-notice-authors.sh base

# Call with an ancestor whereas all commits newer than the ancestor are checked.
base="$1"
if [ -z "$base" ]; then
commits="$(git rev-list --reverse HEAD)"
else
commits="$(git rev-list --reverse $base..HEAD)"
fi

# Authors found in commits and NOTICE.
declare -A known_authors
# Authors found only in commits but not NOTICE file.
declare -A assumed_authors

for c in $commits; do
author=$(git show -s --format='%an <%ae>' $c)
# Check Signed-Off-By message
if ! git show -s --format='%B' $c | grep -wq "Signed-off-by: $author"; then
echo "Commit $c is missing or has wrong 'Signed-off-by' message."
exit_code=1
fi

# Get the notice file of the commit and check that the author is in it.
notice=$(git show $c:NOTICE 2> /dev/null || true)
for k in "${known_authors[@]}"; do
a="${known_authors[$k]}"
if ! echo "$notice" | grep -wq "$a"; then
echo "Author '$a' was deleted from NOTICE in commit $c"
exit_code=1
fi
done
if [ -n "${assumed_authors[$author]}" ]; then
continue
fi
# This must be the first commit of this author, since he should add himself
# to the NOTICE file here.
if ! echo "$notice" | grep -wq "$author"; then
echo "Author '$author' is missing from NOTICE file and should have been added in commit $c."
assumed_authors[$author]="$author"
unset "known_authors[$author]"
exit_code=1
else
known_authors[$author]="$author"
unset "assumed_authors[$author]"
fi
done

exit $exit_code
17 changes: 13 additions & 4 deletions .scripts/copyright-notice
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
// Copyright (c) 20XX Chair of Applied Cryptography, Technische Universität
// Darmstadt, Germany. All rights reserved. This file is part of go-perun. Use
// of this source code is governed by the Apache 2.0 license that can be found
// in the LICENSE file.
// Copyright 20XX - See NOTICE file for copyright holders.
//
// Licensed 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.

36 changes: 36 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This is the official list of Perun Network go-perun copyright
# holders and authors.
#
# Often employers or academic institutions have ownership over code that is
# written in certain circumstances, so please do due diligence to ensure that
# you have the right to submit the code.
#
# When adding J Random Contributor's name to this file, either J's name on its
# own or J's name associated with J's organization's name should be added,
# depending on whether J's employer (or academic institution) has ownership
# over code that is written for this project.
#
# How to add names to this file:
# Individual's name <submission email address>.
#
# If Individual's organization is copyright holder of her contributions add the
# organization's name, optionally also the contributor's name:
#
# Organization's name
# Individual's name <submission corporate email address>
#
# Please keep the list in alphabetical order.

Chair of Applied Cryptography, Technische Universität Darmstadt, Germany
Hendrik Amler <[email protected]>
Christoph Conrads <[email protected]>
Norbert Dzikowski <[email protected]>
Luigi Iandolo <[email protected]>
Steffen Rattay <[email protected]>
Sebastian Stammler <[email protected]>
Oliver Tale-Yazdi <[email protected]>
Marius van der Wijden <[email protected]>

Robert Bosch GmbH
Manoranjith <[email protected]>
Anagha Sukumaran <[email protected]>
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ We thank the German Federal Ministry of Education and Research (BMBF) for their

## Copyright

Copyright &copy; 2020 Chair of Applied Cryptography, Technische Universität Darmstadt, Germany.
Copyright 2020 - See NOTICE file for copyright holders.
All rights reserved.
Use of the source code is governed by the Apache 2.0 license that can be found in the [LICENSE file](LICENSE).

Expand Down

0 comments on commit af7ff17

Please sign in to comment.