All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, famz@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3] scripts: use git archive in archive-source
Date: Fri, 1 Feb 2019 07:27:52 +0100	[thread overview]
Message-ID: <20190201062752.h7zud3bqd7zhho4q@sirius.home.kraxel.org> (raw)
In-Reply-To: <b7995d51-0486-728e-05d9-7606064824c1@redhat.com>

  Hi,

> >  tar_file=$(realpath "$1")
> > -list_file="${tar_file}.list"
> > -vroot_dir="${tar_file}.vroot"
> > +sub_file=$(mktemp "${tar_file%.tar}.sub.XXXXXXXX.tar")
> > +sub_tdir=$(mktemp -d "${tar_file%.tar}.sub.XXXXXXXX")
> 
> mktemp is not specified by POSIX; and FreeBSD man pages for mktemp
> suggest that if you don't use XXXXXX as the suffix that you are not
> guaranteed correct behavior.  Are you sure this is portable enough?  Do
> you need both a temp file and dir, or can you create the file name of
> your choice inside a temp dir, where only the dir has to have a
> randomized name?

Yes, storing temp tar in the temp dir should work.

> > +	status="$(git submodule status "$sm")"
> > +	smhash="${status# }"
> > +	smhash="${smhash#+}"
> > +	smhash="${smhash#-}"
> 
> These three lines can be consolidated into one:
> smhash=${status#[ +-]}

Ah, cool.  Learned a new trick.

> > +		smdir="$sub_tdir/$sm"
> > +		smurl="$(git config -f .gitmodules submodule.${sm}.url)"
> > +		echo "NOTICE: using temporary clone for submodule $sm"
> > +		git clone "$smurl" "$smdir"
> > +		test $? -ne 0 && error "failed to clone submodule $sm"
> 
> I know we don't want to affect the developer's normal checkout, but is
> it worth storing the temporary clone in a specifically-named
> subdirectory of their checkout instead

Hmm, we could do "git submodule init + git archive + git submodule
deinit".  With git storing a bare repo in .git/modules/$submodule these
days (and not deleting it on deinit) that'll effectively cache things.
It's a (temporary) modification of the checkout though.

Alternatively we could clone to $HOME/.cache/$somewhere, similar to the
vm tests which store downloads (and soon vm images too) below
$HOME/.cache/qemu-vm/.

cheers,
  Gerd

  reply	other threads:[~2019-02-01  6:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-31 13:00 [Qemu-devel] [PATCH v3] scripts: use git archive in archive-source Gerd Hoffmann
2019-01-31 15:41 ` Eric Blake
2019-02-01  6:27   ` Gerd Hoffmann [this message]
2019-01-31 18:03 ` 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=20190201062752.h7zud3bqd7zhho4q@sirius.home.kraxel.org \
    --to=kraxel@redhat.com \
    --cc=eblake@redhat.com \
    --cc=famz@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.