Migrate pkg_tar from internal copy to @rules_pkg: Bazel packaging and
distribution.

This is one of several changes to complete this migration.

- Rules used to package and distribute Bazel. (This CL)
- third_party/...
- Rules which interact with other built-in rules.
  tools/android/runtime_deps
  src/main/cpp/util
- src/test/shell/bazel/bazel_embedded_skylark_test.sh
- Repository rule testing
  src/test/java/com/google/devtools/build/lib/blackbox/tests/workspace/...
  Defer until the incompatible flag flip.

RELNOTES: pkg_deb, pkg_rpm & pkg_tar deprecation plan announced in the documentation.
PiperOrigin-RevId: 259615722
diff --git a/BUILD b/BUILD
index 1b0bfdb..ebbdc77 100644
--- a/BUILD
+++ b/BUILD
@@ -66,7 +66,7 @@
     visibility = ["//:__subpackages__"],
 )
 
-load("//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
+load("@rules_pkg//:pkg.bzl", "pkg_tar")
 
 pkg_tar(
     name = "bazel-srcs",
diff --git a/distdir.bzl b/distdir.bzl
index fb237d7..a4d9265 100644
--- a/distdir.bzl
+++ b/distdir.bzl
@@ -14,7 +14,7 @@
 """Defines a repository rule that generates an archive consisting of the specified files to fetch"""
 
 _BUILD = """
-load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
+load("@rules_pkg//:pkg.bzl", "pkg_tar")
 
 pkg_tar(
   name="archives",
diff --git a/site/BUILD b/site/BUILD
index bd1c02c..d9b4b15 100644
--- a/site/BUILD
+++ b/site/BUILD
@@ -1,4 +1,4 @@
-load("//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
+load("@rules_pkg//:pkg.bzl", "pkg_tar")
 load("//scripts/docs:jekyll.bzl", "jekyll_build")
 load("//scripts/docs:doc_versions.bzl", "DOC_VERSIONS")
 
diff --git a/tools/build_defs/pkg/README.md b/tools/build_defs/pkg/README.md
index 80a2a03..1e8ae6a 100644
--- a/tools/build_defs/pkg/README.md
+++ b/tools/build_defs/pkg/README.md
@@ -1,5 +1,22 @@
 # Packaging for Bazel
 
+## Deprecated
+
+These rules have been extracted from the Bazel sources and are now available at
+[bazelbuild/rules_pkg](https://github.com/bazelbuild/rules_pkg/releases).
+
+Issues and PRs against the built-in versions of these rules will no longer be
+addressed. This page will exist for reference until the code is removed from
+Bazel. You can test the removal of these rules with Bazel at version >= 0.28.0.
+
+```
+bazel build --//tools/build_defs/pkg:incompatible_no_build_defs_pkg  target...
+```
+
+For more information, follow [issue 8857](https://github.com/bazelbuild/bazel/issues/8857)
+
+## rules_pkg
+
 <div class="toc">
   <h2>Rules</h2>
   <ul>
diff --git a/tools/build_defs/repo/BUILD b/tools/build_defs/repo/BUILD
index 000a8db..6f51161 100644
--- a/tools/build_defs/repo/BUILD
+++ b/tools/build_defs/repo/BUILD
@@ -1,6 +1,6 @@
 load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
 load("@io_bazel_skydoc//stardoc:stardoc.bzl", "stardoc")
-load("//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
+load("@rules_pkg//:pkg.bzl", "pkg_tar")
 
 licenses(["notice"])  # Apache 2.0