Skip to content

Commit f70563d

Browse files
authored
Merge pull request #30 from delphix/master
Sync master to 6.0/stage
2 parents 5d637cc + ab78094 commit f70563d

File tree

208 files changed

+14758
-8882
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

208 files changed

+14758
-8882
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: [3.9, 3.8, 3.7, 3.6]
10+
python-version: ['3.10', '3.9', '3.8', '3.7', '3.6']
1111
cc: [gcc, clang]
1212
fail-fast: false
1313
env:
@@ -23,11 +23,11 @@ jobs:
2323
run: |
2424
sudo apt-get update
2525
sudo apt-get install busybox-static libelf-dev libdw-dev qemu-kvm zstd ${{ matrix.cc == 'clang' && 'libomp-$(clang --version | sed -rn "s/.*clang version ([0-9]+).*/\\1/p")-dev' || '' }}
26-
pip install mypy
26+
pip install mypy pyroute2
2727
- name: Generate version.py
2828
run: python setup.py --version
2929
- name: Check with mypy
30-
run: mypy --strict --no-warn-return-any drgn _drgn.pyi
30+
run: mypy --strict --no-warn-return-any --no-warn-unused-ignores drgn _drgn.pyi
3131
- name: Build and test with ${{ matrix.cc }}
3232
run: python setup.py test -K
3333

.github/workflows/dco-check.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: DCO Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, ready_for_review]
6+
7+
jobs:
8+
check:
9+
if: ${{ !github.event.pull_request.draft }}
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout commit logs
13+
run: |
14+
git init
15+
git fetch --filter=blob:none "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" "$GITHUB_BASE_REF" "$GITHUB_REF"
16+
- name: Check for DCO sign-offs
17+
run: |
18+
no_sign_off="$(git log --no-merges --grep=Signed-off-by --invert-grep "FETCH_HEAD..$GITHUB_SHA")"
19+
if [ -z "$no_sign_off" ]; then
20+
echo "All commits have a Developer Certificate of Origin sign-off"
21+
else
22+
echo "The following commits are missing a Developer Certificate of Origin sign-off;"
23+
echo "see https://github.com/osandov/drgn/blob/main/CONTRIBUTING.rst#signing-off"
24+
echo
25+
echo "$no_sign_off"
26+
exit 1
27+
fi

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
/cscope.*
88
/dist
99
/docs/_build
10+
/drgn-*.tar.gz
1011
/drgn.egg-info
1112
/drgn/internal/version.py
1213
/htmlcov
14+
/python-drgn-*.src.rpm
15+
/python-drgn.spec
1316
__pycache__

.packit.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See the documentation for more information:
2+
# https://packit.dev/docs/configuration/
3+
4+
specfile_path: python-drgn.spec
5+
synced_files:
6+
- python-drgn.spec
7+
- .packit.yaml
8+
9+
upstream_package_name: drgn
10+
downstream_package_name: python-drgn
11+
actions:
12+
get-current-version: "python3 setup.py --version"
13+
# Fetch the specfile from Rawhide and drop any patches
14+
post-upstream-clone: "bash -c \"curl -s https://src.fedoraproject.org/rpms/python-drgn/raw/main/f/python-drgn.spec | sed '/^Patch[0-9]/d' > python-drgn.spec\""
15+
16+
jobs:
17+
- job: copr_build
18+
trigger: commit
19+
metadata:
20+
targets:
21+
- fedora-all-aarch64
22+
- fedora-all-armhfp
23+
- fedora-all-i386
24+
- fedora-all-ppc64le
25+
- fedora-all-s390x
26+
- fedora-all-x86_64
27+
- epel-8-aarch64
28+
- epel-8-ppc64le
29+
- epel-8-x86_64
30+
- job: copr_build
31+
trigger: pull_request
32+
metadata:
33+
targets:
34+
- fedora-all-aarch64
35+
- fedora-all-armhfp
36+
- fedora-all-i386
37+
- fedora-all-ppc64le
38+
- fedora-all-s390x
39+
- fedora-all-x86_64
40+
- epel-8-aarch64
41+
- epel-8-ppc64le
42+
- epel-8-x86_64

.readthedocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
version: 2
22
sphinx:
33
configuration: docs/conf.py
4+
python:
5+
install:
6+
- requirements: docs/requirements.txt

CONTRIBUTING.rst

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,25 @@ submit changes for drgn.
77
Building
88
--------
99

10-
The easiest way to develop drgn is by building and running it locally. See the
11-
`installation documentation
12-
<https://drgn.readthedocs.io/en/latest/installation.html#development>`_.
10+
The easiest way to develop drgn is by building and running it locally. Please
11+
build with warnings enabled. Install the dependencies from the `installation
12+
instructions <README.rst#from-source>`_, then run:
13+
14+
.. code-block:: console
15+
16+
$ git clone https://github.com/osandov/drgn.git
17+
$ cd drgn
18+
$ CFLAGS="-Wall -Werror -g -O2" python3 setup.py build_ext -i
19+
$ python3 -m drgn --help
1320
1421
Testing
1522
-------
1623

17-
.. highlight:: console
18-
1924
Tests should be added for all features and bug fixes.
2025

21-
drgn's test suite can be run with::
26+
drgn's test suite can be run with:
27+
28+
.. code-block:: console
2229
2330
$ python3 setup.py test
2431
@@ -27,7 +34,9 @@ add ``-K``. See `vmtest <vmtest/README.rst>`_ for more details.
2734

2835
Tests can also be run manually with `unittest
2936
<https://docs.python.org/3/library/unittest.html#command-line-interface>`_
30-
after building locally::
37+
after building locally:
38+
39+
.. code-block:: console
3140
3241
$ python3 -m unittest discover -v
3342
@@ -49,14 +58,32 @@ C code in drgn mostly follows the `Linux kernel coding style
4958
<https://www.kernel.org/doc/html/latest/process/coding-style.html>`_ except
5059
that drgn requires C11 or newer, so declarations may be mixed with code.
5160

52-
A few other guidelines:
61+
A few other guidelines/conventions:
5362

63+
* Constants should be defined as enums or ``static const`` variables rather
64+
than macros.
5465
* Functions that can fail should return a ``struct drgn_error *`` (and return
5566
their result via an out parameter if necessary).
5667
* Out parameters should be named ``ret`` (or suffixed with ``_ret`` if there
57-
are multiple).
58-
* Constants should be defined as enums or ``static const`` variables rather
59-
than macros.
68+
are multiple) and be the last parameter(s) of the function.
69+
* Functions that initialize an already allocated structure should be suffixed
70+
with ``_init`` and take the structure to initialize as the first argument,
71+
e.g., ``struct drgn_error *foo_init(struct foo *foo, int foo_flags)``.
72+
* The matching function to deinitialize a structure should be suffixed with
73+
``_deinit``, e.g., ``void foo_deinit(struct foo *foo)``. If possible, the
74+
definition should be placed directly after the definition of ``_init`` so
75+
that it is easier to visually verify that everything is cleaned up.
76+
* Functions that allocate and initialize a structure should be suffixed with
77+
``_create`` and either return the structure as an out parameter (e.g.,
78+
``struct drgn_error *foo_create(int foo_flags, struct foo **ret)``) or as the
79+
return value if they can only fail with an out-of-memory error (e.g.,
80+
``struct foo *foo_create(int foo_flags)``).
81+
* The matching function to free an allocated structure should be suffixed with
82+
``_destroy``, e.g., ``void foo_destroy(struct foo *foo)``. If possible, the
83+
definition should be placed directly after the definition of ``_create``.
84+
``_destroy`` should usually allow a ``NULL`` argument, just like ``free()``.
85+
* Functions that return a result in a ``struct drgn_object *`` parameter should
86+
only modify the object if the function succeeds.
6087

6188
drgn assumes some `implementation-defined behavior
6289
<https://gcc.gnu.org/onlinedocs/gcc/C-Implementation.html>`_ for sanity:
@@ -74,7 +101,9 @@ Python
74101
Python code in drgn should be compatible with Python 3.6 and newer.
75102

76103
Python code should be formatted with `black <https://github.com/psf/black>`_
77-
and `isort <https://github.com/timothycrosley/isort>`_::
104+
and `isort <https://github.com/timothycrosley/isort>`_:
105+
106+
.. code-block:: console
78107
79108
$ isort . && black .
80109

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ recursive-include examples *.py
33
recursive-include tests *.py
44
recursive-include tools *.py
55
recursive-include vmtest *.c *.py *.rst
6-
include COPYING util.py vmtest/config
6+
include CONTRIBUTING.rst COPYING pytest.ini util.py vmtest/config

0 commit comments

Comments
 (0)