rules_pkg icon indicating copy to clipboard operation
rules_pkg copied to clipboard

pkg_files -> pkg_tar -> pkg_tar loses owner/group

Open AustinSchuh opened this issue 1 year ago • 2 comments

I'm in the process of migrating a ton of pkg_tar rules to pkg_files. I'm trying to do it incrementally to stay sane. I would expect the following two to be equivalent.

pkg_files(
    name = "shell_history",
    srcs = [
        ".zsh_history",
    ],  
    attributes = pkg_attributes(
        group = "1000",
        mode = "0600",
        user = "1000",
    ),  
    prefix = "/home/debian",
    visibility = ["//brt/vpu:__subpackages__"],
)
pkg_tar(
    name = "bin_files",
    srcs = [":shell_history"]
    deps = [":more_pkg_tar_targets"],
    symlinks = symlinks,
)

and

pkg_tar(
    name = "shell_history",
    srcs = [
        ".zsh_history",
    ],  
    mode = "0600",
    owner = "1000.1000",
    package_dir = "/home/debian",
    visibility = ["//brt/vpu:__subpackages__"],
)
pkg_tar(
    name = "bin_files",
    deps = [":more_pkg_tar_targets", ":shell_history"],
    symlinks = symlinks,
)

And finally for both:

pkg_tar(
    name = "installed_binaries",
    symlinks = { 
        "/etc/systemd/system/multi-user.target.wants/startup.service": "../startup.service",
    },  
    tags = [ 
        "no-remote",
    ],  
    deps = [ 
        ":bin_files",
    ],  
)

When I inspect bin_files.tar, I see that .zsh_history is owned by 1000.1000. Inside installed_binaries, I see it owned by 0.0. With the pkg_tar rules for all steps, I see ownership properly tracked.

AustinSchuh avatar Dec 06 '22 20:12 AustinSchuh