Skip to content

Build RPM packages on OBS from the shared spec - #202

Merged
x1unix merged 6 commits into
open-telemetry:mainfrom
x1unix:rpm-migrate-obs
Nov 27, 2026
Merged

x1unix merged 6 commits into
open-telemetry:mainfrom
x1unix:rpm-migrate-obs

Conversation

@x1unix

@x1unix x1unix commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

This PR updates the SRPM spec generator to produce a shared spec to support both debbuild and rpmbuild (for RPM packages).

This is the first step of moving the RPMs from COPR to OBS (see the design doc).

It adds no RPM repositories to the workflow's targets yet, and COPR is untouched.

What changes

  • A single shared spec serves debbuild and rpmbuild, with small differences guarded by %{_vendor}.

  • StageOBS stages one payload with two file lists: <component>.rpm.files (with %attr and %config(noreplace)) and <component>.deb.files.

  • make obs-rpm-rebuild-container rebuilds the generated specs, and make integration-test-obs-rpm-rebuild tests the RPM metadata.

  • A new rpm-source-rebuild CI job runs these on Fedora 44 and AlmaLinux 9, on amd64 and arm64.

  • The generator uses format-neutral names.

    Before After
    cmd/build-spec/deb cmd/build-spec/obs
    make deb-sources[-<component>], DEB_SOURCES_DIR, build/deb-sources make obs-sources[-<component>], OBS_SOURCES_DIR, build/obs-sources
    debspec.go, debsources.go, and the Deb* identifiers obsspec.go, obssources.go, and OBS*

Testing

Run locally on amd64:

  • make obs-sources, then make integration-test-obs-rpm-rebuild on Fedora 44: six RPMs build and every TestRpm* test passes.
  • The same on almalinux:9 (rpm 4.16) and almalinux:10: six RPMs build and every TestRpm* test passes.
  • make integration-test-deb-rebuild on debian:12: six DEBs build and every TestDeb* test passes, so sharing the spec does not change the DEBs.
  • Unit tests cover both vendor branches, the architecture and payload mapping, the two file lists, reproducible archives, and that no spec comment contains a macro (rpm 4.16 expands macros in comments and starts the section there, which broke the EL 9 build once).

Also checked on OBS, in a sandbox project: all six packages built from the unified spec for the DEB and RPM targets on both architectures and published with signed metadata.
The RPMs built on AlmaLinux 9 and 10 installed from the published repository, with signature checks on, on clean AlmaLinux 9, AlmaLinux 10, and Fedora 44 containers (x86_64).

Not verified yet

  • The rpm-source-rebuild job has not run on GitHub (registry pulls, arm64 runners, Python staging time).
  • Installing the RPMs from a published repository on Fedora and EL, and the Python package staged by CI rather than locally.
  • obs.yml has not been dispatched since the rename.

Notes for reviewers

  • RPMs go to a single rpm repository built on AlmaLinux 9 and used by Fedora and EL alike.
    The Python package is part of it everywhere; on EL 9 its system Python 3.9 is not among the bundled interpreters (3.10 to 3.13), so it installs but does nothing unless a supported interpreter is used.
  • The rpm repository already exists in the home:opentelemetry:stable:build and home:opentelemetry:stable OBS projects, with builds disabled in the build project.
    Until this PR is merged, the build project still holds the DEB-only specs, which fail under rpm, so a DEB-only upload would wait on failing RPM builds and not release.
  • Follow-ups, not in this PR:
    • Enable the rpm builds in home:opentelemetry:stable:build once this PR is merged and its obs.yml run has uploaded the unified specs (remove the project-level build disable on rpm), then release the first RPMs.
    • Retire COPR (copr-build.yml, .copr/Makefile, and the SRPM path).

@mmanciop

Copy link
Copy Markdown
Contributor

This PR turns off stripping, debuginfo, and build-id links for the prebuilt payload.
It leaves brp-mangle-shebangs on, so rpmbuild changes files in the payload after %install.
The RPMs then ship different bytes from the DEB and nfpm packages built from the same source archive.

Evidence

In the rpm-source-rebuild CI jobs of #202, both on Fedora 44 and on AlmaLinux 9, rpmbuild logs:

mangling shebang in /usr/lib/opentelemetry/nodejs/node_modules/@grpc/proto-loader/build/bin/proto-loader-gen-types.js from /usr/bin/env node to #!/usr/bin/node
mangling shebang in /usr/lib/opentelemetry/nodejs/node_modules/yaml/bin.mjs from /usr/bin/env node to #!/usr/bin/node
mangling shebang in /usr/lib/opentelemetry/nodejs/node_modules/rimraf/dist/esm/bin.mjs from /usr/bin/env node to #!/usr/bin/node
mangling shebang in /usr/lib/opentelemetry/nodejs/node_modules/systeminformation/lib/cli.js from /usr/bin/env node to #!/usr/bin/node
mangling shebang in /usr/lib/opentelemetry/nodejs/node_modules/which/bin/node-which from /usr/bin/env node to #!/usr/bin/node
mangling shebang in /usr/lib/opentelemetry/nodejs/node_modules/glob/dist/esm/bin.mjs from /usr/bin/env node to #!/usr/bin/node

Impact

The impact is admittedly small:

  • The RPM and DEB payloads of the same version are no longer byte-identical, which defeats the point of staging one tree for both builders.
  • On a host whose node is not /usr/bin/node (nvm, /usr/local/bin, a container image), the rewritten scripts no longer start.
  • The rewritten shebang is also why the spec has to filter %{_bindir}/node out of the automatic Requires.

brp-python-bytecompile runs too, but is currently a no-op for this payload.
It is invoked as brp-python-bytecompile '' 1 0 on both distributions: no interpreter in the buildroot, and _python_bytecompile_extra set to 0.
It would start writing unpackaged __pycache__/*.pyc files if either of those changed.

Proposed fix

Add the following next to the existing debug_package and __strip overrides in the rpm branch:

%global __brp_mangle_shebangs %{nil}
%global __brp_python_bytecompile %{nil}

Then add matching assertions to packaging/builder/obsspec_test.go.

Update SRPM spec generator to generate a spec shared among rpmbuild and
debbuild

Signed-off-by: x1unix <9203548+x1unix@users.noreply.github.com>
The unified spec is built by debbuild and rpmbuild, so names that
said "deb" for the shared parts were misleading.

- cmd/build-spec/deb -> cmd/build-spec/obs
- make deb-sources[-<component>] -> make obs-sources[-<component>],
  DEB_SOURCES_DIR -> OBS_SOURCES_DIR, build/deb-sources ->
  build/obs-sources
- packaging/builder: debspec.go, debsources.go and their test ->
  obsspec.go, obssources.go, obsspec_test.go; WriteDebSpec,
  WriteDebSources, DebVersionRelease and related identifiers -> OBS*

DEB-specific names stay: deb-rebuild-container, debbuild-rebuild.sh,
DEBFileListSuffix, TestDeb*.

Also fix the rpm-source-rebuild matrix: its include entries had no
arch, so GitHub would have merged them into the arch axis and run only
the AlmaLinux image. Use a plain image x arch matrix and derive the
Python skip from the image.

Signed-off-by: x1unix <9203548+x1unix@users.noreply.github.com>
Signed-off-by: x1unix <9203548+x1unix@users.noreply.github.com>
Signed-off-by: x1unix <9203548+x1unix@users.noreply.github.com>
Signed-off-by: x1unix <9203548+x1unix@users.noreply.github.com>
brp-mangle-shebangs rewrote "#!/usr/bin/env node" to "#!/usr/bin/node"
in the Node.js scripts, so the RPMs shipped different bytes from the
DEBs built from the same source archive and the scripts failed on hosts
whose node is not /usr/bin/node. Turn it off, and brp-python-bytecompile
too, which would write unpackaged __pycache__ files if its inputs changed.

Signed-off-by: x1unix <9203548+x1unix@users.noreply.github.com>
@x1unix

x1unix commented Nov 27, 2026

Copy link
Copy Markdown
Member Author

@mmanciop good catch, reproduced.

I've added both overrides to commit 2fccf98 and rebased the branch.

@x1unix
x1unix requested a review from mmanciop November 27, 2026 17:42
@x1unix
x1unix merged commit d492c15 into open-telemetry:main Nov 27, 2026
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants