Skip to content

Commit

Permalink
readthedocs: pre generate kas-container docs
Browse files Browse the repository at this point in the history
The kas-container documentation needs manual pre-processing before the
sphinx build can run. As the readthedocs build works differently, we
need to manually call the pre-processing.

Signed-off-by: Felix Moessbauer <[email protected]>
[Jan: add podman as dependency]
Signed-off-by: Jan Kiszka <[email protected]>
  • Loading branch information
fmoessbauer authored and jan-kiszka committed Sep 30, 2024
1 parent f537669 commit 50a16c2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# kas - setup tool for bitbake based projects
#
# Copyright (c) Siemens AG, 2021
# Copyright (c) Siemens AG, 2021-2024
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -28,6 +28,11 @@ build:
python: "3.9"
apt_packages:
- python3-newt
- make
- podman
jobs:
pre_build:
- cd docs && make kas-container-usage && cd ..

python:
install:
Expand Down
8 changes: 8 additions & 0 deletions docs/command-line/environment-variables.inc
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ Variables Glossary
| ``PARALLEL_MAKE`` | |
| (C,K,E) | |
+--------------------------+--------------------------------------------------+
| ``BUILDTOOLS_DIR`` (K) | The path to the directory where buildtools have |
| | been installed. The environment-setup script |
| | will run before bitbake, so the whole buildtools |
| | environment will be available. More information |
| | on how to install or generate buildtools can be |
| | found at: |yp_doc_buildtools| |
+--------------------------+--------------------------------------------------+

.. |aws_cred| replace:: ``AWS_ROLE_ARN``
``AWS_SHARED_CREDENTIALS_FILE``
Expand All @@ -177,6 +184,7 @@ Variables Glossary
``CI_SERVER_SHELL_SSH_HOST``
``CI_SERVER_SHELL_SSH_PORT``

.. |yp_doc_buildtools| replace:: https://docs.yoctoproject.org/3.3/ref-manual/system-requirements.html#required-git-tar-python-and-gcc-versions
.. only:: html

For details about the access of remote resources, see
Expand Down
8 changes: 8 additions & 0 deletions kas/libkas.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import errno
import pathlib
import signal
import glob
from subprocess import Popen, PIPE
from .context import get_context
from .kasusererror import KasUserError, CommandExecError
Expand Down Expand Up @@ -252,9 +253,16 @@ def get_build_environ(build_system):
if not init_repo:
raise InitBuildEnvError('Did not find any init-build-env script')

buildtools_env =""
if "BUILDTOOLS_DIR" in os.environ:
envfiles = glob.glob(os.path.join(os.environ["BUILDTOOLS_DIR"],"environment-setup-*"))
if len(envfiles) == 1:
buildtools_env = "source {}\n".format(os.path.realpath(envfiles[0]))

with tempfile.TemporaryDirectory() as temp_dir:
script = f"""#!/bin/bash
set -e
{buildtools_env}
source {init_script} $1 > /dev/null
env
"""
Expand Down

0 comments on commit 50a16c2

Please sign in to comment.