• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..29-Apr-2020-

README.mdH A D29-Apr-20207.2 KiB203150

circular-dependencies.pyH A D29-Apr-20202.6 KiB8061

clang-format-diff.pyH A D29-Apr-20206.1 KiB16793

copyright_header.pyH A D29-Apr-202021.5 KiB602426

gen-manpages.shH A D29-Apr-20201.2 KiB3420

github-merge.pyH A D29-Apr-202014 KiB341268

optimize-pngs.pyH A D29-Apr-20203.4 KiB7760

security-check.pyH A D29-Apr-20208 KiB216186

split-debug.sh.inH A D29-Apr-2020359 118

symbol-check.pyH A D29-Apr-20206.6 KiB178131

test-security-check.pyH A D29-Apr-20203.6 KiB7258

update-translations.pyH A D29-Apr-20208.2 KiB216156

README.md

1Contents
2========
3This directory contains tools for developers working on this repository.
4
5clang-format-diff.py
6===================
7
8A script to format unified git diffs according to [.clang-format](../../src/.clang-format).
9
10For instance, to format the last commit with 0 lines of context,
11the script should be called from the git root folder as follows.
12
13```
14git diff -U0 HEAD~1.. | ./contrib/devtools/clang-format-diff.py -p1 -i -v
15```
16
17copyright\_header.py
18====================
19
20Provides utilities for managing copyright headers of `The Bitcoin Core
21developers` in repository source files. It has three subcommands:
22
23```
24$ ./copyright_header.py report <base_directory> [verbose]
25$ ./copyright_header.py update <base_directory>
26$ ./copyright_header.py insert <file>
27```
28Running these subcommands without arguments displays a usage string.
29
30copyright\_header.py report \<base\_directory\> [verbose]
31---------------------------------------------------------
32
33Produces a report of all copyright header notices found inside the source files
34of a repository. Useful to quickly visualize the state of the headers.
35Specifying `verbose` will list the full filenames of files of each category.
36
37copyright\_header.py update \<base\_directory\> [verbose]
38---------------------------------------------------------
39Updates all the copyright headers of `The Bitcoin Core developers` which were
40changed in a year more recent than is listed. For example:
41```
42// Copyright (c) <firstYear>-<lastYear> The Bitcoin Core developers
43```
44will be updated to:
45```
46// Copyright (c) <firstYear>-<lastModifiedYear> The Bitcoin Core developers
47```
48where `<lastModifiedYear>` is obtained from the `git log` history.
49
50This subcommand also handles copyright headers that have only a single year. In
51those cases:
52```
53// Copyright (c) <year> The Bitcoin Core developers
54```
55will be updated to:
56```
57// Copyright (c) <year>-<lastModifiedYear> The Bitcoin Core developers
58```
59where the update is appropriate.
60
61copyright\_header.py insert \<file\>
62------------------------------------
63Inserts a copyright header for `The Bitcoin Core developers` at the top of the
64file in either Python or C++ style as determined by the file extension. If the
65file is a Python file and it has  `#!` starting the first line, the header is
66inserted in the line below it.
67
68The copyright dates will be set to be `<year_introduced>-<current_year>` where
69`<year_introduced>` is according to the `git log` history. If
70`<year_introduced>` is equal to `<current_year>`, it will be set as a single
71year rather than two hyphenated years.
72
73If the file already has a copyright for `The Bitcoin Core developers`, the
74script will exit.
75
76gen-manpages.sh
77===============
78
79A small script to automatically create manpages in ../../doc/man by running the release binaries with the -help option.
80This requires help2man which can be found at: https://www.gnu.org/software/help2man/
81
82With in-tree builds this tool can be run from any directory within the
83repostitory. To use this tool with out-of-tree builds set `BUILDDIR`. For
84example:
85
86```bash
87BUILDDIR=$PWD/build contrib/devtools/gen-manpages.sh
88```
89
90github-merge.py
91===============
92
93A small script to automate merging pull-requests securely and sign them with GPG.
94
95For example:
96
97  ./github-merge.py 3077
98
99(in any git repository) will help you merge pull request #3077 for the
100bitcoin/bitcoin repository.
101
102What it does:
103* Fetch master and the pull request.
104* Locally construct a merge commit.
105* Show the diff that merge results in.
106* Ask you to verify the resulting source tree (so you can do a make
107check or whatever).
108* Ask you whether to GPG sign the merge commit.
109* Ask you whether to push the result upstream.
110
111This means that there are no potential race conditions (where a
112pullreq gets updated while you're reviewing it, but before you click
113merge), and when using GPG signatures, that even a compromised GitHub
114couldn't mess with the sources.
115
116Setup
117---------
118Configuring the github-merge tool for the bitcoin repository is done in the following way:
119
120    git config githubmerge.repository bitcoin/bitcoin
121    git config githubmerge.testcmd "make -j4 check" (adapt to whatever you want to use for testing)
122    git config --global user.signingkey mykeyid
123
124Authentication (optional)
125--------------------------
126
127The API request limit for unauthenticated requests is quite low, but the
128limit for authenticated requests is much higher. If you start running
129into rate limiting errors it can be useful to set an authentication token
130so that the script can authenticate requests.
131
132- First, go to [Personal access tokens](https://github.com/settings/tokens).
133- Click 'Generate new token'.
134- Fill in an arbitrary token description. No further privileges are needed.
135- Click the `Generate token` button at the bottom of the form.
136- Copy the generated token (should be a hexadecimal string)
137
138Then do:
139
140    git config --global user.ghtoken "pasted token"
141
142Create and verify timestamps of merge commits
143---------------------------------------------
144To create or verify timestamps on the merge commits, install the OpenTimestamps
145client via `pip3 install opentimestamps-client`. Then, dowload the gpg wrapper
146`ots-git-gpg-wrapper.sh` and set it as git's `gpg.program`. See
147[the ots git integration documentation](https://github.com/opentimestamps/opentimestamps-client/blob/master/doc/git-integration.md#usage)
148for further details.
149
150optimize-pngs.py
151================
152
153A script to optimize png files in the bitcoin
154repository (requires pngcrush).
155
156security-check.py and test-security-check.py
157============================================
158
159Perform basic ELF security checks on a series of executables.
160
161symbol-check.py
162===============
163
164A script to check that the (Linux) executables produced by gitian only contain
165allowed gcc, glibc and libstdc++ version symbols. This makes sure they are
166still compatible with the minimum supported Linux distribution versions.
167
168Example usage after a gitian build:
169
170    find ../gitian-builder/build -type f -executable | xargs python contrib/devtools/symbol-check.py
171
172If only supported symbols are used the return value will be 0 and the output will be empty.
173
174If there are 'unsupported' symbols, the return value will be 1 a list like this will be printed:
175
176    .../64/test_bitcoin: symbol memcpy from unsupported version GLIBC_2.14
177    .../64/test_bitcoin: symbol __fdelt_chk from unsupported version GLIBC_2.15
178    .../64/test_bitcoin: symbol std::out_of_range::~out_of_range() from unsupported version GLIBCXX_3.4.15
179    .../64/test_bitcoin: symbol _ZNSt8__detail15_List_nod from unsupported version GLIBCXX_3.4.15
180
181update-translations.py
182======================
183
184Run this script from the root of the repository to update all translations from transifex.
185It will do the following automatically:
186
187- fetch all translations
188- post-process them into valid and committable format
189- add missing translations to the build system (TODO)
190
191See doc/translation-process.md for more information.
192
193circular-dependencies.py
194========================
195
196Run this script from the root of the source tree (`src/`) to find circular dependencies in the source code.
197This looks only at which files include other files, treating the `.cpp` and `.h` file as one unit.
198
199Example usage:
200
201    cd .../src
202    ../contrib/devtools/circular-dependencies.py {*,*/*,*/*/*}.{h,cpp}
203