From aa1a7fd63dcdffd8e20b7ea3d06f26b27aba12e8 Mon Sep 17 00:00:00 2001 From: Chris Sosa Date: Fri, 2 Apr 2010 14:06:29 -0700 Subject: [PATCH] Adds gmergefs. A method of remoting to a target and pushing new packages using emerge from the host Review URL: http://codereview.chromium.org/1515011 --- build_image | 4 ++-- common.sh | 28 ++++++++++++++++++++++++++++ enter_chroot.sh | 29 +++++++++++++++++++++++++++-- run_remote_tests.sh | 9 --------- 4 files changed, 57 insertions(+), 13 deletions(-) diff --git a/build_image b/build_image index b1f8fe6e84..66b66ed58f 100755 --- a/build_image +++ b/build_image @@ -237,8 +237,8 @@ sudo cp -a "${BOARD_ROOT}"/lib/libgcc_s.so* "${ROOT_FS_DIR}/lib" sudo cp -a "${BOARD_ROOT}"/usr/lib/libstdc++.so* "${ROOT_FS_DIR}/usr/lib" INSTALL_MASK="" -if [[ $FLAGS_installmask -eq $FLAGS_TRUE ]] ; then - INSTALL_MASK="/usr/include/ /usr/man /usr/share/man /usr/share/doc /usr/share/gtk-doc /usr/share/gtk-2.0 /usr/lib/gtk-2.0/include /usr/share/info /usr/share/aclocal /usr/lib/gcc /usr/lib/pkgconfig /usr/share/pkgconfig /usr/share/gettext /usr/share/readline /etc/runlevels /usr/share/openrc /lib/rc *.a *.la" +if [[ $FLAGS_installmask -eq $FLAGS_FALSE ]] ; then + INSTALL_MASK="$DEFAULT_INSTALL_MASK" fi if [[ $FLAGS_jobs -ne -1 ]]; then diff --git a/common.sh b/common.sh index e276215ae0..f75fa6b130 100644 --- a/common.sh +++ b/common.sh @@ -116,6 +116,13 @@ fi # Directory locations inside the dev chroot CHROOT_TRUNK_DIR="/home/$USER/trunk" +# Install make for portage ebuilds. Used by build_image and gmergefs. +DEFAULT_INSTALL_MASK="/usr/include/ /usr/man /usr/share/man /usr/share/doc \ + /usr/share/gtk-doc /usr/share/gtk-2.0 /usr/lib/gtk-2.0/include \ + /usr/share/info /usr/share/aclocal /usr/lib/gcc /usr/lib/pkgconfig \ + /usr/share/pkgconfig /usr/share/gettext /usr/share/readline /etc/runlevels \ + /usr/share/openrc /lib/rc *.a *.la" + # Check to ensure not running old scripts V_REVERSE='' V_VIDOFF='' @@ -295,3 +302,24 @@ function die { error "$1" exit 1 } + +# Retry an emerge command according to $FLAGS_retries +# The $EMERGE_JOBS flags will only be added the first time the command is run +function eretry () { + $* $EMERGE_JOBS && return 0 + local i= + for i in $(seq $FLAGS_retries); do + echo Retrying $* + $* && return 0 + done + return 1 +} + +# Removes single quotes around parameter +# Arguments: +# $1 - string which optionally has surrounding quotes +# Returns: +# None, but prints the string without quotes. +function remove_quotes() { + echo "$1" | sed -e "s/^'//; s/'$//" +} diff --git a/enter_chroot.sh b/enter_chroot.sh index 6ad51fa44c..a056dd445e 100755 --- a/enter_chroot.sh +++ b/enter_chroot.sh @@ -25,7 +25,8 @@ DEFINE_string build_number "" \ DEFINE_string chrome_root "" \ "The root of your chrome browser source. Should contain a 'src' subdir." -DEFINE_boolean official_build $FLAGS_FALSE "Set CHROMEOS_OFFICIAL=1 for release builds." +DEFINE_boolean official_build $FLAGS_FALSE \ + "Set CHROMEOS_OFFICIAL=1 for release builds." DEFINE_boolean mount $FLAGS_FALSE "Only set up mounts." DEFINE_boolean unmount $FLAGS_FALSE "Only tear down mounts." @@ -64,6 +65,8 @@ set -e INNER_CHROME_ROOT="/home/$USER/chrome_root" # inside chroot CHROME_ROOT_CONFIG="/var/cache/chrome_root" # inside chroot INNER_DEPOT_TOOLS_ROOT="/home/$USER/depot_tools" # inside chroot +KERNEL_MODULES_ROOT="/lib/modules/$( uname -r )" # inside and outside chroot +FUSE_DEVICE="/dev/fuse" sudo chmod 0777 "$FLAGS_chroot/var/lock" @@ -138,7 +141,29 @@ function setup_env { echo "This may impact chromium build." fi fi - fi + fi + + # Mount fuse device from host machine into chroot and copy over + # corresponding kernel modules. + MOUNTED_PATH="$(readlink -f "${FLAGS_chroot}${FUSE_DEVICE}")" + if [ -z "$(mount | grep -F "on ${MOUNTED_PATH} ")" ] + then + if [ -c "${FUSE_DEVICE}" ] ; then + echo "Mounting fuse device" + sudo touch "${MOUNTED_PATH}" + sudo mount --bind "${FUSE_DEVICE}" "${MOUNTED_PATH}" + INNER_MOD_PATH="$(readlink -f "${FLAGS_chroot}${KERNEL_MODULES_ROOT}")" + if [ ! -f "${INNER_MOD_PATH}/modules.dep" ] ; then + sudo mkdir -p "${INNER_MOD_PATH}/kernel/fs/fuse" + sudo cp -fu "${KERNEL_MODULES_ROOT}/modules.dep" "${INNER_MOD_PATH}" + sudo cp -fu "${KERNEL_MODULES_ROOT}/kernel/fs/fuse/fuse.ko" \ + "${INNER_MOD_PATH}/kernel/fs/fuse" + fi + else + echo "Warning: Fuse device not found. gmergefs will not work" + fi + fi + ) 200>>"$LOCKFILE" || die "setup_env failed" } diff --git a/run_remote_tests.sh b/run_remote_tests.sh index f6060c9555..6239137c15 100755 --- a/run_remote_tests.sh +++ b/run_remote_tests.sh @@ -79,15 +79,6 @@ function is_successful_test() { return 0 } -# Removes single quotes around parameter -# Arguments: -# $1 - string which optionally has surrounding quotes -# Returns: -# None, but prints the string without quotes. -function remove_quotes() { - echo "$1" | sed -e "s/^'//; s/'$//" -} - # Adds attributes to all tests run # Arguments: # $1 - results directory