qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] git-submodule.sh: allow running in validate mode without pre


From: Paolo Bonzini
Subject: Re: [PATCH] git-submodule.sh: allow running in validate mode without previous update
Date: Tue, 20 Jun 2023 22:44:53 +0200



Il mar 20 giu 2023, 19:35 Nina Schoetterl-Glausch <nsg@linux.ibm.com> ha scritto:
> +            modules="$modules $m"
> +            grep $m $substat > /dev/null 2>&1 || $GIT submodule status $module >> $substat
> +        else
> +            echo "warn: ignoring non-existent submodule $m"

What is the rational for ignoring non-existing submodules, i.e. how do the arguments to
the script go stale as you say in the patch description?

For example when a Makefile calls the script before the Makefile itself is rebuilt.

I'm asking because the fedora spec file initializes a new git repo in order to apply
patches so the script exits with 0.

You mean it succeeds even if roms/SLOF is empty?

Nothing that cannot be worked around ofc.

> +        fi
> +    done
> +else
> +    modules=$maybe_modules
>  fi

> -if test -n "$maybe_modules" && test -z "$GIT"
> -then
> -    echo "$0: unexpectedly called with submodules but git binary not found"
> -    exit 1
> -fi
> -
> -modules=""
> -for m in $maybe_modules
> -do
> -    $GIT submodule status $m 1> /dev/null 2>&1
> -    if test $? = 0
> -    then
> -        modules="$modules $m"
> -    else
> -        echo "warn: ignoring non-existent submodule $m"
> -    fi
> -done
> -
>  case "$command" in
>  status|validate)
> -    test -f "$substat" || validate_error "$command"
> -    test -z "$maybe_modules" && exit 0
>      for module in $modules; do
> -        check_updated $module || validate_error "$command"
> +        if is_git; then
> +            check_updated $module || validate_error "$command"
> +        elif ! test -d $module; then

archive-source.sh creates an empty directory for e.g. roms/SLOF,
so this check succeeds even if the submodule sources are unavailable.
Something like

        elif ! test -d $module || test -z "$(ls -A "$module")"; then

Or (set "$module"/* && test -e "$1").

Paolo

works.

> +            echo "$0: sources not available for $module and $no_git_error"
> +            validate_error "$command"
> +        fi
>      done
> -    exit 0
>      ;;
> +
>  update)
> -    test -e $substat || touch $substat
> -    test -z "$maybe_modules" && exit 0
> +    is_git || {
> +        echo "$0: unexpectedly called with submodules but $no_git_error"
> +        exit 1
> +    }

>      $GIT submodule update --init $modules 1>/dev/null
>      test $? -ne 0 && update_error "failed to update modules"


reply via email to

[Prev in Thread] Current Thread [Next in Thread]