summaryrefslogtreecommitdiffstats
path: root/src/cephadm/build.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #54948 from mgfritch/cephadm-build-rpmAdam King2024-01-091-1/+1
|\ | | | | | | | | cephadm: add runtime python minor version to RPM query macro Reviewed-by: John Mulligan <jmulligan@redhat.com>
| * cephadm: add runtime python minor version to RPM query macroMichael Fritch2023-12-181-1/+1
| | | | | | | | | | | | | | when multiple versions of python are installed, the `python3dist` macro produces a multiline string causing later rpm query commands to fail. Signed-off-by: Michael Fritch <mfritch@suse.com>
* | cephadm: add comments documenting install spec options to build.pyJohn Mulligan2023-12-131-0/+22
| | | | | | | | Signed-off-by: John Mulligan <jmulligan@redhat.com>
* | cepadm: black reformat build.pyJohn Mulligan2023-12-131-3/+6
| | | | | | | | Signed-off-by: John Mulligan <jmulligan@redhat.com>
* | cephadm: add a pyyaml zipapp dependencyJohn Mulligan2023-12-131-9/+47
| | | | | | | | | | | | | | | | | | | | | | Add a pyyaml zipapp dependency based on installing from wheels but stripping those wheels of compiled (shared object) extensions. This is the only way I could get it to work because the pyproject.toml file in pyyaml requires Cython and having Cython present enables the extension in setup.py even though some setup.py options exist to disable building the C/Cython based extension. Signed-off-by: John Mulligan <jmulligan@redhat.com>
* | cephadm: make the pip-install-from-source approach for deps explicitJohn Mulligan2023-12-131-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | Previously, the code assumed that all dependencies can be cleanly installed from source with native-code compilers disabled. This worked ok for MarkupSafe because it falls back to pure-python if it can't compile the C extension code. Unfortunately, not all packages that can fall back to pure python do so cleanly in the build. As a first step to resolving that, make the current behavior an explicitly selected mode and permit installing from wheels in the future. Signed-off-by: John Mulligan <jmulligan@redhat.com>
* | cephadm: add InstallSpec type to build.pyJohn Mulligan2023-12-131-21/+53
|/ | | | | | | | Add a new InstallSpec type to build.py and rework the requirements lists in terms of the InstallSpec. The new type will be able to encode more per-dependency behavior than the previous approach. Signed-off-by: John Mulligan <jmulligan@redhat.com>
* Merge pull request #54173 from phlogistonjohn/jjm-cephadm-jinja-2Adam King2023-11-171-10/+167
|\ | | | | | | | | cephadm: expand support for dependencies bundled into the zipapp Reviewed-by: Adam King <adking@redhat.com>
| * cephadm: add modes for bundled deps and track what is installedJohn Mulligan2023-11-061-10/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add additional modes for how to handle bundled dependencies. Add a mode to disable bundled dependencies entirely. Add a mode to source dependencies from installed RPM packages. This mode will likely be the basis for some distributions of ceph were the exact version of the package can be used via a controlled build environment. Add the capability to store metadata about the bundled dependencies in the zipapp. Move all the metadata created by build.py to a synthetic package `_cephadmmeta` that gets created when building the zipapp. Signed-off-by: John Mulligan <jmulligan@redhat.com>
* | cephadm: work around pip failure on some envsJohn Mulligan2023-11-071-0/+1
|/ | | | | | | | | | Work around an encoding/locale issue when the dashboard tests are run (ubuntu 20.04). The build.py changes brought in a9d1c62ca86 were validated for package builds, teuthology, and other CI jobs but a different error was masking this failure in the dashboard ci job. Signed-off-by: John Mulligan <jmulligan@redhat.com>
* cephadm: update the build.py script to work on multiple distrosJohn Mulligan2023-11-031-21/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, a single simple call to pip does not work on all the distributions that ceph is built on. In particular, Ubuntu 20.04 and Ubuntu 22.04 come with pip versions that can not correctly handle disabling wheels and installing Jinja2 (it tries to use the markupsafe dependency before it is installed). This can be worked around by using a virtual env and updating pip before proceeding. However, this is not enough because CentOS/RHEL 8 uses python 3.6 and there is no version of pip that supports 3.6 that we can update to that is new enough to fix the issue with disabling wheels. The workaround in this case is to install each dependency one at a time through multiple calls to pip. Because of this extra complexity is it simpler to eschew the use of a requirements.txt file in build.py entirely. Thus the zipapp is built using build.py only. Requirements files for cephadm are for setting up the tox environments *only*. For completeness a new option is added that gives the caller control over when build.py uses a virtualenv or not. Thus the build.py script requires at least one of: a working pip that handles disabling wheels; or, a virtualenv (venv) and the ability to update to a working version of pip. If the list of distros ceph supports (and the python versions they use) ever becomes simpler/newer some of this complexity could be removed from the build.py script. Signed-off-by: John Mulligan <jmulligan@redhat.com>
* cephadm: disable wheels and C compilers when building cephadm zipappJohn Mulligan2023-11-031-1/+9
| | | | | | | | | | We can not rely on any particular python version (py 3.6+ is supported) and can not assume any particular architecture. So using wheels based on the build system is pointless. Installing binary .so files compiled from C/C++ similarly so. Attempt to block the behaviors when adding dependencies to the zipapp. Signed-off-by: John Mulligan <jmulligan@redhat.com>
* cephadm: include the cephadmlib package in the binary's zipappJohn Mulligan2023-08-301-6/+15
| | | | | | Signed-off-by: John Mulligan <jmulligan@redhat.com> Pair-programmed-with: Adam King <adking@redhat.com> Co-authored-by: Adam King <adking@redhat.com>
* Merge pull request #51267 from phlogistonjohn/jjm-cephadm-versioningAdam King2023-06-141-2/+39
|\ | | | | | | | | Support cephadm "binary" versioning Reviewed-by: Adam King <adking@redhat.com>
| * cephadm: add generated version info file to zipappJohn Mulligan2023-05-221-2/+39
| | | | | | | | | | | | | | | | Pass --set-version-var=KEY=VALUE cli options to the script and it will create an embedded "_version.py" file in the zipapp containing the passed parameters. Signed-off-by: John Mulligan <jmulligan@redhat.com>
* | cephadm: call compile_dir to byte compile zipapp py filesJohn Mulligan2023-05-111-0/+9
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Python provides the compileall module to explicitly create pyc files from py files. If we byte-compile the content of the cephadm zipapp we get a small speed boost when running the application. In a not-very-scientific benchmark I found that running with pyc files almost halved the time to run the help command 50 times. ``` $ time for _ in {0..50}; do /tmp/cephadm-nobc -h >/dev/null; done real 0m9.486s user 0m8.547s sys 0m0.893s $ time for _ in {0..50}; do /tmp/cephadm-bc -h >/dev/null; done real 0m4.634s user 0m3.992s sys 0m0.618s ``` I ran the above a few times on my laptop and the numbers are pretty consistent. One thing to note is that zipapp doesn't seem to understand the current `__pycache__` approach to storing the bytecode files so we have to set the `legacy` argument for compileall.compile_dir to true. Since __pycache__ dirs mostly exist to allow multiple bytecode files for different python versions to coexist, and a zipapp is read-only this should not be a major issue. Tangentially related, we lose out on the speedup if you run the zipapp with a version of python other than the one the zipapp was built with but it continues to function. Signed-off-by: John Mulligan <jmulligan@redhat.com>
* cephadm: add a pythonic build.py for constructing the cephadm binaryJohn Mulligan2022-09-131-0/+158
As discussed in a ceph orch meeting, the build.sh script was deemed "unpythonic". This script is a first attempt to do it more pythonic with fewer explicit version checks. This change minimizes the existing build.sh to simply call build.py. We can completely eliminate build.sh at a later time if desired. Signed-off-by: John Mulligan <jmulligan@redhat.com>