From fdc9250bca7bfce660758d77af2ffa971bc19ecb Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 4 Jan 2015 18:08:09 +0100 Subject: [PATCH] Changing package dependency checks within chroot to work outside as well. --- functions/packages.sh | 50 +++++++++++------------ scripts/build/.grep.swp | Bin 0 -> 4096 bytes scripts/build/binary_grub | 2 +- scripts/build/binary_grub2 | 2 +- scripts/build/binary_hdd | 14 +++---- scripts/build/binary_iso | 2 +- scripts/build/binary_loadlin | 2 +- scripts/build/binary_memtest | 4 +- scripts/build/binary_netboot | 2 +- scripts/build/binary_package-lists | 4 +- scripts/build/binary_rootfs | 6 +-- scripts/build/binary_syslinux | 6 +-- scripts/build/binary_win32-loader | 2 +- scripts/build/binary_zsync | 2 +- scripts/build/bootstrap_debootstrap | 2 +- scripts/build/chroot_archives | 2 +- scripts/build/chroot_package-lists | 2 +- scripts/build/chroot_preseed | 2 +- scripts/build/installer_debian-installer | 4 +- scripts/build/source_hdd | 4 +- scripts/build/source_iso | 2 +- 21 files changed, 57 insertions(+), 59 deletions(-) create mode 100644 scripts/build/.grep.swp diff --git a/functions/packages.sh b/functions/packages.sh index 4211c0eaa..ebbeb4aa8 100755 --- a/functions/packages.sh +++ b/functions/packages.sh @@ -10,10 +10,11 @@ Check_package () { - FILE="${1}" - PACKAGE="${2}" + CHROOT="${1}" + FILE="${2}" + PACKAGE="${3}" - Check_installed "${FILE}" "${PACKAGE}" + Check_installed "${CHROOT}" "${FILE}" "${PACKAGE}" case "${INSTALL_STATUS}" in 1) @@ -66,38 +67,35 @@ Remove_package () # 2 if package isn't installed and we aren't in an apt managed system Check_installed () { - FILE="${1}" - PACKAGE="${2}" + CHROOT="${1}" + FILE="${2}" + PACKAGE="${3}" - case "${LB_BUILD_WITH_CHROOT}" in - true) + if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] && [ "${CHROOT}" = "chroot" ] + then + if Chroot chroot "dpkg-query -s ${PACKAGE}" 2> /dev/null | grep -qs "Status: install" + then + INSTALL_STATUS=0 + else + INSTALL_STATUS=1 + fi + else + if which dpkg-query > /dev/null 2>&1 + then if Chroot chroot "dpkg-query -s ${PACKAGE}" 2> /dev/null | grep -qs "Status: install" then INSTALL_STATUS=0 else INSTALL_STATUS=1 fi - ;; - false) - if which dpkg-query > /dev/null 2>&1 + else + if [ ! -e "${FILE}" ] then - if Chroot chroot "dpkg-query -s ${PACKAGE}" 2> /dev/null | grep -qs "Status: install" - then - INSTALL_STATUS=0 - else - INSTALL_STATUS=1 - fi + INSTALL_STATUS=2 else - FILE="$(echo ${FILE} | sed -e 's|chroot||')" - - if [ ! -e "${FILE}" ] - then - INSTALL_STATUS=2 - else - INSTALL_STATUS=0 - fi + INSTALL_STATUS=0 fi - ;; - esac + fi + fi } diff --git a/scripts/build/.grep.swp b/scripts/build/.grep.swp new file mode 100644 index 0000000000000000000000000000000000000000..ccbb0c89572f0e8a8df0eea20e5024a39aaa176e GIT binary patch literal 4096 zcmYc?2=nw+FxN9-00IFJ0Re0385mL$^D /dev/null 2>&1 then - Check_package chroot/usr/bin/rsvg-convert librsvg2-bin + Check_package chroot /usr/bin/rsvg-convert librsvg2-bin fi ;; diff --git a/scripts/build/binary_win32-loader b/scripts/build/binary_win32-loader index 401144687..7855110f7 100755 --- a/scripts/build/binary_win32-loader +++ b/scripts/build/binary_win32-loader @@ -48,7 +48,7 @@ case "${LB_ARCHITECTURES}" in if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] then # Checking depends - Check_package chroot/usr/share/win32/win32-loader.exe win32-loader + Check_package chroot /usr/share/win32/win32-loader.exe win32-loader # Restoring cache Restore_cache cache/packages.binary diff --git a/scripts/build/binary_zsync b/scripts/build/binary_zsync index fd2fe01a7..efd703a65 100755 --- a/scripts/build/binary_zsync +++ b/scripts/build/binary_zsync @@ -49,7 +49,7 @@ Check_lockfile .lock Create_lockfile .lock # Checking depends -Check_package chroot/usr/bin/zsyncmake zsync +Check_package chroot /usr/bin/zsyncmake zsync # Restoring cache Restore_cache cache/packages.binary diff --git a/scripts/build/bootstrap_debootstrap b/scripts/build/bootstrap_debootstrap index 36b441e85..0863a7334 100755 --- a/scripts/build/bootstrap_debootstrap +++ b/scripts/build/bootstrap_debootstrap @@ -37,7 +37,7 @@ Check_crossarchitectures Echo_message "Begin bootstrapping system..." -Check_package /usr/sbin/debootstrap debootstrap +Check_package chroot bin/debootstrap debootstrap # Checking stage file Check_stagefile .build/bootstrap diff --git a/scripts/build/chroot_archives b/scripts/build/chroot_archives index 59f1b6318..0a66e2706 100755 --- a/scripts/build/chroot_archives +++ b/scripts/build/chroot_archives @@ -275,7 +275,7 @@ EOF fi # Check depends - Check_package chroot/usr/bin/apt-ftparchive apt-utils + Check_package chroot /usr/bin/apt-ftparchive apt-utils # Installing depends Install_package diff --git a/scripts/build/chroot_package-lists b/scripts/build/chroot_package-lists index 072343c8e..3ad1d7946 100755 --- a/scripts/build/chroot_package-lists +++ b/scripts/build/chroot_package-lists @@ -52,7 +52,7 @@ fi case "${LB_BUILD_WITH_CHROOT}" in true) # Checking depends - Check_package chroot/usr/bin/grep-aptavail dctrl-tools + Check_package chroot /usr/bin/grep-aptavail dctrl-tools # Restoring cache Restore_cache cache/packages.chroot diff --git a/scripts/build/chroot_preseed b/scripts/build/chroot_preseed index 4ef772957..7fd43cdf9 100755 --- a/scripts/build/chroot_preseed +++ b/scripts/build/chroot_preseed @@ -43,7 +43,7 @@ if ls config/preseed/*.cfg > /dev/null 2>&1 || \ ls chroot/root/packages.chroot.cfg > /dev/null 2>&1 then # Check dependency - Check_package chroot/usr/bin/debconf-set-selections debconf + Check_package chroot /usr/bin/debconf-set-selections debconf # Install dependency Install_package diff --git a/scripts/build/installer_debian-installer b/scripts/build/installer_debian-installer index 5146ede5b..0d4a3c0ba 100755 --- a/scripts/build/installer_debian-installer +++ b/scripts/build/installer_debian-installer @@ -64,8 +64,8 @@ Check_lockfile .lock Create_lockfile .lock # Checking depends -Check_package chroot/usr/bin/wget wget -Check_package chroot/usr/bin/apt-ftparchive apt-utils +Check_package chroot /usr/bin/wget wget +Check_package chroot /usr/bin/apt-ftparchive apt-utils # Restoring cache Restore_cache cache/packages.binary diff --git a/scripts/build/source_hdd b/scripts/build/source_hdd index 022c1e186..c932034cf 100755 --- a/scripts/build/source_hdd +++ b/scripts/build/source_hdd @@ -49,8 +49,8 @@ Check_lockfile .lock Create_lockfile .lock # Checking depends -Check_package chroot/sbin/mkdosfs dosfstools -Check_package chroot/sbin/parted parted +Check_package chroot /sbin/mkdosfs dosfstools +Check_package chroot /sbin/parted parted # Installing depends Install_package diff --git a/scripts/build/source_iso b/scripts/build/source_iso index 3896e00dd..8c6300c11 100755 --- a/scripts/build/source_iso +++ b/scripts/build/source_iso @@ -53,7 +53,7 @@ Check_lockfile .lock Create_lockfile .lock # Checking depends -Check_package chroot/usr/bin/xorriso xorriso +Check_package chroot /usr/bin/xorriso xorriso # Installing depends Install_package