* [PATCH v2] deb-dl-dir: Fallback to copying when import-export
@ 2023-02-06 12:19 Uladzimir Bely
0 siblings, 0 replies; only message in thread
From: Uladzimir Bely @ 2023-02-06 12:19 UTC (permalink / raw)
To: isar-users
By default, hardlinks are used when doing DL_DIR import and export.
This fails if DL_DIR's filesystem differs from TMPDIR's one.
Fallback to file copying (with lower performance and huge disk usage)
in this case.
Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
meta/classes/deb-dl-dir.bbclass | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
Changes since v1:
- Try create handrlink first and then copy if failed. It should better
handle hardlink issues that may happen even on the same partition.
diff --git a/meta/classes/deb-dl-dir.bbclass b/meta/classes/deb-dl-dir.bbclass
index 7db25251..4d5d4c9a 100644
--- a/meta/classes/deb-dl-dir.bbclass
+++ b/meta/classes/deb-dl-dir.bbclass
@@ -85,8 +85,11 @@ deb_dl_dir_import() {
set -e
printenv | grep -q BB_VERBOSE_LOGS && set -x
- sudo find "${pc}" -type f -iname "*\.deb" -exec \
- ln -Pf -t "${rootfs}"/var/cache/apt/archives/ {} +
+ find "${pc}" -type f -iname "*\.deb" |\
+ while read p; do
+ sudo ln -Pf -t "${rootfs}"/var/cache/apt/archives/ "$p" 2>/dev/null ||
+ sudo cp -n --no-preserve=owner -t "${rootfs}var/cache/apt/archives/" "$p"
+ done
'
}
@@ -109,7 +112,8 @@ deb_dl_dir_export() {
if [ -n "$package" ]; then
cmp --silent "$package" "$p" && continue
fi
- sudo ln -Pf "${p}" "${pc}"
+ sudo ln -Pf "${p}" "${pc}" 2>/dev/null ||
+ sudo cp -n "${p}" "${pc}"
done
sudo chown -R $(id -u):$(id -g) "${pc}"
'
--
2.20.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-06 12:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-06 12:19 [PATCH v2] deb-dl-dir: Fallback to copying when import-export Uladzimir Bely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox