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