Check if dpkg supports the --force-unsafe-io option 81/197881/1
authorMichael Schroeder <mls@suse.de>
Mon, 22 Oct 2018 12:29:33 +0000 (14:29 +0200)
committerYonghee Han <onstudy@samsung.com>
Thu, 17 Jan 2019 01:41:00 +0000 (10:41 +0900)
Change-Id: I26459cc056eb5adbb4e0299ebd755542dd41b9eb

build-pkg-deb
build-recipe-debootstrap

index 539952f..bb937a9 100644 (file)
@@ -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
index 62ab7d5..c2fb263 100644 (file)
@@ -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