qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [PATCH] git-submodule.sh: allow running in validate mode without previous update
Date: Tue, 20 Jun 2023 22:44:53 +0200	[thread overview]
Message-ID: <CABgObfa8kEiG22MAdsuhgpuWrzWq9yWMeRaFgvWA5x_eoROPUw@mail.gmail.com> (raw)
In-Reply-To: <d6a79a1d2159e0659cd0ed6ff545bf577c05bad3.camel@linux.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 2531 bytes --]

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"
>
>

[-- Attachment #2: Type: text/html, Size: 4580 bytes --]

  reply	other threads:[~2023-06-20 20:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-18 21:20 [PATCH] git-submodule.sh: allow running in validate mode without previous update Paolo Bonzini
2023-06-20 17:35 ` Nina Schoetterl-Glausch
2023-06-20 20:44   ` Paolo Bonzini [this message]
2023-06-21 14:07     ` Nina Schoetterl-Glausch
2023-06-21 14:20       ` Nina Schoetterl-Glausch
2023-06-22  9:50         ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABgObfa8kEiG22MAdsuhgpuWrzWq9yWMeRaFgvWA5x_eoROPUw@mail.gmail.com \
    --to=pbonzini@redhat.com \
    --cc=nsg@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).