build_image: use --usepkg instead of --usepkgonly

We want build_image to honour the configuration in PORTDIR and only use
the latest stable version as known by portage and the overlays.

We get these semantics with --usepkg. We do not get them with --usepkgonly.
The one downside is that instead of failing when you forget to run
build_packages before build_image, build_image will try to build
packages from source.

From "man emerge":

       --usepkg[=n] (-k)
              Tells emerge to use binary packages (from $PKGDIR) if they
              are available, thus possibly avoiding some  time-consuming
              compiles.   This option is useful for CD installs; you can
              export PKGDIR=/mnt/cdrom/packages and then use this option
              to have emerge "pull" binary packages from the CD in order
              to satisfy dependencies.

       --usepkgonly[=n] (-K)
              Tells emerge to only use binary packages  (from  $PKGDIR).
              All  the  binary packages must be available at the time of
              dependency  calculation  or  emerge  will  simply   abort.
              Portage  does not use $PORTDIR when calculating dependency
              information so all masking information is ignored.

Change-Id: I267dad8992ac683d0ff4db0d0c72baba61ecbccf

Review URL: http://codereview.chromium.org/2874013
This commit is contained in:
Mandeep Singh Baines 2010-06-24 15:00:49 -07:00
parent 23761a3b61
commit 3dfa852743

View File

@ -250,7 +250,7 @@ update_dev_packages() {
# Install developer packages described in chromeos-dev. # Install developer packages described in chromeos-dev.
sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \ sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \
--root="${root_dev_dir}" --root-deps=rdeps \ --root="${root_dev_dir}" --root-deps=rdeps \
--usepkgonly chromeos-dev ${EMERGE_JOBS} --usepkg chromeos-dev ${EMERGE_JOBS}
# Re-run ldconfig to fix /etc/ldconfig.so.cache. # Re-run ldconfig to fix /etc/ldconfig.so.cache.
sudo /sbin/ldconfig -r "${ROOT_FS_DIR}" sudo /sbin/ldconfig -r "${ROOT_FS_DIR}"
@ -298,7 +298,7 @@ update_recovery_packages() {
-s "${STATEFUL_FS_DIR}" -s "${STATEFUL_FS_DIR}"
# Install recovery installer. # Install recovery installer.
sudo ${EMERGE_BOARD_CMD} --root=${ROOT_FS_DIR} --usepkgonly \ sudo ${EMERGE_BOARD_CMD} --root=${ROOT_FS_DIR} --usepkg \
--root-deps=rdeps --nodeps chromeos-recovery --root-deps=rdeps --nodeps chromeos-recovery
# Re-run ldconfig to fix /etc/ldconfig.so.cache. # Re-run ldconfig to fix /etc/ldconfig.so.cache.
@ -418,13 +418,13 @@ EOF
sudo mount --bind "${STATEFUL_FS_DIR}/var" "${ROOT_FS_DIR}/var" sudo mount --bind "${STATEFUL_FS_DIR}/var" "${ROOT_FS_DIR}/var"
sudo mkdir -p "${ROOT_FS_DIR}/dev" sudo mkdir -p "${ROOT_FS_DIR}/dev"
# We "emerge --root=${ROOT_FS_DIR} --root-deps=rdeps --usepkgonly" all of the # We "emerge --root=${ROOT_FS_DIR} --root-deps=rdeps --usepkg" all of the
# runtime packages for chrome os. This builds up a chrome os image from # runtime packages for chrome os. This builds up a chrome os image from
# binary packages with runtime dependencies only. We use INSTALL_MASK to # binary packages with runtime dependencies only. We use INSTALL_MASK to
# trim the image size as much as possible. # trim the image size as much as possible.
sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \ sudo INSTALL_MASK="${INSTALL_MASK}" ${EMERGE_BOARD_CMD} \
--root="${ROOT_FS_DIR}" --root-deps=rdeps \ --root="${ROOT_FS_DIR}" --root-deps=rdeps \
--usepkgonly chromeos ${EMERGE_JOBS} --usepkg chromeos ${EMERGE_JOBS}
# Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI # Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI
# BIOS). We only need this for x86, but it's simpler and safer to keep the # BIOS). We only need this for x86, but it's simpler and safer to keep the