kbuild: do not print extra logs for V=2

Some scripts increase the verbose level when V=1, but others when
not V=0.

I think the former is correct because V=2 is not a log level but
a switch to print the reason for rebuilding.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
This commit is contained in:
Masahiro Yamada 2022-12-23 01:25:33 +09:00
parent 8962b6b475
commit c0d3b83100
5 changed files with 15 additions and 13 deletions

View File

@ -28,7 +28,7 @@ BUILDDIR = $(obj)/output
PDFLATEX = xelatex PDFLATEX = xelatex
LATEXOPTS = -interaction=batchmode -no-shell-escape LATEXOPTS = -interaction=batchmode -no-shell-escape
ifeq ($(KBUILD_VERBOSE),0) ifeq ($(findstring 1, $(KBUILD_VERBOSE)),)
SPHINXOPTS += "-q" SPHINXOPTS += "-q"
endif endif

View File

@ -51,11 +51,10 @@ do
# a leading . on the name, so strip it off here. # a leading . on the name, so strip it off here.
UNDEF="${UNDEF#.}" UNDEF="${UNDEF#.}"
if [ $KBUILD_VERBOSE ]; then case "$KBUILD_VERBOSE" in
if [ $KBUILD_VERBOSE -ne 0 ]; then *1*)
echo "Checking prom_init.o symbol '$UNDEF'" echo "Checking prom_init.o symbol '$UNDEF'" ;;
fi esac
fi
OK=0 OK=0
for WHITE in $WHITELIST for WHITE in $WHITELIST

View File

@ -78,7 +78,7 @@ static void drain_openssl_errors(void)
static const char *key_pass; static const char *key_pass;
static BIO *wb; static BIO *wb;
static char *cert_dst; static char *cert_dst;
static int kbuild_verbose; static bool verbose;
static void write_cert(X509 *x509) static void write_cert(X509 *x509)
{ {
@ -90,19 +90,22 @@ static void write_cert(X509 *x509)
} }
X509_NAME_oneline(X509_get_subject_name(x509), buf, sizeof(buf)); X509_NAME_oneline(X509_get_subject_name(x509), buf, sizeof(buf));
ERR(!i2d_X509_bio(wb, x509), "%s", cert_dst); ERR(!i2d_X509_bio(wb, x509), "%s", cert_dst);
if (kbuild_verbose) if (verbose)
fprintf(stderr, "Extracted cert: %s\n", buf); fprintf(stderr, "Extracted cert: %s\n", buf);
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
char *cert_src; char *cert_src;
char *verbose_env;
OpenSSL_add_all_algorithms(); OpenSSL_add_all_algorithms();
ERR_load_crypto_strings(); ERR_load_crypto_strings();
ERR_clear_error(); ERR_clear_error();
kbuild_verbose = atoi(getenv("KBUILD_VERBOSE")?:"0"); verbose_env = getenv("KBUILD_VERBOSE");
if (verbose_env && strchr(verbose_env, '1'))
verbose = true;
key_pass = getenv("KBUILD_SIGN_PIN"); key_pass = getenv("KBUILD_SIGN_PIN");

View File

@ -567,8 +567,8 @@ int main(int argc, char **argv)
int fd; int fd;
kbuild_verbose = getenv("KBUILD_VERBOSE"); kbuild_verbose = getenv("KBUILD_VERBOSE");
if (kbuild_verbose) if (kbuild_verbose && strchr(kbuild_verbose, '1'))
verbose_opt = atoi(kbuild_verbose); verbose_opt = true;
while (argc > 4) { while (argc > 4) {
if (strcmp(argv[1], "-v") == 0) if (strcmp(argv[1], "-v") == 0)

View File

@ -175,8 +175,8 @@ my $declaration_start_line;
my ($type, $declaration_name, $return_type); my ($type, $declaration_name, $return_type);
my ($newsection, $newcontents, $prototype, $brcount, %source_map); my ($newsection, $newcontents, $prototype, $brcount, %source_map);
if (defined($ENV{'KBUILD_VERBOSE'})) { if (defined($ENV{'KBUILD_VERBOSE'}) && $ENV{'KBUILD_VERBOSE'} =~ '1') {
$verbose = "$ENV{'KBUILD_VERBOSE'}"; $verbose = 1;
} }
if (defined($ENV{'KCFLAGS'})) { if (defined($ENV{'KCFLAGS'})) {