Skip to content

Commit 3bcbc26

Browse files
committed
man: Migrate to doc/
As sphinx supports generating manpages, use it to simplify the process and drop the dependency on rst2man. All manpages are now tracked in doc/man. The Makefile in man/ remains for forward compatibility. Keep tracking manpages themselves in troff format so sphinx is not required for packaging, slightly update Documentation to reflect the changes requirements for manpage generation. Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
1 parent f63dfd7 commit 3bcbc26

21 files changed

+772
-855
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Did you test the change locally? If yes, best to mention how you did it in the d
3333
--->
3434
- [ ] PR has been tested
3535
<!---
36-
If your PR touched the man pages they have to be regenerated by calling make in the man subdirectory of the project
36+
If your PR touched the man pages in doc/man, or an argparse struct from which manpages are generated, they have to be regenerated by calling make in the man subdirectory of the project. sphinx with our themes and extensions is required for this, see the README for more information,
3737
--->
3838
- [ ] Man pages have been regenerated
3939

README.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ Tests can now run via:
135135
136136
venv $ python -m pytest --lg-env <config>
137137
138+
To install sphinx and the dependencies needed for generating man pages and documentation run:
139+
140+
.. code-block:: bash
141+
142+
venv $ pip install '.[doc]'
138143
139144
.. |license| image:: https://img.shields.io/badge/license-LGPLv2.1-blue.svg
140145
:alt: LGPLv2.1

doc/conf.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,19 @@
156156
# (source start file, name, description, authors, manual section).
157157
man_pages = [
158158
(master_doc, 'labgrid', 'labgrid Documentation',
159-
[author], 1)
159+
[author], 1),
160+
('man/client', 'labgrid-client', 'labgrid\'s client interface to control boards',
161+
[author], 1),
162+
('man/coordinator', 'labgrid-coordinator', 'managing labgrid resources and places',
163+
[author], 1),
164+
('man/device-config', 'labgrid-device-config', 'test configuration files',
165+
[author], 5),
166+
('man/exporter', 'labgrid-exporter', 'interface to control boards',
167+
[author], 1),
168+
('man/pytest', 'labgrid-pytest', 'labgrid integration for pytest',
169+
[author], 7),
170+
('man/suggest', 'labgrid-suggest', 'generator for YAML config files',
171+
[author], 1),
160172
]
161173

162174

@@ -185,7 +197,10 @@
185197
autodoc_mock_imports = ['onewire',
186198
'gi',
187199
'gi.repository',
188-
'vxi11']
200+
'vxi11',
201+
'pysnmp',
202+
'kasa',
203+
'kasa.iot']
189204

190205
# -- Options for autosection ----------------------------------------------
191206
autosectionlabel_prefix_document = True

doc/man.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Manual Pages
33

44
.. toctree::
55
man/client
6+
man/coordinator
67
man/device-config
78
man/exporter
8-
man/coordinator
9+
man/pytest
10+
man/suggest

doc/man/client.rst

Lines changed: 262 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,263 @@
11
.. _labgrid-client:
2-
.. include:: ../../man/labgrid-client.rst
2+
3+
================
4+
labgrid-client
5+
================
6+
7+
labgrid-client interface to control boards
8+
==========================================
9+
10+
SYNOPSIS
11+
--------
12+
13+
``labgrid-client`` ``--help``
14+
15+
``labgrid-client`` -p <place> <command>
16+
17+
``labgrid-client`` ``places|resources``
18+
19+
DESCRIPTION
20+
-----------
21+
Labgrid is a scalable infrastructure and test architecture for embedded (linux) systems.
22+
23+
This is the client to control a boards status and interface with it on remote machines.
24+
25+
OPTIONS
26+
-------
27+
-h, --help
28+
display command line help
29+
-p PLACE, --place PLACE
30+
specify the place to operate on
31+
-x ADDRESS, --coordinator ADDRESS
32+
coordinator ``HOST[:PORT]`` to connect to, defaults to ``127.0.0.1:20408``
33+
-c CONFIG, --config CONFIG
34+
set the configuration file
35+
-s STATE, --state STATE
36+
set an initial state before executing a command, requires a configuration
37+
file and strategy
38+
-i INITIAL_STATE, --initial-state INITIAL_STATE
39+
strategy state to force into before switching to desired state, requires a
40+
desired state (``-s``/``--state``/``LG_STATE``)
41+
-d, --debug
42+
enable debugging
43+
-v, --verbose
44+
increase verbosity
45+
-P PROXY, --proxy PROXY
46+
proxy connections over ssh
47+
48+
CONFIGURATION FILE
49+
------------------
50+
The configuration file follows the description in ``labgrid-device-config``\(5).
51+
52+
ENVIRONMENT VARIABLES
53+
---------------------
54+
Various labgrid-client commands use the following environment variable:
55+
56+
LG_PLACE
57+
~~~~~~~~
58+
This variable can be used to specify a place without using the ``-p`` option, the ``-p`` option overrides it.
59+
60+
LG_TOKEN
61+
~~~~~~~~
62+
This variable can be used to specify a reservation for the ``wait`` command and
63+
for the ``+`` place expansion.
64+
65+
LG_STATE
66+
~~~~~~~~
67+
This variable can be used to specify a state which the device transitions into
68+
before executing a command. Requires a configuration file and a Strategy
69+
specified for the device.
70+
71+
LG_INITIAL_STATE
72+
~~~~~~~~~~~~~~~~
73+
This variable can be used to specify an initial state the device is known to
74+
be in.
75+
This is useful during development. The Strategy used must implement the
76+
``force()`` method.
77+
A desired state must be set using ``LG_STATE`` or ``-s``/``--state``.
78+
79+
LG_ENV
80+
~~~~~~
81+
This variable can be used to specify the configuration file to use without
82+
using the ``--config`` option, the ``--config`` option overrides it.
83+
84+
LG_COORDINATOR
85+
~~~~~~~~~~~~~~
86+
This variable can be used to set the default coordinator in the format
87+
``HOST[:PORT]`` (instead of using the ``-x`` option).
88+
89+
LG_PROXY
90+
~~~~~~~~
91+
This variable can be used to specify a SSH proxy hostname which should be used
92+
to connect to the coordinator and any resources which are normally accessed
93+
directly.
94+
95+
LG_HOSTNAME
96+
~~~~~~~~~~~
97+
Override the hostname used when accessing a resource. Typically only useful for
98+
CI pipelines where the hostname may not be consistent between pipeline stages.
99+
100+
LG_USERNAME
101+
~~~~~~~~~~~
102+
Override the username used when accessing a resource. Typically only useful for
103+
CI pipelines where the username may not be consistent between pipeline stages.
104+
105+
LG_SSH_CONNECT_TIMEOUT
106+
~~~~~~~~~~~~~~~~~~~~~~
107+
Set the connection timeout when using SSH (The ``ConnectTimeout`` option). If
108+
unspecified, defaults to 30 seconds.
109+
110+
LG_AGENT_PREFIX
111+
~~~~~~~~~~~~~~~~~~~~~~
112+
Add a prefix to ``.labgrid_agent_{agent_hash}.py`` allowing specification for
113+
where on the exporter it should be uploaded to.
114+
115+
MATCHES
116+
-------
117+
Match patterns are used to assign a resource to a specific place. The format is:
118+
exporter/group/cls/name, exporter is the name of the exporting machine, group is
119+
a name defined within the exporter, cls is the class of the exported resource
120+
and name is its name. Wild cards in match patterns are explicitly allowed, *
121+
matches anything.
122+
123+
LABGRID-CLIENT COMMANDS
124+
-----------------------
125+
``monitor`` Monitor events from the coordinator
126+
127+
``resources (r)`` List available resources
128+
129+
``places (p)`` List available places
130+
131+
``who`` List acquired places by user
132+
133+
``show`` Show a place and related resources
134+
135+
``create`` Add a new place (name supplied by -p parameter)
136+
137+
``delete`` Delete an existing place
138+
139+
``add-alias`` ``[alias]`` Add an alias to a place
140+
141+
``del-alias`` ``[alias]`` Delete an alias from a place
142+
143+
``set-comment`` ``[comment]`` Update or set the place comment
144+
145+
``set-tags`` ``[key=value]`` Set place tags (key=value)
146+
147+
``add-match`` ``[match]`` Add one (or multiple) match pattern(s) to a place, see MATCHES
148+
149+
``del-match`` ``[match]`` Delete one (or multiple) match pattern(s) from a place, see MATCHES
150+
151+
``add-named-match`` ``[match]`` ``[name]`` Add one match pattern with a name to a place
152+
153+
``acquire (lock)`` Acquire a place
154+
155+
``allow`` ``[user]`` Allow another user to access a place
156+
157+
``release (unlock)`` Release a place
158+
159+
``release-from`` ``[host/user]`` Atomically release a place, but only if acquired by a specific user.
160+
161+
Note that this command returns success as long
162+
as the specified user no longer owns the place,
163+
meaning it may be acquired by another user or
164+
not at all.
165+
166+
``env`` Generate a labgrid environment file for a place
167+
168+
``power (pw)`` ``[action]`` Change (or get) a place's power status, where action is one of get, on, off, cycle
169+
170+
``io`` ``[action]`` ``[name]`` Interact with GPIO (OneWire, relays, ...) devices, where action is one of high, low, get
171+
172+
``console (con)`` ``[name]`` Connect to the console
173+
174+
``dfu`` ``[arg]`` Run dfu commands
175+
176+
``fastboot`` ``[arg]`` Run fastboot with argument
177+
178+
``flashscript`` ``[script]`` ``[arg]`` Run arbitrary script with arguments to flash device
179+
180+
``bootstrap`` ``[filename]`` Start a bootloader
181+
182+
``sd-mux`` ``[action]`` Switch USB SD Muxer, where action is one of dut (device-under-test), host, off
183+
184+
``usb-mux`` ``[action]`` Switch USB Muxer, where action is one of off, dut-device, host-dut, host-device, host-dut+host-device
185+
186+
``ssh`` ``[command]`` Connect via SSH. Additional arguments are passed to ssh.
187+
188+
``scp`` ``[source]`` ``[destination]`` Transfer file via scp (use ':dir/file' for the remote side)
189+
190+
``rsync`` ``[source]`` ``[destination]`` Transfer files via rsync (use ':dir/file' for the remote side)
191+
192+
``sshfs`` ``[remotepath]`` ``[mountpoint]`` Mount a remote path via sshfs
193+
194+
``forward`` Forward local port to remote target
195+
196+
``telnet`` Connect via telnet
197+
198+
``video`` Start a video stream
199+
200+
``audio`` Start an audio stream
201+
202+
``tmc`` ``[command]`` Control a USB TMC device
203+
204+
``write-files`` ``[filename(s)]`` Copy files onto mass storage device
205+
206+
``write-image`` ``[filename]`` Write images onto block devices (USBSDMux, USB Sticks, …)
207+
208+
``reserve`` ``[filter]`` Create a reservation
209+
210+
``cancel-reservation`` ``[token]`` Cancel a pending reservation
211+
212+
``wait`` ``[token]`` Wait for a reservation to be allocated
213+
214+
``reservations`` List current reservations
215+
216+
``export`` ``[filename]`` Export driver information to file (needs environment with drivers)
217+
218+
``version`` Print the labgrid version
219+
220+
ADDING NAMED RESOURCES
221+
----------------------
222+
If a target contains multiple Resources of the same type, named matches need to
223+
be used to address the individual resources. In addition to the *match* taken by
224+
``add-match``, ``add-named-match`` also takes a name for the resource. The other
225+
client commands support the name as an optional parameter and will inform the
226+
user that a name is required if multiple resources are found, but no name is
227+
given.
228+
229+
If one of the resources should be used by default when no resource name is
230+
explicitly specified, it can be named ``default``.
231+
232+
EXAMPLES
233+
--------
234+
235+
To retrieve a list of places run:
236+
237+
.. code-block:: bash
238+
239+
$ labgrid-client places
240+
241+
To access a place, it needs to be acquired first, this can be done by running
242+
the ``acquire command`` and passing the placename as a -p parameter:
243+
244+
.. code-block:: bash
245+
246+
$ labgrid-client -p <placename> acquire
247+
248+
Open a console to the acquired place:
249+
250+
.. code-block:: bash
251+
252+
$ labgrid-client -p <placename> console
253+
254+
Add all resources with the group "example-group" to the place example-place:
255+
256+
.. code-block:: bash
257+
258+
$ labgrid-client -p example-place add-match */example-group/*/*
259+
260+
SEE ALSO
261+
--------
262+
263+
``labgrid-exporter``\(1)

doc/man/coordinator.rst

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,34 @@
1-
.. _labgrid-coordinator:
2-
.. include:: ../../man/labgrid-coordinator.rst
1+
=====================
2+
labgrid-coordinator
3+
=====================
4+
5+
labgrid-coordinator managing labgrid resources and places
6+
=========================================================
7+
8+
SYNOPSIS
9+
--------
10+
11+
``labgrid-coordinator`` ``--help``
12+
13+
DESCRIPTION
14+
-----------
15+
Labgrid is a scalable infrastructure and test architecture for embedded (linux)
16+
systems.
17+
18+
This is the man page for the coordinator. Clients and exporters connect to the
19+
coordinator to publish resources, manage place configuration and handle mutual
20+
exclusion.
21+
22+
OPTIONS
23+
-------
24+
-h, --help
25+
display command line help
26+
-l ADDRESS, --listen ADDRESS
27+
make coordinator listen on host and port
28+
-d, --debug
29+
enable debug mode
30+
31+
SEE ALSO
32+
--------
33+
34+
``labgrid-client``\(1), ``labgrid-exporter``\(1)

0 commit comments

Comments
 (0)