From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 01/13 v7] support/scripts: add helper to hardlink-or-copy
Date: Wed, 11 May 2016 23:23:46 +0200 [thread overview]
Message-ID: <20160511232346.2968e909@free-electrons.com> (raw)
In-Reply-To: <7c92d1e222419fef1422295dd3027ec4e205fca5.1462637351.git.yann.morin.1998@free.fr>
Hello,
On Sat, 7 May 2016 18:14:26 +0200, Yann E. MORIN wrote:
> When preparing the legal-info, the source archives are copied in the
> legal-info/ output directory. When the archives are big, it can take
> quite a bit of time and unnecessarily uses disk space. When the
> legal-info output directory is on the same filesystem as the BR2_DL_DIR,
> we can easily reduce copy time and disk usage by just using hardlins
> instead of copying. However, the BR2_DL_DIR may be on a different
> filesystem, so we must fallback to copying in this case
>
> Introduce a helper script that copies a source file into a destination
> directory, by first attempting to hard-link, and falling back to a
> plain copy in case the hardlink fails.
>
> In case the destination already exists, it is forcibly removed first, to
> avoid clobering any existing target file (and especially any hardlink to
> it), since cp -f does not remove the destination file, but clobbers it.
>
> In some situations, it will be necessary that the destination file is
> named differently than the source, so if a third argument is specified,
> it is treated as the basename of the destination file.
>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Luca Ceresoli <luca@lucaceresoli.net>
>
> ---
> Changes v6 -> v7:
> - more explicit variables (Arnout)
> - drop the variable with the helper path (Arnout)
> - use shell substitution instead of $(basename ...) (Arnout! ;- )
> - improve commit log to explain the 'rm -f'
> - split now-too-long line
Applied to next, thanks.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2016-05-11 21:23 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-07 16:14 [Buildroot] [PATCH 00/13 v7] legal-info improvements and completeness (branch yem/legal-4) Yann E. MORIN
2016-05-07 16:14 ` [Buildroot] [PATCH 01/13 v7] support/scripts: add helper to hardlink-or-copy Yann E. MORIN
2016-05-07 18:48 ` Arnout Vandecappelle
2016-05-11 21:23 ` Thomas Petazzoni [this message]
2016-05-07 16:14 ` [Buildroot] [PATCH 02/13 v7] core/legal-info: use the helper to install source archives Yann E. MORIN
2016-05-07 19:54 ` Arnout Vandecappelle
2016-05-11 21:24 ` Thomas Petazzoni
2016-05-07 16:14 ` [Buildroot] [PATCH 03/13 v7] core/pkg-generic: add variable to store the package rawname-version Yann E. MORIN
2016-05-11 21:29 ` Thomas Petazzoni
2016-05-07 16:14 ` [Buildroot] [PATCH 04/13 v7] core/legal-info: install source archives in their own sub-dir Yann E. MORIN
2016-05-11 21:40 ` Thomas Petazzoni
2016-05-07 16:14 ` [Buildroot] [PATCH 05/13 v7] core/legal-info: add package version to license directory Yann E. MORIN
2016-05-07 20:01 ` Arnout Vandecappelle
2016-05-11 21:43 ` Thomas Petazzoni
2016-05-13 20:11 ` Yann E. MORIN
2016-05-14 21:22 ` Arnout Vandecappelle
2016-05-15 9:49 ` Yann E. MORIN
2016-05-15 17:50 ` Yann E. MORIN
2016-05-16 21:31 ` Arnout Vandecappelle
2016-06-24 13:50 ` Thomas Petazzoni
2016-05-07 16:14 ` [Buildroot] [PATCH 06/13 v7] core/apply-patches: store full path of applied patches Yann E. MORIN
2016-05-07 20:09 ` Arnout Vandecappelle
2016-06-22 20:59 ` Yann E. MORIN
2016-06-24 14:02 ` Thomas Petazzoni
2016-05-07 16:14 ` [Buildroot] [PATCH 07/13 v7] support/apply-patches: bail-out on duplicate patch basenames Yann E. MORIN
2016-05-07 20:16 ` Arnout Vandecappelle
2016-06-22 21:01 ` Yann E. MORIN
2016-06-24 14:09 ` Thomas Petazzoni
2016-05-07 16:14 ` [Buildroot] [PATCH 08/13 v7] core/legal-info: also save patches Yann E. MORIN
2016-05-07 20:36 ` Arnout Vandecappelle
2016-06-22 21:03 ` Yann E. MORIN
2016-06-24 14:22 ` Thomas Petazzoni
2016-05-07 16:14 ` [Buildroot] [PATCH 09/13 v7] core/legal-info: also save extra downloads Yann E. MORIN
2016-05-07 20:42 ` Arnout Vandecappelle
2016-06-24 14:22 ` Thomas Petazzoni
2016-05-07 16:14 ` [Buildroot] [PATCH 10/13 v7] legal-info: explicitly state how patches are licensed Yann E. MORIN
2016-06-24 14:25 ` Thomas Petazzoni
2016-05-07 16:14 ` [Buildroot] [PATCH 11/13 v7] core/legal-info: generate a hash of all saved files Yann E. MORIN
2016-06-24 15:08 ` Thomas Petazzoni
2016-05-07 16:14 ` [Buildroot] [PATCH 12/13 v7] core/pkg-generic: reorder variables definitions for legal-info Yann E. MORIN
2016-06-24 15:10 ` Thomas Petazzoni
2016-05-07 16:14 ` [Buildroot] [PATCH 13/13 v7] core/legal-info: ensure legal-info works in off-line mode Yann E. MORIN
2016-06-24 15:11 ` Thomas Petazzoni
2016-06-22 21:12 ` [Buildroot] [PATCH 00/13 v7] legal-info improvements and completeness (branch yem/legal-4) Yann E. MORIN
2016-06-24 15:11 ` Thomas Petazzoni
2016-06-24 17:20 ` 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=20160511232346.2968e909@free-electrons.com \
--to=thomas.petazzoni@free-electrons.com \
--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