Thank you for wanting to contribute to FernIvy!
Please read this contributing guide carefully to make sure that your PR can be merged quickly.
The vision of FernIvy is to be a uniform interface across many platforms and tools.
Unfortunately, these often all require different things.
We therefore work with a template.sh
for development, and we use a Makefile
to generate FernIvy for each tool separately.
Let"s take Perf as an example. The following things are needed to support Perf:
- A separate directory called
perf
with abackup
subdirectory. - A
perf_run.sh
script inside theperf/backup/
directory which contains the command that performs the actual measurement. It takes the target output file as the first argument and the command to measure for as the second argument. - A directory
perf/backup/debian/
which contains the file structure necessary to create a.deb
package from FernIvy. - A
generate_perf
method in thegenerate.py
file, which generates the entire tool into theperf/package/
andperf/package-deb/
directories. It:- creates a
perf/package/
directory and copies theperf/backup/perf_run.sh
script into it, - copies the entire
perf/backup/
intoperf/package-deb/
, - generates the
fernivy
script into both directories by replacing$TOOL
with the correct packaging locations and adding a line requesting sudo access to run, - generates the
debian/control
file containing the relevant release information intoperf/package-deb/
, - copies the
parser.py
into both packages.
- creates a
- Two commands in the
Makefile
:- A
clean_perf
command which recursively removes both directories and is included in theclean
command. - A
perf
command which cleans the packages, calls thegenerate.py
script for perf, and makes all the executables executable. It is included in thegenerate
command.
- A
To package FernIvy with Perf into a .deb
file, simply navigate to the perf/package-deb/
directory and run dpkg-buildpackage -uc -us
.
To run FernIvy with Perf in the dev environment, change the TOOL=<tool>
line in template.sh
to TOOL=perf
(this line is always removed in the generation process).
You can run e.g. the following command:
./template.sh -s 2 -b 1 -r 5 -p -e -t
NOTE: For Perf specifically, you need to run the tool using sudo
, since Perf requires root access.
For each tool and operating system, FernIvy needs different dependencies to work and to be packaged. We therefore aim to keep all dependencies to a minimum. Therefore, if you can implement something simply without a library, please do so.
For this reason, the yml
file we use cannot have nested properties.
FernIvy is currently written using a mixture of Shell and Python scripts. As you can imagine, this can quickly become unmaintainable and hard to read. Therefore, we ask you to follow these code style guidelines:
- Use the standard Python code style (snake-casing, indentation, etc.).
- Write docstrings for all the methods that you write (initialisers only need one if there is something special about them).
- Name information variables with capitals.
- Name control flow variables using the
_name
format. - Flow control blocks should have the following format:
if [[ <condition> ]]; then
# comment
<body>
fi
- Use 4 spaces for 1 indent.
- Use double-quotes for strings (
"
instead of"
). - Provide comments for your code.
Please record each significant change in the CHANGELOG.md file under "Unreleased" to enable us to facilitate keeping track of all the changes.
To keep a clean git history, please follow these guidelines:
- Rebase on main instead of merging main into your own branch.
- Have informative and structured commit messages.
- Use the templates available.