mirror of https://github.com/bazelbuild/rules_pkg
chore: buildifier format all files (#775)
This commit is contained in:
parent
a2250d999f
commit
eb46104bc5
2
BUILD
2
BUILD
|
@ -22,7 +22,7 @@ package(
|
|||
license(
|
||||
name = "license",
|
||||
license_kinds = [
|
||||
"@rules_license//licenses/spdx:Apache-2.0"
|
||||
"@rules_license//licenses/spdx:Apache-2.0",
|
||||
],
|
||||
license_text = "LICENSE",
|
||||
)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
module(
|
||||
name = "rules_pkg",
|
||||
version = "0.10.0", # Must sync with version.bzl.
|
||||
repo_name = "rules_pkg",
|
||||
compatibility_level = 1,
|
||||
repo_name = "rules_pkg",
|
||||
)
|
||||
|
||||
# Do not update to newer versions until you need a specific new feature.
|
||||
|
@ -18,4 +18,8 @@ bazel_dep(name = "rules_cc", version = "0.0.9", dev_dependency = True)
|
|||
# Find the system rpmbuild if one is available.
|
||||
find_rpm = use_extension("//toolchains/rpm:rpmbuild_configure.bzl", "find_system_rpmbuild_bzlmod", dev_dependency = True)
|
||||
use_repo(find_rpm, "rules_pkg_rpmbuild")
|
||||
register_toolchains("@rules_pkg_rpmbuild//:all", dev_dependency = True)
|
||||
|
||||
register_toolchains(
|
||||
"@rules_pkg_rpmbuild//:all",
|
||||
dev_dependency = True,
|
||||
)
|
||||
|
|
|
@ -36,11 +36,11 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|||
|
||||
http_archive(
|
||||
name = "platforms",
|
||||
sha256 = "3a561c99e7bdbe9173aa653fd579fe849f1d8d67395780ab4770b1f381431d51",
|
||||
urls = [
|
||||
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz",
|
||||
"https://github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz",
|
||||
],
|
||||
sha256 = "3a561c99e7bdbe9173aa653fd579fe849f1d8d67395780ab4770b1f381431d51",
|
||||
)
|
||||
|
||||
# Find rpmbuild if it exists.
|
||||
|
@ -74,10 +74,11 @@ stardoc_repositories()
|
|||
|
||||
http_archive(
|
||||
name = "rules_cc",
|
||||
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"],
|
||||
sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf",
|
||||
strip_prefix = "rules_cc-0.0.9",
|
||||
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"],
|
||||
)
|
||||
|
||||
load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains")
|
||||
|
||||
rules_cc_dependencies()
|
||||
|
|
|
@ -12,12 +12,11 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
load("@rules_python//python:defs.bzl", "py_test")
|
||||
load("//:version.bzl", "version")
|
||||
load("//pkg:tar.bzl", "pkg_tar")
|
||||
load("//pkg/releasing:defs.bzl", "print_rel_notes")
|
||||
load("//pkg/releasing:git.bzl", "git_changelog")
|
||||
load("@rules_python//python:defs.bzl", "py_test")
|
||||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
||||
|
||||
package(
|
||||
default_applicable_licenses = ["//:license"],
|
||||
|
@ -83,12 +82,12 @@ py_test(
|
|||
"packaging_test.py",
|
||||
":release_version.py",
|
||||
],
|
||||
imports = [".."],
|
||||
data = [
|
||||
"testdata/BUILD.tpl",
|
||||
":distro",
|
||||
"//:standard_package",
|
||||
],
|
||||
imports = [".."],
|
||||
local = True,
|
||||
python_version = "PY3",
|
||||
tags = [
|
||||
|
|
|
@ -21,7 +21,6 @@ How to:
|
|||
|
||||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
|
||||
load("@bazel_stardoc//stardoc:stardoc.bzl", "stardoc")
|
||||
load("@rules_python//python:defs.bzl", "py_library")
|
||||
load("//:version.bzl", "version")
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
# limitations under the License.
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load("@rules_pkg//pkg:deb.bzl", "pkg_deb")
|
||||
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
|
||||
load(":package_upload.bzl", "debian_upload")
|
||||
load(":my_package_name.bzl", "basic_naming", "name_part_from_command_line", "names_from_toolchains")
|
||||
load(":package_upload.bzl", "debian_upload")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
config_setting(
|
||||
name = "special_build",
|
||||
|
|
|
@ -27,7 +27,7 @@ rules_pkg_dependencies()
|
|||
|
||||
http_archive(
|
||||
name = "rules_cc",
|
||||
url = "https://github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip",
|
||||
sha256 = "d0c573b94a6ef20ef6ff20154a23d0efcb409fb0e1ff0979cec318dfe42f0cdd",
|
||||
strip_prefix = "rules_cc-b1c40e1de81913a3c40e5948f78719c28152486d",
|
||||
url = "https://github.com/bazelbuild/rules_cc/archive/b1c40e1de81913a3c40e5948f78719c28152486d.zip",
|
||||
)
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
"""Example rules to show package naming techniques."""
|
||||
|
||||
load("@rules_pkg//pkg:providers.bzl", "PackageVariablesInfo")
|
||||
load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cc_toolchain")
|
||||
load("@rules_pkg//pkg:providers.bzl", "PackageVariablesInfo")
|
||||
|
||||
def _basic_naming_impl(ctx):
|
||||
values = {}
|
||||
|
@ -97,6 +97,7 @@ names_from_toolchains = rule(
|
|||
#
|
||||
def _name_part_from_command_line_naming_impl(ctx):
|
||||
values = {"name_part": ctx.build_setting_value}
|
||||
|
||||
# Just pass the value from the command line through. An implementation
|
||||
# could also perform validation, such as done in
|
||||
# https://github.com/bazelbuild/bazel-skylib/blob/master/rules/common_settings.bzl
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files", "pkg_mkdirs", "strip_prefix")
|
||||
load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix")
|
||||
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
|
||||
load("@rules_pkg//pkg:zip.bzl", "pkg_zip")
|
||||
|
||||
|
|
|
@ -27,10 +27,11 @@ rules_pkg_dependencies()
|
|||
|
||||
http_archive(
|
||||
name = "rules_cc",
|
||||
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"],
|
||||
sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf",
|
||||
strip_prefix = "rules_cc-0.0.9",
|
||||
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"],
|
||||
)
|
||||
|
||||
load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains")
|
||||
|
||||
rules_cc_dependencies()
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
filegroup(
|
||||
name = "docs",
|
||||
srcs = glob(["**/*"], exclude=["BUILD"]),
|
||||
srcs = glob(
|
||||
["**/*"],
|
||||
exclude = ["BUILD"],
|
||||
),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files", "strip_prefix")
|
||||
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
|
||||
load("@rules_pkg//pkg:zip.bzl", "pkg_zip")
|
||||
load("//:foo_defs.bzl", "shared_object_path_selector")
|
||||
|
||||
# There are localized message catalogs for all the components.
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
|
||||
load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files", "pkg_mkdirs")
|
||||
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
|
||||
load("//:foo_defs.bzl", "shared_object_path_selector")
|
||||
|
||||
cc_library(
|
||||
name = "foolib",
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
# limitations under the License.
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
pkg_tar(
|
||||
name = "never_stamped",
|
||||
srcs = [
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
|
||||
workspace(name = "rich_structure")
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
|
||||
local_repository(
|
||||
name = "rules_pkg",
|
||||
path = "../..",
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
def format(target):
|
||||
provider_map = providers(target)
|
||||
output_group_info = provider_map["OutputGroupInfo"]
|
||||
|
||||
# Look at the attributes of the provider. Visit the depsets.
|
||||
ret = []
|
||||
for attr in dir(output_group_info):
|
||||
|
|
|
@ -12,9 +12,10 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
load("@rules_pkg//pkg/private:make_starlark_library.bzl", "starlark_library")
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
load("@rules_python//python:defs.bzl", "py_binary", "py_library")
|
||||
load("@rules_pkg//pkg/private:make_starlark_library.bzl", "starlark_library")
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
||||
|
|
|
@ -36,10 +36,10 @@ def _pkg_rpm_impl(ctx):
|
|||
tools = []
|
||||
args = ["--name=" + ctx.label.name]
|
||||
if ctx.attr.debug:
|
||||
args += ["--debug"]
|
||||
args.append("--debug")
|
||||
|
||||
if ctx.attr.rpmbuild_path:
|
||||
args += ["--rpmbuild=" + ctx.attr.rpmbuild_path]
|
||||
args.append("--rpmbuild=" + ctx.attr.rpmbuild_path)
|
||||
|
||||
# buildifier: disable=print
|
||||
print("rpmbuild_path is deprecated. See the README for instructions on how" +
|
||||
|
@ -50,7 +50,7 @@ def _pkg_rpm_impl(ctx):
|
|||
fail("The rpmbuild_toolchain is not properly configured: " +
|
||||
toolchain.name)
|
||||
if toolchain.path:
|
||||
args += ["--rpmbuild=" + toolchain.path]
|
||||
args.append("--rpmbuild=" + toolchain.path)
|
||||
else:
|
||||
executable_files = toolchain.label[DefaultInfo].files_to_run
|
||||
tools.append(executable_files)
|
||||
|
@ -60,31 +60,31 @@ def _pkg_rpm_impl(ctx):
|
|||
if ctx.attr.version_file:
|
||||
if ctx.attr.version:
|
||||
fail("Both version and version_file attributes were specified")
|
||||
args += ["--version=@" + ctx.file.version_file.path]
|
||||
files += [ctx.file.version_file]
|
||||
args.append("--version=@" + ctx.file.version_file.path)
|
||||
files.append(ctx.file.version_file)
|
||||
elif ctx.attr.version:
|
||||
args += ["--version=" + ctx.attr.version]
|
||||
args.append("--version=" + ctx.attr.version)
|
||||
|
||||
# Release can be specified by a file or inlined.
|
||||
if ctx.attr.release_file:
|
||||
if ctx.attr.release:
|
||||
fail("Both release and release_file attributes were specified")
|
||||
args += ["--release=@" + ctx.file.release_file.path]
|
||||
files += [ctx.file.release_file]
|
||||
args.append("--release=@" + ctx.file.release_file.path)
|
||||
files.append(ctx.file.release_file)
|
||||
elif ctx.attr.release:
|
||||
args += ["--release=" + ctx.attr.release]
|
||||
args.append("--release=" + ctx.attr.release)
|
||||
|
||||
# SOURCE_DATE_EPOCH can be specified by a file or inlined.
|
||||
if ctx.attr.source_date_epoch_file:
|
||||
if ctx.attr.source_date_epoch:
|
||||
fail("Both source_date_epoch and source_date_epoch_file attributes were specified")
|
||||
args += ["--source_date_epoch=@" + ctx.file.source_date_epoch_file.path]
|
||||
files += [ctx.file.source_date_epoch_file]
|
||||
args.append("--source_date_epoch=@" + ctx.file.source_date_epoch_file.path)
|
||||
files.append(ctx.file.source_date_epoch_file)
|
||||
elif ctx.attr.source_date_epoch != None:
|
||||
args += ["--source_date_epoch=" + str(ctx.attr.source_date_epoch)]
|
||||
args.append("--source_date_epoch=" + str(ctx.attr.source_date_epoch))
|
||||
|
||||
if ctx.attr.architecture:
|
||||
args += ["--arch=" + ctx.attr.architecture]
|
||||
args.append("--arch=" + ctx.attr.architecture)
|
||||
|
||||
if not ctx.attr.spec_file:
|
||||
fail("spec_file was not specified")
|
||||
|
@ -102,19 +102,19 @@ def _pkg_rpm_impl(ctx):
|
|||
output = spec_file,
|
||||
substitutions = substitutions,
|
||||
)
|
||||
args += ["--spec_file=" + spec_file.path]
|
||||
files += [spec_file]
|
||||
args.append("--spec_file=" + spec_file.path)
|
||||
files.append(spec_file)
|
||||
|
||||
args += ["--out_file=" + ctx.outputs.rpm.path]
|
||||
args.append("--out_file=" + ctx.outputs.rpm.path)
|
||||
|
||||
# Add data files.
|
||||
if ctx.file.changelog:
|
||||
files += [ctx.file.changelog]
|
||||
args += [ctx.file.changelog.path]
|
||||
files.append(ctx.file.changelog)
|
||||
args.append(ctx.file.changelog.path)
|
||||
files += ctx.files.data
|
||||
|
||||
for f in ctx.files.data:
|
||||
args += [f.path]
|
||||
args.append(f.path)
|
||||
|
||||
# Call the generator script.
|
||||
ctx.actions.run(
|
||||
|
|
|
@ -27,8 +27,8 @@ Rules that actually make use of the outputs of the above rules are not specified
|
|||
here.
|
||||
"""
|
||||
|
||||
load("//pkg:providers.bzl", "PackageDirsInfo", "PackageFilegroupInfo", "PackageFilesInfo", "PackageSymlinkInfo")
|
||||
load("@bazel_skylib//lib:paths.bzl", "paths")
|
||||
load("//pkg:providers.bzl", "PackageDirsInfo", "PackageFilegroupInfo", "PackageFilesInfo", "PackageSymlinkInfo")
|
||||
|
||||
# TODO(#333): strip_prefix module functions should produce unique outputs. In
|
||||
# particular, this one and `_sp_from_pkg` can overlap.
|
||||
|
|
|
@ -16,6 +16,6 @@
|
|||
|
||||
def add_ctx_variables(ctx, values):
|
||||
"""Add selected variables from ctx."""
|
||||
values['target_cpu'] = ctx.var.get("TARGET_CPU")
|
||||
values['compilation_mode'] = ctx.var.get("COMPILATION_MODE")
|
||||
values["target_cpu"] = ctx.var.get("TARGET_CPU")
|
||||
values["compilation_mode"] = ctx.var.get("COMPILATION_MODE")
|
||||
return values
|
||||
|
|
|
@ -50,39 +50,39 @@ def _pkg_deb_impl(ctx):
|
|||
if ctx.attr.architecture_file:
|
||||
if ctx.attr.architecture != "all":
|
||||
fail("Both architecture and architecture_file attributes were specified")
|
||||
args += ["--architecture=@" + ctx.file.architecture_file.path]
|
||||
files += [ctx.file.architecture_file]
|
||||
args.append("--architecture=@" + ctx.file.architecture_file.path)
|
||||
files.append(ctx.file.architecture_file)
|
||||
else:
|
||||
args += ["--architecture=" + ctx.attr.architecture]
|
||||
args.append("--architecture=" + ctx.attr.architecture)
|
||||
|
||||
if ctx.attr.preinst:
|
||||
args += ["--preinst=@" + ctx.file.preinst.path]
|
||||
files += [ctx.file.preinst]
|
||||
args.append("--preinst=@" + ctx.file.preinst.path)
|
||||
files.append(ctx.file.preinst)
|
||||
if ctx.attr.postinst:
|
||||
args += ["--postinst=@" + ctx.file.postinst.path]
|
||||
files += [ctx.file.postinst]
|
||||
args.append("--postinst=@" + ctx.file.postinst.path)
|
||||
files.append(ctx.file.postinst)
|
||||
if ctx.attr.prerm:
|
||||
args += ["--prerm=@" + ctx.file.prerm.path]
|
||||
files += [ctx.file.prerm]
|
||||
args.append("--prerm=@" + ctx.file.prerm.path)
|
||||
files.append(ctx.file.prerm)
|
||||
if ctx.attr.postrm:
|
||||
args += ["--postrm=@" + ctx.file.postrm.path]
|
||||
files += [ctx.file.postrm]
|
||||
args.append("--postrm=@" + ctx.file.postrm.path)
|
||||
files.append(ctx.file.postrm)
|
||||
if ctx.attr.config:
|
||||
args += ["--config=@" + ctx.file.config.path]
|
||||
files += [ctx.file.config]
|
||||
args.append("--config=@" + ctx.file.config.path)
|
||||
files.append(ctx.file.config)
|
||||
if ctx.attr.templates:
|
||||
args += ["--templates=@" + ctx.file.templates.path]
|
||||
files += [ctx.file.templates]
|
||||
args.append("--templates=@" + ctx.file.templates.path)
|
||||
files.append(ctx.file.templates)
|
||||
if ctx.attr.triggers:
|
||||
args += ["--triggers=@" + ctx.file.triggers.path]
|
||||
files += [ctx.file.triggers]
|
||||
args.append("--triggers=@" + ctx.file.triggers.path)
|
||||
files.append(ctx.file.triggers)
|
||||
|
||||
# Conffiles can be specified by a file or a string list
|
||||
if ctx.attr.conffiles_file:
|
||||
if ctx.attr.conffiles:
|
||||
fail("Both conffiles and conffiles_file attributes were specified")
|
||||
args += ["--conffile=@" + ctx.file.conffiles_file.path]
|
||||
files += [ctx.file.conffiles_file]
|
||||
args.append("--conffile=@" + ctx.file.conffiles_file.path)
|
||||
files.append(ctx.file.conffiles_file)
|
||||
elif ctx.attr.conffiles:
|
||||
args += ["--conffile=%s" % cf for cf in ctx.attr.conffiles]
|
||||
|
||||
|
@ -90,55 +90,55 @@ def _pkg_deb_impl(ctx):
|
|||
if ctx.attr.version_file:
|
||||
if ctx.attr.version:
|
||||
fail("Both version and version_file attributes were specified")
|
||||
args += ["--version=@" + ctx.file.version_file.path]
|
||||
files += [ctx.file.version_file]
|
||||
args.append("--version=@" + ctx.file.version_file.path)
|
||||
files.append(ctx.file.version_file)
|
||||
elif ctx.attr.version:
|
||||
args += ["--version=" + ctx.attr.version]
|
||||
args.append("--version=" + ctx.attr.version)
|
||||
else:
|
||||
fail("Neither version_file nor version attribute was specified")
|
||||
|
||||
if ctx.attr.description_file:
|
||||
if ctx.attr.description:
|
||||
fail("Both description and description_file attributes were specified")
|
||||
args += ["--description=@" + ctx.file.description_file.path]
|
||||
files += [ctx.file.description_file]
|
||||
args.append("--description=@" + ctx.file.description_file.path)
|
||||
files.append(ctx.file.description_file)
|
||||
elif ctx.attr.description:
|
||||
args += ["--description=" + ctx.attr.description]
|
||||
args.append("--description=" + ctx.attr.description)
|
||||
else:
|
||||
fail("Neither description_file nor description attribute was specified")
|
||||
|
||||
if ctx.attr.changelog:
|
||||
args += ["--changelog=@" + ctx.file.changelog.path]
|
||||
files += [ctx.file.changelog]
|
||||
args.append("--changelog=@" + ctx.file.changelog.path)
|
||||
files.append(ctx.file.changelog)
|
||||
|
||||
# Built using can also be specified by a file or inlined (but is not mandatory)
|
||||
if ctx.attr.built_using_file:
|
||||
if ctx.attr.built_using:
|
||||
fail("Both build_using and built_using_file attributes were specified")
|
||||
args += ["--built_using=@" + ctx.file.built_using_file.path]
|
||||
files += [ctx.file.built_using_file]
|
||||
args.append("--built_using=@" + ctx.file.built_using_file.path)
|
||||
files.append(ctx.file.built_using_file)
|
||||
elif ctx.attr.built_using:
|
||||
args += ["--built_using=" + ctx.attr.built_using]
|
||||
args.append("--built_using=" + ctx.attr.built_using)
|
||||
|
||||
if ctx.attr.depends_file:
|
||||
if ctx.attr.depends:
|
||||
fail("Both depends and depends_file attributes were specified")
|
||||
args += ["--depends=@" + ctx.file.depends_file.path]
|
||||
files += [ctx.file.depends_file]
|
||||
args.append("--depends=@" + ctx.file.depends_file.path)
|
||||
files.append(ctx.file.depends_file)
|
||||
elif ctx.attr.depends:
|
||||
args += ["--depends=" + d for d in ctx.attr.depends]
|
||||
|
||||
if ctx.attr.priority:
|
||||
args += ["--priority=" + ctx.attr.priority]
|
||||
args.append("--priority=" + ctx.attr.priority)
|
||||
if ctx.attr.section:
|
||||
args += ["--section=" + ctx.attr.section]
|
||||
args.append("--section=" + ctx.attr.section)
|
||||
if ctx.attr.homepage:
|
||||
args += ["--homepage=" + ctx.attr.homepage]
|
||||
args.append("--homepage=" + ctx.attr.homepage)
|
||||
if ctx.attr.license:
|
||||
args += ["--license=" + ctx.attr.license]
|
||||
args.append("--license=" + ctx.attr.license)
|
||||
|
||||
args += ["--distribution=" + ctx.attr.distribution]
|
||||
args += ["--urgency=" + ctx.attr.urgency]
|
||||
args.append("--distribution=" + ctx.attr.distribution)
|
||||
args.append("--urgency=" + ctx.attr.urgency)
|
||||
args += ["--suggests=" + d for d in ctx.attr.suggests]
|
||||
args += ["--enhances=" + d for d in ctx.attr.enhances]
|
||||
args += ["--conflicts=" + d for d in ctx.attr.conflicts]
|
||||
|
@ -229,14 +229,14 @@ pkg_deb_impl = rule(
|
|||
"changelog": attr.label(
|
||||
doc = """The package changelog.
|
||||
See https://www.debian.org/doc/debian-policy/ch-source.html#s-dpkgchangelog.""",
|
||||
allow_single_file = True
|
||||
allow_single_file = True,
|
||||
),
|
||||
"description": attr.string(
|
||||
doc = """The package description. Must not be used with `description_file`.""",
|
||||
),
|
||||
"description_file": attr.label(
|
||||
doc = """The package description. Must not be used with `description`.""",
|
||||
allow_single_file = True
|
||||
allow_single_file = True,
|
||||
),
|
||||
"distribution": attr.string(
|
||||
doc = """"distribution: See http://www.debian.org/doc/debian-policy.""",
|
||||
|
@ -277,11 +277,11 @@ pkg_deb_impl = rule(
|
|||
allow_single_file = True,
|
||||
),
|
||||
"built_using": attr.string(
|
||||
doc="""The tool that were used to build this package provided either inline (with built_using) or from a file (with built_using_file)."""
|
||||
doc = """The tool that were used to build this package provided either inline (with built_using) or from a file (with built_using_file).""",
|
||||
),
|
||||
"built_using_file": attr.label(
|
||||
doc = """The tool that were used to build this package provided either inline (with built_using) or from a file (with built_using_file).""",
|
||||
allow_single_file = True
|
||||
allow_single_file = True,
|
||||
),
|
||||
"conffiles": attr.string_list(
|
||||
doc = """The list of conffiles or a file containing one conffile per line. Each item is an absolute path on the target system where the deb is installed.
|
||||
|
@ -303,7 +303,6 @@ See https://www.debian.org/doc/debian-policy/ch-files.html#s-config-files.""",
|
|||
),
|
||||
"homepage": attr.string(doc = """The homepage of the project."""),
|
||||
"license": attr.string(doc = """The license of the project."""),
|
||||
|
||||
"breaks": attr.string_list(
|
||||
doc = """See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps.""",
|
||||
default = [],
|
||||
|
@ -349,7 +348,7 @@ See https://www.debian.org/doc/debian-policy/ch-files.html#s-config-files.""",
|
|||
# Common attributes
|
||||
"out": attr.output(
|
||||
doc = """See [Common Attributes](#out)""",
|
||||
mandatory = True
|
||||
mandatory = True,
|
||||
),
|
||||
"package_file_name": attr.string(
|
||||
doc = """See [Common Attributes](#package_file_name).
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test")
|
||||
load("git.bzl", "git_changelog")
|
||||
|
||||
package(
|
||||
default_applicable_licenses = ["//:license"],
|
||||
|
|
|
@ -14,6 +14,7 @@ def print_rel_notes(
|
|||
mirror_host = None):
|
||||
if not artifact_name:
|
||||
artifact_name = ":%s-%s.tar.gz" % (repo, version)
|
||||
|
||||
# Must use Label to get a path relative to the rules_pkg repository,
|
||||
# instead of the calling BUILD file.
|
||||
print_rel_notes_helper = Label("//pkg/releasing:print_rel_notes")
|
||||
|
@ -33,6 +34,7 @@ def print_rel_notes(
|
|||
cmd.append("--toolchains_method=%s" % toolchains_method)
|
||||
if changelog:
|
||||
cmd.append("--changelog=$(location %s)" % changelog)
|
||||
|
||||
# We should depend on a changelog as a tool so that it is always built
|
||||
# for the host configuration. If the changelog is generated on the fly,
|
||||
# then we would have to run commands against our revision control
|
||||
|
|
|
@ -83,7 +83,6 @@ _git_changelog = rule(
|
|||
toolchains = ["@rules_pkg//toolchains/git:git_toolchain_type"],
|
||||
)
|
||||
|
||||
|
||||
def git_changelog(name, **kwargs):
|
||||
_git_changelog(
|
||||
name = name,
|
||||
|
@ -93,5 +92,5 @@ def git_changelog(name, **kwargs):
|
|||
str(Label("//toolchains/git:have_git")): [],
|
||||
"//conditions:default": ["//:not_compatible"],
|
||||
}),
|
||||
**kwargs,
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
@ -29,8 +29,8 @@ The mechanism for choosing between the two is documented in the function itself.
|
|||
|
||||
"""
|
||||
|
||||
load("//pkg/legacy:rpm.bzl", pkg_rpm_legacy = "pkg_rpm")
|
||||
load("//pkg:rpm_pfg.bzl", pkg_rpm_pfg = "pkg_rpm")
|
||||
load("//pkg/legacy:rpm.bzl", pkg_rpm_legacy = "pkg_rpm")
|
||||
|
||||
def pkg_rpm(name, srcs = None, spec_file = None, **kwargs):
|
||||
"""pkg_rpm wrapper
|
||||
|
|
|
@ -670,7 +670,7 @@ def _pkg_rpm_impl(ctx):
|
|||
output_groups = {
|
||||
"out": [default_file],
|
||||
"rpm": [output_file],
|
||||
"changes": changes
|
||||
"changes": changes,
|
||||
}
|
||||
return [
|
||||
OutputGroupInfo(**output_groups),
|
||||
|
|
12
tests/BUILD
12
tests/BUILD
|
@ -15,12 +15,12 @@
|
|||
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
|
||||
load("@rules_python//python:defs.bzl", "py_test")
|
||||
load(":my_package_name.bzl", "my_package_naming")
|
||||
load(":path_test.bzl", "path_tests")
|
||||
load("//pkg:deb.bzl", "pkg_deb")
|
||||
load("//pkg:mappings.bzl", "pkg_attributes", "pkg_files", "strip_prefix")
|
||||
load("//pkg:tar.bzl", "pkg_tar")
|
||||
load("//pkg:zip.bzl", "pkg_zip")
|
||||
load(":my_package_name.bzl", "my_package_naming")
|
||||
load(":path_test.bzl", "path_tests")
|
||||
|
||||
package(
|
||||
default_applicable_licenses = ["//:license"],
|
||||
|
@ -75,16 +75,16 @@ py_test(
|
|||
srcs = [
|
||||
"archive_test.py",
|
||||
],
|
||||
imports = [".."],
|
||||
data = [
|
||||
"//tests:testdata/empty.ar",
|
||||
"//tests:testdata/a_ab.ar",
|
||||
"//tests:testdata/a.ar",
|
||||
"//tests:testdata/a_b_ab.ar",
|
||||
"//tests:testdata/a_ab.ar",
|
||||
"//tests:testdata/a_b.ar",
|
||||
"//tests:testdata/a_b_ab.ar",
|
||||
"//tests:testdata/ab.ar",
|
||||
"//tests:testdata/b.ar",
|
||||
"//tests:testdata/empty.ar",
|
||||
],
|
||||
imports = [".."],
|
||||
python_version = "PY3",
|
||||
srcs_version = "PY3",
|
||||
deps = [
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
# Tests for pkg_deb specific behavior
|
||||
|
||||
load("@rules_python//python:defs.bzl", "py_test")
|
||||
load(":deb_tests.bzl", "package_naming_test")
|
||||
load("//pkg:mappings.bzl", "pkg_mklink")
|
||||
load("//pkg:deb.bzl", "pkg_deb")
|
||||
load("//pkg:mappings.bzl", "pkg_mklink")
|
||||
load("//pkg:tar.bzl", "pkg_tar")
|
||||
load("//tests:my_package_name.bzl", "my_package_naming")
|
||||
load(":deb_tests.bzl", "package_naming_test")
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
||||
|
@ -96,11 +96,11 @@ py_test(
|
|||
srcs = [
|
||||
"pkg_deb_test.py",
|
||||
],
|
||||
imports = ["../.."],
|
||||
data = [
|
||||
# The target includes both the .deb and .changes files in DefaultInfo
|
||||
":test_deb",
|
||||
],
|
||||
imports = ["../.."],
|
||||
python_version = "PY3",
|
||||
deps = [
|
||||
"//pkg/private:archive",
|
||||
|
@ -130,6 +130,9 @@ py_test(
|
|||
# Test case for expanding $(var) constructions and for using ctx.var directly
|
||||
pkg_deb(
|
||||
name = "deb_using_ctxvar",
|
||||
# This does not make sense for architecture, but for testing, compilation
|
||||
# mode is more stable than cpu.
|
||||
architecture = "$(COMPILATION_MODE)",
|
||||
config = "config",
|
||||
data = ":tar_input",
|
||||
description = "Compiled with $(COMPILATION_MODE)",
|
||||
|
@ -137,9 +140,6 @@ pkg_deb(
|
|||
maintainer = "soméone@somewhere.com",
|
||||
package = "fizzbuzz",
|
||||
version = "7",
|
||||
# This does not make sense for architecture, but for testing, compilation
|
||||
# mode is more stable than cpu.
|
||||
architecture = "$(COMPILATION_MODE)",
|
||||
)
|
||||
|
||||
package_naming_test(
|
||||
|
|
|
@ -23,10 +23,10 @@ py_test(
|
|||
name = "install_test",
|
||||
srcs = ["test.py"],
|
||||
args = ["-v"],
|
||||
imports = ["../.."],
|
||||
data = [
|
||||
":test_installer",
|
||||
],
|
||||
imports = ["../.."],
|
||||
main = "test.py",
|
||||
tags = [
|
||||
# TODO(nacl): investigate this. See also
|
||||
|
|
|
@ -12,23 +12,21 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
load(
|
||||
":mappings_test.bzl",
|
||||
"manifest_golden_test",
|
||||
"mappings_analysis_tests",
|
||||
"mappings_unit_tests",
|
||||
)
|
||||
load(":mappings_external_repo_test.bzl", "mappings_external_repo_analysis_tests")
|
||||
load(
|
||||
"//pkg:mappings.bzl",
|
||||
"pkg_attributes",
|
||||
"pkg_filegroup",
|
||||
"pkg_files",
|
||||
"pkg_mkdirs",
|
||||
"strip_prefix",
|
||||
)
|
||||
load("//tests/util:defs.bzl", "directory", "link_tree", "write_content_manifest")
|
||||
load("@rules_python//python:defs.bzl", "py_test")
|
||||
load(":mappings_external_repo_test.bzl", "mappings_external_repo_analysis_tests")
|
||||
load(
|
||||
":mappings_test.bzl",
|
||||
"manifest_golden_test",
|
||||
"mappings_analysis_tests",
|
||||
"mappings_unit_tests",
|
||||
)
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
# limitations under the License.
|
||||
|
||||
load("@rules_python//python:defs.bzl", "py_test")
|
||||
load(":defs.bzl", "inspect_directory_test")
|
||||
load("//pkg:mappings.bzl", "filter_directory")
|
||||
load("//tests/util:defs.bzl", "directory")
|
||||
load(":defs.bzl", "inspect_directory_test")
|
||||
|
||||
# TODO: the below tests only check for rule success and confirmation that
|
||||
# directory structure matches expectations. A more thorough test implementation
|
||||
|
|
|
@ -14,10 +14,7 @@
|
|||
|
||||
"""Tests for file mapping routines in pkg/mappings.bzl"""
|
||||
|
||||
load("@bazel_skylib//lib:new_sets.bzl", "sets")
|
||||
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts", "unittest")
|
||||
load(":mappings_test.bzl", "pkg_files_contents_test")
|
||||
load("//pkg:providers.bzl", "PackageFilegroupInfo", "PackageFilesInfo")
|
||||
load("//pkg:mappings.bzl", "pkg_files", "strip_prefix")
|
||||
|
||||
##########
|
||||
|
|
|
@ -14,14 +14,9 @@
|
|||
|
||||
"""Tests for file mapping routines in pkg/mappings.bzl"""
|
||||
|
||||
load("@bazel_skylib//lib:new_sets.bzl", "sets")
|
||||
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts", "unittest")
|
||||
load(
|
||||
"//pkg:providers.bzl",
|
||||
"PackageDirsInfo",
|
||||
"PackageFilegroupInfo",
|
||||
"PackageFilesInfo",
|
||||
"PackageSymlinkInfo",
|
||||
)
|
||||
load("@rules_python//python:defs.bzl", "py_test")
|
||||
load(
|
||||
"//pkg:mappings.bzl",
|
||||
"REMOVE_BASE_DIRECTORY",
|
||||
|
@ -32,6 +27,13 @@ load(
|
|||
"pkg_mklink",
|
||||
"strip_prefix",
|
||||
)
|
||||
load(
|
||||
"//pkg:providers.bzl",
|
||||
"PackageDirsInfo",
|
||||
"PackageFilegroupInfo",
|
||||
"PackageFilesInfo",
|
||||
"PackageSymlinkInfo",
|
||||
)
|
||||
load(
|
||||
"//tests/util:defs.bzl",
|
||||
"directory",
|
||||
|
@ -39,8 +41,6 @@ load(
|
|||
"generic_base_case_test",
|
||||
"generic_negative_test",
|
||||
)
|
||||
load("@bazel_skylib//lib:new_sets.bzl", "sets")
|
||||
load("@rules_python//python:defs.bzl", "py_test")
|
||||
|
||||
##########
|
||||
# Helpers
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
"""Tests for RPM generation analysis"""
|
||||
|
||||
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
|
||||
load(
|
||||
"//pkg:mappings.bzl",
|
||||
"pkg_filegroup",
|
||||
|
@ -21,10 +22,9 @@ load(
|
|||
"pkg_mkdirs",
|
||||
"pkg_mklink",
|
||||
)
|
||||
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
|
||||
load("//pkg:providers.bzl", "PackageVariablesInfo")
|
||||
load("//pkg:rpm.bzl", "pkg_rpm")
|
||||
load("//tests/util:defs.bzl", "directory", "generic_base_case_test", "generic_negative_test")
|
||||
load("//tests/util:defs.bzl", "generic_base_case_test", "generic_negative_test")
|
||||
|
||||
def _declare_pkg_rpm(name, srcs_ungrouped, tags = None, **kwargs):
|
||||
pfg_name = "{}_pfg".format(name)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
load("@rules_python//python:defs.bzl", "py_test")
|
||||
load(
|
||||
"//pkg:mappings.bzl",
|
||||
"REMOVE_BASE_DIRECTORY",
|
||||
|
@ -22,7 +23,6 @@ load(
|
|||
)
|
||||
load("//pkg:rpm.bzl", "pkg_rpm")
|
||||
load("//tests/util:defs.bzl", "directory")
|
||||
load("@rules_python//python:defs.bzl", "py_test")
|
||||
|
||||
############################################################################
|
||||
# Test handling of directory outputs
|
||||
|
@ -44,11 +44,11 @@ py_test(
|
|||
name = "layer_with_files",
|
||||
srcs = ["rpm_contents_vs_manifest_test.py"],
|
||||
data = [":layer_with_files_test_data"],
|
||||
env = {"TEST_RPM": "test_dirs_rpm-1.1.1-2222.noarch.rpm"},
|
||||
main = "rpm_contents_vs_manifest_test.py",
|
||||
tags = [
|
||||
"no_windows", # Windows doesn't have rpm(8) or rpmbuild(8)
|
||||
],
|
||||
env = {"TEST_RPM": "test_dirs_rpm-1.1.1-2222.noarch.rpm"},
|
||||
deps = [
|
||||
"//tests/rpm:rpm_util",
|
||||
"@rules_python//python/runfiles",
|
||||
|
@ -205,8 +205,8 @@ py_test(
|
|||
name = "treeartifact_ops",
|
||||
srcs = ["rpm_treeartifact_ops_test.py"],
|
||||
data = [":treeartifact_ops_rpm_test_data"],
|
||||
main = "rpm_treeartifact_ops_test.py",
|
||||
env = {"TEST_RPM": "treeartifact_ops_rpm-1.1.1-2222.noarch.rpm"},
|
||||
main = "rpm_treeartifact_ops_test.py",
|
||||
tags = [
|
||||
"no_windows", # Windows doesn't have rpm(8) or rpmbuild(8)
|
||||
],
|
||||
|
|
|
@ -14,15 +14,14 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Tests for pkg_tar."""
|
||||
|
||||
load("@rules_python//python:defs.bzl", "py_test")
|
||||
|
||||
# buildifier: disable=bzl-visibility
|
||||
load("//pkg:mappings.bzl", "pkg_attributes")
|
||||
load("//pkg:mappings.bzl", "pkg_files", "pkg_mkdirs", "pkg_mklink", "strip_prefix")
|
||||
load("//pkg:mappings.bzl", "pkg_attributes", "pkg_files", "pkg_mkdirs", "pkg_mklink")
|
||||
load("//pkg:verify_archive.bzl", "verify_archive_test")
|
||||
load("//pkg/private/tar:tar.bzl", "SUPPORTED_TAR_COMPRESSIONS", "pkg_tar")
|
||||
load("//tests:my_package_name.bzl", "my_package_naming")
|
||||
load("//tests/util:defs.bzl", "directory", "fake_artifact", "link_tree")
|
||||
load("@rules_python//python:defs.bzl", "py_test")
|
||||
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
|
||||
|
||||
package(
|
||||
default_applicable_licenses = ["//:license"],
|
||||
|
@ -34,7 +33,6 @@ py_test(
|
|||
srcs = [
|
||||
"tar_writer_test.py",
|
||||
],
|
||||
imports = ["../.."],
|
||||
data = [
|
||||
":compressor",
|
||||
":test_tar_compression",
|
||||
|
@ -46,6 +44,7 @@ py_test(
|
|||
"//tests:testdata/tar_test.tar.xz",
|
||||
"//tests:testdata/test_tar_package_dir_file.txt",
|
||||
],
|
||||
imports = ["../.."],
|
||||
python_version = "PY3",
|
||||
srcs_version = "PY3",
|
||||
deps = [
|
||||
|
@ -348,7 +347,6 @@ py_test(
|
|||
srcs = [
|
||||
"pkg_tar_test.py",
|
||||
],
|
||||
imports = ["../.."],
|
||||
data = [
|
||||
":test-pkg-tar-from-pkg-files-with-attributes",
|
||||
":test-pkg-tar-with-attributes",
|
||||
|
@ -382,6 +380,7 @@ py_test(
|
|||
":test-tar-inclusion-%s" % compression
|
||||
for compression in SUPPORTED_TAR_COMPRESSIONS
|
||||
],
|
||||
imports = ["../.."],
|
||||
python_version = "PY3",
|
||||
deps = [
|
||||
"//pkg/private/tar:tar_writer",
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
# limitations under the License.
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
|
||||
load("@rules_python//python:defs.bzl", "py_library", "py_test")
|
||||
load("//pkg:mappings.bzl", "pkg_attributes", "pkg_mkdirs", "pkg_mklink")
|
||||
load("//pkg:zip.bzl", "pkg_zip")
|
||||
load("//tests:my_package_name.bzl", "my_package_naming")
|
||||
load("//tests/util:defs.bzl", "directory", "fake_artifact")
|
||||
load("@rules_python//python:defs.bzl", "py_library", "py_test")
|
||||
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
|
||||
load("//tests/util:defs.bzl", "directory")
|
||||
|
||||
package(default_applicable_licenses = ["//:license"])
|
||||
|
||||
|
@ -242,9 +242,10 @@ pkg_zip(
|
|||
srcs = [
|
||||
"//tests:testdata/loremipsum.txt",
|
||||
],
|
||||
compression_type = "deflated",
|
||||
compression_level = 3,
|
||||
compression_type = "deflated",
|
||||
)
|
||||
|
||||
pkg_zip(
|
||||
name = "test_zip_bzip2",
|
||||
srcs = [
|
||||
|
@ -252,6 +253,7 @@ pkg_zip(
|
|||
],
|
||||
compression_type = "bzip2",
|
||||
)
|
||||
|
||||
pkg_zip(
|
||||
name = "test_zip_lzma",
|
||||
srcs = [
|
||||
|
@ -259,6 +261,7 @@ pkg_zip(
|
|||
],
|
||||
compression_type = "lzma",
|
||||
)
|
||||
|
||||
pkg_zip(
|
||||
name = "test_zip_stored",
|
||||
srcs = [
|
||||
|
@ -278,16 +281,16 @@ py_test(
|
|||
":test-zip-strip_prefix-none.zip",
|
||||
":test-zip-strip_prefix-zipcontent.zip",
|
||||
":test_zip_basic.zip",
|
||||
":test_zip_bzip2",
|
||||
":test_zip_deflated_level_3",
|
||||
":test_zip_empty.zip",
|
||||
":test_zip_lzma",
|
||||
":test_zip_package_dir0.zip",
|
||||
":test_zip_package_dir_substitution.zip",
|
||||
":test_zip_permissions.zip",
|
||||
":test_zip_stored",
|
||||
":test_zip_timestamp.zip",
|
||||
":test_zip_tree.zip",
|
||||
":test_zip_deflated_level_3",
|
||||
":test_zip_bzip2",
|
||||
":test_zip_lzma",
|
||||
":test_zip_stored",
|
||||
],
|
||||
python_version = "PY3",
|
||||
deps = [
|
||||
|
@ -320,7 +323,7 @@ py_test(
|
|||
|
||||
pkg_zip(
|
||||
name = "unicode_names",
|
||||
srcs = ["//tests:utf8_files"]
|
||||
srcs = ["//tests:utf8_files"],
|
||||
)
|
||||
|
||||
py_test(
|
||||
|
|
|
@ -68,5 +68,5 @@ def find_system_rpmbuild(name, verbose=False):
|
|||
|
||||
# For use from MODULE.bzl
|
||||
find_system_rpmbuild_bzlmod = module_extension(
|
||||
implementation = lambda ctx: build_repo_for_rpmbuild_toolchain(name=NAME)
|
||||
implementation = lambda ctx: build_repo_for_rpmbuild_toolchain(name = NAME),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue