On Thu, 2023-06-22 at 11:52 +0200, Paolo Bonzini wrote:
> The call to git-submodule.sh done in configure may happen without a
> previous checkout of the roms/SLOF submodule, or even without a
> previous run of the script.
> 
> So, handle creating a .git-submodule-status file even in validate
> mode.  If git is absent, ensure that all passed directories exists
> (because you should be in a fresh untar and will not have stale
> arguments to git-submodule.sh) but do no other checks.  If git
> is present, ensure that .git-submodule-status contains an entry
> for all submodules passed on the command line.
> 
> With this change, "ignore" mode is not needed anymore.
> 
> Reported-by: Nina Schoetterl-Glausch <n...@linux.ibm.com>
> Fixes: b11f9bd96f4 ("configure: move SLOF submodule handling to 
> pc-bios/s390-ccw", 2023-06-06)

Reviewed-by: Nina Schoetterl-Glausch <n...@linux.ibm.com>
Tested-by: Nina Schoetterl-Glausch <n...@linux.ibm.com>

> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
> ---
>  configure                |  2 +-
>  scripts/git-submodule.sh | 73 ++++++++++++++++++++++------------------
>  2 files changed, 42 insertions(+), 33 deletions(-)

[...]

>  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 ! (set xyz "$module"/* && test -e "$2"); then

You could also do set -- "$module"/* and use $1, not that it matters.

> +            # The directory does not exist or it contains no files
> +            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