Skip to content

Commit

Permalink
Fix tar.gz assembly having incorrect folder structure (#6644)
Browse files Browse the repository at this point in the history
## What is the goal of this PR?

Fix the issues in tar.gz assembly that were caused by #6642.

## What are the changes implemented in this PR?

PR #6642 has changed the upstream repository of `rules_docker` to be
from `bazelbuild`. Previously, the upstream repository was the Vaticle's
fork of `rules_docker`. That fork contained a patch that fixed a bug in
`rules_pkg` that stopped `pkg_tar` rule from working with long paths
(the bug caused targz assembly of TypeDB to be incorrect) .
Incidentally, an identical patch was applied in Vaticle's
`bazel-distribution`. By loading, `rules_docker` from
`vaticle_dependencies` before `bazel-distribution`, we ended up using
the unpatched `rules_pkg` in the assembly targets that were depending on
`rules_pkg` (we can't have multiple versions of a workspace dependency
at the same time). This caused the targz assembly of TypeDB to contain
invalid paths.

The solution in this PR simply swaps the order of loading, so that
`typedb` ends up depending on the patched `rules_pkg` that is provided
by `bazel-distribution`.

The ideal solution for this problem would be to bump the `rules_pkg`
dependency in `bazel-distribution`, however, the newer versions of
`rules_pkg` changed their subpackage visibility modifiers. More
precisely, in the newer versions, `pkg_tar` depends on private
subpackages. Unfortunately, `stardoc`, the tool that we use to generate
documentation, does not work with rules that depend on rules that are
invisible to our project
(bazelbuild/stardoc#93,
bazelbuild/stardoc#128). Therefore, in order
to continue using `stardoc`, we must continue using the older version of
`rules_pkg`.

Co-authored-by: Lukas Slezevicius <[email protected]>
Co-authored-by: Alex Walker <[email protected]>
  • Loading branch information
3 people authored Sep 20, 2022
1 parent 57c3403 commit f0f7501
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,6 @@ sonarcloud_dependencies()
load("@vaticle_dependencies//tool/unuseddeps:deps.bzl", unuseddeps_deps = "deps")
unuseddeps_deps()

# Load //distribution/docker
load("@vaticle_dependencies//distribution/docker:deps.bzl", docker_deps = "deps")
docker_deps()

load("@io_bazel_rules_docker//repositories:repositories.bzl", bazel_rules_docker_repositories = "repositories")
bazel_rules_docker_repositories()

load("@io_bazel_rules_docker//repositories:deps.bzl", bazel_rules_docker_container_deps = "deps")
bazel_rules_docker_container_deps()

load("@io_bazel_rules_docker//container:container.bzl", "container_pull")
container_pull(
name = "vaticle_ubuntu_image",
registry = "index.docker.io",
repository = "vaticle/ubuntu",
tag = "4ee548cea883c716055566847c4736a7ef791c38"
)

######################################
# Load @vaticle_bazel_distribution #
######################################
Expand All @@ -115,6 +97,31 @@ github_deps()
load("@vaticle_bazel_distribution//pip:deps.bzl", pip_deps = "deps")
pip_deps()

######################################
# Load @vaticle_dependencies//distribution/docker #
######################################

# must be loaded after `vaticle_bazel_distribution` to ensure
# `rules_pkg` is correctly patched (bazel-distribution #251)

# Load //distribution/docker
load("@vaticle_dependencies//distribution/docker:deps.bzl", docker_deps = "deps")
docker_deps()

load("@io_bazel_rules_docker//repositories:repositories.bzl", bazel_rules_docker_repositories = "repositories")
bazel_rules_docker_repositories()

load("@io_bazel_rules_docker//repositories:deps.bzl", bazel_rules_docker_container_deps = "deps")
bazel_rules_docker_container_deps()

load("@io_bazel_rules_docker//container:container.bzl", "container_pull")
container_pull(
name = "vaticle_ubuntu_image",
registry = "index.docker.io",
repository = "vaticle/ubuntu",
tag = "4ee548cea883c716055566847c4736a7ef791c38"
)

#####################################
# Load @vaticle/typedb dependencies #
#####################################
Expand Down

0 comments on commit f0f7501

Please sign in to comment.