| # Copyright 2024 The ChromiumOS Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_files", "strip_prefix") |
| load("@rules_pkg//pkg:tar.bzl", "pkg_tar") |
| load("@rules_python//python:defs.bzl", "py_binary", "py_library") |
| |
| # Chromite has some recursive symlinks which we need to exclude |
| |
| package_group( |
| name = "all_packages", |
| packages = [ |
| "//...", |
| ], |
| ) |
| |
| pkg_files( |
| name = "__sdkcommon_files__", |
| srcs = glob( |
| [ |
| "api/**", |
| "bin/**", |
| "cbuildbot/**", |
| "cidb/**", |
| "cli/**", |
| "config/**", |
| "contrib/**", |
| "cros/**", |
| "docs/**", |
| "format/**", |
| "infra/**", |
| "lib/**", |
| "licensing/**", |
| "lint/**", |
| "scripts/**", |
| "sdk/**", |
| "service/**", |
| "shell/**", |
| "signing/**", |
| "ssh_keys/**", |
| "test/**", |
| "third_party/**", |
| "utils/**", |
| # venv includes a recursive symlink to Chromite that confuses |
| # Bazel, so exclude it since it's not needed anyway. We can't use |
| # the exclude list below to filter it out because the recursive |
| # symlink messes up Bazel before that exclusion is considered, |
| # which is why we can't just include "**" rather than enumerate all |
| # the subdirs. |
| # "venv/**" |
| # Include all files, in addition to the subdirs above |
| "*", |
| ], |
| exclude = [ |
| # Contains utf-8 characters |
| "third_party/swarming.client/example/**", |
| "**/__pycache__/**", |
| ".git/**", |
| "**/*_unittest.py", |
| ], |
| ), |
| attributes = pkg_attributes( |
| mode = "0755", |
| ), |
| prefix = "/mnt/host/source/chromite", |
| strip_prefix = strip_prefix.from_pkg(), |
| visibility = ["//visibility:private"], |
| ) |
| |
| pkg_tar( |
| name = "src", |
| srcs = [ |
| ":__sdkcommon_files__", |
| ], |
| compressor = "@//bazel/portage/repo_defs/zstd", |
| compressor_args = "--threads=0", |
| extension = "tar.zst", |
| visibility = [ |
| "@//bazel:internal", |
| "@portage//:__subpackages__", |
| ], |
| ) |
| |
| # The following targets should ideally be defined elsewhere. |
| # However, if we added third_party/BUILD.bazel, for example, then the glob |
| # above would exclude them. |
| py_library( |
| name = "elftools", |
| srcs = glob(["third_party/pyelftools/elftools/**/*.py"]), |
| ) |
| |
| py_binary( |
| name = "lddtree", |
| srcs = ["third_party/lddtree.py"], |
| visibility = ["//visibility:public"], |
| deps = [":elftools"], |
| ) |