From 8d6d152fd0132a55274169b8a6a9fd22504a2a66 Mon Sep 17 00:00:00 2001 From: Huang Rui Date: Sun, 27 Sep 2026 02:56:59 -0700 Subject: [PATCH] dev-util/codex: add 0.157.1-r1, drop 0.157.1 The app-server daemon is enabled by default since 0.157 and refuses to start without the complete package layout next to the executable, which broke every interactive launch. Bug: https://github.com/openai/codex/issues/48050 Signed-off-by: Huang Rui --- ...0.157.1.ebuild => codex-0.157.1-r1.ebuild} | 44 +++++++++++++++++-- 1 file changed, 40 insertions(+), 4 deletions(-) rename dev-util/codex/{codex-0.157.1.ebuild => codex-0.157.1-r1.ebuild} (83%) diff --git a/dev-util/codex/codex-0.157.1.ebuild b/dev-util/codex/codex-0.157.1-r1.ebuild similarity index 83% rename from dev-util/codex/codex-0.157.1.ebuild rename to dev-util/codex/codex-0.157.1-r1.ebuild index 65ef446a07..8de803cb5b 100644 --- a/dev-util/codex/codex-0.157.1.ebuild +++ b/dev-util/codex/codex-0.157.1-r1.ebuild @@ -50,7 +50,7 @@ HOMEPAGE="https://github.com/openai/codex" # This tarball is generated by: https://github.com/gentoo-zh-drafts/codex/ # See .github/workflows/crates.yml for the generation process. SRC_URI=" - https://github.com/openai/${PN}/archive/rust-v${PV}.tar.gz -> ${P}.tar.gz + https://github.com/openai/${PN}/archive/rust-v${PV}.tar.gz -> ${PN}-${PV}.tar.gz https://github.com/gentoo-zh-drafts/codex/releases/download/rust-v${PV}/codex-rust-v${PV}-crates.tar.xz amd64? ( https://github.com/openai/codex/releases/download/rusty-v8-v${RUSTY_V8_TAG}/librusty_v8_release_x86_64-unknown-linux-musl.a.gz @@ -88,11 +88,12 @@ DEPEND=" " RDEPEND="${DEPEND} >=sys-apps/bubblewrap-0.11.2 + sys-apps/ripgrep " BDEPEND="virtual/pkgconfig" # rust does not use *FLAGS from make.conf, silence portage warning -QA_FLAGS_IGNORED="usr/bin/${PN}" +QA_FLAGS_IGNORED="usr/lib/${PN}/bin/*" pkg_pretend() { check-reqs_pkg_pretend @@ -153,7 +154,42 @@ src_compile() { } src_install() { - dobin "$(cargo_target_dir)/codex" - dobin "$(cargo_target_dir)/codex-code-mode-host" + local pkgdir="/usr/lib/${PN}" + local pkg_target + case ${ARCH} in + amd64) pkg_target="x86_64-unknown-linux-gnu" ;; + arm64) pkg_target="aarch64-unknown-linux-gnu" ;; + esac + + exeinto "${pkgdir}"/bin + doexe "$(cargo_target_dir)/codex" "$(cargo_target_dir)/codex-code-mode-host" + + # The app-server daemon installs the CLI from this layout, see + # https://github.com/openai/codex/issues/48050 + cat > "${T}"/codex-package.json <<-EOF || die + { + "layoutVersion": 1, + "version": "${PV}", + "target": "${pkg_target}", + "variant": "codex", + "entrypoint": "bin/codex", + "resourcesDir": "codex-resources", + "pathDir": "codex-path" + } + EOF + insinto "${pkgdir}" + doins "${T}"/codex-package.json + + # The layout requires both files, they resolve to the system programs + printf '#!/bin/sh\nexec %s/usr/bin/rg "$@"\n' "${EPREFIX}" > "${T}"/rg || die + printf '#!/bin/sh\nexec %s/usr/bin/bwrap "$@"\n' "${EPREFIX}" > "${T}"/bwrap || die + exeinto "${pkgdir}"/codex-path + doexe "${T}"/rg + exeinto "${pkgdir}"/codex-resources + doexe "${T}"/bwrap + + dosym ../lib/"${PN}"/bin/codex /usr/bin/"${PN}" + dosym ../lib/"${PN}"/bin/codex-code-mode-host /usr/bin/codex-code-mode-host + einstalldocs }