patches and low-level development discussion
 help / color / mirror / Atom feed
c2e33dbde66ff35547800a1d18cdc716be3b484d blob 7847 bytes (raw)

  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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
 
From ae0c98ed2715c685b0cb97ac6e5d65101168b625 Mon Sep 17 00:00:00 2001
From: Alyssa Ross <hi@alyssa.is>
Date: Sun, 24 Nov 2019 16:56:11 +0000
Subject: [PATCH 1/6] common-mk: don't leak source-absolute paths

Source-absolute paths like //vm_tools/whatever were being leaked to
subprocesses, which of course didn't know how to understand them.
With this patch, source-absolute paths are only used to tell GN the
outputs, and normal Unix paths are passed to subprocesses.
---
 common-mk/external_dependencies/BUILD.gn    |  3 ++-
 common-mk/mojom_bindings_generator.gni      | 12 ++++++------
 common-mk/mojom_type_mappings_generator.gni |  2 +-
 common-mk/pkg_config.gni                    |  3 ++-
 common-mk/proto_library.gni                 | 19 ++++++++++---------
 5 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/common-mk/external_dependencies/BUILD.gn b/common-mk/external_dependencies/BUILD.gn
index 2581d31ac8..2ead288006 100644
--- a/common-mk/external_dependencies/BUILD.gn
+++ b/common-mk/external_dependencies/BUILD.gn
@@ -45,6 +45,7 @@ genxml2cpp("dbus-proxies") {
 action("cloud_policy_proto_generator") {
   policy_resources_dir = "${sysroot}/usr/share/policy_resources"
   proto_out_dir = "${target_gen_dir}/proto"
+  cloud_policy_protobuf_dir = rebase_path(proto_out_dir)
   policy_tools_dir = "${sysroot}/usr/share/policy_tools"
 
   script = "${policy_tools_dir}/generate_policy_source.py"
@@ -54,7 +55,7 @@ action("cloud_policy_proto_generator") {
   ]
   outputs = [ "${proto_out_dir}/cloud_policy.proto" ]
   args = [
-    "--cloud-policy-protobuf=${proto_out_dir}/cloud_policy.proto",
+    "--cloud-policy-protobuf=${cloud_policy_protobuf_dir}/cloud_policy.proto",
     "--chrome-version-file=${policy_resources_dir}/VERSION",
     "--target-platform=chromeos",
     "--policy-templates-file=${policy_resources_dir}/policy_templates.json",
diff --git a/common-mk/mojom_bindings_generator.gni b/common-mk/mojom_bindings_generator.gni
index 038c20ed36..205d7d3037 100644
--- a/common-mk/mojom_bindings_generator.gni
+++ b/common-mk/mojom_bindings_generator.gni
@@ -100,7 +100,7 @@ template("generate_mojom_bindings_gen") {
     args = [
       "mkdir",
       "-p",
-      mojo_templates_dir,
+      rebase_path(mojo_templates_dir),
     ]
   }
 
@@ -116,7 +116,7 @@ template("generate_mojom_bindings_gen") {
     args = [
       "--use_bundled_pylibs",
       "-o",
-      mojo_templates_dir,
+      rebase_path(mojo_templates_dir),
       "precompile",
     ]
     deps = [ ":${mojo_templates_dir_action_name}" ]
@@ -143,7 +143,7 @@ template("generate_mojom_bindings_gen") {
     args = [
       "--mojom-file-list={{response_file_name}}",
       "--output-root",
-      _mojo_output_base,
+      rebase_path(_mojo_output_base),
       "--input-root",
       mojo_root,  # Mojo depth.
       "--input-root",
@@ -188,11 +188,11 @@ template("generate_mojom_bindings_gen") {
              mojom_bindings_generator,
              "--use_bundled_pylibs",
              "--output_dir",
-             _mojo_output_base,
+             rebase_path(_mojo_output_base),
              "generate",
              "--filelist={{response_file_name}}",
              "--bytecode_path",
-             mojo_templates_dir,
+             rebase_path(mojo_templates_dir),
              "-I",
              mojo_root,  # Mojo include path.
              "-d",
@@ -216,7 +216,7 @@ template("generate_mojom_bindings_gen") {
       foreach(typemap, invoker.typemaps) {
         args += [
           "--typemap",
-          typemap,
+          rebase_path(typemap),
         ]
       }
     }
diff --git a/common-mk/mojom_type_mappings_generator.gni b/common-mk/mojom_type_mappings_generator.gni
index ff09397111..959a8b6ca9 100644
--- a/common-mk/mojom_type_mappings_generator.gni
+++ b/common-mk/mojom_type_mappings_generator.gni
@@ -21,7 +21,7 @@ template("generate_mojom_type_mappings") {
     outputs = [ "$target_gen_dir/${target_name}_typemapping" ]
     args = [
              "--output",
-             "$target_gen_dir/${target_name}_typemapping",
+             rebase_path("$target_gen_dir/${target_name}_typemapping"),
            ] + rebase_path(sources, root_build_dir)
   }
 }
diff --git a/common-mk/pkg_config.gni b/common-mk/pkg_config.gni
index b2c58845d4..31d3f4ab51 100644
--- a/common-mk/pkg_config.gni
+++ b/common-mk/pkg_config.gni
@@ -81,7 +81,8 @@ template("generate_pkg_config") {
     if (!defined(output_name)) {
       output_name = name
     }
-    outputs = [ "${target_out_dir}/${output_name}.pc" ]
+    lib_path = "${target_out_dir}/${output_name}.pc"
+    outputs = [ lib_path ]
 
     script = "//common-mk/generate-pc.py"
     args = [ "--output" ] + rebase_path(outputs) + [ "--name=" + name ]
diff --git a/common-mk/proto_library.gni b/common-mk/proto_library.gni
index e64aedabe0..fb9fb4231d 100644
--- a/common-mk/proto_library.gni
+++ b/common-mk/proto_library.gni
@@ -56,7 +56,7 @@ template("proto_library") {
 
     cc_dir = "${root_gen_dir}/${proto_out_dir}"
     proto_in_dir = rebase_path(proto_in_dir)
-    proto_out_dir = rebase_path(proto_out_dir)
+    proto_out_dir = rebase_path(cc_dir)
 
     proto_lib_dirs = [
       proto_in_dir,
@@ -96,10 +96,9 @@ template("proto_library") {
     }
     outputs = []
     if (gen_python) {
-      python_dir = "${root_gen_dir}/${proto_out_dir}/py"
       args += [
         "--python_out",
-        "${python_dir}",
+        "${proto_out_dir}/py",
       ]
       foreach(source, sources) {
         source = rebase_path(source, proto_in_dir)
@@ -109,19 +108,19 @@ template("proto_library") {
     }
     if (gen_grpc) {
       if (gen_grpc_gmock) {
-        args += [ "--grpc_out=generate_mock_code=true:${cc_dir}" ]
+        args += [ "--grpc_out=generate_mock_code=true:${proto_out_dir}" ]
         foreach(source, sources) {
           source = rebase_path(source, proto_in_dir)
           source = string_replace(source, ".proto", "")
           outputs += [ "${cc_dir}/${source}_mock.grpc.pb.h" ]
         }
       } else {
-        args += [ "--grpc_out=${cc_dir}" ]
+        args += [ "--grpc_out=${proto_out_dir}" ]
       }
       grpc_cpp_plugin = "/usr/bin/grpc_cpp_plugin"
       args += [
         "--plugin=protoc-gen-grpc=${grpc_cpp_plugin}",
-        "--cpp_out=${gen_cpp_mode}${cc_dir}",
+        "--cpp_out=${gen_cpp_mode}${proto_out_dir}",
       ]
       foreach(source, sources) {
         source = rebase_path(source, proto_in_dir)
@@ -135,7 +134,7 @@ template("proto_library") {
       }
     }
     if (!gen_grpc && !gen_python) {
-      args += [ "--cpp_out=${gen_cpp_mode}${cc_dir}" ]
+      args += [ "--cpp_out=${gen_cpp_mode}${proto_out_dir}" ]
       foreach(source, sources) {
         source = rebase_path(source, proto_in_dir)
         source = string_replace(source, ".proto", "")
@@ -238,7 +237,9 @@ template("goproto_library") {
     # otherwise file descriptor var name will conflict.
     # cf) https://github.com/golang/protobuf/issues/109
 
+    cc_dir = "${root_gen_dir}/${proto_out_dir}"
     proto_in_dir = rebase_path(invoker.proto_in_dir)
+    proto_out_dir = rebase_path(cc_dir)
 
     # Build protoc command line to run.
     script = "//common-mk/file_generator_wrapper.py"
@@ -278,7 +279,7 @@ template("goproto_library") {
       "--go_out",
 
       # go_out_prefix can be empty, so we can always add a colon here.
-      "${go_out_prefix}:${root_gen_dir}/${proto_out_dir}",
+      "${go_out_prefix}:${proto_out_dir}",
     ]
     foreach(source, sources) {
       args += [ rebase_path(source) ]
@@ -288,7 +289,7 @@ template("goproto_library") {
     outputs = []
     foreach(source, invoker.sources) {
       name = get_path_info(source, "name")
-      outputs += [ "${root_gen_dir}/${proto_out_dir}/${name}.pb.go" ]
+      outputs += [ "${cc_dir}/${name}.pb.go" ]
     }
   }
 }
-- 
2.32.0

debug log:

solving c2e33dbde66 ...
found c2e33dbde66 in https://spectrum-os.org/git/nixpkgs

patches and low-level development discussion

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://spectrum-os.org/lists/archives/spectrum-devel/0 spectrum-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 spectrum-devel spectrum-devel/ https://spectrum-os.org/lists/archives/spectrum-devel \
		public-inbox+spectrum-devel@spectrum-os.org devel@spectrum-os.org
	public-inbox-index spectrum-devel

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntps://spectrum-os.org/inbox.comp.spectrum.devel
	nntp://spectrum-os.org/inbox.comp.spectrum.devel


code repositories for the project(s) associated with this inbox:

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

AGPL code for this site: https://ftp.qyliss.net/public-inbox/public-inbox-1.6.1-qyliss-cn3xfarfp0nz6c9asz6hqns9b5byb6sr.tar.gz