History

rust: rust_is_available: remove warning for `bindgen` 0.66.[01]

It is not possible anymore to fall into the issue that this warning was alerting about given the `bindgen` version bump. Thus simplify by removing the machinery behind it, including tests.

Miguel Ojeda committed 7 months ago

Commit 41cfbb41 parent c3a00a33 files · +3 −38Browse files

Unified · Split

3 files
  1. scripts/rust_is_available.sh +0 −13
  2. scripts/rust_is_available_bindgen_0_66.h +0 −2
  3. scripts/rust_is_available_test.py +3 −23
scripts/rust_is_available.sh+0−13
@@ -163,19 +163,6 @@ if [ "$rust_bindings_generator_cversion" -lt "$rust_bindings_generator_min_cvers · 162 unmodified lines
163163 echo >&2 "***"
164164 exit 1
165165 fi
166−if [ "$rust_bindings_generator_cversion" -eq 6600 ] ||
167− [ "$rust_bindings_generator_cversion" -eq 6601 ]; then
168− # Distributions may have patched the issue (e.g. Debian did).
169− if ! "$BINDGEN" $(dirname $0)/rust_is_available_bindgen_0_66.h >/dev/null; then
170− echo >&2 "***"
171− echo >&2 "*** Rust bindings generator '$BINDGEN' versions 0.66.0 and 0.66.1 may not"
172− echo >&2 "*** work due to a bug (https://github.com/rust-lang/rust-bindgen/pull/2567),"
173− echo >&2 "*** unless patched (like Debian's)."
174− echo >&2 "*** Your version: $rust_bindings_generator_version"
175− echo >&2 "***"
176− warning=1
177− fi
178−fi
179166
180167 # Check that the `libclang` used by the Rust bindings generator is suitable.
181168 #
scripts/rust_is_available_bindgen_0_66.h+0−2
@@ -1,2 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
2−#define A "\0"
scripts/rust_is_available_test.py+3−23
@@ -54,17 +54,12 @@ else: · 53 unmodified lines
5454 """)
5555
5656 @classmethod
57− def generate_bindgen(cls, version_stdout, libclang_stderr, version_0_66_patched=False, libclang_concat_patched=False):
57+ def generate_bindgen(cls, version_stdout, libclang_stderr, libclang_concat_patched=False):
5858 if libclang_stderr is None:
5959 libclang_case = f"raise SystemExit({cls.bindgen_default_bindgen_libclang_failure_exit_code})"
6060 else:
6161 libclang_case = f"print({repr(libclang_stderr)}, file=sys.stderr)"
6262
63− if version_0_66_patched:
64− version_0_66_case = "pass"
65− else:
66− version_0_66_case = "raise SystemExit(1)"
67−
6863 if libclang_concat_patched:
6964 libclang_concat_case = "print('pub static mut foofoo: ::std::os::raw::c_int;')"
7065 else:
@@ -74,8 +69,6 @@ else: · 3 unmodified lines
7469 import sys
7570 if "rust_is_available_bindgen_libclang.h" in " ".join(sys.argv):
7671 {libclang_case}
77−elif "rust_is_available_bindgen_0_66.h" in " ".join(sys.argv):
78− {version_0_66_case}
7972 elif "rust_is_available_bindgen_libclang_concat.h" in " ".join(sys.argv):
8073 {libclang_concat_case}
8174 else:
@@ -83,8 +76,8 @@ else: · 1 unmodified line
8376 """)
8477
8578 @classmethod
86− def generate_bindgen_version(cls, stdout, version_0_66_patched=False):
87− return cls.generate_bindgen(stdout, cls.bindgen_default_bindgen_libclang_stderr, version_0_66_patched)
79+ def generate_bindgen_version(cls, stdout):
80+ return cls.generate_bindgen(stdout, cls.bindgen_default_bindgen_libclang_stderr)
8881
8982 @classmethod
9083 def generate_bindgen_libclang_failure(cls):
@@ -245,19 +238,6 @@ else: · 154 unmodified lines
245238 result = self.run_script(self.Expected.FAILURE, { "BINDGEN": bindgen })
246239 self.assertIn(f"Rust bindings generator '{bindgen}' is too old.", result.stderr)
247240
248− def test_bindgen_bad_version_0_66_0_and_0_66_1(self):
249− for version in ("0.66.0", "0.66.1"):
250− with self.subTest(version=version):
251− bindgen = self.generate_bindgen_version(f"bindgen {version}")
252− result = self.run_script(self.Expected.SUCCESS_WITH_WARNINGS, { "BINDGEN": bindgen })
253− self.assertIn(f"Rust bindings generator '{bindgen}' versions 0.66.0 and 0.66.1 may not", result.stderr)
254−
255− def test_bindgen_bad_version_0_66_0_and_0_66_1_patched(self):
256− for version in ("0.66.0", "0.66.1"):
257− with self.subTest(version=version):
258− bindgen = self.generate_bindgen_version(f"bindgen {version}", True)
259− result = self.run_script(self.Expected.SUCCESS, { "BINDGEN": bindgen })
260−
261241 def test_bindgen_libclang_failure(self):
262242 bindgen = self.generate_bindgen_libclang_failure()
263243 result = self.run_script(self.Expected.FAILURE, { "BINDGEN": bindgen })