mirror of
https://github.com/funkemunky/codex-copr.git
synced 2026-05-31 06:11:55 +00:00
Creating codex copr files
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
*.tar.gz
|
||||
Makefile
|
||||
*.rpm
|
||||
results*/
|
||||
.rpmbuild/
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
TOPDIR ?= $(CURDIR)/.rpmbuild
|
||||
|
||||
.PHONY: srpm clean
|
||||
|
||||
srpm:
|
||||
./make-srpm.sh
|
||||
|
||||
clean:
|
||||
rm -rf "$(TOPDIR)"
|
||||
+16
-74
@@ -1,86 +1,35 @@
|
||||
%bcond_without check
|
||||
%bcond_without bootstrap
|
||||
%global cargo_install_lib 0
|
||||
%global crate_dir codex-rs/cli
|
||||
%global up_version %{?up_version}%{!?up_version:0}
|
||||
%global debug_package %{nil}
|
||||
%global _build_id_links none
|
||||
%{!?bash_completions_dir:%global bash_completions_dir %{_datadir}/bash-completion/completions}
|
||||
%{!?fish_completions_dir:%global fish_completions_dir %{_datadir}/fish/vendor_completions.d}
|
||||
%{!?zsh_completions_dir:%global zsh_completions_dir %{_datadir}/zsh/site-functions}
|
||||
%if 0%{?fedora}
|
||||
%global has_fedora_macros 1
|
||||
%else
|
||||
%global has_fedora_macros 0
|
||||
%endif
|
||||
|
||||
Name: codex
|
||||
Version: 0.98.0
|
||||
Release: 7
|
||||
Version: %{up_version}
|
||||
Release: 1%{?dist}
|
||||
Summary: OpenAI Codex command-line interface
|
||||
|
||||
License: Apache-2.0
|
||||
URL: https://github.com/openai/codex
|
||||
Source0: %{url}/archive/refs/tags/rust-v%{version}.tar.gz
|
||||
Source0: %{name}-%{version}-x86_64-unknown-linux-musl.tar.gz
|
||||
|
||||
%if %{has_fedora_macros}
|
||||
BuildRequires: cargo-rpm-macros >= 24
|
||||
BuildRequires: rust-packaging
|
||||
%endif
|
||||
BuildRequires: cargo
|
||||
BuildRequires: rust
|
||||
BuildRequires: pkgconfig(openssl)
|
||||
BuildRequires: git-core
|
||||
BuildArch: x86_64
|
||||
Requires: git
|
||||
|
||||
%description
|
||||
OpenAI Codex is a coding assistant that runs in your terminal.
|
||||
|
||||
%if %{has_fedora_macros}
|
||||
%if %{without bootstrap}
|
||||
%generate_buildrequires
|
||||
cd %{crate_dir}
|
||||
%cargo_generate_buildrequires
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%autosetup -n codex-rust-v%{version}
|
||||
cd %{crate_dir}
|
||||
|
||||
%if %{has_fedora_macros}
|
||||
%if %{with bootstrap}
|
||||
# Bootstrap pulls crates from the network with mock --enable-network
|
||||
# because not all dependencies exist as Fedora crate RPMs yet
|
||||
%cargo_prep -N
|
||||
sed -i 's/offline = true/offline = false/' .cargo/config.toml
|
||||
%else
|
||||
%cargo_prep
|
||||
%endif
|
||||
%else
|
||||
%if %{with bootstrap}
|
||||
# Allow online crate fetches when bootstrap builds are requested.
|
||||
sed -i 's/offline = true/offline = false/' .cargo/config.toml || :
|
||||
%endif
|
||||
%endif
|
||||
%autosetup -n %{name}-%{version}
|
||||
|
||||
%build
|
||||
cd %{crate_dir}
|
||||
%if %{has_fedora_macros}
|
||||
%cargo_build
|
||||
%else
|
||||
%set_build_flags
|
||||
export CARGO_HOME=$PWD/.cargo-home
|
||||
mkdir -p "$CARGO_HOME"
|
||||
export RUSTFLAGS="%{?build_rustflags} -C debuginfo=2"
|
||||
cargo build --release
|
||||
%endif
|
||||
|
||||
%install
|
||||
cd %{crate_dir}
|
||||
%if %{has_fedora_macros}
|
||||
%cargo_install
|
||||
%else
|
||||
install -Dpm 0755 ../target/release/codex %{buildroot}%{_bindir}/codex
|
||||
%endif
|
||||
install -Dpm 0755 codex %{buildroot}%{_bindir}/codex
|
||||
|
||||
# Shell completion files are generated from the built binary.
|
||||
# Generate shell completions from the packaged binary so the payload stays
|
||||
# aligned with the shipped CLI.
|
||||
%{buildroot}%{_bindir}/codex completion bash > codex.bash
|
||||
%{buildroot}%{_bindir}/codex completion fish > codex.fish
|
||||
%{buildroot}%{_bindir}/codex completion zsh > _codex
|
||||
@@ -90,23 +39,16 @@ install -Dpm 0644 codex.fish %{buildroot}%{fish_completions_dir}/codex.fish
|
||||
install -Dpm 0644 _codex %{buildroot}%{zsh_completions_dir}/_codex
|
||||
|
||||
%check
|
||||
%{buildroot}%{_bindir}/codex --help >/dev/null
|
||||
# Cargo tests cause build machine timeout (5h) TODO
|
||||
%{buildroot}%{_bindir}/codex --version >/dev/null
|
||||
|
||||
%files
|
||||
%license LICENSE
|
||||
%doc codex-rs/README.md
|
||||
%doc README.md
|
||||
%{_bindir}/codex
|
||||
%{bash_completions_dir}/codex
|
||||
%{fish_completions_dir}/codex.fish
|
||||
%{zsh_completions_dir}/_codex
|
||||
|
||||
%changelog
|
||||
* Thu Feb 12 2026 Ernesto Martinez <me@ecomaikgolf.com> - 0.98.0-7
|
||||
- Define fallback shell completion directory macros for non-Fedora chroots.
|
||||
|
||||
* Wed Feb 11 2026 Ernesto Martinez <me@ecomaikgolf.com> - 0.98.0-4
|
||||
- Gate Fedora Rust macros to Fedora; use plain cargo flow on EL-like chroots.
|
||||
|
||||
* Wed Feb 11 2026 Ernesto Martinez <me@ecomaikgolf.com> - 0.98.0-1
|
||||
- Maintain explicit changelog entry for wider chroot compatibility.
|
||||
* Wed Apr 29 2026 Codex <codex@example.invalid> - 0-1
|
||||
- Package the latest upstream musl release tarball as an RPM.
|
||||
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
TOPDIR="${TOPDIR:-$PWD/.rpmbuild}"
|
||||
SOURCES_DIR="$TOPDIR/SOURCES"
|
||||
SRPMS_DIR="$TOPDIR/SRPMS"
|
||||
SPECS_DIR="$TOPDIR/SPECS"
|
||||
WORK_DIR="$(mktemp -d)"
|
||||
LATEST_URL="https://github.com/openai/codex/releases/latest/download/codex-x86_64-unknown-linux-musl.tar.gz"
|
||||
|
||||
cleanup() {
|
||||
rm -rf "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
mkdir -p "$SOURCES_DIR" "$SRPMS_DIR" "$SPECS_DIR"
|
||||
|
||||
ARCHIVE="$WORK_DIR/codex-x86_64-unknown-linux-musl.tar.gz"
|
||||
echo "Downloading latest Codex release tarball..."
|
||||
curl -fL --retry 3 --retry-delay 2 -o "$ARCHIVE" "$LATEST_URL"
|
||||
|
||||
mkdir -p "$WORK_DIR/unpack"
|
||||
tar -xzf "$ARCHIVE" -C "$WORK_DIR/unpack"
|
||||
|
||||
UPSTREAM_BINARY="$WORK_DIR/unpack/codex-x86_64-unknown-linux-musl"
|
||||
if [[ ! -x "$UPSTREAM_BINARY" ]]; then
|
||||
echo "Expected upstream binary codex-x86_64-unknown-linux-musl, but it was not found." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION="$("$UPSTREAM_BINARY" --version | awk '{print $2}')"
|
||||
if [[ -z "$VERSION" ]]; then
|
||||
echo "Failed to determine Codex version from downloaded binary." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TAG="rust-v$VERSION"
|
||||
SOURCE_TREE="$WORK_DIR/codex-$VERSION"
|
||||
mkdir -p "$SOURCE_TREE"
|
||||
|
||||
install -pm 0755 "$UPSTREAM_BINARY" "$SOURCE_TREE/codex"
|
||||
|
||||
echo "Downloading LICENSE and README for $TAG..."
|
||||
curl -fL --retry 3 --retry-delay 2 \
|
||||
-o "$SOURCE_TREE/LICENSE" \
|
||||
"https://raw.githubusercontent.com/openai/codex/$TAG/LICENSE"
|
||||
curl -fL --retry 3 --retry-delay 2 \
|
||||
-o "$SOURCE_TREE/README.md" \
|
||||
"https://raw.githubusercontent.com/openai/codex/$TAG/README.md"
|
||||
|
||||
SOURCE_ARCHIVE="$SOURCES_DIR/codex-$VERSION-x86_64-unknown-linux-musl.tar.gz"
|
||||
tar -C "$WORK_DIR" -czf "$SOURCE_ARCHIVE" "codex-$VERSION"
|
||||
|
||||
cp codex.spec "$SPECS_DIR/codex.spec"
|
||||
|
||||
echo "Building SRPM for version $VERSION..."
|
||||
rpmbuild \
|
||||
--define "_topdir $TOPDIR" \
|
||||
--define "up_version $VERSION" \
|
||||
-bs "$SPECS_DIR/codex.spec"
|
||||
|
||||
echo
|
||||
echo "SRPM written to:"
|
||||
find "$SRPMS_DIR" -maxdepth 1 -type f -name "codex-$VERSION-*.src.rpm" -print
|
||||
Reference in New Issue
Block a user