-
Notifications
You must be signed in to change notification settings - Fork 603
fix: obsoletes redhat-rpm-config and adds symlinks #15830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: tomls/base/main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR addresses compatibility issues with the azurelinux-rpm-config package by changing the approach from globally renaming "redhat" to "azurelinux" to using symlinks for compatibility. The key insight is that python3-rpm-macros hardcodes /usr/lib/rpm/redhat/ paths, so renaming that directory would break compatibility.
Changes:
- Removed global search-replace operations that renamed files and directory references from "redhat" to "azurelinux"
- Added symlinks (
/usr/lib/rpm/azurelinux -> /usr/lib/rpm/redhatand pkg-config wrappers) to maintain compatibility with both naming conventions - Added Name, Obsoletes, and Conflicts tags to properly identify the package and ensure it supersedes Fedora's redhat-rpm-config
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
base/comps/azurelinux-rpm-config/azurelinux-rpm-config.comp.toml
Outdated
Show resolved
Hide resolved
base/comps/azurelinux-rpm-config/azurelinux-rpm-config.comp.toml
Outdated
Show resolved
Hide resolved
| { type = "spec-set-tag", tag = "Name", value = "azurelinux-rpm-config" }, | ||
| # Set this distro's URL. | ||
| { type = "spec-set-tag", tag = "URL", value = "https://aka.ms/azurelinux" }, | ||
| # Set our version. | ||
| { type = "spec-update-tag", tag = "Version", value = "1004" }, | ||
| # Provide compatibility with Fedora's upstream version. | ||
| { type = "spec-add-tag", tag = "Provides", value = "redhat-rpm-config = %{version}-%{release}" }, | ||
| # Make sure this package takes precedence over any Fedora variant. | ||
| # Make sure this package takes precedence over (and would replace) any Fedora variant. | ||
| # Note that Fedora's version of redhat-rpm-config has a version equal to 300 + the release number | ||
| # (e.g., 343 for Fedora 43). | ||
| { type = "spec-add-tag", tag = "Obsoletes", value = "redhat-rpm-config < 1000" }, | ||
| # Global search-and-replace in spec file: {fedora,redhat}->azurelinux | ||
| { type = "spec-search-replace", regex = "(fedora|redhat)", replacement = "azurelinux" }, | ||
| # Remove symlink; replace it with a dynamically constructed one in the spec. | ||
| # We need to change how we generate a symlink and the tag referencing the checked-in one. | ||
| { type = "spec-search-replace", regex = '^.*:\s*azurelinux-annobin-cc1\s*$', replacement = "" }, | ||
| { type = "spec-append-lines", section = "%prep", lines = ["ln -sfr azurelinux-annobin-select-annobin-built-plugin azurelinux-annobin-cc1"] }, | ||
| { type = "spec-add-tag", tag = "Conflicts", value = "redhat-rpm-config < 1000" }, | ||
|
|
||
| # Create symlink for our own name: /usr/lib/rpm/azurelinux -> /usr/lib/rpm/redhat | ||
| # Note that we don't do the reverse to avoid conflicts with upstream Fedora | ||
| # redhat-rpm-config during bootstrapping (replacing a dir with a symlink is | ||
| # problematic in RPM land). | ||
| { type = "spec-prepend-lines", section = "%install", lines = ["mkdir -p %{buildroot}/usr/lib/rpm", "ln -sf redhat %{buildroot}/usr/lib/rpm/azurelinux"] }, | ||
| { type = "spec-prepend-lines", section = "%files", lines = ["/usr/lib/rpm/azurelinux"] }, | ||
|
|
||
| #Create a symlink pkg-config: /usr/bin/<arch>-azurelinux-linux-gnu-pkg-config -> /usr/bin/<arch>-redhat-linux-gnu-pkg-config. | ||
| { type = "spec-prepend-lines", section = "%install", lines = ["mkdir -p %{buildroot}/usr/bin", "for arch in x86_64 aarch64; do", " ln -sf ${arch}-redhat-linux-gnu-pkg-config %{buildroot}/usr/bin/${arch}-azurelinux-linux-gnu-pkg-config", "done"] }, | ||
| { type = "spec-prepend-lines", section = "%files", lines = ["/usr/bin/*-azurelinux-linux-gnu-pkg-config"] }, | ||
|
|
||
| # | ||
| # Overlays for non-spec files. | ||
| # | ||
|
|
||
| # Remove the symlink that we can't easily fix up (the spec changes above avoid using it). | ||
| { type = "file-remove", file = "redhat-annobin-cc1" }, | ||
|
|
||
| # Apply file renames *first*: fedora/redhat -> azurelinux | ||
| { type = "file-rename", file = "macros.fedora-misc-srpm", replacement = "macros.azurelinux-misc-srpm" }, | ||
| { type = "file-rename", file = "macros.fedora-misc", replacement = "macros.azurelinux-misc" }, | ||
| { type = "file-rename", file = "redhat-annobin-plugin-select.sh", replacement = "azurelinux-annobin-plugin-select.sh" }, | ||
| { type = "file-rename", file = "redhat-annobin-select-annobin-built-plugin", replacement = "azurelinux-annobin-select-annobin-built-plugin" }, | ||
| { type = "file-rename", file = "redhat-annobin-select-gcc-built-plugin", replacement = "azurelinux-annobin-select-gcc-built-plugin" }, | ||
| { type = "file-rename", file = "redhat-hardened-cc1", replacement = "azurelinux-hardened-cc1" }, | ||
| { type = "file-rename", file = "redhat-hardened-clang-ld.cfg", replacement = "azurelinux-hardened-clang-ld.cfg" }, | ||
| { type = "file-rename", file = "redhat-hardened-clang.cfg", replacement = "azurelinux-hardened-clang.cfg" }, | ||
| { type = "file-rename", file = "redhat-hardened-ld-errors", replacement = "azurelinux-hardened-ld-errors" }, | ||
| { type = "file-rename", file = "redhat-hardened-ld", replacement = "azurelinux-hardened-ld" }, | ||
| { type = "file-rename", file = "STAGE2-redhat-rpm-config", replacement = "STAGE2-azurelinux-rpm-config" }, | ||
|
|
||
| # Update all references to the Fedora version of this package to the Azure Linux one. | ||
| { type = "file-search-replace", file = "**/*", regex = "redhat-rpm-config", replacement = "azurelinux-rpm-config" }, | ||
| # Update all references to the vendor-specific dir under /usr/lib/rpm. | ||
| { type = "file-search-replace", file = "**/*", regex = "/usr/lib/rpm/redhat", replacement = "/usr/lib/rpm/azurelinux" }, | ||
|
|
||
| # Update vendor macro + textual references in macros files. | ||
| # Update vendor macro. | ||
| { type = "file-search-replace", file = "macros", regex = "%_vendor.*", replacement = "%_vendor azurelinux" }, | ||
| { type = "file-search-replace", file = "macros", regex = "redhat", replacement = "azurelinux" }, | ||
|
|
||
| # Remove dist.sh file; we'll replace it wholesale with our own version. | ||
| { type = "file-remove", file = "dist.sh" }, | ||
| # Add our own version of dist.sh customized for Azure Linux. | ||
| { type = "file-add", file = "dist.sh", source = "dist.sh" }, | ||
|
|
||
| # Additional replacements of the distro name in macros files. | ||
| { type = "file-search-replace", file = "rpmrc", regex = "fedora", replacement = "azurelinux" }, | ||
| { type = "file-search-replace", file = "macros.azurelinux-misc", regex = "fedora", replacement = "azurelinux" }, | ||
| { type = "file-search-replace", file = "macros.azurelinux-misc-srpm", regex = "/lib/swidtag/fedoraproject.org", replacement = "/lib/swidtag/microsoft.com" }, | ||
| { type = "file-search-replace", file = "macros.azurelinux-misc-srpm", regex = "[Ff]edora", replacement = "azurelinux" }, | ||
| # Update annobin references. | ||
| { type = "file-search-replace", file = "azurelinux-annobin-plugin-select.sh", regex = "redhat-annobin", replacement = "azurelinux-annobin" }, | ||
| { type = "file-search-replace", file = "buildflags.md", regex = "redhat-annobin", replacement = "azurelinux-annobin" }, | ||
| # Update redhat-hardened references. | ||
| { type = "file-search-replace", file = "STAGE2-azurelinux-rpm-config", regex = "redhat-hardened", replacement = "azurelinux-hardened" }, | ||
| { type = "file-search-replace", file = "buildflags.md", regex = "redhat-hardened", replacement = "azurelinux-hardened" }, | ||
| # Targeted adjustments in some macros files. | ||
| { type = "file-search-replace", file = "macros.fedora-misc-srpm", regex = "/lib/swidtag/fedoraproject.org", replacement = "/lib/swidtag/microsoft.com" }, | ||
| { type = "file-search-replace", file = "macros.fedora-misc-srpm", regex = "[Ff]edora", replacement = "azurelinux" }, | ||
| ] |
Copilot
AI
Feb 12, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All overlays in this file are missing the required description field. According to the repository hygiene rules (see .github/copilot-instructions.md:55), every overlay MUST include a description field explaining why the change is needed. Each overlay should be converted from inline array syntax to the table-of-arrays syntax (using [[components.azurelinux-rpm-config.overlays]]) with a description field added to each one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reubeno @dmcilvaney is this really needed, what copilot is asking for? ^
| #Create a symlink pkg-config: /usr/bin/<arch>-azurelinux-linux-gnu-pkg-config -> /usr/bin/<arch>-redhat-linux-gnu-pkg-config. | ||
| { type = "spec-prepend-lines", section = "%install", lines = ["mkdir -p %{buildroot}/usr/bin", "for arch in x86_64 aarch64; do", " ln -sf ${arch}-redhat-linux-gnu-pkg-config %{buildroot}/usr/bin/${arch}-azurelinux-linux-gnu-pkg-config", "done"] }, | ||
| { type = "spec-prepend-lines", section = "%files", lines = ["/usr/bin/*-azurelinux-linux-gnu-pkg-config"] }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ddstreet Here is what I'm not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because this pkg isn't what provides the *-redhat-linux-gnu-pkg-config files, sure. I think all the bootstrapping workarounds should be confined to a single package, and if we're doing it here for the /usr/lib/rpm/redhat symlink i think we should add all the workarounds in this package. i hope that after bootstrapping, we can remove most/all of the workarounds, so if they are all in this package it'll make removing them later much easier. so this looks fine to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these overlays, then, need to be removed after we bootstrap. we need to very clearly annotate those -- i.e., with TODOs or similar.
ddstreetmicrosoft
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this LGTM with the caveat that i'd like to see all or most of the workarounds removed after we finish bootstrapping our own full repo of packages.
also, copilot is complaining about needing description for all the overlays, which i'm not sure if we need or not, but i'll mark this review as 'request changes' until we can get an answer to that
| #Create a symlink pkg-config: /usr/bin/<arch>-azurelinux-linux-gnu-pkg-config -> /usr/bin/<arch>-redhat-linux-gnu-pkg-config. | ||
| { type = "spec-prepend-lines", section = "%install", lines = ["mkdir -p %{buildroot}/usr/bin", "for arch in x86_64 aarch64; do", " ln -sf ${arch}-redhat-linux-gnu-pkg-config %{buildroot}/usr/bin/${arch}-azurelinux-linux-gnu-pkg-config", "done"] }, | ||
| { type = "spec-prepend-lines", section = "%files", lines = ["/usr/bin/*-azurelinux-linux-gnu-pkg-config"] }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because this pkg isn't what provides the *-redhat-linux-gnu-pkg-config files, sure. I think all the bootstrapping workarounds should be confined to a single package, and if we're doing it here for the /usr/lib/rpm/redhat symlink i think we should add all the workarounds in this package. i hope that after bootstrapping, we can remove most/all of the workarounds, so if they are all in this package it'll make removing them later much easier. so this looks fine to me.
| { type = "spec-set-tag", tag = "Name", value = "azurelinux-rpm-config" }, | ||
| # Set this distro's URL. | ||
| { type = "spec-set-tag", tag = "URL", value = "https://aka.ms/azurelinux" }, | ||
| # Set our version. | ||
| { type = "spec-update-tag", tag = "Version", value = "1004" }, | ||
| # Provide compatibility with Fedora's upstream version. | ||
| { type = "spec-add-tag", tag = "Provides", value = "redhat-rpm-config = %{version}-%{release}" }, | ||
| # Make sure this package takes precedence over any Fedora variant. | ||
| # Make sure this package takes precedence over (and would replace) any Fedora variant. | ||
| # Note that Fedora's version of redhat-rpm-config has a version equal to 300 + the release number | ||
| # (e.g., 343 for Fedora 43). | ||
| { type = "spec-add-tag", tag = "Obsoletes", value = "redhat-rpm-config < 1000" }, | ||
| # Global search-and-replace in spec file: {fedora,redhat}->azurelinux | ||
| { type = "spec-search-replace", regex = "(fedora|redhat)", replacement = "azurelinux" }, | ||
| # Remove symlink; replace it with a dynamically constructed one in the spec. | ||
| # We need to change how we generate a symlink and the tag referencing the checked-in one. | ||
| { type = "spec-search-replace", regex = '^.*:\s*azurelinux-annobin-cc1\s*$', replacement = "" }, | ||
| { type = "spec-append-lines", section = "%prep", lines = ["ln -sfr azurelinux-annobin-select-annobin-built-plugin azurelinux-annobin-cc1"] }, | ||
| { type = "spec-add-tag", tag = "Conflicts", value = "redhat-rpm-config < 1000" }, | ||
|
|
||
| # Create symlink for our own name: /usr/lib/rpm/azurelinux -> /usr/lib/rpm/redhat | ||
| # Note that we don't do the reverse to avoid conflicts with upstream Fedora | ||
| # redhat-rpm-config during bootstrapping (replacing a dir with a symlink is | ||
| # problematic in RPM land). | ||
| { type = "spec-prepend-lines", section = "%install", lines = ["mkdir -p %{buildroot}/usr/lib/rpm", "ln -sf redhat %{buildroot}/usr/lib/rpm/azurelinux"] }, | ||
| { type = "spec-prepend-lines", section = "%files", lines = ["/usr/lib/rpm/azurelinux"] }, | ||
|
|
||
| #Create a symlink pkg-config: /usr/bin/<arch>-azurelinux-linux-gnu-pkg-config -> /usr/bin/<arch>-redhat-linux-gnu-pkg-config. | ||
| { type = "spec-prepend-lines", section = "%install", lines = ["mkdir -p %{buildroot}/usr/bin", "for arch in x86_64 aarch64; do", " ln -sf ${arch}-redhat-linux-gnu-pkg-config %{buildroot}/usr/bin/${arch}-azurelinux-linux-gnu-pkg-config", "done"] }, | ||
| { type = "spec-prepend-lines", section = "%files", lines = ["/usr/bin/*-azurelinux-linux-gnu-pkg-config"] }, | ||
|
|
||
| # | ||
| # Overlays for non-spec files. | ||
| # | ||
|
|
||
| # Remove the symlink that we can't easily fix up (the spec changes above avoid using it). | ||
| { type = "file-remove", file = "redhat-annobin-cc1" }, | ||
|
|
||
| # Apply file renames *first*: fedora/redhat -> azurelinux | ||
| { type = "file-rename", file = "macros.fedora-misc-srpm", replacement = "macros.azurelinux-misc-srpm" }, | ||
| { type = "file-rename", file = "macros.fedora-misc", replacement = "macros.azurelinux-misc" }, | ||
| { type = "file-rename", file = "redhat-annobin-plugin-select.sh", replacement = "azurelinux-annobin-plugin-select.sh" }, | ||
| { type = "file-rename", file = "redhat-annobin-select-annobin-built-plugin", replacement = "azurelinux-annobin-select-annobin-built-plugin" }, | ||
| { type = "file-rename", file = "redhat-annobin-select-gcc-built-plugin", replacement = "azurelinux-annobin-select-gcc-built-plugin" }, | ||
| { type = "file-rename", file = "redhat-hardened-cc1", replacement = "azurelinux-hardened-cc1" }, | ||
| { type = "file-rename", file = "redhat-hardened-clang-ld.cfg", replacement = "azurelinux-hardened-clang-ld.cfg" }, | ||
| { type = "file-rename", file = "redhat-hardened-clang.cfg", replacement = "azurelinux-hardened-clang.cfg" }, | ||
| { type = "file-rename", file = "redhat-hardened-ld-errors", replacement = "azurelinux-hardened-ld-errors" }, | ||
| { type = "file-rename", file = "redhat-hardened-ld", replacement = "azurelinux-hardened-ld" }, | ||
| { type = "file-rename", file = "STAGE2-redhat-rpm-config", replacement = "STAGE2-azurelinux-rpm-config" }, | ||
|
|
||
| # Update all references to the Fedora version of this package to the Azure Linux one. | ||
| { type = "file-search-replace", file = "**/*", regex = "redhat-rpm-config", replacement = "azurelinux-rpm-config" }, | ||
| # Update all references to the vendor-specific dir under /usr/lib/rpm. | ||
| { type = "file-search-replace", file = "**/*", regex = "/usr/lib/rpm/redhat", replacement = "/usr/lib/rpm/azurelinux" }, | ||
|
|
||
| # Update vendor macro + textual references in macros files. | ||
| # Update vendor macro. | ||
| { type = "file-search-replace", file = "macros", regex = "%_vendor.*", replacement = "%_vendor azurelinux" }, | ||
| { type = "file-search-replace", file = "macros", regex = "redhat", replacement = "azurelinux" }, | ||
|
|
||
| # Remove dist.sh file; we'll replace it wholesale with our own version. | ||
| { type = "file-remove", file = "dist.sh" }, | ||
| # Add our own version of dist.sh customized for Azure Linux. | ||
| { type = "file-add", file = "dist.sh", source = "dist.sh" }, | ||
|
|
||
| # Additional replacements of the distro name in macros files. | ||
| { type = "file-search-replace", file = "rpmrc", regex = "fedora", replacement = "azurelinux" }, | ||
| { type = "file-search-replace", file = "macros.azurelinux-misc", regex = "fedora", replacement = "azurelinux" }, | ||
| { type = "file-search-replace", file = "macros.azurelinux-misc-srpm", regex = "/lib/swidtag/fedoraproject.org", replacement = "/lib/swidtag/microsoft.com" }, | ||
| { type = "file-search-replace", file = "macros.azurelinux-misc-srpm", regex = "[Ff]edora", replacement = "azurelinux" }, | ||
| # Update annobin references. | ||
| { type = "file-search-replace", file = "azurelinux-annobin-plugin-select.sh", regex = "redhat-annobin", replacement = "azurelinux-annobin" }, | ||
| { type = "file-search-replace", file = "buildflags.md", regex = "redhat-annobin", replacement = "azurelinux-annobin" }, | ||
| # Update redhat-hardened references. | ||
| { type = "file-search-replace", file = "STAGE2-azurelinux-rpm-config", regex = "redhat-hardened", replacement = "azurelinux-hardened" }, | ||
| { type = "file-search-replace", file = "buildflags.md", regex = "redhat-hardened", replacement = "azurelinux-hardened" }, | ||
| # Targeted adjustments in some macros files. | ||
| { type = "file-search-replace", file = "macros.fedora-misc-srpm", regex = "/lib/swidtag/fedoraproject.org", replacement = "/lib/swidtag/microsoft.com" }, | ||
| { type = "file-search-replace", file = "macros.fedora-misc-srpm", regex = "[Ff]edora", replacement = "azurelinux" }, | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reubeno @dmcilvaney is this really needed, what copilot is asking for? ^
This PR adds fix for making
azurelinux-rpm-configflavored overredhat-rpm-configand managing symlinks for compatibility.Spec file and compatibility improvements:
NameandConflictstags to the spec to clarify the package's identity and ensure it replaces conflicting Fedora packages.(fedora|redhat) -> azurelinuxbecause it renames the directory path/usr/lib/rpm/redhat/to/usr/lib/rpm/azurelinux/insideazurelinux-rpm-configspec, butpython3-rpm-macroshardcodes/usr/lib/rpm/redhat/...: Tree - rpms/python-rpm-macros - src.fedoraproject.org./usr/lib/rpm/azurelinux./usr/bin/<arch>-azurelinux-linux-gnu-pkg-configto theirredhatcounterparts, ensuring compatibility without interfering with Fedora's package during bootstrapping.