Skip to content

Fix RPM packaging for modern openSUSE Leap 16, Fedora, and RHEL/Rocky Linux - #749

Open
leotada wants to merge 1 commit into
dlang:masterfrom
leotada:fix-rpm-packaging-leap16-rhel-rocky
Open

leotada wants to merge 1 commit into
dlang:masterfrom
leotada:fix-rpm-packaging-leap16-rhel-rocky

Conversation

@leotada

@leotada leotada commented Oct 19, 2026

Copy link
Copy Markdown

Summary of Changes

This PR modernizes the RPM packaging in linux/dmd_rpm.sh to fix compatibility on openSUSE Leap 16, openSUSE Tumbleweed, Rocky Linux / RHEL, and Fedora:

  1. RPM Boolean Rich Dependencies (Requires:):

    • Replaced distro-specific names with explicit boolean dependencies: (libcurl($FARCH) or libcurl4($FARCH)) and (libgcc($FARCH) or libgcc_s1($FARCH)).
    • On openSUSE Leap 16+, libcurl4 is used (there is no libcurl or libcurl4-32bit). On Fedora/RHEL, libcurl is used. This allows the RPM packages to be cross-compatible across all RPM-based distros.
  2. 32-bit Multilib Isolation & Weak Dependencies (Recommends:):

    • Bundled 32-bit Phobos (/usr/lib/libphobos2.so*) previously caused RPM's find-requires to inject an automatic 32-bit Requires: libgcc_s.so.1 into the 64-bit package, which fails on standard 64-bit systems where 32-bit libgcc_s.so.1 is not installed by default. Added %global __requires_exclude_from ^/usr/lib/libphobos2\\.so.*$ on x86_64 to prevent this leak.
    • Converted 32-bit development dependencies (glibc-devel(x86-32) or glibc-devel-32bit, libgcc(x86-32) or libgcc_s1-32bit, libcurl(x86-32) or libcurl4-32bit) from hard Requires: to Recommends:. This prevents installation failures on 64-bit-only installations while still pulling in multilib packages when requested/available.
    • Fixed typo in openSUSE 32-bit dependencies: gcc-32bit($FARCH) evaluated to non-existent gcc-32bit(x86-64).
  3. Smooth openSUSE Upgrades (Provides: & Obsoletes:):

    • Added Provides and Obsoletes for phobos-devel, phobos-devel-static, and dub to prevent file conflicts when upgrading over openSUSE's distribution-split packages.
  4. Build System Compatibility:

    • Updated OS verification to recognize /etc/os-release so dmd_rpm.sh can be executed on any modern Linux distribution.
    • Made fakeroot optional if rpmbuild is already installed.
    • Defined _topdir and _tmppath to ensure clean builds in unprivileged or containerized build environments.

- Use explicit RPM boolean rich dependencies in Requires:
  (libcurl($FARCH) or libcurl4($FARCH)) and (libgcc($FARCH) or libgcc_s1($FARCH))
  so the Fedora and openSUSE RPMs are cross-compatible across Fedora,
  openSUSE Leap 15/16/Tumbleweed, and RHEL/Rocky Linux.
- Use cross-distro Recommends: for 32-bit multilib packages:
  (glibc-devel(x86-32) or glibc-devel-32bit), (libgcc(x86-32) or libgcc_s1-32bit),
  and (libcurl(x86-32) or libcurl4-32bit) so 64-bit-only systems are not blocked
  and fixed the invalid gcc-32bit($FARCH) typo.
- Exclude bundled 32-bit /usr/lib/libphobos2.so* from automatic requirement
  generation via __requires_exclude_from on x86_64 packages.
- Add Provides and Obsoletes for phobos-devel, phobos-devel-static, and dub
  to avoid file collisions when upgrading over split openSUSE packages.
- Allow dmd_rpm.sh to run on build environments with /etc/os-release and make
  fakeroot optional if rpmbuild is available.
@dejlek

dejlek commented Oct 20, 2026 •

Copy link
Copy Markdown

Tested this in incus containers on Fedora 44, openSUSE Leap 16.0, Tumbleweed, AlmaLinux 8 & 9 (dmd 2.110.0). Works, one bug to fix.

Verified working

  • __requires_exclude_from fix: A/B build on Leap 16 confirmed the 32-bit libphobos2.so in /usr/lib leaks ld-linux.so.2, libgcc_s.so.1, … into the x86_64 package without it; clean with it. (rpm 6/Fedora never leaks; this matters on rpm 4.x.)
  • Rich deps parse and resolve on all 5 distros; fresh install + dmd -run test_curl.d passes on all.
  • Leap 16 upgrade over the distro split stack (dmd/phobos-devel/phobos-devel-static/dub/libphobos2-0_109) replaces it cleanly, no file conflicts.
  • fakeroot-optional path, _topdir/_tmppath defines, dub --version extraction all work.

Bug

  • Obsoletes: libphobos2-0_109 is hardcoded but this script builds every release. A 2.110 build has soname libphobos2.so.0.110 yet obsoletes libphobos2-0_109; Tumbleweed already ships libphobos2-0_113. Derive it instead:
    PHOBOS_LIB_PKG="libphobos2-$(echo $SO_VERSION | tr . _)"

Nits

  • Recommends are installed by default (dnf/zypper weak deps): 32-bit multilib is still pulled on Fedora/EL (verified: glibc-devel/libgcc/libcurl i686 + deps). Use Suggests: for "only when requested", or reword the PR description.
  • DUB_VER=$VERSION fallback mixes namespaces (dub = 2.110.0-0); and Obsoletes: dub < $DUB_VER misses when the distro dub is newer than bundled (e.g. TW 1.42 vs bundled 1.39) → /usr/bin/dub conflict remains.
  • The os-release check is now vacuous (every distro has /etc/os-release) — drop it or check ID_LIKE.
  • README "installable on fedora/rhel/centos/rocky": rich deps need rpm ≥ 4.13, so RHEL 7 can't install it — say "RHEL/Rocky 8+".

Fix the Bug and it should be good to merge!

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