[Buildroot] [PATCH 1/1] package: make package download from Mercurial repositories more robust

Mathias De Maré mathias.demare at gmail.com
Wed Mar 5 10:33:23 UTC 2014


Hello Thomas,

On Wed, Mar 5, 2014 at 9:12 AM, Thomas De Schampheleire <
patrickdepinguin at gmail.com> wrote:

> Hi Mathias, Yann,
>
> On Wed, Mar 5, 2014 at 7:54 AM, Mathias De Maré
> <mathias.demare at gmail.com> wrote:
> > Previously, after cloning a Mercurial repository,
> > an interrupted 'hg archive' operation would leave behind a partial
> > archive. This caused future archive operations to fail.
> >
> > Signed-off-by: Mathias De Maré <mathias.demare at gmail.com>
> > ---
> >  package/pkg-download.mk | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/package/pkg-download.mk b/package/pkg-download.mk
> > index 85842de..6f53f53 100644
> > --- a/package/pkg-download.mk
> > +++ b/package/pkg-download.mk
> > @@ -176,13 +176,19 @@ define SHOW_EXTERNAL_DEPS_SCP
> >  endef
> >
> >
> > +# Download a file using Mercurial.
> > +# In case a previous clone failed, remove the directory.
> > +# To handle interrupted archive operations, use a temporary directory,
> > +# and remove this directory before archiving again.
> >  define DOWNLOAD_HG
> >         test -e $(DL_DIR)/$($(PKG)_SOURCE) || \
> >         (pushd $(DL_DIR) > /dev/null && \
> >         rm -rf $($(PKG)_BASE_NAME) && \
> >         $(HG) clone --noupdate --rev $($(PKG)_DL_VERSION) $($(PKG)_SITE)
> $($(PKG)_BASE_NAME) && \
> > +       rm -rf $(DL_DIR)/$($(PKG)_SOURCE).tmp && \
> >         $(HG) archive --repository $($(PKG)_BASE_NAME) --type tgz
> --prefix $($(PKG)_BASE_NAME)/ \
> > -                     --rev $($(PKG)_DL_VERSION)
> $(DL_DIR)/$($(PKG)_SOURCE) && \
> > +                       --rev $($(PKG)_DL_VERSION)
> $(DL_DIR)/$($(PKG)_SOURCE).tmp && \
> > +       mv $(DL_DIR)/$($(PKG)_SOURCE).tmp $(DL_DIR)/$($(PKG)_SOURCE) && \
> >         rm -rf $($(PKG)_DL_DIR) && \
> >         popd > /dev/null)
> >  endef
>
> When the operation is indeed interrupted, the tmp file will not be removed.
> For the wget helper, there is a line:
> ... ||  (rm -f $(DL_DIR)/$(2).tmp ; exit 1)
>
> that I believe should do exactly that. Could you check this?
>
This is correct, the wget helper apparently does the cleanup while running.
The change I've made to the Mercurial helper does the cleanup when starting
the next build. I don't really have a preference either way.

Greetings,
Mathias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20140305/fa67f12b/attachment-0002.html>


More information about the buildroot mailing list