-
Notifications
You must be signed in to change notification settings - Fork 42
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
add more developer docs #1089
add more developer docs #1089
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -357,6 +357,7 @@ Note: One of the functional tests deletes a source, so you may need to add it ba | |
7. Add a detached signature (with the release key) for the source tarball. | ||
8. Submit the source tarball and signature via PR into this [repository](https://github.com/freedomofpress/securedrop-debian-packaging) along with the debian changelog addition. This tarball and changelog will be used by the package builder. | ||
|
||
|
||
## Debugging | ||
|
||
To use `pdb`, add these lines: | ||
|
@@ -369,3 +370,73 @@ Then you can use [`pdb` commands](https://docs.python.org/3/library/pdb.html#deb | |
|
||
Logs can be found in the `{sdc-home}/logs`. If you are debugging a version of this application installed from a deb package in Qubes, you can debug issues by looking at the log file in `~/.securedrop_client/logs/client.log`. You can also add additional log lines in the running code in | ||
`/opt/venvs/securedrop-client/lib/python3.7/site-packages/securedrop_client/`. | ||
|
||
Sometimes there is a bug in Qt rather than the client, so it helps to install [a debug version of PyQt5](#build-and-install-a-debug-version-of-pyqt5) which will allow you to see Qt debug symbols in your Python tracebacks. You can use `gdb` to view a traceback as well as a core file, if you're debugging a segfault, but first you must need to install the following some additional packages in order for `gdb` to work with Python programs. | ||
|
||
``` | ||
sudo apt-get install libclang-dev '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev gperf bison flex libgl1-mesa-dev pkg-config libdbus-1-dev libnss3-dev libfontconfig1-dev libxi-dev libxcomposite-dev libxcursor-dev libxtst-dev python3-sip-dev | ||
``` | ||
|
||
### Build and install a debug version of PyQt5 | ||
|
||
Note that the resulting artifacts should not be used in production contexts, and are used to debug issues in development environments only. | ||
|
||
1. Build a debug version of Qt 5 | ||
|
||
Clone the Qt repo and build it from source following these instructions: https://wiki.qt.io/Building_Qt_5_from_Git#Getting_the_source_code. This defaults to creating a 'debug' build and installs the binaries in the current directory, avoiding the need for `make install`. Note that the `-developer-build` option causes more symbols to be exported in order to allow more classes and functions to be unit tested than in a regular Qt build. | ||
|
||
``` | ||
git clone https://code.qt.io/qt/qt5.git | ||
cd qt5 | ||
git checkout v5.11.3 # or checkout a different version | ||
git submodule update --init --recursive | ||
export LLVM_INSTALL_DIR=/usr/llvm | ||
mkdir ../qt5-build && cd ../qt5-build # we don't want to build in the source code directory | ||
../qt5/configure -developer-build -opensource -nomake examples -nomake tests -confirm-license | ||
make -j 4 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This step took ~1h on my computer, perhaps worth mentioning either here or elsewhere in the docs that this takes a while There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We will also need to build
|
||
``` | ||
|
||
2. Prepare to build PyQt5 | ||
|
||
We are going to use the client virtual environment to build and install PyQt5. Make sure the client dependencies are installed. This will include `pyqt5-sip` which will be used when we build pyqt5 from source. | ||
|
||
If you haven't already, download the client and set up the virtual environment. | ||
|
||
``` | ||
git clone [email protected]:freedomofpress/securedrop-client.git | ||
cd securedrop-client | ||
virtualenv --python=python3.7 .venv | ||
source .venv/bin/activate | ||
pip install --require-hashes -r dev-requirements.txt | ||
``` | ||
|
||
Make sure to uninstall the prepackaged pyqt5 library since we will be using our own. | ||
|
||
``` | ||
pip uninstall pyqt5 | ||
``` | ||
|
||
3. Download the PyQt5 source tarball | ||
|
||
``` | ||
wget http://deb.debian.org/debian/pool/main/p/pyqt5/pyqt5_5.11.3+dfsg.orig.tar.gz | ||
``` | ||
|
||
4. Build and install PyQt5 | ||
|
||
Make sure you are still in the client virtual environment before building PyQt5. | ||
|
||
``` | ||
tar -xzvf pyqt5_5.11.3+dfsg.orig.tar.gz | ||
cd PyQt5_gpl-5.11.3 | ||
pip install PyQt-builder | ||
export PATH=~/qt5-build/qtbase/bin:$PATH | ||
export QT_PLUGIN_PATH=~/qt5-build/qtbase/plugins | ||
python3 configure.py --verbose --qmake=~/qt5-build/qtbase/bin/qmake | ||
make install | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This step took 15-20 minutes (17M of disk space used, which is probably negligible in context) |
||
|
||
### Find/report a Qt bug | ||
|
||
1. Create a Qt account: https://login.qt.io/register | ||
2. Find or report a bug here: https://bugreports.qt.io |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also add a line about required free space for a debug build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call.. my
qt5-build
directory is 1.9 GB, is that what you're seeing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am seeing significantly more than that: