1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
licenses(["notice"]) # Apache 2.0
filegroup(
name = "srcs",
srcs = glob(["**"]),
visibility = ["//tools:__pkg__"],
)
# Used by pkg_deb
py_library(
name = "archive",
srcs = ["archive.py"],
visibility = [
"//tools/build_defs/docker:__subpackages__",
],
)
filegroup(
name = "archive_testdata",
srcs = glob(["testdata/**"]),
)
py_test(
name = "archive_test",
srcs = [
"archive_test.py",
"testenv.py",
],
data = [":archive_testdata"],
deps = [":archive"],
)
py_binary(
name = "build_tar",
srcs = ["build_tar.py"],
visibility = ["//visibility:public"],
deps = [
":archive",
"//third_party/py/gflags",
],
)
py_binary(
name = "make_deb",
srcs = ["make_deb.py"],
visibility = ["//visibility:public"],
deps = [
":archive",
"//third_party/py/gflags",
],
)
# tests
load("/tools/build_defs/pkg/pkg", "pkg_deb", "pkg_tar")
genrule(
name = "generate_files",
outs = [
"etc/nsswitch.conf",
"usr/titi",
],
cmd = "for i in $(OUTS); do echo 1 >$$i; done",
)
[pkg_tar(
name = "test-tar-%s" % ext[1:],
extension = "tar%s" % ext,
files = [
":etc/nsswitch.conf",
":usr/titi",
],
mode = "0644",
modes = {"usr/titi": "0755"},
package_dir = "/",
strip_prefix = ".",
symlinks = {"usr/bin/java": "/path/to/bin/java"},
) for ext in [
"",
".gz",
".bz2",
]]
pkg_deb(
name = "test-deb",
data = ":test-tar-gz.tar.gz",
depends = [
"dep1",
"dep2",
],
description = "toto",
maintainer = "someone@somewhere.com",
package = "titi",
version = "test",
)
sh_test(
name = "build_test",
size = "medium",
srcs = [
"build_test.sh",
],
data = [
"testenv.sh",
":test-deb.deb",
":test-tar-.tar",
":test-tar-bz2.tar.bz2",
":test-tar-gz.tar.gz",
],
deps = [
"//src/test/shell:bashunit",
],
)
|