google / rpmpack

rpmpack (tar2rpm) - package rpms in pure golang or cli
Apache License 2.0
116 stars 32 forks source link

The example depends on a deprecated version of pkg_tar #74

Closed aiuto closed 1 year ago

aiuto commented 2 years ago

example_bazel/BULID.bazel contains the line `load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar").

That should be changed to load("@rules_pkg//pkg:tar.bzl", "pkg_tar") and rules_license added to the WORKSPACE as per https://github.com/bazelbuild/rules_pkg/releases/tag/0.7.0

In Bazel 6.0 your example may cease to work, either because pkg_tar is removed, or simply because the mode and ownername attributes are removed.

jarondl commented 2 years ago

Thanks @aiuto for the heads up! Seems like an easy fix, I'll do that.

jarondl commented 2 years ago

Oh boy, I had some fun here. I kept getting errors using load("@rules_pkg//pkg:tar.bzl", "pkg_tar"), it kept saying pkg is not a package. Using load("@rules_pkg//:pkg.bzl", "pkg_tar") worked, but that clearly means I'm using an old version of rules_pkg. Looking into the cached directories, I found the reason: io_bazel_rules_docker also calls rules_pkg, but with the 0.2.6 version.

Aliasing my import to rules_pkg_070 fixed it, but seems ugly. I am really surprised bazel let me shadow a version of a dependency with the same name.

aiuto commented 2 years ago

What you can normally do is just make sure the newer rules_pkg is loaded before rules_docker, then both will pick up the new version. Do you have a PR for this? I could take a look at that.

jarondl commented 2 years ago

Uploaded my changes as #75. I'd appreciate your look @aiuto.

aiuto commented 2 years ago

Doing the versioned pkg_tar is super ugly.
Once https://github.com/bazelbuild/rules_docker/pull/2125 goes in, and rules_docker cuts a new release, you can unify them again. Or, like I said, put rules_pkg before rules_docker so you get the one you want.

jarondl commented 2 years ago

Updated #75, PTAL.