Debian Codegraph @

tools/build_defs/pkg/BUILD

raw
1 # -*- coding: utf-8 -*-
2 load("//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
3 load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test")
4
5 licenses(["notice"])
6
7 filegroup(
8 name = "srcs",
9 srcs = glob(["**"]),
10 visibility = ["//tools/build_defs:__pkg__"],
11 )
12
13 filegroup(
14 name = "embedded_tools",
15 srcs = [
16 "BUILD",
17 "archive.py",
18 "build_tar.py",
19 "path.bzl",
20 "pkg.bzl",
21 ],
22 visibility = ["//tools/build_defs:__pkg__"],
23 )
24
25 py_library(
26 name = "archive",
27 srcs = ["archive.py"],
28 srcs_version = "PY3",
29 )
30
31 filegroup(
32 name = "archive_testdata",
33 srcs = glob(
34 ["testdata/**"],
35 allow_empty = True,
36 ),
37 )
38
39 py_test(
40 name = "archive_test",
41 srcs = [
42 "archive_test.py",
43 ],
44 data = [":archive_testdata"],
45 python_version = "PY3",
46 srcs_version = "PY3",
47 tags = [
48 # TODO(laszlocsomor): fix on Windows or describe why it cannot pass.
49 "no_windows",
50 ],
51 deps = [":archive"],
52 )
53
54 py_test(
55 name = "path_test",
56 srcs = ["path_test.py"],
57 data = ["path.bzl"],
58 python_version = "PY3",
59 srcs_version = "PY3",
60 )
61
62 py_binary(
63 name = "build_tar",
64 srcs = ["build_tar.py"],
65 python_version = "PY3",
66 srcs_version = "PY3",
67 visibility = ["//visibility:public"],
68 deps = [
69 ":archive",
70 ],
71 )
72
73 # tests
74
75 genrule(
76 name = "generate_files",
77 outs = [
78 "etc/nsswitch.conf",
79 "usr/titi",
80 ],
81 cmd = "for i in $(OUTS); do echo 1 >$$i; done",
82 )
83
84 pkg_tar(
85 name = "test-tar",
86 srcs = [
87 ":etc/nsswitch.conf",
88 ":usr/titi",
89 ],
90 build_tar = ":build_tar",
91 package_dir = "/",
92 )
93
94 sh_test(
95 name = "build_test",
96 size = "medium",
97 srcs = [
98 "build_test.sh",
99 ],
100 data = [
101 "testenv.sh",
102 ":test-tar.tar",
103 ],
104 tags = [
105 # TODO(laszlocsomor): fix on Windows or describe why it cannot pass.
106 "no_windows",
107 ],
108 deps = [
109 "//src/test/shell:bashunit",
110 ],
111 )
112
113 filegroup(
114 name = "bzl_srcs",
115 srcs = glob(["*.bzl"]),
116 visibility = ["//tools/build_defs:__pkg__"],
117 )