Skip to content

fix: handle -l flag in spec section header package name extraction#180

Merged
reubeno merged 1 commit into
microsoft:mainfrom
trungams:tvuong/fix/spec-l-flag
May 12, 2026
Merged

fix: handle -l flag in spec section header package name extraction#180
reubeno merged 1 commit into
microsoft:mainfrom
trungams:tvuong/fix/spec-l-flag

Conversation

@trungams
Copy link
Copy Markdown
Member

@trungams trungams commented May 12, 2026

[GetPackageNameFromSectionHeader] did not recognize the '-l' flag used in localized %description sections (e.g. '%description -l fr subpkg'). The language code was incorrectly parsed as the package name suffix, causing [RemoveSubpackage] to miss localized description sections when removing a subpackage.

Add '-l' to the flag switch with 'index += 2' to skip both the flag and the language code, matching the behavior of '-f' and '-p'.

Fixes #142

[GetPackageNameFromSectionHeader] did not recognize the '-l' flag
used in localized %description sections (e.g. '%description -l fr
subpkg'). The language code was incorrectly parsed as the package
name suffix, causing [RemoveSubpackage] to miss localized
description sections when removing a subpackage.

Add '-l' to the flag switch with 'index += 2' to skip both the flag
and the language code, matching the behavior of '-f' and '-p'.
Copilot AI review requested due to automatic review settings May 12, 2026 20:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes RPM spec section header parsing so localized %description headers using -l <lang> don’t misinterpret the language code as the package name suffix, which in turn allows subpackage removal logic to correctly match localized description sections.

Changes:

  • Teach GetPackageNameFromSectionHeader to recognize and skip the -l flag plus its language argument.
  • Add unit tests covering %description -l <lang> ... token patterns, including combinations with -n.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/rpm/spec/spec.go Extends section-header token parsing to skip the -l flag and its language token when extracting package names.
internal/rpm/spec/spec_test.go Adds regression tests ensuring -l doesn’t affect extracted package names and handles missing suffix/name cleanly.

@reubeno reubeno merged commit a6691a8 into microsoft:main May 12, 2026
19 of 20 checks passed
@trungams trungams deleted the tvuong/fix/spec-l-flag branch May 12, 2026 20:28
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.

RPM spec parser mis-attributes %description -l <lang> <pkg> sections

3 participants