diff options
Diffstat (limited to 'meta/classes-recipe')
-rw-r--r-- | meta/classes-recipe/cargo_common.bbclass | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/meta/classes-recipe/cargo_common.bbclass b/meta/classes-recipe/cargo_common.bbclass index f503a001dd..63b1382908 100644 --- a/meta/classes-recipe/cargo_common.bbclass +++ b/meta/classes-recipe/cargo_common.bbclass | |||
@@ -116,6 +116,36 @@ cargo_common_do_configure () { | |||
116 | EOF | 116 | EOF |
117 | } | 117 | } |
118 | 118 | ||
119 | python cargo_common_do_patch_paths() { | ||
120 | cargo_config = os.path.join(d.getVar("CARGO_HOME"), "config") | ||
121 | if not os.path.exists(cargo_config): | ||
122 | return | ||
123 | |||
124 | src_uri = (d.getVar('SRC_URI') or "").split() | ||
125 | if len(src_uri) == 0: | ||
126 | return | ||
127 | |||
128 | patches = dict() | ||
129 | workdir = d.getVar('WORKDIR') | ||
130 | fetcher = bb.fetch2.Fetch(src_uri, d) | ||
131 | for url in fetcher.urls: | ||
132 | ud = fetcher.ud[url] | ||
133 | if ud.type == 'git': | ||
134 | name = ud.parm.get('name') | ||
135 | destsuffix = ud.parm.get('destsuffix') | ||
136 | if name is not None and destsuffix is not None: | ||
137 | repo = '%s://%s%s' % (ud.proto, ud.host, ud.path) | ||
138 | path = '%s = { path = "%s" }' % (name, os.path.join(workdir, destsuffix)) | ||
139 | patches.setdefault(repo, []).append(path) | ||
140 | |||
141 | with open(cargo_config, "a+") as config: | ||
142 | for k, v in patches.items(): | ||
143 | print('\n[patch."%s"]' % k, file=config) | ||
144 | for name in v: | ||
145 | print(name, file=config) | ||
146 | } | ||
147 | do_configure[postfuncs] += "cargo_common_do_patch_paths" | ||
148 | |||
119 | oe_cargo_fix_env () { | 149 | oe_cargo_fix_env () { |
120 | export CC="${RUST_TARGET_CC}" | 150 | export CC="${RUST_TARGET_CC}" |
121 | export CXX="${RUST_TARGET_CXX}" | 151 | export CXX="${RUST_TARGET_CXX}" |