* [PATCH 0/2] Various bug fixes @ 2018-08-10 10:31 Maxim Yu. Osipov 2018-08-10 10:31 ` [PATCH 1/2] isar-bootstrap: Fix gpg error file name too long Maxim Yu. Osipov 2018-08-10 10:31 ` [PATCH 2/2] isar-bootstrap: exit if command fails under flock Maxim Yu. Osipov 0 siblings, 2 replies; 8+ messages in thread From: Maxim Yu. Osipov @ 2018-08-10 10:31 UTC (permalink / raw) To: isar-users Hello everybody, This series contains fixes for bugs discovered during CI server migration to Debian 9.x (stretch). * The first patch fixes the bug when home directory path name was too long for 'gpg'. * The second patch fixes the bug discovered when qemu-user-static package (containing qemu-debootstrap) was not installed by occasion, which leaded to wrong behaviour: ===== /workspace/build/isar_mosipov_next/24/build/tmp/work/debian-stretch-amd64/isar-bootstrap-target/temp$ cat log.do_bootstrap DEBUG: Executing shell function do_bootstrap sudo: qemu-debootstrap: command not found <snip> sed: can't read /workspace/build/isar_mosipov_next/24/build/tmp/work/debian-stretch-amd64/isar-bootstrap-target/rootfs/etc/locale.gen: No such file or directory chroot: failed to run command ‘/usr/sbin/locale-gen’: No such file or directory '/workspace/build/isar_mosipov_next/24/build/tmp/work/debian-stretch-amd64/isar-bootstrap-target/chroot-setup.sh' -> '/workspace/build/isar_mosipov_next/24/build/tmp/work/debian-stretch-amd64/isar-bootstrap-target/rootfs/chroot-setup.sh' Target '/workspace/build/isar_mosipov_next/24/build/tmp/work/debian-stretch-amd64/isar-bootstrap-target/rootfs' does not exist or does contain required directories <snip> mount: mount point /workspace/build/isar_mosipov_next/24/build/tmp/work/debian-stretch-amd64/isar-bootstrap-target/rootfs/dev does not exist mount: mount point /workspace/build/isar_mosipov_next/24/build/tmp/work/debian-stretch-amd64/isar-bootstrap-target/rootfs/proc does not exist chroot: failed to run command ‘/usr/bin/apt-get’: No such file or directory chroot: failed to run command ‘/usr/bin/apt-get’: No such file or directory DEBUG: Shell function do_bootstrap finished ==== Kind regards, Maxim. Maxim Yu. Osipov (2): isar-bootstrap: Fix gpg error file name too long isar-bootstrap: exit if command fails under flock .../recipes-core/isar-bootstrap/isar-bootstrap.inc | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) -- 2.11.0 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] isar-bootstrap: Fix gpg error file name too long 2018-08-10 10:31 [PATCH 0/2] Various bug fixes Maxim Yu. Osipov @ 2018-08-10 10:31 ` Maxim Yu. Osipov 2018-08-13 8:16 ` Henning Schild 2018-08-27 22:07 ` Maxim Yu. Osipov 2018-08-10 10:31 ` [PATCH 2/2] isar-bootstrap: exit if command fails under flock Maxim Yu. Osipov 1 sibling, 2 replies; 8+ messages in thread From: Maxim Yu. Osipov @ 2018-08-10 10:31 UTC (permalink / raw) To: isar-users Change homedir to DL_DIR to workaround gpg failure "File name too long". Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de> --- meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc index 8afd470..5c90713 100644 --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc @@ -138,13 +138,13 @@ def get_distro_components_argument(d, is_host): else: return "" -do_generate_keyring[dirs] = "${WORKDIR}" +do_generate_keyring[dirs] = "${DL_DIR}" do_generate_keyring[vardeps] += "DISTRO_APT_KEYS" do_generate_keyring() { if [ -n "${@d.getVar("APTKEYFILES", True) or ""}" ]; then for keyfile in ${@d.getVar("APTKEYFILES", True)}; do gpg --no-default-keyring --keyring "${APTKEYRING}" \ - --homedir "${WORKDIR}" --import "$keyfile" + --homedir "${DL_DIR}" --import "$keyfile" done fi } -- 2.11.0 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] isar-bootstrap: Fix gpg error file name too long 2018-08-10 10:31 ` [PATCH 1/2] isar-bootstrap: Fix gpg error file name too long Maxim Yu. Osipov @ 2018-08-13 8:16 ` Henning Schild 2018-08-27 22:07 ` Maxim Yu. Osipov 1 sibling, 0 replies; 8+ messages in thread From: Henning Schild @ 2018-08-13 8:16 UTC (permalink / raw) To: Maxim Yu. Osipov; +Cc: isar-users Am Fri, 10 Aug 2018 12:31:49 +0200 schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>: > Change homedir to DL_DIR to workaround gpg failure "File name too > long". > > Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de> > --- > meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc index > 8afd470..5c90713 100644 --- > a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc +++ > b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc @@ -138,13 > +138,13 @@ def get_distro_components_argument(d, is_host): else: > return "" > > -do_generate_keyring[dirs] = "${WORKDIR}" > +do_generate_keyring[dirs] = "${DL_DIR}" > do_generate_keyring[vardeps] += "DISTRO_APT_KEYS" > do_generate_keyring() { > if [ -n "${@d.getVar("APTKEYFILES", True) or ""}" ]; then > for keyfile in ${@d.getVar("APTKEYFILES", True)}; do > gpg --no-default-keyring --keyring "${APTKEYRING}" \ > - --homedir "${WORKDIR}" --import "$keyfile" > + --homedir "${DL_DIR}" --import "$keyfile" > done > fi > } I would suggest "${TMPDIR}/gnupg" instead. Files that we keep in there are not downloaded, so DL_DIR seems incorrect. Henning ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] isar-bootstrap: Fix gpg error file name too long 2018-08-10 10:31 ` [PATCH 1/2] isar-bootstrap: Fix gpg error file name too long Maxim Yu. Osipov 2018-08-13 8:16 ` Henning Schild @ 2018-08-27 22:07 ` Maxim Yu. Osipov 1 sibling, 0 replies; 8+ messages in thread From: Maxim Yu. Osipov @ 2018-08-27 22:07 UTC (permalink / raw) To: isar-users On 08/10/2018 01:31 PM, Maxim Yu. Osipov wrote: > Change homedir to DL_DIR to workaround gpg failure "File name too long". Applied to the 'next'. > Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de> > --- > meta/recipes-core/isar-bootstrap/isar-bootstrap.inc | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > index 8afd470..5c90713 100644 > --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > @@ -138,13 +138,13 @@ def get_distro_components_argument(d, is_host): > else: > return "" > > -do_generate_keyring[dirs] = "${WORKDIR}" > +do_generate_keyring[dirs] = "${DL_DIR}" > do_generate_keyring[vardeps] += "DISTRO_APT_KEYS" > do_generate_keyring() { > if [ -n "${@d.getVar("APTKEYFILES", True) or ""}" ]; then > for keyfile in ${@d.getVar("APTKEYFILES", True)}; do > gpg --no-default-keyring --keyring "${APTKEYRING}" \ > - --homedir "${WORKDIR}" --import "$keyfile" > + --homedir "${DL_DIR}" --import "$keyfile" > done > fi > } > -- Maxim Osipov ilbers GmbH Maria-Merian-Str. 8 85521 Ottobrunn Germany +49 (151) 6517 6917 mosipov@ilbers.de http://ilbers.de/ Commercial register Munich, HRB 214197 General Manager: Baurzhan Ismagulov ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] isar-bootstrap: exit if command fails under flock 2018-08-10 10:31 [PATCH 0/2] Various bug fixes Maxim Yu. Osipov 2018-08-10 10:31 ` [PATCH 1/2] isar-bootstrap: Fix gpg error file name too long Maxim Yu. Osipov @ 2018-08-10 10:31 ` Maxim Yu. Osipov 2018-08-11 15:52 ` Jan Kiszka 1 sibling, 1 reply; 8+ messages in thread From: Maxim Yu. Osipov @ 2018-08-10 10:31 UTC (permalink / raw) To: isar-users If command under 'flock' fails, isar_bootstrap continues to execute. This is wrong behaviour, which leads that the do_bootstrap task is considered successfully done. Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de> --- .../recipes-core/isar-bootstrap/isar-bootstrap.inc | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc index 5c90713..60e5d10 100644 --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc @@ -187,7 +187,7 @@ isar_bootstrap() { ${DEBOOTSTRAP_KEYRING} \ "${@get_distro_suite(d, True)}" \ "${ROOTFSDIR}" \ - "${@get_distro_source(d, True)}" + "${@get_distro_source(d, True)}" || exit 1 else sudo -E "${DEBOOTSTRAP}" --verbose \ @@ -198,45 +198,45 @@ isar_bootstrap() { ${DEBOOTSTRAP_KEYRING} \ "${@get_distro_suite(d, False)}" \ "${ROOTFSDIR}" \ - "${@get_distro_source(d, False)}" + "${@get_distro_source(d, False)}" || exit 1 fi # Install apt config sudo mkdir -p "${ROOTFSDIR}/etc/apt/preferences.d" sudo install -v -m644 "${APTPREFS}" \ - "${ROOTFSDIR}/etc/apt/preferences.d/bootstrap" + "${ROOTFSDIR}/etc/apt/preferences.d/bootstrap" || exit 1 sudo mkdir -p "${ROOTFSDIR}/etc/apt/sources.list.d" sudo install -v -m644 "${APTSRCS}" \ - "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list" + "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list" || exit 1 sudo rm -f "${ROOTFSDIR}/etc/apt/sources.list" sudo mkdir -p "${ROOTFSDIR}/etc/apt/apt.conf.d" sudo install -v -m644 "${WORKDIR}/isar-apt.conf" \ - "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar.conf" + "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar.conf" || exit 1 if [ "${@get_distro_suite(d, True)}" = "stretch" ] && [ "${@get_host_release().split('.')[0]}" -lt "4" ]; then sudo install -v -m644 "${WORKDIR}/isar-apt-fallback.conf" \ - "${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf" + "${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf" || exit 1 fi # Set locale - sudo install -v -m644 "${WORKDIR}/locale" "${ROOTFSDIR}/etc/locale" + sudo install -v -m644 "${WORKDIR}/locale" "${ROOTFSDIR}/etc/locale" || exit 1 sudo sed -i '/en_US.UTF-8 UTF-8/s/^#//g' "${ROOTFSDIR}/etc/locale.gen" - sudo -E chroot "${ROOTFSDIR}" /usr/sbin/locale-gen + sudo -E chroot "${ROOTFSDIR}" /usr/sbin/locale-gen || exit 1 # setup chroot - sudo install -v -m755 "${WORKDIR}/chroot-setup.sh" "${ROOTFSDIR}/chroot-setup.sh" - sudo "${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}" + sudo install -v -m755 "${WORKDIR}/chroot-setup.sh" "${ROOTFSDIR}/chroot-setup.sh" || exit 1 + sudo "${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}" || exit 1 # update APT - sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${ROOTFSDIR}/dev - sudo mount -t proc none ${ROOTFSDIR}/proc + sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${ROOTFSDIR}/dev || exit 1 + sudo mount -t proc none ${ROOTFSDIR}/proc || exit 1 E="${@bb.utils.export_proxies(d)}" export DEBIAN_FRONTEND=noninteractive - sudo -E chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y + sudo -E chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y || exit 1 sudo -E chroot "${ROOTFSDIR}" /usr/bin/apt-get dist-upgrade -y \ - -o Debug::pkgProblemResolver=yes + -o Debug::pkgProblemResolver=yes || exit 1 # Finalize debootstrap by setting the link in deploy ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_ISAR_BOOTSTRAP}" -- 2.11.0 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] isar-bootstrap: exit if command fails under flock 2018-08-10 10:31 ` [PATCH 2/2] isar-bootstrap: exit if command fails under flock Maxim Yu. Osipov @ 2018-08-11 15:52 ` Jan Kiszka 2018-08-12 8:46 ` Maxim Yu. Osipov 0 siblings, 1 reply; 8+ messages in thread From: Jan Kiszka @ 2018-08-11 15:52 UTC (permalink / raw) To: Maxim Yu. Osipov, isar-users On 2018-08-10 12:31, Maxim Yu. Osipov wrote: > If command under 'flock' fails, isar_bootstrap continues to execute. > This is wrong behaviour, which leads that the do_bootstrap task is > considered successfully done. > > Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de> > --- > .../recipes-core/isar-bootstrap/isar-bootstrap.inc | 28 +++++++++++----------- > 1 file changed, 14 insertions(+), 14 deletions(-) > > diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > index 5c90713..60e5d10 100644 > --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > @@ -187,7 +187,7 @@ isar_bootstrap() { > ${DEBOOTSTRAP_KEYRING} \ > "${@get_distro_suite(d, True)}" \ > "${ROOTFSDIR}" \ > - "${@get_distro_source(d, True)}" > + "${@get_distro_source(d, True)}" || exit 1 > > else > sudo -E "${DEBOOTSTRAP}" --verbose \ > @@ -198,45 +198,45 @@ isar_bootstrap() { > ${DEBOOTSTRAP_KEYRING} \ > "${@get_distro_suite(d, False)}" \ > "${ROOTFSDIR}" \ > - "${@get_distro_source(d, False)}" > + "${@get_distro_source(d, False)}" || exit 1 > fi > > # Install apt config > sudo mkdir -p "${ROOTFSDIR}/etc/apt/preferences.d" > sudo install -v -m644 "${APTPREFS}" \ > - "${ROOTFSDIR}/etc/apt/preferences.d/bootstrap" > + "${ROOTFSDIR}/etc/apt/preferences.d/bootstrap" || exit 1 > sudo mkdir -p "${ROOTFSDIR}/etc/apt/sources.list.d" > sudo install -v -m644 "${APTSRCS}" \ > - "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list" > + "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list" || exit 1 > sudo rm -f "${ROOTFSDIR}/etc/apt/sources.list" > sudo mkdir -p "${ROOTFSDIR}/etc/apt/apt.conf.d" > sudo install -v -m644 "${WORKDIR}/isar-apt.conf" \ > - "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar.conf" > + "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar.conf" || exit 1 > > if [ "${@get_distro_suite(d, True)}" = "stretch" ] && [ "${@get_host_release().split('.')[0]}" -lt "4" ]; then > sudo install -v -m644 "${WORKDIR}/isar-apt-fallback.conf" \ > - "${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf" > + "${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf" || exit 1 > fi > > # Set locale > - sudo install -v -m644 "${WORKDIR}/locale" "${ROOTFSDIR}/etc/locale" > + sudo install -v -m644 "${WORKDIR}/locale" "${ROOTFSDIR}/etc/locale" || exit 1 > > sudo sed -i '/en_US.UTF-8 UTF-8/s/^#//g' "${ROOTFSDIR}/etc/locale.gen" > - sudo -E chroot "${ROOTFSDIR}" /usr/sbin/locale-gen > + sudo -E chroot "${ROOTFSDIR}" /usr/sbin/locale-gen || exit 1 > > # setup chroot > - sudo install -v -m755 "${WORKDIR}/chroot-setup.sh" "${ROOTFSDIR}/chroot-setup.sh" > - sudo "${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}" > + sudo install -v -m755 "${WORKDIR}/chroot-setup.sh" "${ROOTFSDIR}/chroot-setup.sh" || exit 1 > + sudo "${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}" || exit 1 > > # update APT > - sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${ROOTFSDIR}/dev > - sudo mount -t proc none ${ROOTFSDIR}/proc > + sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs ${ROOTFSDIR}/dev || exit 1 > + sudo mount -t proc none ${ROOTFSDIR}/proc || exit 1 > > E="${@bb.utils.export_proxies(d)}" > export DEBIAN_FRONTEND=noninteractive > - sudo -E chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y > + sudo -E chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y || exit 1 > sudo -E chroot "${ROOTFSDIR}" /usr/bin/apt-get dist-upgrade -y \ > - -o Debug::pkgProblemResolver=yes > + -o Debug::pkgProblemResolver=yes || exit 1 > > # Finalize debootstrap by setting the link in deploy > ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_ISAR_BOOTSTRAP}" > This is a bit ugly and leaves out a number of commands. Why can't we do "set -e" inside that section? Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] isar-bootstrap: exit if command fails under flock 2018-08-11 15:52 ` Jan Kiszka @ 2018-08-12 8:46 ` Maxim Yu. Osipov 2018-08-13 8:34 ` Henning Schild 0 siblings, 1 reply; 8+ messages in thread From: Maxim Yu. Osipov @ 2018-08-12 8:46 UTC (permalink / raw) To: Jan Kiszka, isar-users Hi Jan, On 08/11/2018 06:52 PM, Jan Kiszka wrote: > On 2018-08-10 12:31, Maxim Yu. Osipov wrote: >> If command under 'flock' fails, isar_bootstrap continues to execute. >> This is wrong behaviour, which leads that the do_bootstrap task is >> considered successfully done. >> >> Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de> >> --- >> .../recipes-core/isar-bootstrap/isar-bootstrap.inc | 28 >> +++++++++++----------- >> 1 file changed, 14 insertions(+), 14 deletions(-) >> >> diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc >> b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc >> index 5c90713..60e5d10 100644 >> --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc >> +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc >> @@ -187,7 +187,7 @@ isar_bootstrap() { >> ${DEBOOTSTRAP_KEYRING} \ >> "${@get_distro_suite(d, >> True)}" \ >> "${ROOTFSDIR}" \ >> - "${@get_distro_source(d, >> True)}" >> + "${@get_distro_source(d, >> True)}" || exit 1 >> else >> sudo -E "${DEBOOTSTRAP}" --verbose \ >> @@ -198,45 +198,45 @@ isar_bootstrap() { >> ${DEBOOTSTRAP_KEYRING} \ >> "${@get_distro_suite(d, >> False)}" \ >> "${ROOTFSDIR}" \ >> - "${@get_distro_source(d, >> False)}" >> + "${@get_distro_source(d, >> False)}" || exit 1 >> fi >> # Install apt config >> sudo mkdir -p "${ROOTFSDIR}/etc/apt/preferences.d" >> sudo install -v -m644 "${APTPREFS}" \ >> - >> "${ROOTFSDIR}/etc/apt/preferences.d/bootstrap" >> + >> "${ROOTFSDIR}/etc/apt/preferences.d/bootstrap" || exit 1 >> sudo mkdir -p "${ROOTFSDIR}/etc/apt/sources.list.d" >> sudo install -v -m644 "${APTSRCS}" \ >> - >> "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list" >> + >> "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list" || exit 1 >> sudo rm -f "${ROOTFSDIR}/etc/apt/sources.list" >> sudo mkdir -p "${ROOTFSDIR}/etc/apt/apt.conf.d" >> sudo install -v -m644 "${WORKDIR}/isar-apt.conf" \ >> - >> "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar.conf" >> + >> "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar.conf" || exit 1 >> if [ "${@get_distro_suite(d, True)}" = "stretch" ] && [ >> "${@get_host_release().split('.')[0]}" -lt "4" ]; then >> sudo install -v -m644 >> "${WORKDIR}/isar-apt-fallback.conf" \ >> - >> "${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf" >> + >> "${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf" || exit 1 >> fi >> # Set locale >> - sudo install -v -m644 "${WORKDIR}/locale" >> "${ROOTFSDIR}/etc/locale" >> + sudo install -v -m644 "${WORKDIR}/locale" >> "${ROOTFSDIR}/etc/locale" || exit 1 >> sudo sed -i '/en_US.UTF-8 UTF-8/s/^#//g' >> "${ROOTFSDIR}/etc/locale.gen" >> - sudo -E chroot "${ROOTFSDIR}" /usr/sbin/locale-gen >> + sudo -E chroot "${ROOTFSDIR}" /usr/sbin/locale-gen || exit 1 >> # setup chroot >> - sudo install -v -m755 "${WORKDIR}/chroot-setup.sh" >> "${ROOTFSDIR}/chroot-setup.sh" >> - sudo "${ROOTFSDIR}/chroot-setup.sh" "setup" "${ROOTFSDIR}" >> + sudo install -v -m755 "${WORKDIR}/chroot-setup.sh" >> "${ROOTFSDIR}/chroot-setup.sh" || exit 1 >> + sudo "${ROOTFSDIR}/chroot-setup.sh" "setup" >> "${ROOTFSDIR}" || exit 1 >> # update APT >> - sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs >> ${ROOTFSDIR}/dev >> - sudo mount -t proc none ${ROOTFSDIR}/proc >> + sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs >> ${ROOTFSDIR}/dev || exit 1 >> + sudo mount -t proc none ${ROOTFSDIR}/proc || exit 1 >> E="${@bb.utils.export_proxies(d)}" >> export DEBIAN_FRONTEND=noninteractive >> - sudo -E chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y >> + sudo -E chroot "${ROOTFSDIR}" /usr/bin/apt-get update -y >> || exit 1 >> sudo -E chroot "${ROOTFSDIR}" /usr/bin/apt-get >> dist-upgrade -y \ >> - -o Debug::pkgProblemResolver=yes >> + -o >> Debug::pkgProblemResolver=yes || exit 1 >> # Finalize debootstrap by setting the link in deploy >> ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_ISAR_BOOTSTRAP}" >> > > This is a bit ugly and leaves out a number of commands. Why can't we do > "set -e" inside that section? Actually, 'set -e' is put automatically in corresponding run.do_bootstrap script but it doesn't work for flock case. Maxim. -- Maxim Osipov ilbers GmbH Maria-Merian-Str. 8 85521 Ottobrunn Germany +49 (151) 6517 6917 mosipov@ilbers.de http://ilbers.de/ Commercial register Munich, HRB 214197 General Manager: Baurzhan Ismagulov ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] isar-bootstrap: exit if command fails under flock 2018-08-12 8:46 ` Maxim Yu. Osipov @ 2018-08-13 8:34 ` Henning Schild 0 siblings, 0 replies; 8+ messages in thread From: Henning Schild @ 2018-08-13 8:34 UTC (permalink / raw) To: Maxim Yu. Osipov; +Cc: Jan Kiszka, isar-users Am Sun, 12 Aug 2018 11:46:30 +0300 schrieb "Maxim Yu. Osipov" <mosipov@ilbers.de>: > Hi Jan, > > On 08/11/2018 06:52 PM, Jan Kiszka wrote: > > On 2018-08-10 12:31, Maxim Yu. Osipov wrote: > >> If command under 'flock' fails, isar_bootstrap continues to > >> execute. This is wrong behaviour, which leads that the > >> do_bootstrap task is considered successfully done. > >> > >> Signed-off-by: Maxim Yu. Osipov <mosipov@ilbers.de> > >> --- > >> .../recipes-core/isar-bootstrap/isar-bootstrap.inc | 28 > >> +++++++++++----------- > >> 1 file changed, 14 insertions(+), 14 deletions(-) > >> > >> diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > >> b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > >> index 5c90713..60e5d10 100644 > >> --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > >> +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc > >> @@ -187,7 +187,7 @@ isar_bootstrap() { > >> ${DEBOOTSTRAP_KEYRING} \ > >> "${@get_distro_suite(d, > >> True)}" \ > >> "${ROOTFSDIR}" \ > >> - "${@get_distro_source(d, > >> True)}" > >> + "${@get_distro_source(d, > >> True)}" || exit 1 > >> else > >> sudo -E "${DEBOOTSTRAP}" --verbose \ > >> @@ -198,45 +198,45 @@ isar_bootstrap() { > >> ${DEBOOTSTRAP_KEYRING} > >> \ "${@get_distro_suite(d, > >> False)}" \ > >> "${ROOTFSDIR}" \ > >> - "${@get_distro_source(d, > >> False)}" > >> + "${@get_distro_source(d, > >> False)}" || exit 1 > >> fi > >> # Install apt config > >> sudo mkdir -p "${ROOTFSDIR}/etc/apt/preferences.d" > >> sudo install -v -m644 "${APTPREFS}" \ > >> - > >> "${ROOTFSDIR}/etc/apt/preferences.d/bootstrap" > >> + > >> "${ROOTFSDIR}/etc/apt/preferences.d/bootstrap" || exit 1 > >> sudo mkdir -p "${ROOTFSDIR}/etc/apt/sources.list.d" > >> sudo install -v -m644 "${APTSRCS}" \ > >> - > >> "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list" > >> + > >> "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list" || exit 1 > >> sudo rm -f "${ROOTFSDIR}/etc/apt/sources.list" > >> sudo mkdir -p "${ROOTFSDIR}/etc/apt/apt.conf.d" > >> sudo install -v -m644 "${WORKDIR}/isar-apt.conf" \ > >> - > >> "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar.conf" > >> + > >> "${ROOTFSDIR}/etc/apt/apt.conf.d/50isar.conf" || exit 1 > >> if [ "${@get_distro_suite(d, True)}" = "stretch" ] > >> && [ "${@get_host_release().split('.')[0]}" -lt "4" ]; then > >> sudo install -v -m644 > >> "${WORKDIR}/isar-apt-fallback.conf" \ > >> - > >> "${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf" > >> + > >> "${ROOTFSDIR}/etc/apt/apt.conf.d/55isar-fallback.conf" || exit 1 > >> fi > >> # Set locale > >> - sudo install -v -m644 "${WORKDIR}/locale" > >> "${ROOTFSDIR}/etc/locale" > >> + sudo install -v -m644 "${WORKDIR}/locale" > >> "${ROOTFSDIR}/etc/locale" || exit 1 > >> sudo sed -i '/en_US.UTF-8 UTF-8/s/^#//g' > >> "${ROOTFSDIR}/etc/locale.gen" > >> - sudo -E chroot "${ROOTFSDIR}" /usr/sbin/locale-gen > >> + sudo -E chroot "${ROOTFSDIR}" /usr/sbin/locale-gen || > >> exit 1 # setup chroot > >> - sudo install -v -m755 "${WORKDIR}/chroot-setup.sh" > >> "${ROOTFSDIR}/chroot-setup.sh" > >> - sudo "${ROOTFSDIR}/chroot-setup.sh" "setup" > >> "${ROOTFSDIR}" > >> + sudo install -v -m755 "${WORKDIR}/chroot-setup.sh" > >> "${ROOTFSDIR}/chroot-setup.sh" || exit 1 > >> + sudo "${ROOTFSDIR}/chroot-setup.sh" "setup" > >> "${ROOTFSDIR}" || exit 1 > >> # update APT > >> - sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs > >> ${ROOTFSDIR}/dev > >> - sudo mount -t proc none ${ROOTFSDIR}/proc > >> + sudo mount -t devtmpfs -o mode=0755,nosuid devtmpfs > >> ${ROOTFSDIR}/dev || exit 1 > >> + sudo mount -t proc none ${ROOTFSDIR}/proc || exit 1 > >> E="${@bb.utils.export_proxies(d)}" > >> export DEBIAN_FRONTEND=noninteractive > >> - sudo -E chroot "${ROOTFSDIR}" /usr/bin/apt-get update > >> -y > >> + sudo -E chroot "${ROOTFSDIR}" /usr/bin/apt-get update > >> -y || exit 1 > >> sudo -E chroot "${ROOTFSDIR}" /usr/bin/apt-get > >> dist-upgrade -y \ > >> - -o > >> Debug::pkgProblemResolver=yes > >> + -o > >> Debug::pkgProblemResolver=yes || exit 1 > >> # Finalize debootstrap by setting the link in deploy > >> ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_ISAR_BOOTSTRAP}" > >> > > > > This is a bit ugly and leaves out a number of commands. Why can't > > we do "set -e" inside that section? > > Actually, 'set -e' is put automatically in corresponding > run.do_bootstrap script but it doesn't work for flock case. The problem is that all these steps are "the command" for flock. That is pretty ugly to begin with. If one needs to do that, all those commands should be chained with &&. What would be nicer would be a bitbake lock for isar_bootstrap or the two "do_bootstrap" calls and get rid of the flock. Your patch fails to deal with all the errors the other commands could trigger. And i wonder why we need sudo inside "sudo flock". (commit ab0a1c8c) Henning > Maxim. > ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-08-27 22:07 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-08-10 10:31 [PATCH 0/2] Various bug fixes Maxim Yu. Osipov 2018-08-10 10:31 ` [PATCH 1/2] isar-bootstrap: Fix gpg error file name too long Maxim Yu. Osipov 2018-08-13 8:16 ` Henning Schild 2018-08-27 22:07 ` Maxim Yu. Osipov 2018-08-10 10:31 ` [PATCH 2/2] isar-bootstrap: exit if command fails under flock Maxim Yu. Osipov 2018-08-11 15:52 ` Jan Kiszka 2018-08-12 8:46 ` Maxim Yu. Osipov 2018-08-13 8:34 ` Henning Schild
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox