From: Michael Schroeder Date: Mon, 22 Oct 2018 12:29:33 +0000 (+0200) Subject: Check if dpkg supports the --force-unsafe-io option X-Git-Tag: submit/devel/20190730.074441~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=421bb4189e2bf598610eb0f662f81adc7813626a;p=tools%2Fbuild.git Check if dpkg supports the --force-unsafe-io option Change-Id: I26459cc056eb5adbb4e0299ebd755542dd41b9eb --- diff --git a/build-pkg-deb b/build-pkg-deb index 539952f..bb937a9 100644 --- a/build-pkg-deb +++ b/build-pkg-deb @@ -21,6 +21,8 @@ # ################################################################ +DEB_UNSAFE_IO= + # # A wrapper around chroot to set the environment correctly for dpkg and # pre/postinst scripts. @@ -58,15 +60,19 @@ pkg_initdb_deb() { rm -f "$BUILD_ROOT"/.init_b_cache/dpkg.deb cp "$BUILD_ROOT"/.init_b_cache/rpms/dpkg.deb "$BUILD_ROOT"/.init_b_cache/dpkg.deb || cleanup_and_exit 1 fi - deb_chroot "$BUILD_ROOT" dpkg --install --force-depends .init_b_cache/dpkg.deb >/dev/null 2>&1 + DEB_UNSAFE_IO= + chroot "$BUILD_ROOT" dpkg --force-unsafe-io --version >/dev/null 2>&1 && DEB_UNSAFE_IO="--force-unsafe-io" + deb_chroot "$BUILD_ROOT" dpkg --install $DEB_UNSAFE_IO --force-depends .init_b_cache/dpkg.deb >/dev/null 2>&1 } pkg_prepare_deb() { - : + # test if dpkg knows --force-unsafe-io + DEB_UNSAFE_IO= + chroot $BUILD_ROOT dpkg --force-unsafe-io --version >/dev/null 2>&1 && DEB_UNSAFE_IO="--force-unsafe-io" } pkg_install_deb() { - ( deb_chroot "$BUILD_ROOT" dpkg --install --force-depends .init_b_cache/$PKG.deb 2>&1 || touch "$BUILD_ROOT"/exit ) | \ + ( deb_chroot "$BUILD_ROOT" dpkg --install $DEB_UNSAFE_IO --force-depends .init_b_cache/$PKG.deb 2>&1 || touch "$BUILD_ROOT"/exit ) | \ perl -ne '$|=1;/^(Configuration file|Installing new config file|Selecting previously deselected|Selecting previously unselected|\(Reading database|Unpacking |Setting up|Creating config file|Preparing to replace dpkg|Preparing to unpack )/||/^$/||print' # ugly workaround for upstart system. some packages (procps) try # to start a service in their configure phase. As we don't have diff --git a/build-recipe-debootstrap b/build-recipe-debootstrap index 62ab7d5..c2fb263 100644 --- a/build-recipe-debootstrap +++ b/build-recipe-debootstrap @@ -45,6 +45,10 @@ recipe_build_debootstrap() { done FULL_PKG_LIST="${FULL_PKG_LIST#,}" rm -rf "$BUILD_ROOT/$myroot" + if chroot $BUILD_ROOT dpkg --force-unsafe-io --version >/dev/null 2>&1 ; then + mkdir -p "$BUILD_ROOT/$myroot/etc/dpkg/dpkg.cfg.d" + echo force-unsafe-io > "$BUILD_ROOT/$myroot/etc/dpkg/dpkg.cfg.d/force-unsafe-io" + fi set -- chroot $BUILD_ROOT debootstrap --keep-debootstrap-dir --no-check-gpg --variant=buildd --arch="${arch}" --include="$FULL_PKG_LIST" "$dist" "$myroot" file:///.build.binaries echo "running debootstrap..." if ! "$@" || ! chroot $BUILD_ROOT dpkg --configure -a; then