aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/bitcoin-cli.bash-completion2
-rw-r--r--contrib/devtools/README.md20
-rwxr-xr-xcontrib/devtools/copyright_header.py47
-rwxr-xr-xcontrib/devtools/github-merge.py19
-rwxr-xr-xcontrib/gitian-build.py4
-rw-r--r--contrib/gitian-keys/keys.txt1
-rw-r--r--contrib/init/bitcoind.service34
-rwxr-xr-xcontrib/macdeploy/macdeployqtplus6
-rwxr-xr-xcontrib/verify-commits/verify-commits.py14
9 files changed, 94 insertions, 53 deletions
diff --git a/contrib/bitcoin-cli.bash-completion b/contrib/bitcoin-cli.bash-completion
index 732981fe7c..f4cac84182 100644
--- a/contrib/bitcoin-cli.bash-completion
+++ b/contrib/bitcoin-cli.bash-completion
@@ -50,7 +50,7 @@ _bitcoin_cli() {
COMPREPLY=( $( compgen -W "true false" -- "$cur" ) )
return 0
;;
- signrawtransaction)
+ signrawtransactionwithkey|signrawtransactionwithwallet)
COMPREPLY=( $( compgen -W "ALL NONE SINGLE ALL|ANYONECANPAY NONE|ANYONECANPAY SINGLE|ANYONECANPAY" -- "$cur" ) )
return 0
;;
diff --git a/contrib/devtools/README.md b/contrib/devtools/README.md
index a0b6225345..6ee65f40be 100644
--- a/contrib/devtools/README.md
+++ b/contrib/devtools/README.md
@@ -119,7 +119,25 @@ Configuring the github-merge tool for the bitcoin repository is done in the foll
git config githubmerge.repository bitcoin/bitcoin
git config githubmerge.testcmd "make -j4 check" (adapt to whatever you want to use for testing)
- git config --global user.signingkey mykeyid (if you want to GPG sign)
+ git config --global user.signingkey mykeyid
+
+Authentication (optional)
+--------------------------
+
+The API request limit for unauthenticated requests is quite low, but the
+limit for authenticated requests is much higher. If you start running
+into rate limiting errors it can be useful to set an authentication token
+so that the script can authenticate requests.
+
+- First, go to [Personal access tokens](https://github.com/settings/tokens).
+- Click 'Generate new token'.
+- Fill in an arbitrary token description. No further privileges are needed.
+- Click the `Generate token` button at the bottom of the form.
+- Copy the generated token (should be a hexadecimal string)
+
+Then do:
+
+ git config --global user.ghtoken "pasted token"
Create and verify timestamps of merge commits
---------------------------------------------
diff --git a/contrib/devtools/copyright_header.py b/contrib/devtools/copyright_header.py
index 6d7a592f01..f2987f2260 100755
--- a/contrib/devtools/copyright_header.py
+++ b/contrib/devtools/copyright_header.py
@@ -48,15 +48,22 @@ def applies_to_file(filename):
# obtain list of files in repo according to INCLUDE and EXCLUDE
################################################################################
-GIT_LS_CMD = 'git ls-files'
+GIT_LS_CMD = 'git ls-files --full-name'.split(' ')
+GIT_TOPLEVEL_CMD = 'git rev-parse --show-toplevel'.split(' ')
-def call_git_ls():
- out = subprocess.check_output(GIT_LS_CMD.split(' '))
+def call_git_ls(base_directory):
+ out = subprocess.check_output([*GIT_LS_CMD, base_directory])
return [f for f in out.decode("utf-8").split('\n') if f != '']
-def get_filenames_to_examine():
- filenames = call_git_ls()
- return sorted([filename for filename in filenames if
+def call_git_toplevel():
+ "Returns the absolute path to the project root"
+ return subprocess.check_output(GIT_TOPLEVEL_CMD).strip().decode("utf-8")
+
+def get_filenames_to_examine(base_directory):
+ "Returns an array of absolute paths to any project files in the base_directory that pass the include/exclude filters"
+ root = call_git_toplevel()
+ filenames = call_git_ls(base_directory)
+ return sorted([os.path.join(root, filename) for filename in filenames if
applies_to_file(filename)])
################################################################################
@@ -83,24 +90,12 @@ def compile_copyright_regex(copyright_style, year_style, name):
EXPECTED_HOLDER_NAMES = [
"Satoshi Nakamoto\n",
"The Bitcoin Core developers\n",
- "The Bitcoin Core developers \n",
"Bitcoin Core Developers\n",
- "the Bitcoin Core developers\n",
- "The Bitcoin developers\n",
- "The LevelDB Authors\. All rights reserved\.\n",
"BitPay Inc\.\n",
- "BitPay, Inc\.\n",
"University of Illinois at Urbana-Champaign\.\n",
- "MarcoFalke\n",
"Pieter Wuille\n",
- "Pieter Wuille +\*\n",
- "Pieter Wuille, Gregory Maxwell +\*\n",
- "Pieter Wuille, Andrew Poelstra +\*\n",
- "Andrew Poelstra +\*\n",
"Wladimir J. van der Laan\n",
"Jeff Garzik\n",
- "Diederik Huys, Pieter Wuille +\*\n",
- "Thomas Daede, Cory Fields +\*\n",
"Jan-Klaas Kollhof\n",
"Sam Rushing\n",
"ArtForz -- public domain half-a-node\n",
@@ -146,7 +141,7 @@ def file_has_without_c_style_copyright_for_holder(contents, holder_name):
################################################################################
def read_file(filename):
- return open(os.path.abspath(filename), 'r', encoding="utf8").read()
+ return open(filename, 'r', encoding="utf8").read()
def gather_file_info(filename):
info = {}
@@ -260,12 +255,9 @@ def print_report(file_infos, verbose):
print(SEPARATOR)
def exec_report(base_directory, verbose):
- original_cwd = os.getcwd()
- os.chdir(base_directory)
- filenames = get_filenames_to_examine()
+ filenames = get_filenames_to_examine(base_directory)
file_infos = [gather_file_info(f) for f in filenames]
print_report(file_infos, verbose)
- os.chdir(original_cwd)
################################################################################
# report cmd
@@ -325,13 +317,13 @@ def get_most_recent_git_change_year(filename):
################################################################################
def read_file_lines(filename):
- f = open(os.path.abspath(filename), 'r', encoding="utf8")
+ f = open(filename, 'r', encoding="utf8")
file_lines = f.readlines()
f.close()
return file_lines
def write_file_lines(filename, file_lines):
- f = open(os.path.abspath(filename), 'w', encoding="utf8")
+ f = open(filename, 'w', encoding="utf8")
f.write(''.join(file_lines))
f.close()
@@ -399,11 +391,8 @@ def update_updatable_copyright(filename):
"Copyright updated! -> %s" % last_git_change_year)
def exec_update_header_year(base_directory):
- original_cwd = os.getcwd()
- os.chdir(base_directory)
- for filename in get_filenames_to_examine():
+ for filename in get_filenames_to_examine(base_directory):
update_updatable_copyright(filename)
- os.chdir(original_cwd)
################################################################################
# update cmd
diff --git a/contrib/devtools/github-merge.py b/contrib/devtools/github-merge.py
index 4f827401fb..ab834b7623 100755
--- a/contrib/devtools/github-merge.py
+++ b/contrib/devtools/github-merge.py
@@ -23,6 +23,7 @@ import sys
import json
import codecs
from urllib.request import Request, urlopen
+from urllib.error import HTTPError
# External tools (can be overridden using environment)
GIT = os.getenv('GIT','git')
@@ -46,17 +47,24 @@ def git_config_get(option, default=None):
except subprocess.CalledProcessError:
return default
-def retrieve_pr_info(repo,pull):
+def retrieve_pr_info(repo,pull,ghtoken):
'''
Retrieve pull request information from github.
Return None if no title can be found, or an error happens.
'''
try:
req = Request("https://api.github.com/repos/"+repo+"/pulls/"+pull)
+ if ghtoken is not None:
+ req.add_header('Authorization', 'token ' + ghtoken)
result = urlopen(req)
reader = codecs.getreader('utf-8')
obj = json.load(reader(result))
return obj
+ except HTTPError as e:
+ error_message = e.read()
+ print('Warning: unable to retrieve pull information from github: %s' % e)
+ print('Detailed error: %s' % error_message)
+ return None
except Exception as e:
print('Warning: unable to retrieve pull information from github: %s' % e)
return None
@@ -134,6 +142,7 @@ def parse_arguments():
In addition, you can set the following git configuration variables:
githubmerge.repository (mandatory),
user.signingkey (mandatory),
+ user.ghtoken (default: none).
githubmerge.host (default: git@github.com),
githubmerge.branch (no default),
githubmerge.testcmd (default: none).
@@ -152,6 +161,7 @@ def main():
host = git_config_get('githubmerge.host','git@github.com')
opt_branch = git_config_get('githubmerge.branch',None)
testcmd = git_config_get('githubmerge.testcmd')
+ ghtoken = git_config_get('user.ghtoken')
signingkey = git_config_get('user.signingkey')
if repo is None:
print("ERROR: No repository configured. Use this command to set:", file=stderr)
@@ -162,14 +172,17 @@ def main():
print("git config --global user.signingkey <key>",file=stderr)
sys.exit(1)
- host_repo = host+":"+repo # shortcut for push/pull target
+ if host.startswith(('https:','http:')):
+ host_repo = host+"/"+repo+".git"
+ else:
+ host_repo = host+":"+repo
# Extract settings from command line
args = parse_arguments()
pull = str(args.pull[0])
# Receive pull information from github
- info = retrieve_pr_info(repo,pull)
+ info = retrieve_pr_info(repo,pull,ghtoken)
if info is None:
sys.exit(1)
title = info['title'].strip()
diff --git a/contrib/gitian-build.py b/contrib/gitian-build.py
index faf8b014aa..fc7fbb764d 100755
--- a/contrib/gitian-build.py
+++ b/contrib/gitian-build.py
@@ -51,8 +51,10 @@ def build():
os.chdir('gitian-builder')
os.makedirs('inputs', exist_ok=True)
- subprocess.check_call(['wget', '-N', '-P', 'inputs', 'http://downloads.sourceforge.net/project/osslsigncode/osslsigncode/osslsigncode-1.7.1.tar.gz'])
+ subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://downloads.sourceforge.net/project/osslsigncode/osslsigncode/osslsigncode-1.7.1.tar.gz'])
subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://bitcoincore.org/cfields/osslsigncode-Backports-to-1.7.1.patch'])
+ subprocess.check_call(["echo 'a8c4e9cafba922f89de0df1f2152e7be286aba73f78505169bc351a7938dd911 inputs/osslsigncode-Backports-to-1.7.1.patch' | sha256sum -c"], shell=True)
+ subprocess.check_call(["echo 'f9a8cdb38b9c309326764ebc937cba1523a3a751a7ab05df3ecc99d18ae466c9 inputs/osslsigncode-1.7.1.tar.gz' | sha256sum -c"], shell=True)
subprocess.check_call(['make', '-C', '../bitcoin/depends', 'download', 'SOURCES_PATH=' + os.getcwd() + '/cache/common'])
if args.linux:
diff --git a/contrib/gitian-keys/keys.txt b/contrib/gitian-keys/keys.txt
index 593fba1d09..80c18aa889 100644
--- a/contrib/gitian-keys/keys.txt
+++ b/contrib/gitian-keys/keys.txt
@@ -9,6 +9,7 @@ BF6273FAEF7CC0BA1F562E50989F6B3048A116B5 Dev Random
9A1689B60D1B3CCE9262307A2F40A9BF167FBA47 Erik Mossberg (erkmos)
D35176BE9264832E4ACA8986BF0792FBE95DC863 fivepiece
01CDF4627A3B88AAE4A571C87588242FBE38D3A8 Gavin Andresen
+D1DBF2C4B96F2DEBF4C16654410108112E7EA81F Hennadii Stepanov (hebasto)
D3CC177286005BB8FF673294C5242A1AB3936517 jl2012
32EE5C4C3FA15CCADB46ABE529D4BCB6416F53EC Jonas Schnelli
4B4E840451149DD7FB0D633477DFAB5C3108B9A8 Jorge Timon
diff --git a/contrib/init/bitcoind.service b/contrib/init/bitcoind.service
index 877abafd19..cfc5f77580 100644
--- a/contrib/init/bitcoind.service
+++ b/contrib/init/bitcoind.service
@@ -5,21 +5,45 @@
# See "man systemd.service" for details.
# Note that almost all daemon options could be specified in
-# /etc/bitcoin/bitcoin.conf
+# /etc/bitcoin/bitcoin.conf, except for those explicitly specified as arguments
+# in ExecStart=
[Unit]
Description=Bitcoin daemon
After=network.target
[Service]
-ExecStart=/usr/bin/bitcoind -daemon -conf=/etc/bitcoin/bitcoin.conf -pid=/run/bitcoind/bitcoind.pid
-# Creates /run/bitcoind owned by bitcoin
-RuntimeDirectory=bitcoind
-User=bitcoin
+ExecStart=/usr/bin/bitcoind -daemon \
+ -pid=/run/bitcoind/bitcoind.pid \
+ -conf=/etc/bitcoin/bitcoin.conf \
+ -datadir=/var/lib/bitcoind
+
+# Process management
+####################
+
Type=forking
PIDFile=/run/bitcoind/bitcoind.pid
Restart=on-failure
+# Directory creation and permissions
+####################################
+
+# Run as bitcoin:bitcoin
+User=bitcoin
+Group=bitcoin
+
+# /run/bitcoind
+RuntimeDirectory=bitcoind
+RuntimeDirectoryMode=0710
+
+# /etc/bitcoin
+ConfigurationDirectory=bitcoin
+ConfigurationDirectoryMode=0710
+
+# /var/lib/bitcoind
+StateDirectory=bitcoind
+StateDirectoryMode=0710
+
# Hardening measures
####################
diff --git a/contrib/macdeploy/macdeployqtplus b/contrib/macdeploy/macdeployqtplus
index 17ce6c44f9..9da03e5b02 100755
--- a/contrib/macdeploy/macdeployqtplus
+++ b/contrib/macdeploy/macdeployqtplus
@@ -172,12 +172,6 @@ class DeploymentInfo(object):
if os.path.exists(os.path.join(parentDir, "translations")):
# Classic layout, e.g. "/usr/local/Trolltech/Qt-4.x.x"
self.qtPath = parentDir
- elif os.path.exists(os.path.join(parentDir, "share", "qt4", "translations")):
- # MacPorts layout, e.g. "/opt/local/share/qt4"
- self.qtPath = os.path.join(parentDir, "share", "qt4")
- elif os.path.exists(os.path.join(os.path.dirname(parentDir), "share", "qt4", "translations")):
- # Newer Macports layout
- self.qtPath = os.path.join(os.path.dirname(parentDir), "share", "qt4")
else:
self.qtPath = os.getenv("QTDIR", None)
diff --git a/contrib/verify-commits/verify-commits.py b/contrib/verify-commits/verify-commits.py
index b3c8064ec2..6bbed01073 100755
--- a/contrib/verify-commits/verify-commits.py
+++ b/contrib/verify-commits/verify-commits.py
@@ -91,7 +91,7 @@ def main():
no_sha1 = True
prev_commit = ""
initial_commit = current_commit
- branch = subprocess.check_output([GIT, 'show', '-s', '--format=%H', initial_commit], universal_newlines=True, encoding='utf8').splitlines()[0]
+ branch = subprocess.check_output([GIT, 'show', '-s', '--format=%H', initial_commit]).decode('utf8').splitlines()[0]
# Iterate through commits
while True:
@@ -112,7 +112,7 @@ def main():
if prev_commit != "":
print("No parent of {} was signed with a trusted key!".format(prev_commit), file=sys.stderr)
print("Parents are:", file=sys.stderr)
- parents = subprocess.check_output([GIT, 'show', '-s', '--format=format:%P', prev_commit], universal_newlines=True, encoding='utf8').splitlines()[0].split(' ')
+ parents = subprocess.check_output([GIT, 'show', '-s', '--format=format:%P', prev_commit]).decode('utf8').splitlines()[0].split(' ')
for parent in parents:
subprocess.call([GIT, 'show', '-s', parent], stdout=sys.stderr)
else:
@@ -122,25 +122,25 @@ def main():
# Check the Tree-SHA512
if (verify_tree or prev_commit == "") and current_commit not in incorrect_sha512_allowed:
tree_hash = tree_sha512sum(current_commit)
- if ("Tree-SHA512: {}".format(tree_hash)) not in subprocess.check_output([GIT, 'show', '-s', '--format=format:%B', current_commit], universal_newlines=True, encoding='utf8').splitlines():
+ if ("Tree-SHA512: {}".format(tree_hash)) not in subprocess.check_output([GIT, 'show', '-s', '--format=format:%B', current_commit]).decode('utf8').splitlines():
print("Tree-SHA512 did not match for commit " + current_commit, file=sys.stderr)
sys.exit(1)
# Merge commits should only have two parents
- parents = subprocess.check_output([GIT, 'show', '-s', '--format=format:%P', current_commit], universal_newlines=True, encoding='utf8').splitlines()[0].split(' ')
+ parents = subprocess.check_output([GIT, 'show', '-s', '--format=format:%P', current_commit]).decode('utf8').splitlines()[0].split(' ')
if len(parents) > 2:
print("Commit {} is an octopus merge".format(current_commit), file=sys.stderr)
sys.exit(1)
# Check that the merge commit is clean
- commit_time = int(subprocess.check_output([GIT, 'show', '-s', '--format=format:%ct', current_commit], universal_newlines=True, encoding='utf8').splitlines()[0])
+ commit_time = int(subprocess.check_output([GIT, 'show', '-s', '--format=format:%ct', current_commit]).decode('utf8').splitlines()[0])
check_merge = commit_time > time.time() - args.clean_merge * 24 * 60 * 60 # Only check commits in clean_merge days
allow_unclean = current_commit in unclean_merge_allowed
if len(parents) == 2 and check_merge and not allow_unclean:
- current_tree = subprocess.check_output([GIT, 'show', '--format=%T', current_commit], universal_newlines=True, encoding='utf8').splitlines()[0]
+ current_tree = subprocess.check_output([GIT, 'show', '--format=%T', current_commit]).decode('utf8').splitlines()[0]
subprocess.call([GIT, 'checkout', '--force', '--quiet', parents[0]])
subprocess.call([GIT, 'merge', '--no-ff', '--quiet', '--no-gpg-sign', parents[1]], stdout=subprocess.DEVNULL)
- recreated_tree = subprocess.check_output([GIT, 'show', '--format=format:%T', 'HEAD'], universal_newlines=True, encoding='utf8').splitlines()[0]
+ recreated_tree = subprocess.check_output([GIT, 'show', '--format=format:%T', 'HEAD']).decode('utf8').splitlines()[0]
if current_tree != recreated_tree:
print("Merge commit {} is not clean".format(current_commit), file=sys.stderr)
subprocess.call([GIT, 'diff', current_commit])