Skip to content

fix: handle -- trigger terminator and -P flag in spec section header parsing#189

Merged
reubeno merged 1 commit into
microsoft:mainfrom
trungams:tvuong/fix/trigger-separator
May 14, 2026
Merged

fix: handle -- trigger terminator and -P flag in spec section header parsing#189
reubeno merged 1 commit into
microsoft:mainfrom
trungams:tvuong/fix/trigger-separator

Conversation

@trungams
Copy link
Copy Markdown
Member

GetPackageNameFromSectionHeader did not recognize '--' as a terminator in trigger section headers. In RPM trigger syntax, '--' separates the owning sub-package from the trigger condition (e.g. '%triggerin -- devel' means the main package triggers on devel, not that the trigger belongs to subpackage devel).

Also add '-P' flag handling for file trigger priority arguments.

Fixes #143

Copilot AI review requested due to automatic review settings May 14, 2026 02:22
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 to correctly handle -- trigger terminator and -P priority flag in %trigger*/%filetrigger* sections, preventing mis-attribution of trigger conditions as sub-package names.

Changes:

  • Treat -- as a terminator in GetPackageNameFromSectionHeader, stopping the scan so trigger conditions aren't picked up as the owning sub-package.
  • Skip the -P <priority> flag (file trigger priority) as a two-token flag.
  • Add unit-test coverage for %triggerin --, suffix-form, -n form, -p interaction, and %filetriggerin -P.

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 Adds -- terminator and -P flag handling to the section-header token scanner.
internal/rpm/spec/spec_test.go Adds assertions covering trigger terminator, -n form, suffix form, and -P file-trigger flag.

…parsing

[GetPackageNameFromSectionHeader] did not recognize '--' as a
terminator in trigger section headers. In RPM trigger syntax,
'--' separates the owning sub-package from the trigger condition
(e.g. '%triggerin -- devel' means the main package triggers on
devel, not that the trigger belongs to subpackage devel).

Also add '-P' flag handling for file trigger priority arguments.

Fixes microsoft#143
@trungams trungams force-pushed the tvuong/fix/trigger-separator branch from d6f7e92 to 20979e8 Compare May 14, 2026 02:33
@reubeno reubeno merged commit 35f489f into microsoft:main May 14, 2026
15 checks passed
@trungams trungams deleted the tvuong/fix/trigger-separator branch May 14, 2026 07:07
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 %trigger* -- <trigger> sections to a sub-package

3 participants