On Thu, Aug 10, 2023 at 10:00:57AM -0500, Eric Blake wrote:
Our goal is that rustfmt should be an optional dependency. If
present, we use it to make generated .rs files look nicer in the
tarball created by 'make dist'. But if absent, things should still
compile just fine.
However, the configure test currently rejects cargo as unusable if
'cargo fmt' doesn't work, which is overly strict. Not to mention that
'test ... -a ...' is non-portable (we don't need two conditions, but
if we did, the portable spelling is 'test ... && test ...').
Fixes: b2511d640b ("rust: create basic Rust bindings", v1.17.3)
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushed as b389eaea, as it lets me complete 'make check' with Rust
bindings enabled but rustfmt not installed.
configure.ac | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index b475dccf..d1440688 100644
--- a/configure.ac
+++ b/configure.ac
@@ -627,8 +627,7 @@ AS_IF([test "x$enable_rust" != "xno"],[
AS_IF([ (
cd $srcdir/rust/cargo_test &&
$CARGO test 2>&AS_MESSAGE_LOG_FD 1>&2 &&
- $CARGO doc 2>&AS_MESSAGE_LOG_FD 1>&2 &&
- $CARGO fmt 2>&AS_MESSAGE_LOG_FD 1>&2
+ $CARGO doc 2>&AS_MESSAGE_LOG_FD 1>&2
If I understand this correctly, we're no longer testing that "cargo
fmt" works when run from the ./rust/cargo_tests/ directory. This
would (before patch) have checked that rustfmt is installed.
If this fails, CARGO is set to "no" (even if cargo is present).
) ],[
AC_MSG_RESULT([yes])
],[
@@ -638,7 +637,7 @@ AS_IF([test "x$enable_rust" != "xno"],[
])
])
],[CARGO=no])
-AM_CONDITIONAL([HAVE_RUST],[test "x$CARGO" != "xno" -a
"x$RUSTFMT" != "xno"])
+AM_CONDITIONAL([HAVE_RUST],[test "x$CARGO" != "xno"])
Now we're allowing HAVE_RUST if cargo != "no", and no longer checking
for rustfmt.
That would fail when running the generator, except that in the
generator we check if rustfmt is "" or "no" and skip using it if
it's
not present, since rustfmt is a nice to have and not required.
So this seems good to me, therefore (even though upstream already):
Reviewed-by: Richard W.M. Jones <rjones(a)redhat.com>
Rich.
AC_MSG_CHECKING([for how to mark DSO non-deletable at runtime])
NODELETE=
--
2.41.0
_______________________________________________
Libguestfs mailing list
Libguestfs(a)redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW