Remove owners attribute from bazel legacy pkg_tar.
Also did some mini README cleanup (even though it should all be removed)
Advances: https://github.com/bazelbuild/bazel/issues/11183
We can get to the mini-tar by slowly removing featuers from pkg_tar.
RELNOTES: None
PiperOrigin-RevId: 437462604
diff --git a/tools/build_defs/pkg/BUILD b/tools/build_defs/pkg/BUILD
index 533b284..bc6b933 100644
--- a/tools/build_defs/pkg/BUILD
+++ b/tools/build_defs/pkg/BUILD
@@ -81,7 +81,6 @@
modes = {"usr/titi": "0755"},
owner = "42.24",
ownername = "titi.tata",
- owners = {"etc/nsswitch.conf": "24.42"},
package_dir = "/",
strip_prefix = ".",
symlinks = {"usr/bin/java": "/path/to/bin/java"},
diff --git a/tools/build_defs/pkg/README.md b/tools/build_defs/pkg/README.md
index 26d8057..1e5e120 100644
--- a/tools/build_defs/pkg/README.md
+++ b/tools/build_defs/pkg/README.md
@@ -51,15 +51,6 @@
srcs = ["//tools:package-srcs"],
mode = "0644",
)
-
-pkg_tar(
- name = "bazel-all",
- extension = "tar.gz",
- deps = [
- ":bazel-bin",
- ":bazel-tools",
- ],
-)
```
Here, a package is built from three `pkg_tar` targets:
@@ -69,9 +60,6 @@
- `bazel-tools` create a tarball with the base workspace (mode `0644`) to
`/usr/share/bazel/tools` ; the `modes` attribute let us specifies executable
files,
- - `bazel-all` creates a gzip-compressed tarball that merge the two previous
- tarballs.
-
<a name="pkg_tar"></a>
## pkg_tar
@@ -164,25 +152,6 @@
</td>
</tr>
<tr>
- <td><code>mtime</code></td>
- <td>
- <code>int, seconds since Jan 1, 1970, default to -1 (ignored)</code>
- <p>
- Set the mod time of files added by the <code>files</code> attribute.
- </p>
- </td>
- </tr>
- <tr>
- <td><code>portable_mtime</code></td>
- <td>
- <code>bool, default True</code>
- <p>
- Set the mod time of files added by the <code>files</code> attribute
- to a 2000-01-01.
- </p>
- </td>
- </tr>
- <tr>
<td><code>modes</code></td>
<td>
<code>Dictionary, default to '{}'</code>
@@ -203,6 +172,25 @@
</td>
</tr>
<tr>
+ <td><code>mtime</code></td>
+ <td>
+ <code>int, seconds since Jan 1, 1970, default to -1 (ignored)</code>
+ <p>
+ Set the mod time of files added by the <code>files</code> attribute.
+ </p>
+ </td>
+ </tr>
+ <tr>
+ <td><code>portable_mtime</code></td>
+ <td>
+ <code>bool, default True</code>
+ <p>
+ Set the mod time of files added by the <code>files</code> attribute
+ to a 2000-01-01.
+ </p>
+ </td>
+ </tr>
+ <tr>
<td><code>owner</code></td>
<td>
<code>String, default to '0.0'</code>
@@ -213,28 +201,6 @@
</td>
</tr>
<tr>
- <td><code>owners</code></td>
- <td>
- <code>Dictionary, default to '{}'</code>
- <p>
- A string dictionary to change default owner of specific files from
- <code>files</code>. Each key should be a path to a file before
- appending the prefix <code>package_dir</code> and the corresponding
- value the <code>UID.GID</code> numeric string for the owner of the
- file. When determining owner ids, this attribute is looked first then
- <code>owner</code>.
- </p>
- <p>
- <code>
- owners = {
- "tools/py/2to3.sh": "42.24",
- ...
- },
- </code>
- </p>
- </td>
- </tr>
- <tr>
<td><code>ownername</code></td>
<td>
<code>String, optional</code>
diff --git a/tools/build_defs/pkg/build_test.sh b/tools/build_defs/pkg/build_test.sh
index aad8d32..e8ac8c8 100755
--- a/tools/build_defs/pkg/build_test.sh
+++ b/tools/build_defs/pkg/build_test.sh
@@ -66,13 +66,10 @@
check_eq "$listing" "$(get_tar_listing $1)"
check_eq "-rwxr-xr-x" "$(get_tar_permission $1 ./usr/titi)"
check_eq "-rw-r--r--" "$(get_tar_permission $1 ./etc/nsswitch.conf)"
- check_eq "24/42" "$(get_numeric_tar_owner $1 ./etc/)"
- check_eq "24/42" "$(get_numeric_tar_owner $1 ./etc/nsswitch.conf)"
check_eq "42/24" "$(get_numeric_tar_owner $1 ./usr/)"
check_eq "42/24" "$(get_numeric_tar_owner $1 ./usr/titi)"
if [ -z "${2-}" ]; then
check_eq "titi/tata" "$(get_tar_owner $1 ./etc/)"
- check_eq "titi/tata" "$(get_tar_owner $1 ./etc/nsswitch.conf)"
check_eq "titi/tata" "$(get_tar_owner $1 ./usr/)"
check_eq "titi/tata" "$(get_tar_owner $1 ./usr/titi)"
fi
diff --git a/tools/build_defs/pkg/pkg.bzl b/tools/build_defs/pkg/pkg.bzl
index 6de44b7..652f8d6 100644
--- a/tools/build_defs/pkg/pkg.bzl
+++ b/tools/build_defs/pkg/pkg.bzl
@@ -82,11 +82,6 @@
"--modes=%s=%s" % (_quote(key), ctx.attr.modes[key])
for key in ctx.attr.modes
]
- if ctx.attr.owners:
- args += [
- "--owners=%s=%s" % (_quote(key), ctx.attr.owners[key])
- for key in ctx.attr.owners
- ]
if ctx.attr.extension:
dotPos = ctx.attr.extension.find(".")
if dotPos > 0:
@@ -127,7 +122,6 @@
"out": attr.output(),
"owner": attr.string(default = "0.0"),
"ownername": attr.string(default = "."),
- "owners": attr.string_dict(),
"extension": attr.string(default = "tar"),
"symlinks": attr.string_dict(),
"include_runfiles": attr.bool(),