Skip to content

Commit

Permalink
Use TravisCI to enforce copyright header rules for source files
Browse files Browse the repository at this point in the history
  • Loading branch information
isle2983 committed Jan 7, 2017
1 parent b64b1c6 commit 28f8a36
Show file tree
Hide file tree
Showing 4 changed files with 867 additions and 358 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ script:
- BITCOIN_CONFIG_ALL="--disable-dependency-tracking --prefix=$TRAVIS_BUILD_DIR/depends/$HOST --bindir=$OUTDIR/bin --libdir=$OUTDIR/lib"
- depends/$HOST/native/bin/ccache --max-size=$CCACHE_SIZE
- test -n "$USE_SHELL" && eval '"$USE_SHELL" -c "./autogen.sh"' || ./autogen.sh
- export SOURCE_ROOT=`pwd`
- mkdir build && cd build
- ../configure $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false)
- make $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && make $GOAL V=1 ; false )
- make distdir
- export LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/depends/$HOST/lib
- if [ "$RUN_TESTS" = "true" ]; then make $MAKEJOBS check VERBOSE=1; fi
- if [ "$RUN_TESTS" = "true" ]; then contrib/devtools/copyright_header.py ci_check $SOURCE_ROOT; fi
- if [ "$RUN_TESTS" = "true" ]; then qa/pull-tester/rpc-tests.py --coverage; fi
after_script:
- echo $TRAVIS_COMMIT_RANGE
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,7 @@ AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt
AC_CONFIG_FILES([qa/pull-tester/tests_config.py],[chmod +x qa/pull-tester/tests_config.py])
AC_CONFIG_FILES([contrib/devtools/split-debug.sh],[chmod +x contrib/devtools/split-debug.sh])
AC_CONFIG_LINKS([qa/pull-tester/rpc-tests.py:qa/pull-tester/rpc-tests.py])
AC_CONFIG_LINKS([contrib/devtools/copyright_header.py:contrib/devtools/copyright_header.py])

dnl boost's m4 checks do something really nasty: they export these vars. As a
dnl result, they leak into secp256k1's configure and crazy things happen.
Expand Down
25 changes: 19 additions & 6 deletions contrib/devtools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,32 @@ Provides utilities for managing copyright headers of `The Bitcoin Core
developers` in repository source files. It has three subcommands:

```
$ ./copyright_header.py report <base_directory> [verbose]
$ ./copyright_header.py report <base_directory>
$ ./copyright_header.py ci_check <base_directory>
$ ./copyright_header.py update <base_directory>
$ ./copyright_header.py insert <file>
```
Running these subcommands without arguments displays a usage string.

copyright\_header.py report \<base\_directory\> [verbose]
copyright\_header.py report \<base\_directory\>
---------------------------------------------------------

Produces a report of all copyright header notices found inside the source files
of a repository. Useful to quickly visualize the state of the headers.
Specifying `verbose` will list the full filenames of files of each category.
of a repository. Useful to quickly visualize the state of the headers in the
repository. If there are issues found, the specific files are listed with a
summary of what the issue is.

copyright\_header.py update \<base\_directory\> [verbose]
copyright\_header.py ci\_check \<base\_directory\>
---------------------------------------------------------

Similar to the `report` command, but is for the TravisCI system to run in order
to enforce rules for copyright headers. It returns a non-zero status if issues
are found. Also, it outputs a listing of specific files that have issues and
provides a suggestion for how to resolve by either fixing the file (because
there was an mistake) or by updating the script's rules (because making an
exception is appropriate).

copyright\_header.py update \<base\_directory\>
---------------------------------------------------------
Updates all the copyright headers of `The Bitcoin Core developers` which were
changed in a year more recent than is listed. For example:
Expand Down Expand Up @@ -81,7 +93,8 @@ The copyright dates will be set to be `<year_introduced>-<current_year>` where
year rather than two hyphenated years.

If the file already has a copyright for `The Bitcoin Core developers`, the
script will exit.
script will exit. If the file is in a subtree where a different copyright
header is appropriate, the script will exit.

gen-manpages.sh
===============
Expand Down
Loading

0 comments on commit 28f8a36

Please sign in to comment.