Re: [PATCH] contrib: Cleanup downloaded archives in download_prerequisites

Даниил Гусев <[email protected]>
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
(Resending to the list - my previous reply went to Alexander only
   by mistake.)

Hi Alexander,

I'm not aware of any discussion behind dropping the cleanup step -
from what I can tell it was incidental.

download_prerequisites was introduced in 2010 (commit 69baf0a) and
explicitly removed the downloaded archives at the end:

    rm $MPFR.tar.bz2 $GMP.tar.bz2 $MPC.tar.gz || exit 1

That stayed in place for about three years.

In 2013, commit a8db599 ("download_prerequisites: Download isl and
cloog conditionally") dropped that line while adding conditional
isl/cloog handling. The commit message is entirely about making
isl/cloog optional and says nothing about archive cleanup, so the
removal looks like an unrelated side effect rather than a deliberate
change.

So my patch is restoring the 2010-2013 behavior rather than
introducing something new. --save-archives/--no-save-archives is
there for people who want to keep the archives around (offline
rebuilds etc).

Separately: I noticed my patch has the same weakness the current
script already has - if extraction fails partway through, the target
directory is left non-empty, and the next run (without --force) treats
it as already extracted and silently skips it. The extraction step
only checks `[ -e "${directory}/${package}" ]`, so this isn't
new, but it's worth fixing while we're touching this area:

    [ -e "${directory}/${package}" ]                                          \
        || ( cd "${directory}" && $uncompress <"${ar}" | tar -xf - )          \
        || { rm -rf "${directory:?}/${package}"; die "Cannot extract package from ${ar}"; }

Can fold this into v2 or send separately, whichever you prefer.

Daniil
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.