Merge remote-tracking branch 'zcash/master' into rebase

# Conflicts:
#	README.md
#	src/Makefile.gtest.include
#	src/chainparams.cpp
#	src/init.cpp
#	src/miner.cpp
#	src/wallet/wallet.cpp
This commit is contained in:
jl777
2016-12-12 12:19:13 +02:00
94 changed files with 3461 additions and 808 deletions

View File

@@ -23,10 +23,11 @@ if [ -d $BUILD_DIR ]; then
rm -R $BUILD_DIR
fi
DEB_CMP=$BUILD_DIR/etc/bash_completion.d
DEB_BIN=$BUILD_DIR/usr/bin
DEB_DOC=$BUILD_DIR/usr/share/doc/$PACKAGE_NAME
DEB_MAN=$BUILD_DIR/usr/share/man/man1
mkdir -p $BUILD_DIR/DEBIAN $DEB_BIN $DEB_DOC $DEB_MAN
mkdir -p $BUILD_DIR/DEBIAN $DEB_CMP $DEB_BIN $DEB_DOC $DEB_MAN
chmod 0755 -R $BUILD_DIR/*
# Copy control file
@@ -48,6 +49,9 @@ cp -r $SRC_DEB/examples $DEB_DOC
# Copy manpages
cp $SRC_DEB/manpages/zcashd.1 $DEB_MAN
cp $SRC_DEB/manpages/zcash-cli.1 $DEB_MAN
# Copy bash completion files
cp $SRC_PATH/contrib/bitcoind.bash-completion $DEB_CMP/zcashd
cp $SRC_PATH/contrib/bitcoin-cli.bash-completion $DEB_CMP/zcash-cli
# Gzip files
gzip --best -n $DEB_DOC/changelog
gzip --best -n $DEB_DOC/changelog.Debian

View File

@@ -1,7 +1,30 @@
#!/bin/bash
#!/usr/bin/env bash
set -eu -o pipefail
# Allow user overrides to $MAKE. Typical usage for users who need it:
# MAKE=gmake ./zcutil/build.sh -j$(nproc)
if [[ -z "${MAKE-}" ]]; then
MAKE=make
fi
# Allow overrides to $BUILD and $HOST for porters. Most users will not need it.
# BUILD=i686-pc-linux-gnu ./zcutil/build.sh
if [[ -z "${BUILD-}" ]]; then
BUILD=x86_64-unknown-linux-gnu
fi
if [[ -z "${HOST-}" ]]; then
HOST=x86_64-unknown-linux-gnu
fi
# Allow override to $CC and $CXX for porters. Most users will not need it.
if [[ -z "${CC-}" ]]; then
CC=gcc
fi
if [[ -z "${CXX-}" ]]; then
CXX=g++
fi
if [ "x$*" = 'x--help' ]
then
cat <<EOF
@@ -10,11 +33,13 @@ Usage:
$0 --help
Show this help message and exit.
$0 [ --enable-lcov ] [ MAKEARGS... ]
$0 [ --enable-lcov || --disable-tests ] [ MAKEARGS... ]
Build Zcash and most of its transitive dependencies from
source. MAKEARGS are applied to both dependencies and Zcash itself. If
--enable-lcov is passed, Zcash is configured to add coverage
source. MAKEARGS are applied to both dependencies and Zcash itself.
If --enable-lcov is passed, Zcash is configured to add coverage
instrumentation, thus enabling "make cov" to work.
If --disable-tests is passed instead, the Zcash tests are not built.
EOF
exit 0
fi
@@ -25,17 +50,21 @@ cd "$(dirname "$(readlink -f "$0")")/.."
# If --enable-lcov is the first argument, enable lcov coverage support:
LCOV_ARG=''
HARDENING_ARG='--enable-hardening'
TEST_ARG=''
if [ "x${1:-}" = 'x--enable-lcov' ]
then
LCOV_ARG='--enable-lcov'
HARDENING_ARG='--disable-hardening'
shift
elif [ "x${1:-}" = 'x--disable-tests' ]
then
TEST_ARG='--enable-tests=no'
shift
fi
# BUG: parameterize the platform/host directory:
PREFIX="$(pwd)/depends/x86_64-unknown-linux-gnu/"
PREFIX="$(pwd)/depends/$BUILD/"
HOST=x86_64-unknown-linux-gnu BUILD=x86_64-unknown-linux-gnu make "$@" -C ./depends/ V=1 NO_QT=1
HOST="$HOST" BUILD="$BUILD" "$MAKE" "$@" -C ./depends/ V=1 NO_QT=1
./autogen.sh
./configure --prefix="${PREFIX}" --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" CXXFLAGS='-fwrapv -fno-strict-aliasing -Werror -g'
make "$@" V=1
CC="$CC" CXX="$CXX" ./configure --prefix="${PREFIX}" --host="$HOST" --build="$BUILD" --with-gui=no "$HARDENING_ARG" "$LCOV_ARG" "$TEST_ARG" CXXFLAGS='-fwrapv -fno-strict-aliasing -Werror -g'
"$MAKE" "$@" V=1

View File

@@ -67,6 +67,10 @@ function main() {
cat <<EOF
Zcash - fetch-params.sh
This script will fetch the Zcash zkSNARK parameters and verify their
integrity with sha256sum.
If they already exist locally, it will exit now and do nothing else.
EOF
# Now create PARAMS_DIR and insert a README if necessary:
@@ -84,9 +88,6 @@ EOF
# This may be the first time the user's run this script, so give
# them some info, especially about bandwidth usage:
cat <<EOF
This script will fetch the Zcash zkSNARK parameters and verify their
integrity with sha256sum.
The parameters are currently just under 911MB in size, so plan accordingly
for your bandwidth constraints. If the files are already present and
have the correct sha256sum, no networking is used.
@@ -104,4 +105,5 @@ EOF
}
main
rm -f /tmp/fetch_params.lock
exit 0

99
zcutil/release-notes.py Normal file
View File

@@ -0,0 +1,99 @@
import re, sys, os, os.path
import subprocess
import argparse
from itertools import islice
from operator import itemgetter
author_aliases = {
'Simon': 'Simon Liu',
'bitcartel': 'Simon Liu',
'EthanHeilman': 'Ethan Heilman',
}
def apply_author_aliases(name):
if name in author_aliases:
return author_aliases[name]
else:
return name
def parse_authors(line):
commit_search = re.search('(\d+)', line)
if commit_search:
commits = commit_search.group(1)
else:
commits = 0
name = re.sub(' \(\d+\)|:|\n|\r\n$', '', line)
return name, commits
def alias_authors_in_release_notes(line):
for key in author_aliases:
if re.match(key, line):
line = line.replace(key, author_aliases[key])
break
return line
## Returns dict of {'author': #_of_commits} from a release note
def authors_in_release_notes(filename):
note = os.path.join(doc_dir, 'release-notes', filename)
with open(note, 'r') as f:
authors = {}
line = f.readline()
first_name, commits = parse_authors(line)
authors[apply_author_aliases(first_name)] = commits
for line in f:
if line in ['\n', '\r\n']:
for author in islice(f, 1):
name, commits = parse_authors(author)
authors[apply_author_aliases(name)] = commits
return authors
## Sums commits made by contributors in each Zcash release note in ./doc/release-notes and writes to authors.md
def document_authors():
print "Writing contributors documented in release-notes directory to authors.md."
authors_file = os.path.join(doc_dir, 'authors.md')
with open(authors_file, 'w') as f:
f.write('Zcash Contributors\n==================\n\n')
total_contrib = {}
for notes in os.listdir(os.path.join(doc_dir, 'release-notes')):
authors = authors_in_release_notes(notes)
for author in authors:
commits = int(authors[author])
if author in total_contrib:
total_contrib[author] += commits
else:
total_contrib[author] = commits
sorted_contrib = sorted(total_contrib.items(), key=itemgetter(1, 0), reverse=True)
for n, c in sorted_contrib:
if c != 0:
f.write("{0} ({1})\n".format(n, c))
## Writes release note to ./doc/release-notes based on git shortlog when current version number is specified
def generate_release_note(version, filename):
print "Automatically generating release notes for {0} from git shortlog. Should review {1} for accuracy.".format(version, filename)
latest_tag = subprocess.Popen(['git describe --abbrev=0'], shell=True, stdout=subprocess.PIPE).communicate()[0].strip()
print "Previous release tag: ", latest_tag
notes = subprocess.Popen(['git shortlog --no-merges {0}..HEAD'.format(latest_tag)], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0]
lines = notes.split('\n')
lines = [alias_authors_in_release_notes(line) for line in lines]
release_note = os.path.join(doc_dir, 'release-notes', 'release-notes-{0}.md'.format(version))
with open(release_note, 'w') as f:
f.writelines('\n'.join(lines))
def main(version, filename):
if version != None:
generate_release_note(version, filename)
document_authors()
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--version')
args = parser.parse_args()
root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
doc_dir = os.path.join(root_dir, 'doc')
version = None
filename = None
if args.version:
version = args.version
filename = 'release-notes-{0}.md'.format(version)
main(version, filename)