From 7237f473fb227c7c0318e28aaa390792db096144 Mon Sep 17 00:00:00 2001 From: tedbo Date: Wed, 20 Jan 2010 10:34:33 -0800 Subject: [PATCH] Add --with_dev_pkgs option to build_image.sh to pull in developer debug packages. This defaults to TRUE when building an image. This CL moves some developer-only packages from package-list-prod.txt to package-list-debug.txt and adds support for a comma-separated list of package lists to build_image.sh. Actually, I'd like to rename package-list-dev.txt to package-list-build.txt and package-list-debug.txt to package-list-dev.txt but maybe in another CL. Also there is a patch from lool that we should grab some stuff from that can filter the package lists by build architecture. Eventually we will likely add target-specific package lists as well. With this change, build_image.sh --nowith_dev_pkgs will build an image that does not contain niceties such as xterm. Review URL: http://codereview.chromium.org/549107 --- build_image.sh | 9 +++++++-- install_packages.sh | 16 +++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/build_image.sh b/build_image.sh index 34567223aa..5762ce35fc 100755 --- a/build_image.sh +++ b/build_image.sh @@ -37,6 +37,8 @@ DEFINE_string mirror "$DEFAULT_EXT_MIRROR" "Repository mirror to use." DEFINE_string suite "$DEFAULT_IMG_SUITE" "Repository suite to base image on." DEFINE_string pkglist "$DEFAULT_PKGLIST" \ "Name of file listing packages to install from repository." +DEFINE_boolean with_dev_pkgs $FLAGS_TRUE \ + "Include additional developer-friendly packages in the image." # Parse command line FLAGS "$@" || exit 1 @@ -117,12 +119,15 @@ sudo tune2fs -L "$DISK_LABEL" -U "$UUID" -c 0 -i 0 "$LOOP_DEV" sudo mount "$LOOP_DEV" "$ROOT_FS_DIR" # -- Install packages and customize root file system. -- - +PKGLIST="$FLAGS_pkglist" +if [ $FLAGS_with_dev_pkglist -eq $FLAGS_TRUE ]; then + PKGLIST="$PKGLIST,${SRC_ROOT}/package_repo/package-list-debug.txt" +fi "${SCRIPTS_DIR}/install_packages.sh" \ --build_root="${FLAGS_build_root}" \ --root="$ROOT_FS_DIR" \ --output_dir="${OUTPUT_DIR}" \ - --package_list="$FLAGS_pkglist" \ + --package_list="$PKGLIST" \ --server="$FLAGS_mirror" \ --suite="$FLAGS_suite" diff --git a/install_packages.sh b/install_packages.sh index 39e2f8d67b..1f5f06ed3f 100755 --- a/install_packages.sh +++ b/install_packages.sh @@ -29,7 +29,7 @@ DEFINE_string arch "x86" \ DEFINE_string build_root "$DEFAULT_BUILD_ROOT" \ "Root of build output" DEFINE_string package_list "$DEFAULT_PKGLIST" \ - "The package list file to use." + "Comma separated set of package-list files to use." DEFINE_string server "$DEFAULT_EXT_MIRROR" \ "The package server to use." DEFINE_string suite "$DEFAULT_IMG_SUITE" \ @@ -213,10 +213,16 @@ sudo ln -sf /bin/true "${ROOT_FS_DIR}/usr/sbin/update-rc.d" sudo mount -t proc proc "${ROOT_FS_DIR}/proc" trap cleanup_rootfs_mounts EXIT -# Install prod packages -COMPONENTS=`cat $FLAGS_package_list | sed -e 's/#.*//' | grep -v '^ *$' | sed '/$/{N;s/\n/ /;}'` -sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive \ - apt-get --force-yes install $COMPONENTS +# Install packages from the given package-lists +PACKAGE_LISTS=$(echo "$FLAGS_package_list" | sed -e 's/,/ /g') +for p in $PACKAGE_LISTS; do + COMPONENTS=$(cat "$p" | \ + sed -e 's/#.*//' | \ + grep -v '^ *$' | \ + sed '/$/{N;s/\n/ /;}') + sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive \ + apt-get --force-yes install $COMPONENTS +done # Create kernel installation configuration to suppress warnings, # install the kernel in /boot, and manage symlinks.