From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH v2 3/6] isar-bootstrap: Use options for setup_root_file_system()
Date: Thu, 7 Jun 2018 16:30:56 +0200 [thread overview]
Message-ID: <5c44a2e334fff90e56936036108202a91e87a78a.1528381858.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1528381858.git.jan.kiszka@siemens.com>
In-Reply-To: <cover.1528381858.git.jan.kiszka@siemens.com>
From: Jan Kiszka <jan.kiszka@siemens.com>
Convert the clean/noclean control into an option --clean. We can expand
this pattern later on.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta-isar/recipes-core/images/isar-image-base.bb | 2 +-
meta/classes/isar-bootstrap-helper.bbclass | 15 +++++++++++----
meta/recipes-devtools/buildchroot/buildchroot.bb | 3 +--
3 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/meta-isar/recipes-core/images/isar-image-base.bb b/meta-isar/recipes-core/images/isar-image-base.bb
index f91dfb0..891f80a 100644
--- a/meta-isar/recipes-core/images/isar-image-base.bb
+++ b/meta-isar/recipes-core/images/isar-image-base.bb
@@ -28,7 +28,7 @@ do_rootfs[root_cleandirs] = "${IMAGE_ROOTFS} \
${IMAGE_ROOTFS}/isar-apt"
do_rootfs() {
- setup_root_file_system "${IMAGE_ROOTFS}" "clean" \
+ setup_root_file_system --clean "${IMAGE_ROOTFS}" \
${IMAGE_PREINSTALL} ${IMAGE_INSTALL}
# Configure root filesystem
diff --git a/meta/classes/isar-bootstrap-helper.bbclass b/meta/classes/isar-bootstrap-helper.bbclass
index a3f1686..91dfc1a 100644
--- a/meta/classes/isar-bootstrap-helper.bbclass
+++ b/meta/classes/isar-bootstrap-helper.bbclass
@@ -15,9 +15,16 @@ def reverse_bb_array(d, varname):
return " ".join(i for i in array)
setup_root_file_system() {
+ CLEAN=""
+ while true; do
+ case "$1" in
+ --clean) CLEAN=1 ;;
+ -*) bbfatal "$0: invalid option specified: $1" ;;
+ *) break ;;
+ esac
+ shift
+ done
ROOTFSDIR="$1"
- CLEAN="$2"
- shift
shift
PACKAGES="$@"
APT_ARGS="install --yes -o Debug::pkgProblemResolver=yes"
@@ -51,7 +58,7 @@ setup_root_file_system() {
sudo -E chroot "$ROOTFSDIR" \
/usr/bin/apt-get ${APT_ARGS} --download-only $PACKAGES \
${IMAGE_TRANSIENT_PACKAGES}
- [ "clean" = ${CLEAN} ] && sudo rm -f ${CLEAN_FILES}
+ [ ${CLEAN} ] && sudo rm -f ${CLEAN_FILES}
sudo -E chroot "$ROOTFSDIR" \
/usr/bin/apt-get ${APT_ARGS} $PACKAGES
for pkg in ${IMAGE_TRANSIENT_PACKAGES}; do
@@ -62,7 +69,7 @@ setup_root_file_system() {
sudo -E chroot "$ROOTFSDIR" \
/usr/bin/apt-get purge --yes $pkg
done
- if [ "clean" = ${CLEAN} ]; then
+ if [ ${CLEAN} ]; then
sudo -E chroot "$ROOTFSDIR" \
/usr/bin/apt-get autoremove --purge --yes
sudo -E chroot "$ROOTFSDIR" \
diff --git a/meta/recipes-devtools/buildchroot/buildchroot.bb b/meta/recipes-devtools/buildchroot/buildchroot.bb
index e405509..538c577 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot.bb
+++ b/meta/recipes-devtools/buildchroot/buildchroot.bb
@@ -69,8 +69,7 @@ do_build[root_cleandirs] = "${BUILDCHROOT_DIR} \
do_build[depends] = "isar-apt:do_cache_config isar-bootstrap:do_deploy"
do_build() {
- setup_root_file_system "${BUILDCHROOT_DIR}" "noclean" \
- ${BUILDCHROOT_PREINSTALL}
+ setup_root_file_system "${BUILDCHROOT_DIR}" ${BUILDCHROOT_PREINSTALL}
# Install package builder script
sudo chmod -R a+rw "${BUILDCHROOT_DIR}/home/builder"
--
2.13.7
next prev parent reply other threads:[~2018-06-07 14:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-07 14:30 [PATCH v2 0/6] Enable U-Boot-based images, add Banana Pi demo Jan Kiszka
2018-06-07 14:30 ` [PATCH v2 1/6] Add DISTRO and DISTRO_ARCH as OVERRIDES suffixes Jan Kiszka
2018-06-07 14:30 ` [PATCH v2 2/6] buildchroot: Break up wic build deps into common and arch-specific ones Jan Kiszka
2018-06-07 14:30 ` Jan Kiszka [this message]
2018-06-07 14:30 ` [PATCH v2 4/6] Set up target image fstab prior to installing any packages Jan Kiszka
2018-06-07 14:30 ` [PATCH v2 5/6] Add u-boot script generator Jan Kiszka
2018-06-07 14:30 ` [PATCH v2 6/6] Add Banana Pi SD-card image Jan Kiszka
2018-06-07 17:59 ` [PATCH v2 0/6] Enable U-Boot-based images, add Banana Pi demo Maxim Yu. Osipov
2018-06-11 5:38 ` Jan Kiszka
2018-06-08 18:10 ` Maxim Yu. Osipov
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=5c44a2e334fff90e56936036108202a91e87a78a.1528381858.git.jan.kiszka@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=isar-users@googlegroups.com \
/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