Skip to content

Commit 019b8f4

Browse files
committed
Update contrib/devtools/README.md
Prep for new/renamed scripts
1 parent 2bc9d1b commit 019b8f4

File tree

1 file changed

+128
-29
lines changed

1 file changed

+128
-29
lines changed

contrib/devtools/README.md

Lines changed: 128 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Contents
2-
===========
2+
========
33
This directory contains tools for developers working on this repository.
44

55
check-doc.py
@@ -8,6 +8,93 @@ check-doc.py
88
Check if all command line args are documented. The return value indicates the
99
number of undocumented args.
1010

11+
clang-format-diff.py
12+
===================
13+
14+
A script to format unified git diffs according to [.clang-format](../../src/.clang-format).
15+
16+
Requires `clang-format`, installed e.g. via `brew install clang-format` on macOS.
17+
18+
For instance, to format the last commit with 0 lines of context,
19+
the script should be called from the git root folder as follows.
20+
21+
```
22+
git diff -U0 HEAD~1.. | ./contrib/devtools/clang-format-diff.py -p1 -i -v
23+
```
24+
25+
copyright\_header.py
26+
====================
27+
28+
Provides utilities for managing copyright headers of `The PIVX
29+
developers` in repository source files. It has three subcommands:
30+
31+
```
32+
$ ./copyright_header.py report <base_directory> [verbose]
33+
$ ./copyright_header.py update <base_directory>
34+
$ ./copyright_header.py insert <file>
35+
```
36+
Running these subcommands without arguments displays a usage string.
37+
38+
copyright\_header.py report \<base\_directory\> [verbose]
39+
---------------------------------------------------------
40+
41+
Produces a report of all copyright header notices found inside the source files
42+
of a repository. Useful to quickly visualize the state of the headers.
43+
Specifying `verbose` will list the full filenames of files of each category.
44+
45+
copyright\_header.py update \<base\_directory\> [verbose]
46+
---------------------------------------------------------
47+
Updates all the copyright headers of `The PIVX developers` which were
48+
changed in a year more recent than is listed. For example:
49+
```
50+
// Copyright (c) <firstYear>-<lastYear> The PIVX developers
51+
```
52+
will be updated to:
53+
```
54+
// Copyright (c) <firstYear>-<lastModifiedYear> The PIVX developers
55+
```
56+
where `<lastModifiedYear>` is obtained from the `git log` history.
57+
58+
This subcommand also handles copyright headers that have only a single year. In
59+
those cases:
60+
```
61+
// Copyright (c) <year> The PIVX developers
62+
```
63+
will be updated to:
64+
```
65+
// Copyright (c) <year>-<lastModifiedYear> The PIVX developers
66+
```
67+
where the update is appropriate.
68+
69+
copyright\_header.py insert \<file\>
70+
------------------------------------
71+
Inserts a copyright header for `The PIVX developers` at the top of the
72+
file in either Python or C++ style as determined by the file extension. If the
73+
file is a Python file and it has `#!` starting the first line, the header is
74+
inserted in the line below it.
75+
76+
The copyright dates will be set to be `<year_introduced>-<current_year>` where
77+
`<year_introduced>` is according to the `git log` history. If
78+
`<year_introduced>` is equal to `<current_year>`, it will be set as a single
79+
year rather than two hyphenated years.
80+
81+
If the file already has a copyright for `The PIVX developers`, the
82+
script will exit.
83+
84+
gen-manpages.sh
85+
===============
86+
87+
A small script to automatically create manpages in ../../doc/man by running the release binaries with the -help option.
88+
This requires help2man which can be found at: https://www.gnu.org/software/help2man/
89+
90+
With in-tree builds this tool can be run from any directory within the
91+
repostitory. To use this tool with out-of-tree builds set `BUILDDIR`. For
92+
example:
93+
94+
```bash
95+
BUILDDIR=$PWD/build contrib/devtools/gen-manpages.sh
96+
```
97+
1198
github-merge.py
1299
===============
13100

@@ -40,43 +127,44 @@ Configuring the github-merge tool for the PIVX repository is done in the followi
40127

41128
git config githubmerge.repository PIVX-Project/PIVX
42129
git config githubmerge.testcmd "make -j4 check" (adapt to whatever you want to use for testing)
43-
git config --global user.signingkey mykeyid (if you want to GPG sign)
44-
45-
optimize-pngs.py
46-
================
47-
48-
A script to optimize png files in the PIVX
49-
repository (requires pngcrush).
130+
git config --global user.signingkey mykeyid
50131

51-
fix-copyright-headers.py
52-
===========================
132+
Authentication (optional)
133+
--------------------------
53134

54-
Every year newly updated files need to have its copyright headers updated to reflect the current year.
55-
If you run this script from src/ it will automatically update the year on the copyright header for all
56-
.cpp and .h files if these have a git commit from the current year.
135+
The API request limit for unauthenticated requests is quite low, but the
136+
limit for authenticated requests is much higher. If you start running
137+
into rate limiting errors it can be useful to set an authentication token
138+
so that the script can authenticate requests.
57139

58-
For example a file changed in 2014 (with 2014 being the current year):
59-
```// Copyright (c) 2009-2013 The Bitcoin developers```
140+
- First, go to [Personal access tokens](https://github.com/settings/tokens).
141+
- Click 'Generate new token'.
142+
- Fill in an arbitrary token description. No further privileges are needed.
143+
- Click the `Generate token` button at the bottom of the form.
144+
- Copy the generated token (should be a hexadecimal string)
60145

61-
would be changed to:
62-
```// Copyright (c) 2009-2014 The Bitcoin developers```
146+
Then do:
63147

64-
logprint-scanner.py
65-
===================
66-
LogPrint and LogPrintf are known to throw exceptions when the number of arguments supplied to the
67-
LogPrint(f) function is not the same as the number of format specifiers.
148+
git config --global user.ghtoken "pasted token"
68149

69-
Ideally, the presentation of this mismatch would be at compile-time, but instead it is at run-time.
150+
Create and verify timestamps of merge commits
151+
---------------------------------------------
152+
To create or verify timestamps on the merge commits, install the OpenTimestamps
153+
client via `pip3 install opentimestamps-client`. Then, dowload the gpg wrapper
154+
`ots-git-gpg-wrapper.sh` and set it as git's `gpg.program`. See
155+
[the ots git integration documentation](https://github.com/opentimestamps/opentimestamps-client/blob/master/doc/git-integration.md#usage)
156+
for further details.
70157

71-
This script scans the src/ directory recursively and looks in each .cpp/.h file and identifies all
72-
errorneous LogPrint(f) calls where the number of arguments do not match.
158+
optimize-pngs.py
159+
================
73160

74-
The filename and line number of the errorneous occurence is given.
161+
A script to optimize png files in the PIVX
162+
repository (requires pngcrush).
75163

76-
The script returns with the number of erroneous occurences as an error code to help facilitate
77-
integration with a continuous integration system.
164+
security-check.py and test-security-check.py
165+
============================================
78166

79-
The script can be ran from any working directory inside the git repository.
167+
Perform basic ELF security checks on a series of executables.
80168

81169
symbol-check.py
82170
===============
@@ -87,7 +175,7 @@ still compatible with the minimum supported Linux distribution versions.
87175

88176
Example usage after a gitian build:
89177

90-
find ../gitian-builder/build -type f -executable | xargs python contrib/devtools/symbol-check.py
178+
find ../gitian-builder/build -type f -executable | xargs python3 contrib/devtools/symbol-check.py
91179

92180
If only supported symbols are used the return value will be 0 and the output will be empty.
93181

@@ -109,3 +197,14 @@ It will do the following automatically:
109197
- add missing translations to the build system (TODO)
110198

111199
See doc/translation-process.md for more information.
200+
201+
circular-dependencies.py
202+
========================
203+
204+
Run this script from the root of the source tree (`src/`) to find circular dependencies in the source code.
205+
This looks only at which files include other files, treating the `.cpp` and `.h` file as one unit.
206+
207+
Example usage:
208+
209+
cd .../src
210+
../contrib/devtools/circular-dependencies.py {*,*/*,*/*/*}.{h,cpp}

0 commit comments

Comments
 (0)