diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/python-oem/README.md b/sdk_container/src/third_party/coreos-overlay/dev-lang/python-oem/README.md new file mode 100644 index 0000000000..12b071faeb --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/dev-lang/python-oem/README.md @@ -0,0 +1,45 @@ +Modifications made: + +- Keep using internal expat and libffi, thus dropping dev-libs/libffi + and dev-libs/expat from the dependencies. + +- Drop dev-python/gentoo-common dependency, it provides the + EXTERNALLY-MANAGED file, but we will provide our own. + +- Since this package is installed only for OEM partition as a binary + package, and the installation there happens after the packages + database is removed, we unset the RDEPEND variable. The RDEPEND + variable needs to be empty as it's also used during the binary + package installation. The contents of RDEPEND are already inside the + DEPEND variable, so we are safe. + +- We modify the configure flags: + + - Add `--prefix=/usr/share/oem/python` as `/usr/share/oem` is where + the OEM partition is mounted. + + - Add `--with-platlibdir="$(get_libdir)"`, this is to make sure that + consistent library directory gets picked. In our case for both + amd64 and arm64, it's lib64. + + - Change `--enable-shared` to `--disable-shared`. This will skip + building dynamic libraries, as we don't need them. + + - Add `--includedir=/discard/include` and change `--mandir` and + `--infodir` to also use `/discard` to install files there. Makes + it easy to remove the unnecessary files. + + - We disable loadable sqlite extensions. + + - As we want to use the internal versions of expat and libffi, we + change `--with-system-{expat,ffi}` to + `--without-system-{expat,ffi}`. + + - Comment out the `--with-wheel-pkg-dir` as it's some ensurepip + stuff we are disabling anyway. + +- Essentially drop `src_install` and write our own variant, where we + run `make altinstall`, remove unnecessary files (the original + `src_install` could be read to find out which files to remove), + creates a versionless python symlink, adds an EXTERNALLY-MANAGED + file, and removes the `/discard` directory. diff --git a/sdk_container/src/third_party/coreos-overlay/dev-lang/python-oem/python-oem-3.10.10_p2.ebuild b/sdk_container/src/third_party/coreos-overlay/dev-lang/python-oem/python-oem-3.10.10_p2.ebuild index 3f45df96fd..a97cd66392 100644 --- a/sdk_container/src/third_party/coreos-overlay/dev-lang/python-oem/python-oem-3.10.10_p2.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/dev-lang/python-oem/python-oem-3.10.10_p2.ebuild @@ -40,11 +40,13 @@ RESTRICT="!test? ( test )" # run the bootstrap code on your dev box and include the results in the # patchset. See bug 447752. +# Flatcar: Drop a dependency on dev-libs/expat, we will use the internal one. +# Flatcar: Drop a dependency on dev-libs/libffi, we will use the internal one. +# Flatcar: Drop a dependency on dev-python/gentoo-common, we will install our own EXTERNALLY-MANAGED file RDEPEND=" app-arch/bzip2:= app-arch/xz-utils:= dev-lang/python-exec[python_targets_python3_10(-)] - dev-libs/libffi:= dev-python/gentoo-common sys-apps/util-linux:= >=sys-libs/zlib-1.1.3:= @@ -65,7 +67,6 @@ RDEPEND=" dev-tcltk/blt:= dev-tcltk/tix ) - xml? ( >=dev-libs/expat-2.1:= ) !!/dev/null - ) - newins Tools/gdb/libpython.py "${libname}"-gdb.py - - newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} - newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} - sed \ - -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ - -e "s:@PYDOC@:pydoc${PYVER}:" \ - -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ - "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" - - # python-exec wrapping support - local pymajor=${PYVER%.*} - local EPYTHON=python${PYVER} - local scriptdir=${D}$(python_get_scriptdir) - mkdir -p "${scriptdir}" || die - # python and pythonX - ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die - ln -s "python${pymajor}" "${scriptdir}/python" || die - # python-config and pythonX-config - # note: we need to create a wrapper rather than symlinking it due - # to some random dirname(argv[0]) magic performed by python-config - cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die - #!/bin/sh - exec "${abiver}-config" "\${@}" + insinto "${pythonplatlibdir}" + # https://peps.python.org/pep-0668/ + newins - EXTERNALLY-MANAGED <<-EOF + [externally-managed] + Error= + Please contact Flatcar maintainers if some python package + is necessary for this OEM image. EOF - chmod +x "${scriptdir}/python${pymajor}-config" || die - ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die - # 2to3, pydoc - ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die - ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die - # idle - if use tk; then - ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die - fi + + rm -r "${ED}/discard" || die }