mirror of https://github.com/bazelbuild/rules_pkg
Fix some lint warnings. (#519)
Make buildifier shut up about some docstrings and ordering of attributes. More to do in another pass.
This commit is contained in:
parent
e658d70640
commit
7499938b1e
10
deps.bzl
10
deps.bzl
|
@ -11,11 +11,11 @@
|
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Workspace dependencies for rules_pkg/pkg
|
||||
# This is for backwards compatibility with existing usage. Please use
|
||||
# load("//pkg:deps.bzl", "rules_pkg_dependencies")
|
||||
# going forward.
|
||||
"""Workspace dependencies for rules_pkg/pkg.
|
||||
This is for backwards compatibility with existing usage. Please use
|
||||
load("//pkg:deps.bzl", "rules_pkg_dependencies")
|
||||
going forward.
|
||||
"""
|
||||
|
||||
load("//pkg:deps.bzl", _rules_pkg_dependencies = "rules_pkg_dependencies")
|
||||
|
||||
|
|
|
@ -23,9 +23,8 @@ load("//:version.bzl", "version")
|
|||
|
||||
|
||||
# pairs of rule name and the source file to get it from
|
||||
# buildifier: leave-alone
|
||||
# buildifier: leave-alone, do not sort
|
||||
ORDER = [
|
||||
# buildifier: do not sort
|
||||
("toc", None),
|
||||
("common", None),
|
||||
("pkg_deb", "//pkg/private/deb:deb.bzl"),
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
"""Forwarder for pkg_deb."""
|
||||
|
||||
load("//pkg/private/deb:deb.bzl", _pkg_deb = "pkg_deb")
|
||||
|
||||
pkg_deb = _pkg_deb
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Workspace dependencies for rules_pkg/pkg
|
||||
"""WORKSPACE dependencies for rules_pkg/pkg."""
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
|
|
|
@ -11,12 +11,10 @@
|
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""rules for creating install scripts from pkg_filegroups and friends.
|
||||
"""Rules for creating install scripts from pkg_filegroups and friends.
|
||||
|
||||
This module provides an interface (`pkg_install`) for creating a `bazel
|
||||
run`-able installation script.
|
||||
|
||||
"""
|
||||
|
||||
load("//pkg:providers.bzl", "PackageDirsInfo", "PackageFilegroupInfo", "PackageFilesInfo", "PackageSymlinkInfo")
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
"""Impementation for print_rel_notes."""
|
||||
|
||||
def print_rel_notes(
|
||||
name,
|
||||
repo,
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
"""Forwarder for pkg_zip."""
|
||||
|
||||
load("//pkg/private/zip:zip.bzl", _pkg_zip = "pkg_zip")
|
||||
|
||||
pkg_zip = _pkg_zip
|
||||
|
|
|
@ -106,6 +106,6 @@ py_test(
|
|||
|
||||
package_naming_test(
|
||||
name = "naming_test",
|
||||
target_under_test = ":test_deb",
|
||||
expected_name = "fizzbuzz_test_all.deb",
|
||||
target_under_test = ":test_deb",
|
||||
)
|
||||
|
|
|
@ -43,7 +43,6 @@ def _package_naming_test_impl(ctx):
|
|||
)
|
||||
return analysistest.end(env)
|
||||
|
||||
|
||||
package_naming_test = analysistest.make(
|
||||
_package_naming_test_impl,
|
||||
attrs = {
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
load(
|
||||
":mappings_test.bzl",
|
||||
"manifest_golden_test",
|
||||
"mappings_analysis_tests",
|
||||
"mappings_unit_tests",
|
||||
"manifest_golden_test",
|
||||
"mappings_analysis_tests",
|
||||
"mappings_unit_tests",
|
||||
)
|
||||
load(":mappings_external_repo_test.bzl", "mappings_external_repo_analysis_tests")
|
||||
load(
|
||||
|
@ -51,7 +51,10 @@ mappings_external_repo_analysis_tests()
|
|||
|
||||
directory(
|
||||
name = "treeartifact",
|
||||
filenames = ["artifact_in_tree1", "artifact_in_tree2"],
|
||||
filenames = [
|
||||
"artifact_in_tree1",
|
||||
"artifact_in_tree2",
|
||||
],
|
||||
)
|
||||
|
||||
pkg_files(
|
||||
|
@ -85,16 +88,16 @@ write_content_manifest(
|
|||
name = "all",
|
||||
srcs = [
|
||||
"BUILD",
|
||||
":directory-with-contents",
|
||||
":dirs",
|
||||
":files",
|
||||
":directory-with-contents",
|
||||
],
|
||||
)
|
||||
|
||||
manifest_golden_test(
|
||||
name = "all_test",
|
||||
target = "all",
|
||||
expected = "all.manifest.golden",
|
||||
target = "all",
|
||||
)
|
||||
|
||||
#
|
||||
|
@ -117,6 +120,6 @@ write_content_manifest(
|
|||
|
||||
manifest_golden_test(
|
||||
name = "utf8_manifest_test",
|
||||
target = "utf8",
|
||||
expected = "utf8_manifest.golden",
|
||||
target = "utf8",
|
||||
)
|
||||
|
|
|
@ -109,7 +109,6 @@ def _test_pkg_files_extrepo():
|
|||
expected_dests = ["usr/bin/dir/extproj.sh"],
|
||||
)
|
||||
|
||||
|
||||
def mappings_external_repo_analysis_tests():
|
||||
"""Declare mappings.bzl analysis tests"""
|
||||
_test_pkg_files_extrepo()
|
||||
|
|
|
@ -20,23 +20,24 @@ load(
|
|||
"PackageDirsInfo",
|
||||
"PackageFilegroupInfo",
|
||||
"PackageFilesInfo",
|
||||
"PackageSymlinkInfo",)
|
||||
"PackageSymlinkInfo",
|
||||
)
|
||||
load(
|
||||
"//pkg:mappings.bzl",
|
||||
"REMOVE_BASE_DIRECTORY",
|
||||
"pkg_attributes",
|
||||
"pkg_filegroup",
|
||||
"pkg_files",
|
||||
"pkg_mkdirs",
|
||||
"pkg_mklink",
|
||||
"strip_prefix",
|
||||
"REMOVE_BASE_DIRECTORY",
|
||||
)
|
||||
load(
|
||||
"//tests/util:defs.bzl",
|
||||
"directory",
|
||||
"fake_artifact",
|
||||
"generic_base_case_test",
|
||||
"generic_negative_test"
|
||||
"generic_negative_test",
|
||||
)
|
||||
load("@bazel_skylib//lib:new_sets.bzl", "sets")
|
||||
load("@rules_python//python:defs.bzl", "py_test")
|
||||
|
@ -62,11 +63,11 @@ def _pkg_files_contents_test_impl(ctx):
|
|||
for got in target_under_test[PackageFilesInfo].dest_src_map.keys():
|
||||
asserts.true(
|
||||
got in expected_dests,
|
||||
"got <%s> not in expected set: %s" % (got, ctx.attr.expected_dests))
|
||||
"got <%s> not in expected set: %s" % (got, ctx.attr.expected_dests),
|
||||
)
|
||||
n_found += 1
|
||||
asserts.equals(env, len(expected_dests), n_found)
|
||||
|
||||
|
||||
# Simple equality checks for the others, if specified
|
||||
if ctx.attr.expected_attributes:
|
||||
asserts.equals(
|
||||
|
@ -468,7 +469,6 @@ def _test_pkg_files_rename():
|
|||
target_under_test = ":pf_directory_rename_to_empty_g",
|
||||
)
|
||||
|
||||
|
||||
##########
|
||||
# Test pkg_mkdirs
|
||||
##########
|
||||
|
@ -969,7 +969,6 @@ _gen_manifest_test_main = rule(
|
|||
},
|
||||
)
|
||||
|
||||
|
||||
def manifest_golden_test(name, target, expected):
|
||||
"""Tests that a content manifest file matches a golden copy.
|
||||
|
||||
|
|
|
@ -24,14 +24,15 @@ load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts", "unittest")
|
|||
def _compute_data_path_test_impl(ctx):
|
||||
env = analysistest.begin(ctx)
|
||||
target_under_test = analysistest.target_under_test(env)
|
||||
|
||||
# Subtle: This allows you to vendor the library into your own repo at some
|
||||
# arbitrary path.
|
||||
expect = ctx.attr.expected_path
|
||||
if expect.startswith('tests'):
|
||||
expect = ctx.label.package + expect[5:]
|
||||
if expect.startswith("tests"):
|
||||
expect = ctx.label.package + expect[5:]
|
||||
asserts.equals(
|
||||
env,
|
||||
expect,
|
||||
expect,
|
||||
compute_data_path(ctx, ctx.attr.in_path),
|
||||
)
|
||||
return analysistest.end(env)
|
||||
|
@ -88,4 +89,4 @@ def _test_compute_data_path(name):
|
|||
|
||||
def path_tests(name):
|
||||
"""Declare path.bzl analysis tests."""
|
||||
_test_compute_data_path(name=name + "_compute_data_path")
|
||||
_test_compute_data_path(name = name + "_compute_data_path")
|
||||
|
|
|
@ -100,13 +100,13 @@ pkg_mkdirs(
|
|||
|
||||
pkg_mklink(
|
||||
name = "test_links",
|
||||
link_name = "/usr/bin/link-name",
|
||||
target = "/usr/bin/link-target",
|
||||
attributes = pkg_attributes(
|
||||
group = "root",
|
||||
mode = "0777",
|
||||
user = "root",
|
||||
),
|
||||
link_name = "/usr/bin/link-name",
|
||||
target = "/usr/bin/link-target",
|
||||
)
|
||||
|
||||
pkg_filegroup(
|
||||
|
@ -316,10 +316,10 @@ sh_library(
|
|||
|
||||
pkg_mkdirs(
|
||||
name = "dirtest_dirs",
|
||||
attributes = pkg_attributes(mode = "0755"),
|
||||
dirs = [
|
||||
"dir",
|
||||
],
|
||||
attributes = pkg_attributes(mode = "0755"),
|
||||
)
|
||||
|
||||
pkg_files(
|
||||
|
@ -327,9 +327,10 @@ pkg_files(
|
|||
srcs = [
|
||||
":config_empty",
|
||||
],
|
||||
prefix = "dir",
|
||||
attributes = pkg_attributes(mode = "0644"),
|
||||
prefix = "dir",
|
||||
)
|
||||
|
||||
pkg_rpm(
|
||||
name = "test_rpm_dirs",
|
||||
srcs = [
|
||||
|
@ -354,7 +355,7 @@ genrule(
|
|||
# pkg_rpm emits two outputs
|
||||
RPMS=($(SRCS))
|
||||
rpm -qp --queryformat '[%{FILEMODES:perms} %{FILENAMES}\n]' $${RPMS[0]} > $@
|
||||
"""
|
||||
""",
|
||||
)
|
||||
|
||||
diff_test(
|
||||
|
|
|
@ -191,7 +191,6 @@ def _package_naming_test_impl(ctx):
|
|||
elif f.basename == ctx.attr.expected_default_name and not default_name_found:
|
||||
default_name_found = True
|
||||
|
||||
|
||||
asserts.true(
|
||||
env,
|
||||
packaged_file != None,
|
||||
|
|
|
@ -61,10 +61,10 @@ Paths containing directories will also have the intermediate directories created
|
|||
|
||||
def _fake_artifact_impl(ctx):
|
||||
out_file = ctx.actions.declare_file(ctx.attr.name)
|
||||
content = ['echo ' + rf.path for rf in ctx.files.runfiles]
|
||||
content = ["echo " + rf.path for rf in ctx.files.runfiles]
|
||||
ctx.actions.write(
|
||||
output = out_file,
|
||||
content = '\r\n'.join(content),
|
||||
content = "\r\n".join(content),
|
||||
is_executable = ctx.attr.executable,
|
||||
)
|
||||
return DefaultInfo(
|
||||
|
@ -137,7 +137,7 @@ def write_content_manifest(name, srcs):
|
|||
name = name,
|
||||
srcs = srcs,
|
||||
use_short_path = True,
|
||||
out = name + ".manifest"
|
||||
out = name + ".manifest",
|
||||
)
|
||||
|
||||
############################################################
|
||||
|
|
|
@ -44,11 +44,11 @@ pkg_mkdirs(
|
|||
|
||||
pkg_mklink(
|
||||
name = "link",
|
||||
target = "/usr/local/foo/foo.real",
|
||||
link_name = "/usr/bin/foo",
|
||||
attributes = pkg_attributes(
|
||||
mode = "555",
|
||||
),
|
||||
link_name = "/usr/bin/foo",
|
||||
target = "/usr/local/foo/foo.real",
|
||||
)
|
||||
|
||||
directory(
|
||||
|
@ -85,10 +85,10 @@ pkg_zip(
|
|||
pkg_zip(
|
||||
name = "test_zip_basic",
|
||||
srcs = [
|
||||
"//tests:testdata/hello.txt",
|
||||
"//tests:testdata/loremipsum.txt",
|
||||
":dirs",
|
||||
":link",
|
||||
"//tests:testdata/hello.txt",
|
||||
"//tests:testdata/loremipsum.txt",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -114,10 +114,10 @@ pkg_zip(
|
|||
pkg_zip(
|
||||
name = "test_zip_basic_timestamp_before_epoch",
|
||||
srcs = [
|
||||
"//tests:testdata/hello.txt",
|
||||
"//tests:testdata/loremipsum.txt",
|
||||
":dirs",
|
||||
":link",
|
||||
"//tests:testdata/hello.txt",
|
||||
"//tests:testdata/loremipsum.txt",
|
||||
],
|
||||
timestamp = 0,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue