bazelbuild / rules_pkg

Bazel rules for creating packages of many types (zip, tar, deb, rpm, ...)
Apache License 2.0
216 stars 171 forks source link

When pkg_tar.prefix_dir == base of symlink path, don't double-dip. #749

Closed aiuto closed 10 months ago

aiuto commented 12 months ago

Correct for case where tar has prefix_dir and files/symlinks, but the user has already mapped the prefix_dir into those paths. Under the old behavior, prefix_dir was (incorrectly) not added to symlinks, so some users made the desired prefix part of the link. Protecting them against the double inclusion of the prefix is not strictly pedantic, but is the least surprising behavior, as their intent was most likely to get what the old behavior would have achived.

Add tests for this, which required improving verify_archive_test.

Along the way, it seems that tree artifacts with internal symlinks are a problem. This might be a bazel bug. https://github.com/bazelbuild/rules_pkg/issues/750 is a reminder to look in to this some day.

coffinmatician commented 10 months ago

Why is pkg_tar-files now labeled as "obsolete"? I use this feature very heavily, and would be curious what the replacement for it is (or what I should be doing instead of using pkg_tar-files)?

aiuto commented 10 months ago

It's obsolete because we have the equivalent in the pkg_files rule. Rather than maintain features in tar only, but putting it in pkg_files we can reuse that in zip, deb, and rpm.

The files and symlinks features in pkg_tar were never quite designed. They were hacked in over time at Google to solve some team's immediate needs.

On Mon, Oct 23, 2023 at 2:10 PM Alexander Coffin @.***> wrote:

Why is pkg_tar-files now labeled as "obsolete"? I use this feature very heavily, and would be curious what the replacement for it is (or what I should be doing instead of using pkg_tar-files)?

— Reply to this email directly, view it on GitHub https://github.com/bazelbuild/rules_pkg/pull/749#issuecomment-1775747194, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXHHHDQGBKWYEWBFAC37GLYA2XJ5AVCNFSM6AAAAAA4IBNLTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZVG42DOMJZGQ . You are receiving this because you modified the open/close state.Message ID: @.***>

coffinmatician commented 10 months ago

That makes sense, thank you for helping me out. I'll try converting our internal usage to pkg_files in the near future and see how it goes.