Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <jacmet@uclibc.org>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 3/5] support/download: simplify the local-files helper
Date: Tue, 08 Jul 2014 10:49:47 +0200	[thread overview]
Message-ID: <874mys1bh0.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <bbb8dd812cfbb3025d3796494ce7304f16c6ab6a.1404681878.git.yann.morin.1998@free.fr> (Yann E. MORIN's message of "Sun, 6 Jul 2014 23:27:14 +0200")

>>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:

 > Currently, the local-files download helper behaves like all the other
 > download helpers, by first copying into the BUILD_DIR, then to
 > BR2_DL_DIR, and then rename the final file.

 > This does two copies, for the sake of using the LOCALFILES command.

 > Just get rid of the intermediate copy to BUILD_DIR. Instead, directly
 > copy to the final temp file and rename that.

 > This does a single copy, but we lose the file access mode, so we just
 > reinstate them (in case it's a self-extracting executable used in a
 > br2-external package, for example.)

 > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>


 > +++ b/support/download/cp
 > @@ -8,20 +8,19 @@ set -e
 >  #   $1: source file
 >  #   $2: output file
 >  # And this environment:
 > -#   LOCALFILES: the cp command to call
 > +#   (nothing special)
 
 >  source="${1}"
 >  output="${2}"
 
 > -tmp_dl="$( mktemp "${BUILD_DIR}/.XXXXXX" )"
 >  tmp_output="$( mktemp "${output}.XXXXXX" )"
 
 >  ret=1
 > -if ${LOCALFILES} "${source}" "${tmp_dl}"; then
 > -    if cat "${tmp_dl}" >"${tmp_output}"; then
 > -        mv "${tmp_output}" "${output}"
 > -        ret=0
 > -    fi
 > +if cat "${source}" >"${tmp_output}"; then
 > +    mode="$( stat -c '%a' "${source}" )"
 > +    chmod "${mode}" "${tmp_output}"
 > +    mv "${tmp_output}" "${output}"
 > +    ret=0

Similar to Arnouts comments, wouldn't cp -a be easier?


-- 
Bye, Peter Korsgaard

  reply	other threads:[~2014-07-08  8:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-06 21:27 [Buildroot] [PATCH 0/5] Cleanups in download helpers (branch yem/check-downloads) Yann E. MORIN
2014-07-06 21:27 ` [Buildroot] [PATCH 1/5] support/download: fix the bzr helper Yann E. MORIN
2014-07-07  5:54   ` Arnout Vandecappelle
2014-07-06 21:27 ` [Buildroot] [PATCH 2/5] support/download: properly use temp files Yann E. MORIN
2014-07-07  6:11   ` Arnout Vandecappelle
2014-07-07 21:38     ` Yann E. MORIN
2014-07-08 16:42       ` Arnout Vandecappelle
2014-07-08 21:52         ` Yann E. MORIN
2014-07-09  7:45       ` Thomas Petazzoni
2014-07-10 15:59         ` Yann E. MORIN
2014-07-06 21:27 ` [Buildroot] [PATCH 3/5] support/download: simplify the local-files helper Yann E. MORIN
2014-07-08  8:49   ` Peter Korsgaard [this message]
2014-07-06 21:27 ` [Buildroot] [PATCH 4/5] support/download: only create final temp file when needed Yann E. MORIN
2014-07-07 16:08   ` Arnout Vandecappelle
2014-07-07 21:53     ` Yann E. MORIN
2014-07-08 15:53       ` Arnout Vandecappelle
2014-07-06 21:27 ` [Buildroot] [PATCH 5/5] support/download: rationalise naming and use of the temporary files Yann E. MORIN
2014-07-06 21:40   ` Yann E. MORIN

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=874mys1bh0.fsf@dell.be.48ers.dk \
    --to=jacmet@uclibc.org \
    --cc=buildroot@busybox.net \
    /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