All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-devel@nongnu.org, "Fam Zheng" <fam@euphon.net>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v1 04/14] archive-source.sh: Clone the submodules locally
Date: Wed, 30 Jan 2019 15:11:54 +0000	[thread overview]
Message-ID: <20190130151154.GS15904@redhat.com> (raw)
In-Reply-To: <20190125140017.6092-5-alex.bennee@linaro.org>

On Fri, Jan 25, 2019 at 02:00:07PM +0000, Alex Bennée wrote:
> From: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> We cloned the QEMU repository from the local storage. Since the
> submodules are also available there, clone them too. This is
> quicker and reduce network use.

FYI there's another attempt at solving it here:

  https://lists.gnu.org/archive/html/qemu-devel/2019-01/msg07710.html

though that has some problems, so I prefer what you've done
here.  There's still scope for replacing the git ls-tree + tar
command with a git archive command, but that's tangential to
the problem of reducing network usage.

> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  scripts/archive-source.sh | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
> index 6eed2a29bd..ce31be67b0 100755
> --- a/scripts/archive-source.sh
> +++ b/scripts/archive-source.sh
> @@ -38,6 +38,10 @@ else
>  fi
>  git clone --shared . "$vroot_dir"
>  test $? -ne 0 && error "failed to clone into '$vroot_dir'"
> +for sm in $submodules; do
> +    git clone --shared "$sm" "$vroot_dir/$sm"
> +    test $? -ne 0 && error "failed to clone submodule $sm"
> +done

I don't think this is reliable. Notice the message further up
where we define $submodules

  # We want a predictable list of submodules for builds, that is
  # independent of what the developer currently has initialized
  # in their checkout, because the build environment is completely
  # different to the host OS.


IOW, if the developers host build does not require 'dtc', then
the 'dtc' directory will be an empty directory, not a git
submodule checkout. At which point "git clone" has nothing
available.

Second, even if 'dtc' is checked out, we can't assume that
it is checked out at the right commit hash - 'git clone' will
match whatever is currently checked out.

So this needs to be wrapped

   if test -d "$sm/.git"
   then
       git clone --shared "$sm" "$vroot_dir/$sm"
       test $? -ne 0 && error "failed to clone submodule $sm"
   fi


>  
>  cd "$vroot_dir"
>  test $? -ne 0 && error "failed to change into '$vroot_dir'"
> @@ -45,11 +49,6 @@ test $? -ne 0 && error "failed to change into '$vroot_dir'"
>  git checkout $HEAD
>  test $? -ne 0 && error "failed to checkout $HEAD revision"
>  
> -for sm in $submodules; do
> -    git submodule update --init $sm
> -    test $? -ne 0 && error "failed to init submodule $sm"
> -done

This should not be deleted. It ensures that the checkout we
just cloned gets moved to the correct HEAD. It might still
use the network, but that is genuinely neccessary in some
cases. At least the network usage will be minimized if the
developers host already had an updated submodule set.

> -
>  if test -n "$submodules"; then
>      {
>          git ls-files || error "git ls-files failed"


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

  reply	other threads:[~2019-01-30 15:12 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 14:00 [Qemu-devel] [PATCH v1 00/14] testing/next (binfmt_misc, vm-build and BSD CI) Alex Bennée
2019-01-25 14:00 ` [Qemu-devel] [PATCH v1 01/14] .cirrus.yml: basic compile and test for FreeBSD Alex Bennée
2019-01-25 14:00 ` [Qemu-devel] [PATCH v1 02/14] travis: stop requesting libffi & gettext from homebrew Alex Bennée
2019-01-25 14:00 ` [Qemu-devel] [PATCH v1 03/14] MAINTAINERS: Add an entry for scripts/archive-source.sh Alex Bennée
2019-01-25 14:00 ` [Qemu-devel] [PATCH v1 04/14] archive-source.sh: Clone the submodules locally Alex Bennée
2019-01-30 15:11   ` Daniel P. Berrangé [this message]
2019-01-25 14:00 ` [Qemu-devel] [PATCH v1 05/14] docker: disable Xen on CentOS 7 Alex Bennée
2019-01-25 14:04   ` Paolo Bonzini
2019-01-25 15:26     ` Alex Bennée
2019-01-25 15:27       ` Paolo Bonzini
2019-01-25 14:00 ` [Qemu-devel] [PATCH v1 06/14] tests: make docker.py update use configured binfmt path Alex Bennée
2019-01-25 14:00 ` [Qemu-devel] [PATCH v1 07/14] tests: make docker.py check for persistent configs Alex Bennée
2019-01-25 14:00 ` [Qemu-devel] [PATCH v1 08/14] tests: docker.py be even smarter with persistent binfmt_misc Alex Bennée
2019-01-25 14:00 ` [Qemu-devel] [PATCH v1 09/14] tests: PEP8 cleanup of docker.py, mostly white space Alex Bennée
2019-01-25 14:00 ` [Qemu-devel] [PATCH v1 10/14] tests/vm: move images to $HOME/.cache/qemu-vm/images Alex Bennée
2019-01-25 14:00 ` [Qemu-devel] [PATCH v1 11/14] tests/vm: call make check directly for netbsd/freebsd/ubuntu.i386 Alex Bennée
2019-01-31 11:03   ` Philippe Mathieu-Daudé
2019-01-25 14:00 ` [Qemu-devel] [PATCH v1 12/14] tests/vm: add --build-target option Alex Bennée
2019-01-31 11:02   ` Philippe Mathieu-Daudé
2019-01-25 14:00 ` [Qemu-devel] [PATCH v1 13/14] tests/vm: expose BUILD_TARGET, TARGET_LIST and EXTRA_CONFIGURE_OPTS Alex Bennée
2019-01-31 11:03   ` Philippe Mathieu-Daudé
2019-01-25 14:00 ` [Qemu-devel] [PATCH v1 14/14] scripts/qemu.py: allow arches use KVM for their 32bit cousins Alex Bennée
2019-01-26  3:37   ` Eduardo Habkost
2019-01-26  7:37     ` Alex Bennée
2019-02-01  5:02 ` [Qemu-devel] [PATCH v1 00/14] testing/next (binfmt_misc, vm-build and BSD CI) no-reply

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=20190130151154.GS15904@redhat.com \
    --to=berrange@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=fam@euphon.net \
    --cc=philmd@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.