)]}'
{
  "commit": "a9358d57a797f793cedd460939188496c7d30bbf",
  "tree": "f6adb86fc8b6584e71dda3399393795d1f0c50f3",
  "parents": [
    "67bc3b36d9aed3f8b284438be0ceb866463dbaf5"
  ],
  "author": {
    "name": "Régis Desgroppes",
    "email": "rdesgroppes@gmail.com",
    "time": "Wed Feb 04 21:41:56 2026 +0100"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Wed Feb 04 13:41:56 2026 -0700"
  },
  "message": "fix(rpm): debuginfo support on some distributions (#1006)\n\nThis enables RPM debuginfo package generation across different Linux\ndistributions (tested on Rocky and Ubuntu in CI) by implementing RPM\nversion-based detection if possible, and falling back to the existing OS\nrelease-based detection otherwise.\n\nRPM 4.18.0 introduced changes to make `%{buildsubdir}` independent of\nthe `%setup` macro:\n- commit: `Make %{buildsubdir} more independent of %setup`\n  (rpm-software-management/rpm@6caca84c904423)\n- since: `rpm-4.18.0-alpha1`\n- release: https://rpm.org/wiki/Releases/4.18.0\n\nWhile this change enabled setting `buildsubdir` as a regular macro\nrather than a `spec` object property, it had the side effect of altering\nthe relative path handling in install scripts.\n\nThis requires different file path formats in the `%install` section:\n- RPM \u003c 4.18, corresponding to the project\u0027s \"centos\" type:\n  ```\n  cp \u0027bazel-out/k8-fastbuild/bin/tests/rpm/test_debuginfo\u0027 \u0027%{buildroot}/test_debuginfo\u0027\n  ```\n- RPM \u003e\u003d 4.18, corresponding to the project\u0027s \"fedora\" type:\n  ```\n  cp \u0027../bazel-out/k8-fastbuild/bin/tests/rpm/test_debuginfo\u0027 \u0027%{buildroot}/test_debuginfo\u0027\n  ```\n\nUsing the wrong \"type\" causes build failures:\n- \"fedora\" with RPM \u003c 4.18:\n  ```\n  cp: cannot stat \u0027../bazel-out/k8-fastbuild/bin/tests/rpm/test_debuginfo\u0027: No such file or directory\n  ```\n- \"centos\" with RPM \u003e\u003d 4.18:\n  ```\n  rm: refusing to remove \u0027.\u0027 or \u0027..\u0027 directory: skipping \u0027.\u0027\n  ```\n\nThe present change therefore implements version detection to\nautomatically select the appropriate \"type\".\n\n**Additional fixes for cross-distribution compatibility**\n\nRedHat distros have redhat-rpm-config with `%_enable_debug_packages`\nthat auto-invokes `%debug_package` (rpm-software-management/rpm#2204).\nDebian/Ubuntu ship vanilla upstream RPM without this configuration:\n```\noutput \u0027tests/rpm/test_debuginfo_rpm-debuginfo-1-0..rpm\u0027 was not created\n```\n\nThat\u0027s why the change adds `%debug_package` only when applicable:\n- `%{!?_enable_debug_packages:%debug_package}`.\n\nAlso, since RPM [4.14](https://rpm.org/wiki/Releases/4.14.0), unique\ndebug package filenames are enabled by default, leading to variadic\nfilenames being generated:\n```\nExecuting tests from //tests/rpm:test_golden_debuginfo_rpm_contents\n-----------------------------------------------------------------------------\n29c29\n\u003c /usr/lib/debug/test_debuginfo-1-0.x86_64.debug\n---\n\u003e /usr/lib/debug/test_debuginfo.debug\nFAIL: files \"tests/rpm/test_debuginfo_rpm_contents.txt\" and \"tests/rpm/test_debuginfo_rpm_contents.txt.golden\" differ\n```\n\nThat\u0027s why the change makes debug package filenames consistent across\ndistributions by means of:\n- `%undefine _unique_debug_names` (safe no-op on older RPM versions).\n\nNote: I also verified the change locally with:\n- RPM 4.17.1 on Fedora 35 (\"centos\" type)\n- RPM 4.18.2 on Ubuntu 24.04.3 (\"fedora\" type)\n- RPM 4.19.1.1 on Fedora 40 (\"fedora\" type)",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "62c54826ceeb12bbd1f3ada5099d9b64b9977a94",
      "old_mode": 33188,
      "old_path": ".bazelci/tests.yml",
      "new_id": "5dbf053ec124e5a795386a9bb921553f03b5f68d",
      "new_mode": 33188,
      "new_path": ".bazelci/tests.yml"
    },
    {
      "type": "modify",
      "old_id": "d42b117a7f83daab8db57dc55b9878271746ec79",
      "old_mode": 33188,
      "old_path": "examples/rpm/debuginfo/README.md",
      "new_id": "08f8957cdb9dae6dbd92e70c4d647db839f497d6",
      "new_mode": 33188,
      "new_path": "examples/rpm/debuginfo/README.md"
    },
    {
      "type": "modify",
      "old_id": "ec48512a0331d0aa64343d8859ad27479000ac27",
      "old_mode": 33188,
      "old_path": "pkg/rpm_pfg.bzl",
      "new_id": "941c4ed1a02c645c8bee0596094fe7220c111216",
      "new_mode": 33188,
      "new_path": "pkg/rpm_pfg.bzl"
    },
    {
      "type": "modify",
      "old_id": "1b68c4583f78b8ee7a81d51033ec561f6da80b67",
      "old_mode": 33188,
      "old_path": "toolchains/rpm/rpmbuild.bzl",
      "new_id": "ebc1016cb1ff6db6163d365bfb3b48a97028829e",
      "new_mode": 33188,
      "new_path": "toolchains/rpm/rpmbuild.bzl"
    },
    {
      "type": "modify",
      "old_id": "2f3c7e5f1b0740b44b93541832bc6d969098afdc",
      "old_mode": 33188,
      "old_path": "toolchains/rpm/rpmbuild_configure.bzl",
      "new_id": "3ab6a262fc260137d8a4f25df96ce9737b2ed143",
      "new_mode": 33188,
      "new_path": "toolchains/rpm/rpmbuild_configure.bzl"
    }
  ]
}
