Skip to content

Commit 72c5745

Browse files
committed
Use host CPython as Python dependency; remove xcb image
The `xcb` Dockerfile / image existed to provide a host build of CPython, which was required to build libxcb, xcb-proto, and tk. The existence of this image predated our building a host CPython in order to build CPython itself. With PBS now unconditionally building a host CPython, we can use our host CPython during the builds of these packages, eliminating the need for the xcb image. This commit makes that transition.
1 parent 59bc9eb commit 72c5745

File tree

7 files changed

+26
-18
lines changed

7 files changed

+26
-18
lines changed

.github/workflows/linux.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ jobs:
6060
- build.cross
6161
- build.cross-riscv64
6262
- gcc
63-
- xcb
64-
- xcb.cross
65-
- xcb.cross-riscv64
6663
name: ${{ matrix.image }}
6764
runs-on: depot-ubuntu-22.04
6865
permissions:

cpython-unix/Makefile

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ PYTHON_DEP_DEPENDS := \
7070
$(TOOLCHAIN_DEPENDS) \
7171
$(NULL)
7272

73+
HOST_PYTHON_DEPENDS := $(OUTDIR)/cpython-$(PYTHON_MAJOR_VERSION)-$(CPYTHON_$(PYTHON_MAJOR_VERSION)_VERSION)-$(HOST_PLATFORM).tar
74+
7375
default: $(OUTDIR)/cpython-$(CPYTHON_$(PYTHON_MAJOR_VERSION)_VERSION)-$(PACKAGE_SUFFIX).tar
7476

7577
ifndef PYBUILD_NO_DOCKER
@@ -149,16 +151,16 @@ $(OUTDIR)/libXau-$(LIBXAU_VERSION)-$(PACKAGE_SUFFIX).tar: $(LIBXAU_DEPENDS)
149151

150152
LIBXCB_DEPENDS = \
151153
$(PYTHON_DEP_DEPENDS) \
154+
$(HOST_PYTHON_DEPENDS) \
152155
$(HERE)/build-libxcb.sh \
153-
$(OUTDIR)/image-$(DOCKER_IMAGE_XCB).tar \
154156
$(OUTDIR)/xcb-proto-$(XCB_PROTO_VERSION)-$(PACKAGE_SUFFIX).tar \
155157
$(OUTDIR)/libXau-$(LIBXAU_VERSION)-$(PACKAGE_SUFFIX).tar \
156158
$(OUTDIR)/xorgproto-$(XORGPROTO_VERSION)-$(PACKAGE_SUFFIX).tar \
157159
$(OUTDIR)/libpthread-stubs-$(LIBPTHREAD_STUBS_VERSION)-$(PACKAGE_SUFFIX).tar \
158160
$(NULL)
159161

160162
$(OUTDIR)/libxcb-$(LIBXCB_VERSION)-$(PACKAGE_SUFFIX).tar: $(LIBXCB_DEPENDS)
161-
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_XCB) libxcb
163+
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) --python-host-version $(PYBUILD_PYTHON_VERSION) libxcb
162164

163165
$(OUTDIR)/m4-$(M4_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-m4.sh
164166
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) m4
@@ -204,22 +206,23 @@ $(OUTDIR)/tix-$(TIX_VERSION)-$(PACKAGE_SUFFIX).tar: $(TIX_DEPENDS)
204206
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) tix
205207

206208
TK_DEPENDS = \
209+
$(HOST_PYTHON_DEPENDS) \
207210
$(HERE)/build-tk.sh \
208211
$(OUTDIR)/tcl-$(TCL_VERSION)-$(PACKAGE_SUFFIX).tar \
209212
$(if $(NEED_LIBX11),$(OUTDIR)/libX11-$(LIBX11_VERSION)-$(PACKAGE_SUFFIX).tar) \
210213
$(NULL)
211214

212215
$(OUTDIR)/tk-$(TK_VERSION)-$(PACKAGE_SUFFIX).tar: $(TK_DEPENDS)
213-
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_XCB) tk
216+
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) --python-host-version $(PYBUILD_PYTHON_VERSION) tk
214217

215218
$(OUTDIR)/uuid-$(UUID_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-uuid.sh
216219
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) uuid
217220

218221
$(OUTDIR)/x11-util-macros-$(X11_UTIL_MACROS_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-x11-util-macros.sh
219222
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) x11-util-macros
220223

221-
$(OUTDIR)/xcb-proto-$(XCB_PROTO_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-xcb-proto.sh
222-
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_XCB) xcb-proto
224+
$(OUTDIR)/xcb-proto-$(XCB_PROTO_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HOST_PYTHON_DEPENDS) $(HERE)/build-xcb-proto.sh
225+
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) --python-host-version $(PYBUILD_PYTHON_VERSION) xcb-proto
223226

224227
$(OUTDIR)/xorgproto-$(XORGPROTO_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-xorgproto.sh
225228
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) xorgproto

cpython-unix/build.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ def simple_build(
246246
dest_archive,
247247
extra_archives=None,
248248
tools_path="deps",
249+
python_host_version=None,
249250
):
250251
archive = download_entry(entry, DOWNLOADS_PATH)
251252

@@ -264,6 +265,12 @@ def simple_build(
264265
for a in extra_archives or []:
265266
build_env.install_artifact_archive(BUILD, a, target_triple, build_options)
266267

268+
if python_host_version:
269+
majmin = ".".join(python_host_version.split(".")[0:2])
270+
build_env.install_toolchain_archive(
271+
BUILD, f"cpython-{majmin}", host_platform, version=python_host_version,
272+
)
273+
267274
build_env.copy_file(archive)
268275
build_env.copy_file(SUPPORT / ("build-%s.sh" % entry))
269276

@@ -796,6 +803,7 @@ def build_cpython(
796803
for p in sorted(packages):
797804
build_env.install_artifact_archive(BUILD, p, target_triple, build_options)
798805

806+
# Install the host CPython.
799807
build_env.install_toolchain_archive(
800808
BUILD, entry_name, host_platform, version=python_version
801809
)
@@ -1032,6 +1040,11 @@ def main():
10321040
default=None,
10331041
help="A custom path to CPython source files to use",
10341042
)
1043+
parser.add_argument(
1044+
"--python-host-version",
1045+
default=None,
1046+
help="Python X.Y version for host Python installation",
1047+
)
10351048
parser.add_argument("action")
10361049

10371050
args = parser.parse_args()
@@ -1047,6 +1060,8 @@ def main():
10471060
dest_archive = pathlib.Path(args.dest_archive)
10481061
docker_image = args.docker_image
10491062

1063+
python_host_version = args.python_host_version
1064+
10501065
settings = get_target_settings(TARGETS_CONFIG, target_triple)
10511066

10521067
if args.action == "dockerfiles":
@@ -1213,6 +1228,7 @@ def main():
12131228
target_triple=target_triple,
12141229
build_options=build_options,
12151230
dest_archive=dest_archive,
1231+
python_host_version=python_host_version,
12161232
)
12171233

12181234
elif action == "libxcb":
@@ -1226,6 +1242,7 @@ def main():
12261242
build_options=build_options,
12271243
dest_archive=dest_archive,
12281244
extra_archives={"libpthread-stubs", "libXau", "xcb-proto", "xorgproto"},
1245+
python_host_version=python_host_version,
12291246
)
12301247

12311248
elif action == "tix":
@@ -1260,6 +1277,7 @@ def main():
12601277
build_options=build_options,
12611278
dest_archive=dest_archive,
12621279
extra_archives=extra_archives,
1280+
python_host_version=python_host_version,
12631281
)
12641282

12651283
elif action.startswith("cpython-") and action.endswith("-host"):

cpython-unix/xcb.Dockerfile

Lines changed: 0 additions & 3 deletions
This file was deleted.

cpython-unix/xcb.cross-riscv64.Dockerfile

Lines changed: 0 additions & 3 deletions
This file was deleted.

cpython-unix/xcb.cross.Dockerfile

Lines changed: 0 additions & 3 deletions
This file was deleted.

pythonbuild/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ def write_triples_makefiles(
195195
image_suffix = settings.get("docker_image_suffix", "")
196196

197197
lines.append("DOCKER_IMAGE_BUILD := build%s\n" % image_suffix)
198-
lines.append("DOCKER_IMAGE_XCB := xcb%s\n" % image_suffix)
199198

200199
entry = clang_toolchain(host_platform, triple)
201200
lines.append(

0 commit comments

Comments
 (0)