Joey Armstrong | a144ef3 | 2024-01-11 11:26:41 -0500 | [diff] [blame] | 1 | .. howto_code_voltha-protos: |
| 2 | |
Joey Armstrong | 7bfe29c | 2023-10-25 13:47:00 -0400 | [diff] [blame] | 3 | Modifying repository voltha-protos |
| 4 | ================================== |
| 5 | |
| 6 | #. Clone repository `voltha-protos <https://gerrit.opencord.org/plugins/gitiles/voltha-protos/+/refs/heads/master>`_ |
| 7 | #. Modify structures, sources & makefiles as needed. |
| 8 | #. Build, test and lint locally to validate sources. |
| 9 | #. Commit changes, code review, jenins build and deploy. |
| 10 | #. Update external dependent repositories to use the new version. |
| 11 | |
| 12 | Clone, edit, build & test |
| 13 | ------------------------- |
| 14 | |
| 15 | .. code:: bash |
Eric Ball | 3e4d6d6 | 2024-09-17 09:28:06 -0700 | [diff] [blame] | 16 | |
Joey Armstrong | 7bfe29c | 2023-10-25 13:47:00 -0400 | [diff] [blame] | 17 | git clone ssh://gerrit.opencord.org:29418/voltha-protos.git |
| 18 | cd voltha-protos |
| 19 | vi ... |
| 20 | |
Joey Armstrong | a144ef3 | 2024-01-11 11:26:41 -0500 | [diff] [blame] | 21 | % make lint |
| 22 | % make build |
| 23 | % make test |
Joey Armstrong | 7bfe29c | 2023-10-25 13:47:00 -0400 | [diff] [blame] | 24 | |
| 25 | .. list-table:: Build & Test locally |
| 26 | :widths: 30, 80 |
| 27 | :header-rows: 1 |
| 28 | |
| 29 | * - Command |
| 30 | - Description |
| 31 | * - make sterile |
| 32 | - Remove previously generated targets |
| 33 | * - make protos |
| 34 | - Generate prototypes for go, java & python (dependency for target:build) |
| 35 | * - make build |
| 36 | - make protos; compile: go, java & python |
| 37 | * - make test |
| 38 | - Validate proto changes |
| 39 | * - make lint |
| 40 | - Syntax check sources prior to commit. |
| 41 | |
| 42 | Update all external repositories to consume the new repo:voltha-protos version |
| 43 | ------------------------------------------------------------------------------ |
| 44 | |
| 45 | - Each external VOLTHA repository will need to have dependencies mentioned in |
| 46 | the file go.mod updated. |
| 47 | - Rebuild each repository in hierarchial order also updating external libs as |
| 48 | they are rebuilt. |
| 49 | |
| 50 | .. list-table:: External repositories to modify |
| 51 | :widths: 30, 80 |
| 52 | :header-rows: 1 |
| 53 | |
| 54 | * - Repository |
| 55 | - File(s) to edit |
| 56 | * - bbsim |
| 57 | - `go.mod <https://gerrit.opencord.org/plugins/gitiles/bbsim/+/refs/heads/master/go.mod>`_ |
| 58 | * - ofagent-go |
| 59 | - `go.mod <https://gerrit.opencord.org/plugins/gitiles/ofagent-go/+/refs/heads/master/go.mod>`__ |
| 60 | * - voltctl |
| 61 | - `go.mod <https://gerrit.opencord.org/plugins/gitiles/voltctl/+/refs/heads/master/go.mod>`__ |
| 62 | * - voltha-go |
| 63 | - `go.mod <https://gerrit.opencord.org/plugins/gitiles/voltha-go/+/refs/heads/master/go.mod>`__ |
| 64 | * - voltha-go-controller |
| 65 | - `go.mod <https://gerrit.opencord.org/plugins/gitiles/voltha-go-controller/+/refs/heads/master/go.mod>`__ |
| 66 | * - voltha-lib-go |
| 67 | - `go.mod <https://gerrit.opencord.org/plugins/gitiles/voltha-lib-go/+/refs/heads/master/go.mod>`__ |
| 68 | * - voltha-openolt-adapter |
| 69 | - `go.mod <https://gerrit.opencord.org/plugins/gitiles/voltha-openolt-adapter/+/refs/heads/master/go.mod>`__ |
| 70 | * - voltha-openonu-adapter-go |
| 71 | - `go.mod <https://gerrit.opencord.org/plugins/gitiles/voltha-openonu-adapter-go/+/refs/heads/master/go.mod>`__ |
| 72 | * - voltha-system-tests |
| 73 | - `requirements.txt <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/requirements.txt>`_ (virtualenv/testing) |
| 74 | |
| 75 | .. list-table:: Foreach external repository |
| 76 | :widths: 30, 80 |
| 77 | :header-rows: 1 |
| 78 | |
| 79 | * - Command |
| 80 | - Description |
| 81 | * - vi {repo}/go.mod |
| 82 | - Bump version of repo:voltha-proto to latest published |
| 83 | * - vi {repo}/go.mod |
| 84 | - Bump external module version(s) during hierarcical build. |
| 85 | * - go mod edit -replace [...] |
| 86 | - Use the go mod tool to update version of voltha-protos and friends. |
| 87 | * - go mod tidy |
| 88 | - Cleanup syntax issues in golang source that will fail your pending commit |
| 89 | * - go mod vendor |
| 90 | - | Update sources and dependencies beneath the vendor/ directory. |
| 91 | | See also `go-mod-vendor <https://go.dev/ref/mod#go-mod-vendor>`_, `Packages & Modules <https://golangbyexample.com/packages-modules-go-second/>`_ |
| 92 | * - make build |
| 93 | - Compile with updated module dependencies. |
| 94 | * - make test |
| 95 | - Sanity check everything is still working. |
| 96 | * - make lint LOCAL_FIX_PERMS=1 |
| 97 | - | Syntax check sources for problems prior to checkin. |
| 98 | | LOCAL_FIX_PERMS=1 (optional) can workaround docker related permission problems. |
Joey Armstrong | 86cffed | 2024-06-17 14:22:42 -0400 | [diff] [blame] | 99 | |
| 100 | Problems with pip install |
| 101 | ------------------------- |
| 102 | |
| 103 | - grpcio `VOL-5348 <https://jira.opencord.org/browse/VOL-5348>`__ |
| 104 | |
| 105 | - Clone repo. |
| 106 | - Create a skeleton pytyon virtualenv. |
| 107 | - From requirements.txt file entries, pip install failing versioned package. |
| 108 | |
| 109 | .. code:: bash |
Eric Ball | 3e4d6d6 | 2024-09-17 09:28:06 -0700 | [diff] [blame] | 110 | |
Joey Armstrong | 86cffed | 2024-06-17 14:22:42 -0400 | [diff] [blame] | 111 | :caption: Pip install debugging |
| 112 | |
| 113 | # Debug using virtualenv |
| 114 | % virtualenv -p python3 .venv |
| 115 | % source .venv/bin/activate |
| 116 | % pip install grpcio==1.39.0 |
| 117 | |
| 118 | # Debug using makefile target 'venv' |
| 119 | % echo > requirements.txt |
| 120 | % make venv |
| 121 | % git checkout requirements.txt |
| 122 | % pip install -r requirements.txt |
| 123 | |
| 124 | longintrepr.h |
| 125 | ^^^^^^^^^^^^^ |
| 126 | |
| 127 | .. code:: bash |
Eric Ball | 3e4d6d6 | 2024-09-17 09:28:06 -0700 | [diff] [blame] | 128 | |
Joey Armstrong | 86cffed | 2024-06-17 14:22:42 -0400 | [diff] [blame] | 129 | :caption: Include missing header |
| 130 | |
| 131 | mkdir -p include |
| 132 | pusdh include |
| 133 | find /usr/include -name 'longintrepr.h' -print0 | xargs -0 -I'{}' ln -s {} . |
| 134 | popd include |
| 135 | export CFLAGS='-I./include' |