Skip to content

Commit 95ca6ae

Browse files
author
MarcoFalke
committed
Merge #17691: doc: Add missed copyright headers
fac86ac scripted-diff: Add missed copyright headers (Hennadii Stepanov) 6fde9d5 script: Update EXLUDE list in copyright_header.py (Hennadii Stepanov) 1998152 script: Add empty line after C++ copyright (Hennadii Stepanov) 071f2fc script: Add ability to insert copyright to *.sh (Hennadii Stepanov) Pull request description: This PR improves `contrib/devtools/copyright_header.py` script and adds copyright headers to the files in `src` and `test` directories with two exceptions: - [`src/reverse_iterator.h`](https://github.com/bitcoin/bitcoin/blob/master/src/reverse_iterator.h) (added to exceptions) - [`src/test/fuzz/FuzzedDataProvider.h`](https://github.com/bitcoin/bitcoin/blob/master/src/test/fuzz/FuzzedDataProvider.h) (added to exceptions) On master 5622d8f: ``` $ ./contrib/devtools/copyright_header.py report . | grep zero 25 with zero copyrights ``` With this PR: ``` $ ./contrib/devtools/copyright_header.py report . | grep zero 2 with zero copyrights ``` ~I am uncertain about our copyright policy with `build_msvc` and `contrib` directories content, so they are out of scope of this PR.~ ACKs for top commit: MarcoFalke: ACK fac86ac Tree-SHA512: d7832c4a7a1a3b7806119775b40ec35d7982f49ff0e6199b8cee4c0e0a36e68d51728b6ee9924b1c161df4bc6105bd93391b79d42914357fa522f499cb113fa8
2 parents 2aaeca5 + fac86ac commit 95ca6ae

22 files changed

+89
-8
lines changed

build_msvc/bitcoin_config.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright (c) 2018-2019 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
15
#ifndef BITCOIN_BITCOIN_CONFIG_H
26
#define BITCOIN_BITCOIN_CONFIG_H
37

build_msvc/msvc-autogen.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/usr/bin/env python3
2+
# Copyright (c) 2016-2019 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
25

36
import os
47
import re

build_msvc/testconsensus/testconsensus.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright (c) 2018 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
15
#include <iostream>
26

37
// bitcoin includes.

contrib/devtools/circular-dependencies.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/usr/bin/env python3
2+
# Copyright (c) 2018 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
25

36
import sys
47
import re

contrib/devtools/copyright_header.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
'src/qt/bitcoinstrings.cpp',
2020
'src/chainparamsseeds.h',
2121
# other external copyrights:
22+
'src/reverse_iterator.h',
23+
'src/test/fuzz/FuzzedDataProvider.h',
2224
'src/tinyformat.h',
2325
'test/functional/test_framework/bignum.py',
2426
# python init:
@@ -455,14 +457,14 @@ def get_header_lines(header, start_year, end_year):
455457
def get_cpp_header_lines_to_insert(start_year, end_year):
456458
return reversed(get_header_lines(CPP_HEADER, start_year, end_year))
457459

458-
PYTHON_HEADER = '''
460+
SCRIPT_HEADER = '''
459461
# Copyright (c) %s The Bitcoin Core developers
460462
# Distributed under the MIT software license, see the accompanying
461463
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
462464
'''
463465

464-
def get_python_header_lines_to_insert(start_year, end_year):
465-
return reversed(get_header_lines(PYTHON_HEADER, start_year, end_year))
466+
def get_script_header_lines_to_insert(start_year, end_year):
467+
return reversed(get_header_lines(SCRIPT_HEADER, start_year, end_year))
466468

467469
################################################################################
468470
# query git for year of last change
@@ -491,17 +493,18 @@ def file_has_hashbang(file_lines):
491493
return False
492494
return file_lines[0][:2] == '#!'
493495

494-
def insert_python_header(filename, file_lines, start_year, end_year):
496+
def insert_script_header(filename, file_lines, start_year, end_year):
495497
if file_has_hashbang(file_lines):
496498
insert_idx = 1
497499
else:
498500
insert_idx = 0
499-
header_lines = get_python_header_lines_to_insert(start_year, end_year)
501+
header_lines = get_script_header_lines_to_insert(start_year, end_year)
500502
for line in header_lines:
501503
file_lines.insert(insert_idx, line)
502504
write_file_lines(filename, file_lines)
503505

504506
def insert_cpp_header(filename, file_lines, start_year, end_year):
507+
file_lines.insert(0, '\n')
505508
header_lines = get_cpp_header_lines_to_insert(start_year, end_year)
506509
for line in header_lines:
507510
file_lines.insert(0, line)
@@ -513,8 +516,8 @@ def exec_insert_header(filename, style):
513516
sys.exit('*** %s already has a copyright by The Bitcoin Core developers'
514517
% (filename))
515518
start_year, end_year = get_git_change_year_range(filename)
516-
if style == 'python':
517-
insert_python_header(filename, file_lines, start_year, end_year)
519+
if style in ['python', 'shell']:
520+
insert_script_header(filename, file_lines, start_year, end_year)
518521
else:
519522
insert_cpp_header(filename, file_lines, start_year, end_year)
520523

@@ -555,11 +558,13 @@ def insert_cmd(argv):
555558
if not os.path.isfile(filename):
556559
sys.exit("*** bad filename: %s" % filename)
557560
_, extension = os.path.splitext(filename)
558-
if extension not in ['.h', '.cpp', '.cc', '.c', '.py']:
561+
if extension not in ['.h', '.cpp', '.cc', '.c', '.py', '.sh']:
559562
sys.exit("*** cannot insert for file extension %s" % extension)
560563

561564
if extension == '.py':
562565
style = 'python'
566+
elif extension == '.sh':
567+
style = 'shell'
563568
else:
564569
style = 'cpp'
565570
exec_insert_header(filename, style)

contrib/devtools/gen-manpages.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/usr/bin/env bash
2+
# Copyright (c) 2016-2019 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
25

36
export LC_ALL=C
47
TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)}

contrib/filter-lcov.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/usr/bin/env python3
2+
# Copyright (c) 2017-2018 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
25

36
import argparse
47

contrib/gitian-build.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/usr/bin/env python3
2+
# Copyright (c) 2018-2019 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
25

36
import argparse
47
import os

contrib/install_db4.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/sh
2+
# Copyright (c) 2017-2019 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
25

36
# Install libdb4.8 (Berkeley DB).
47

src/crypto/sha256_avx2.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright (c) 2017-2019 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
15
#ifdef ENABLE_AVX2
26

37
#include <stdint.h>

0 commit comments

Comments
 (0)