Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Framework, scripts and tests. #10

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 27 additions & 0 deletions .bitcoin-maintainer-tools.json
@@ -0,0 +1,27 @@
{
"description" : "This json object describes the local details of the repository to guide how the tools operate.",
"subtrees" : {
"description" : "Subtrees of the repository which should be ignored since they follow different rules. Expressed as a list of fmnmatch expressions.",
"fnmatches" : [
]
},
"no_copyright_header_expected" : {
"description" : "Source files where it is acceptable to not have a MIT Licence copyright header. Expressed as a list of fnmatch expressions.",
"fnmatches" : [
"*__init__.py",
"build-for-compare.py",
"clang-format.py"
]
},
"other_copyright_occurrences_expected" : {
"description" : "Files where it is expected to have an occurrence of the sequence of characters 'Copyright', 'COPYRIGHT', or 'copyright' in the file outside of the MIT Licence copyright header. This list helps to ensures we are keeping close track where there may be external considerations for licence and copyright. Expressed as a list of fnmatch expressions.",
"fnmatches" : [
"bin/checks.py",
"bin/reports.py",
"bin/copyright_header.py",
"test/test_all.py",
"test/test_copyright_header.py",
"clang-format.py"
]
}
}
82 changes: 82 additions & 0 deletions .fallback-bitcoin-maintainer-tools.json
@@ -0,0 +1,82 @@
{
"description" : "This json object is the failback for when the .bitcoin-maintainer-tools.json file is not present in the target repository. It describes the details of the repository to guide how the tools operate.",
"subtrees" : {
"description" : "Subtrees of the repository which should be ignored since they follow different rules. Expressed as a list of fmnmatch expressions.",
"fnmatches" : [
"src/secp256k1/*",
"src/leveldb/*",
"src/univalue/*",
"src/crypto/ctaes/*"
]
},
"clang_format_style" : {
"description" : "File in the repository which contains the clang-format style definition.",
"value" : "src/.clang-format"
},
"no_copyright_header_expected" : {
"description" : "Source files where it is acceptable to not have a MIT Licence copyright header. Expressed as a list of fnmatch expressions.",
"fnmatches" : [
"*__init__.py",
"doc/man/Makefile.am",
"build-aux/m4/ax_boost_base.m4",
"build-aux/m4/ax_boost_chrono.m4",
"build-aux/m4/ax_boost_filesystem.m4",
"build-aux/m4/ax_boost_program_options.m4",
"build-aux/m4/ax_boost_system.m4",
"build-aux/m4/ax_boost_thread.m4",
"build-aux/m4/ax_boost_unit_test_framework.m4",
"build-aux/m4/ax_check_compile_flag.m4",
"build-aux/m4/ax_check_link_flag.m4",
"build-aux/m4/ax_check_preproc_flag.m4",
"build-aux/m4/ax_cxx_compile_stdcxx.m4",
"build-aux/m4/ax_gcc_func_attribute.m4",
"build-aux/m4/ax_pthread.m4",
"build-aux/m4/l_atomic.m4",
"src/qt/bitcoinstrings.cpp",
"src/chainparamsseeds.h",
"src/tinyformat.h",
"qa/rpc-tests/test_framework/bignum.py",
"contrib/devtools/clang-format-diff.py",
"qa/rpc-tests/test_framework/authproxy.py",
"qa/rpc-tests/test_framework/key.py"
]
},
"clang_format_recommended" : {
"description" : "The recommendation for the minimum version of clang-format to be used for applying formatting. Different versions have small discrepancies for applied formatting and the tools will warn if an old version is being used.",
"min_version" : "3.9.0"
},
"other_copyright_occurrences_expected" : {
"description" : "Files where it is expected to have an occurrence of the sequence of characters 'Copyright', 'COPYRIGHT', or 'copyright' in the file outside of the MIT Licence copyright header. This list helps to ensures we are keeping close track where there may be external considerations for licence and copyright. Expressed as a list of fnmatch expressions.",
"fnmatches" : [
"contrib/devtools/copyright_header.py",
"contrib/devtools/gen-manpages.sh",
"share/qt/extract_strings_qt.py",
"src/Makefile.qt.include",
"src/clientversion.h",
"src/init.cpp",
"src/qt/bitcoinstrings.cpp",
"src/qt/splashscreen.cpp",
"src/util.cpp",
"src/util.h",
"src/tinyformat.h",
"contrib/devtools/clang-format-diff.py",
"qa/rpc-tests/test_framework/authproxy.py",
"qa/rpc-tests/test_framework/key.py",
"contrib/devtools/git-subtree-check.sh",
"build-aux/m4/l_atomic.m4",
"build-aux/m4/ax_boost_base.m4",
"build-aux/m4/ax_boost_chrono.m4",
"build-aux/m4/ax_boost_filesystem.m4",
"build-aux/m4/ax_boost_program_options.m4",
"build-aux/m4/ax_boost_system.m4",
"build-aux/m4/ax_boost_thread.m4",
"build-aux/m4/ax_boost_unit_test_framework.m4",
"build-aux/m4/ax_check_compile_flag.m4",
"build-aux/m4/ax_check_link_flag.m4",
"build-aux/m4/ax_check_preproc_flag.m4",
"build-aux/m4/ax_cxx_compile_stdcxx.m4",
"build-aux/m4/ax_gcc_func_attribute.m4",
"build-aux/m4/ax_pthread.m4"
]
}
}
25 changes: 25 additions & 0 deletions .travis.yml
@@ -0,0 +1,25 @@
sudo: required
dist: trusty
os: linux
language: generic
python:
- "3.6"
cache:
directories:
- /tmp/bitcoin-maintainer-tools/clang-release-dl/
- /tmp/bitcoin-maintainer-tools/berkeley-db/
env:
matrix:
- TEST_SCRIPT="test/test_clone_configure_build.py"
- TEST_SCRIPT="test/test_clang_static_analysis.py"
- TEST_SCRIPT="test/test_reports.py"
- TEST_SCRIPT="test/test_checks.py"
- TEST_SCRIPT="test/test_basic_style.py"
- TEST_SCRIPT="test/test_clang_format.py"
- TEST_SCRIPT="test/test_copyright_header.py"
- TEST_SCRIPT="bin/basic_style.py check bin/ framework/ test/"
- TEST_SCRIPT="bin/copyright_header.py check"
install:
- travis_retry sudo apt-get install libboost-all-dev libevent-dev libprotobuf-dev clang-3.8
script:
- travis_wait 60 $TEST_SCRIPT
91 changes: 91 additions & 0 deletions bin/README.md
@@ -0,0 +1,91 @@
Contents
========
This directory contains executable scripts for bitcoin developers and maintainers.

All scripts have a `-h` option which gives a detailed description of usage and options.

The scripts may write to `/tmp/bitcoin-maintainer-tools/` to hold state when needed.

Operations that generate information have a `--json` option to assist programmatic uses of the data.

clone\_configure\_build.py
==========================
Clones, configures builds a bitcoin repository to a given directory from scratch. This includes downloading and building BerkelyDB 4.8. It assumes the local environment has the rest of the dependency packages installed.

The upstream url and branch can be given as options.

It follows the most straightforward configuration path as described by `doc/build_unix.md` in `https://github.com/bitcoin/bitcoin`. If a non-default configuration is required, manual configuration is the best option.

clang\_format.py
================

Provides a set of subcommands for using the `clang-format` tool to operate on on source files.

clang\_format.py report
-----------------------
Generates a report with format metrics on the target repository or target files.

clang\_format.py check
-----------------------
Validates that the target repository or target files match a particular format.

clang\_format.py format
-----------------------
Applies formatting to a target repository or target files.

basic\_style.py
===============
Provides a set of subcommands that does some basic source file coding style checking and reporting. The style rules are defined inside the script as regex expressions.

basic\_style.py report
----------------------
Generates a report with metrics on the target repository or target files.

basic\_style.py check
---------------------
Validates that the target repository or target files match the style rules.

basic\_style.py fix
-------------------
Performs basic regex search-and-replace to fix the style issues that are found in the repo or in target files.

clang\_static\_analysis.py
==========================
Provides a set of subcommmands for running `scan-build` on the repository and revealing any issues.

clang\_static\_analysis.py report
---------------------------------
Runs `scan-build` and generates a summary report of the results.

clang\_static\_analysis.py check
---------------------------------
Runs `scan-build` and validates that there are no issues found. If there are issues found, details are displayed.

copyright\_header.py
====================
Provides a set of subcommands that analyze and assist managing the set of copyright headers of source files of the repository.

copyright\_header.py report
---------------------------
Generates a report with copyright header metrics of the target repository or target files.

copyright\_header.py check
--------------------------
Validates that the copyright headers of the target repository or target files are in an expected state.

copyright\_header.py update
---------------------------
Adjusts the end year of the copyright headers of the target repository or target files to make it match the year of the last edit, as determined by the `git log` output.

copyright\_header.py insert
---------------------------
Inserts a properly-formatted `The Bitcoin Core developers`-held MIT License copyright header in target files where it is currently missing.

reports.py
==========
Runs the suite of `report` subcommands provided by other scripts in this directory upon a target.

checks.py
=========
Runs the suite of `check` subcommands provided by other scripts in this directory upon a target.