Skip to content

Commit

Permalink
Merge pull request #476 from citrus-it/py
Browse files Browse the repository at this point in the history
Stop shipping python 3.11 pkg modules
  • Loading branch information
oetiker authored Mar 8, 2024
2 parents f87a727 + 80e39ea commit a95934f
Show file tree
Hide file tree
Showing 11 changed files with 3,337 additions and 6,726 deletions.
9 changes: 9 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ fmt: FRC
python$(PYVER) -mpip install --quiet --user --upgrade black
$(HOME)/.local/bin/black --config $(CODE_WS)/.black $(CODE_WS)/src

bandit: FRC
python$(PYVER) -mpip install --quiet --user --upgrade bandit

check: bandit
python$(PYVER) setup.py bandit

baseline: bandit
-python$(PYVER) setup.py bandit -g

$(SUBDIRS) cffi_src: FRC
@cd $@; pwd; $(MAKE) $(TARGET) CC=$(CC)

Expand Down
2 changes: 1 addition & 1 deletion src/Makefile.com
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CFLAGS = -m64 -Wall -Werror -Wextra -gdwarf-2 -gstrict-dwarf \
CPPFLAGS = -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS

# Whitespace separated list of versions to build and test.
PYVERSIONS = 3.11 3.12
PYVERSIONS = 3.12
# The single version used for shebang lines and packaging.
PYVER = 3.12

Expand Down
2 changes: 1 addition & 1 deletion src/pkg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ INCORP = consolidation\:ips\:ips-incorporation

PM_TRANSFORMS = defaults
# For python version migrations
PM_TRANSFORMS += pynext
#PM_TRANSFORMS += pynext

i386_DEFINES = \
i386_ONLY='' \
Expand Down
11 changes: 0 additions & 11 deletions src/pkg/external_deps.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
pkg:/runtime/python-311
pkg:/library/python-3/cffi-311
pkg:/library/python-3/coverage-311
pkg:/library/python-3/cryptography-311
pkg:/library/python-3/jsonrpclib-311
pkg:/library/python-3/jsonschema-311
pkg:/library/python-3/pybonjour-311
pkg:/library/python-3/pyopenssl-311
pkg:/library/python-3/rapidjson-311
pkg:/library/python-3/setuptools-311
#
pkg:/runtime/python-312
pkg:/library/python-3/cffi-312
Expand All @@ -21,7 +11,6 @@
pkg:/library/python-3/rapidjson-312
pkg:/library/python-3/setuptools-312
#
pkg:/system/library/python/libbe-311
pkg:/system/library/python/libbe-312
#
pkg:/SUNWcs
Expand Down
4 changes: 1 addition & 3 deletions src/pkg/manifests/package:pkg.p5m
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@
<transform file path=$(PYDIRVP)/pkg/solver -> \
set pkg.depend.bypass-generate libm.so.0>
#
<include bundledmodules.3.11.core.p5m>
<include bundledlicences.3.12.core.p5m>
<include bundledmodules.3.12.core.p5m>
set name=pkg.fmri value=pkg:/package/pkg@$(PKGVERS)
set name=pkg.summary value="Image Packaging System - pkg(7)"
set name=pkg.description \
value="The Image Packaging System (IPS), or pkg(7), is the software delivery system used on OmniOS."
set name=pkg.depend.runpath \
value=/usr/lib/pkg/python$(PYVERS):/usr/lib/pkg/python3.11:$PKGDEPEND_RUNPATH
value=/usr/lib/pkg/python$(PYVERS):$PKGDEPEND_RUNPATH
set name=info.classification \
value=org.opensolaris.category.2008:System/Packaging
set name=variant.arch value=$(ARCH)
Expand Down Expand Up @@ -260,7 +259,6 @@ file path=usr/bin/pkgsurf
dir path=usr/lib
dir path=usr/lib/pkg
file path=usr/lib/pkg.depotd mode=0755
dir path=usr/lib/python3.11
dir path=usr/share
dir path=usr/share/lib
dir path=usr/share/lib/pkg
Expand Down
7 changes: 0 additions & 7 deletions src/pkg/manifests/system:zones:brand:bhyve.p5m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# Copyright 2024 OmniOS Community Edition (OmniOSce) Association.
#

<include bundledmodules.3.11.bhyve.p5m>
<include bundledlicences.3.12.bhyve.p5m>
<include bundledmodules.3.12.bhyve.p5m>
set name=pkg.fmri value=pkg:/system/zones/brand/bhyve@$(PKGVERS)
Expand All @@ -31,9 +30,7 @@ dir path=usr/lib
dir path=usr/lib/brand
dir path=usr/lib/brand/bhyve
dir path=usr/lib/brand/bhyve/__pycache__
file path=usr/lib/brand/bhyve/__pycache__/bootlib.cpython-311.pyc mode=0444
file path=usr/lib/brand/bhyve/__pycache__/bootlib.cpython-312.pyc mode=0444
file path=usr/lib/brand/bhyve/__pycache__/bundle.cpython-311.pyc mode=0444
file path=usr/lib/brand/bhyve/__pycache__/bundle.cpython-312.pyc mode=0444
file path=usr/lib/brand/bhyve/boot mode=0555
file path=usr/lib/brand/bhyve/bootlib.py mode=0444
Expand All @@ -47,13 +44,9 @@ file path=usr/lib/brand/bhyve/support mode=0555
dir path=usr/lib/brand/bhyve/uefi
file path=usr/lib/brand/bhyve/uefi/__init__.py mode=0444
dir path=usr/lib/brand/bhyve/uefi/__pycache__
file path=usr/lib/brand/bhyve/uefi/__pycache__/__init__.cpython-311.pyc \
mode=0444
file path=usr/lib/brand/bhyve/uefi/__pycache__/__init__.cpython-312.pyc \
mode=0444
file path=usr/lib/brand/bhyve/uefi/__pycache__/align.cpython-311.pyc mode=0444
file path=usr/lib/brand/bhyve/uefi/__pycache__/align.cpython-312.pyc mode=0444
file path=usr/lib/brand/bhyve/uefi/__pycache__/vars.cpython-311.pyc mode=0444
file path=usr/lib/brand/bhyve/uefi/__pycache__/vars.cpython-312.pyc mode=0444
file path=usr/lib/brand/bhyve/uefi/align.py mode=0444
file path=usr/lib/brand/bhyve/uefi/vars.py mode=0444
Expand Down
58 changes: 27 additions & 31 deletions src/tests/api/t_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import unittest

Expand All @@ -50,18 +51,15 @@
import pkg.publish.dependencies as dependencies
import pkg.updatelog as updatelog

# Default python versions. When the default runtime version
# of python changes then these variables will need to be
# updated. py_ver_lib is the string associated with the
# cpython library for the version of python (can be found
# using from importlib.machinery import EXTENSION_SUFFIXES).
py_ver_default = "3.11"
py_ver_lib = "311"
py_ver_default = sysconfig.get_config_var("py_version_short") # 3.nn
py_ver_lib = sysconfig.get_config_var("py_version_nodot") # 3nn
# .cpython-3nn-x86_64-pc-solaris2.so
ext_suffix = sysconfig.get_config_var("EXT_SUFFIX")
py_ver_lib_list = [
"{0}.abi3.so",
"{0}.cpython-{1}.so".format("{0}", py_ver_lib),
"{0}{1}".format("{0}", ext_suffix),
"64/{0}.abi3.so",
"64/{0}.cpython-{1}.so".format("{0}", py_ver_lib),
"64/{0}{1}".format("{0}", ext_suffix),
]

mod_pats = [
Expand Down Expand Up @@ -1137,12 +1135,12 @@ def run(self):
python_bypass_manf = """
file NOHASH group=sys mode=0755 owner=root path={bypass_path} \
pkg.depend.bypass-generate=opt/pkgdep_runpath/pdtest.py \
pkg.depend.bypass-generate=usr/lib/python{0}/lib-dynload/pkgdep_runpath/pdtest.cpython-{1}.so \
pkg.depend.bypass-generate=usr/lib/python{0}/lib-dynload/pkgdep_runpath/pdtest{1} \
pkg.depend.runpath=opt:$PKGDEPEND_RUNPATH
file NOHASH group=sys mode=0755 owner=root path={runpath_mod_path}
file NOHASH group=sys mode=0755 owner=root path={runpath_mod_test_path}
""".format(
py_ver_default, py_ver_lib, **paths
py_ver_default, ext_suffix, **paths
)

# a manifest that generates a single dependency, which we want to
Expand Down Expand Up @@ -1220,12 +1218,12 @@ def run(self):
pkg.depend.bypass-generate=pdtest.pyc \
pkg.depend.bypass-generate=pdtest.pyo \
pkg.depend.bypass-generate=pdtest.so \
pkg.depend.bypass-generate=pdtest.cpython-{0}.so \
pkg.depend.bypass-generate=pdtest{0} \
pkg.depend.runpath=$PKGDEPEND_RUNPATH:opt
file NOHASH group=sys mode=0755 owner=root path={runpath_mod_path}
file NOHASH group=sys mode=0755 owner=root path={runpath_mod_test_path}
""".format(
py_ver_lib, **paths
ext_suffix, **paths
)

# a manifest which uses a combination of directory, file and normal
Expand All @@ -1234,12 +1232,12 @@ def run(self):
file NOHASH group=sys mode=0755 owner=root path={bypass_path} \
pkg.depend.bypass-generate=pdtest.py \
pkg.depend.bypass-generate=usr/lib/python{0}/vendor-packages/.* \
pkg.depend.bypass-generate=usr/lib/python{0}/site-packages/pkgdep_runpath/pdtest.cpython-{1}.so \
pkg.depend.bypass-generate=usr/lib/python{0}/site-packages/pkgdep_runpath/pdtest{1} \
pkg.depend.runpath=$PKGDEPEND_RUNPATH:opt
file NOHASH group=sys mode=0755 owner=root path={runpath_mod_path}
file NOHASH group=sys mode=0755 owner=root path={runpath_mod_test_path}
""".format(
py_ver_default, py_ver_lib, **paths
py_ver_default, ext_suffix, **paths
)

def glfilter(self, s):
Expand Down Expand Up @@ -3147,8 +3145,8 @@ def test_bypass_1(self):
es,
[
"opt/pkgdep_runpath/pdtest.py",
"usr/lib/python{0}/lib-dynload/pkgdep_runpath/pdtest.cpython-{1}.so".format(
py_ver_default, py_ver_lib
"usr/lib/python{0}/lib-dynload/pkgdep_runpath/pdtest{1}".format(
py_ver_default, ext_suffix
),
],
),
Expand Down Expand Up @@ -3187,8 +3185,8 @@ def test_bypass_1(self):
ds,
[
"opt/pkgdep_runpath/pdtest.py",
"usr/lib/python{0}/lib-dynload/pkgdep_runpath/pdtest.cpython-{1}.so".format(
py_ver_default, py_ver_lib
"usr/lib/python{0}/lib-dynload/pkgdep_runpath/pdtest{1}".format(
py_ver_default, ext_suffix
),
"usr/lib/python{0}/lib-dynload/pkgdep_runpath/pdtest.so".format(
py_ver_default
Expand Down Expand Up @@ -3288,8 +3286,8 @@ def test_bypass_2(self):
"usr/lib/python{0}/lib-dynload/pkgdep_runpath/pdtest.pyo".format(
py_ver_default
),
"usr/lib/python{0}/lib-dynload/pkgdep_runpath/pdtest.cpython-{1}.so".format(
py_ver_default, py_ver_lib
"usr/lib/python{0}/lib-dynload/pkgdep_runpath/pdtest{1}".format(
py_ver_default, ext_suffix
),
],
),
Expand Down Expand Up @@ -3326,9 +3324,7 @@ def test_bypass_2(self):
es,
[
"opt/pkgdep_runpath/pdtest.pyo",
"opt/pkgdep_runpath/pdtest.cpython-{0}.so".format(
py_ver_lib
),
f"opt/pkgdep_runpath/pdtest{ext_suffix}",
],
),
"Failed to bypass some paths despite use of file-wildcard",
Expand All @@ -3341,8 +3337,8 @@ def test_bypass_2(self):
"usr/lib/python{0}/lib-dynload/pkgdep_runpath/pdtest.pyo".format(
py_ver_default
),
"usr/lib/python{0}/lib-dynload/pkgdep_runpath/pdtest.cpython-{1}.so".format(
py_ver_default, py_ver_lib
"usr/lib/python{0}/lib-dynload/pkgdep_runpath/pdtest{1}".format(
py_ver_default, ext_suffix
),
],
),
Expand All @@ -3352,7 +3348,7 @@ def test_bypass_2(self):
# finally, test a combination of the above, we have:
# pkg.depend.bypass-generate=.*/pdtest.py \
# pkg.depend.bypass-generate=usr/lib/python3.x/vendor-packages/.* \
# pkg.depend.bypass-generate=usr/lib/python3.x/site-packages/pkgdep_runpath/pdtest.cpython-3x.so
# pkg.depend.bypass-generate=usr/lib/python3.x/site-packages/pkgdep_runpath/pdtest.cpython-3x-yyy.so
t_path = self.make_manifest(self.python_wildcard_combo_bypass_manf)

ds, es, ws, ms, pkg_attrs = dependencies.list_implicit_deps(
Expand All @@ -3375,8 +3371,8 @@ def test_bypass_2(self):
"usr/lib/python{0}/site-packages/pkgdep_runpath/pdtest.py".format(
py_ver_default
),
"usr/lib/python{0}/site-packages/pkgdep_runpath/pdtest.cpython-{1}.so".format(
py_ver_default, py_ver_lib
"usr/lib/python{0}/site-packages/pkgdep_runpath/pdtest{1}".format(
py_ver_default, ext_suffix
),
],
),
Expand All @@ -3390,8 +3386,8 @@ def test_bypass_2(self):
"usr/lib/python{0}/site-packages/pkgdep_runpath/pdtest.pyc".format(
py_ver_default
),
"usr/lib/python{0}/lib-dynload/pkgdep_runpath/pdtest.cpython-{1}.so".format(
py_ver_default, py_ver_lib
"usr/lib/python{0}/lib-dynload/pkgdep_runpath/pdtest{1}".format(
py_ver_default, ext_suffix
),
],
),
Expand Down
Loading

0 comments on commit a95934f

Please sign in to comment.