* [PATCH] image: make sure do_rootfs_finalize can run multiple times
@ 2023-01-05 18:43 Henning Schild
2023-01-06 18:19 ` Henning Schild
0 siblings, 1 reply; 3+ messages in thread
From: Henning Schild @ 2023-01-05 18:43 UTC (permalink / raw)
To: isar-users; +Cc: Henning Schild
There have been several places that would not work twice in a row. All
the test && not covering || have been moved to if. The rm at the end
tried to remove a file that was just moved. And that mv would not work a
second time because its source would be gone.
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
meta/classes/image.bbclass | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 629a0c1daa55..125eba192a65 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -396,13 +396,16 @@ addtask deploy before do_build after do_image
do_rootfs_finalize() {
sudo -s <<'EOSUDO'
set -e
- test -e "${ROOTFSDIR}/chroot-setup.sh" && \
+
+ if [ -e "${ROOTFSDIR}/chroot-setup.sh" ]; then
"${ROOTFSDIR}/chroot-setup.sh" "cleanup" "${ROOTFSDIR}"
+ fi
rm -f "${ROOTFSDIR}/chroot-setup.sh"
- test ! -e "${ROOTFSDIR}/usr/share/doc/qemu-user-static" && \
+ if [ ! -e "${ROOTFSDIR}/usr/share/doc/qemu-user-static" ]; then
find "${ROOTFSDIR}/usr/bin" \
-maxdepth 1 -name 'qemu-*-static' -type f -delete
+ fi
mountpoint -q '${ROOTFSDIR}/isar-apt' && \
umount -l ${ROOTFSDIR}/isar-apt && \
@@ -424,10 +427,10 @@ do_rootfs_finalize() {
rm -f "${ROOTFSDIR}/etc/apt/sources.list.d/base-apt.list"
rm -f "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar"
- mv "${ROOTFSDIR}/etc/apt/sources-list" \
- "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list"
-
- rm -f "${ROOTFSDIR}/etc/apt/sources-list"
+ if [ -e "${ROOTFSDIR}/etc/apt/sources-list" ]; then
+ mv "${ROOTFSDIR}/etc/apt/sources-list" \
+ "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list"
+ fi
EOSUDO
}
addtask rootfs_finalize before do_rootfs after do_rootfs_postprocess
--
2.38.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] image: make sure do_rootfs_finalize can run multiple times
2023-01-05 18:43 [PATCH] image: make sure do_rootfs_finalize can run multiple times Henning Schild
@ 2023-01-06 18:19 ` Henning Schild
2023-01-07 2:27 ` Roberto A. Foglietta
0 siblings, 1 reply; 3+ messages in thread
From: Henning Schild @ 2023-01-06 18:19 UTC (permalink / raw)
To: isar-users; +Cc: Felix Moessbauer
Forget this let us take
[PATCH] fix rebuild of rootfs_finalize task
from Felix
It was a drive by mini change, and somehow now we have three people
sending patches ... this energy could be used so much better.
Henning
Am Thu, 5 Jan 2023 19:43:28 +0100
schrieb Henning Schild <henning.schild@siemens.com>:
> There have been several places that would not work twice in a row. All
> the test && not covering || have been moved to if. The rm at the end
> tried to remove a file that was just moved. And that mv would not
> work a second time because its source would be gone.
>
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
> meta/classes/image.bbclass | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 629a0c1daa55..125eba192a65 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -396,13 +396,16 @@ addtask deploy before do_build after do_image
> do_rootfs_finalize() {
> sudo -s <<'EOSUDO'
> set -e
> - test -e "${ROOTFSDIR}/chroot-setup.sh" && \
> +
> + if [ -e "${ROOTFSDIR}/chroot-setup.sh" ]; then
> "${ROOTFSDIR}/chroot-setup.sh" "cleanup" "${ROOTFSDIR}"
> + fi
> rm -f "${ROOTFSDIR}/chroot-setup.sh"
>
> - test ! -e "${ROOTFSDIR}/usr/share/doc/qemu-user-static" && \
> + if [ ! -e "${ROOTFSDIR}/usr/share/doc/qemu-user-static" ];
> then find "${ROOTFSDIR}/usr/bin" \
> -maxdepth 1 -name 'qemu-*-static' -type f -delete
> + fi
>
> mountpoint -q '${ROOTFSDIR}/isar-apt' && \
> umount -l ${ROOTFSDIR}/isar-apt && \
> @@ -424,10 +427,10 @@ do_rootfs_finalize() {
> rm -f "${ROOTFSDIR}/etc/apt/sources.list.d/base-apt.list"
> rm -f "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar"
>
> - mv "${ROOTFSDIR}/etc/apt/sources-list" \
> - "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list"
> -
> - rm -f "${ROOTFSDIR}/etc/apt/sources-list"
> + if [ -e "${ROOTFSDIR}/etc/apt/sources-list" ]; then
> + mv "${ROOTFSDIR}/etc/apt/sources-list" \
> + "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list"
> + fi
> EOSUDO
> }
> addtask rootfs_finalize before do_rootfs after do_rootfs_postprocess
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] image: make sure do_rootfs_finalize can run multiple times
2023-01-06 18:19 ` Henning Schild
@ 2023-01-07 2:27 ` Roberto A. Foglietta
0 siblings, 0 replies; 3+ messages in thread
From: Roberto A. Foglietta @ 2023-01-07 2:27 UTC (permalink / raw)
To: Henning Schild; +Cc: isar-users, Felix Moessbauer
On Fri, 6 Jan 2023 at 19:19, Henning Schild <henning.schild@siemens.com> wrote:
>
> Forget this let us take
>
> [PATCH] fix rebuild of rootfs_finalize task
>
> from Felix
>
> It was a drive by mini change, and somehow now we have three people
> sending patches ... this energy could be used so much better.
The
[PATCH v4] image: make sure do_rootfs_finalize can run multiple times, v4
might be worth a look, it uses -f and rationalise the code above plus
include the description provided by Felix.
Best regards, R-
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-07 2:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-05 18:43 [PATCH] image: make sure do_rootfs_finalize can run multiple times Henning Schild
2023-01-06 18:19 ` Henning Schild
2023-01-07 2:27 ` Roberto A. Foglietta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox