Skip to content

rpm_pfg: allow multiple tree artifacts at the same destination#1053

Merged
aiuto merged 3 commits intobazelbuild:mainfrom
chouquette:rpm-allow-shared-tree-dest
Apr 22, 2026
Merged

rpm_pfg: allow multiple tree artifacts at the same destination#1053
aiuto merged 3 commits intobazelbuild:mainfrom
chouquette:rpm-allow-shared-tree-dest

Conversation

@chouquette
Copy link
Copy Markdown
Contributor

When two pkg_files targets both map a configure_make tree artifact (e.g. an include/ directory) to the same destination prefix, pkg_rpm was raising a hard error even though the file contents don't overlap. The duplicate-destination check was firing unconditionally before the src.is_directory branch, so two packages installing headers to embedded/include/ (from different subdirectories) would conflict.

Move the dest_check_map conflict check inside the non-directory branch so that tree artifacts sharing a destination are treated as a merge rather than a conflict. Actual file-level collisions within those trees will be caught at install time by the underlying tooling.

Copy link
Copy Markdown
Collaborator

@cgrindel cgrindel left a comment

Choose a reason for hiding this comment

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

Looks reasonable. Is there a way to add a test for this?

When two pkg_files targets both map a configure_make tree artifact
(e.g. an include/ directory) to the same destination prefix, pkg_rpm
was raising a hard error even though the file contents don't overlap.
The duplicate-destination check was firing unconditionally before the
src.is_directory branch, so two packages installing headers to
embedded/include/ (from different subdirectories) would conflict.

Move the dest_check_map conflict check inside the non-directory branch
so that tree artifacts sharing a destination are treated as a merge
rather than a conflict. Actual file-level collisions within those trees
will be caught at install time by the underlying tooling.
Two TreeArtifacts mapping to the same destination directory should be
permitted; their contents are merged by the installer. File-level
conflicts are still caught naturally when the same destination file
path is claimed by two different sources.

This is the general-purpose counterpart of the rpm_pfg fix in 8f67a8a.
@chouquette chouquette force-pushed the rpm-allow-shared-tree-dest branch from 011cc9c to 0b5c59d Compare April 22, 2026 08:15
@aiuto aiuto added the rpm label Apr 22, 2026
@aiuto aiuto merged commit 401969d into bazelbuild:main Apr 22, 2026
6 checks passed
gh-worker-dd-mergequeue-cf854d Bot pushed a commit to DataDog/datadog-agent that referenced this pull request Apr 23, 2026
### What does this PR do?

Update rules_pkg to the latest commit on main

### Motivation

This fixes potential conflicts when 2 targets attempt to create a similar folder hierarchy, even if the final files aren't overlapping
See related PR: bazelbuild/rules_pkg#1053

### Describe how you validated your changes

### Additional Notes


Co-authored-by: hugo.beauzee <hugo.beauzee@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants