Isolate scripts and files that are used only in build_image

A modest number of different scripts and files have a usage
restricted to build_image.  Move those files to build_library,
to prevent them accumulating unwanted clients.

BUG=chromium-os:17390
TEST=build_image
TEST=grep relevant sources for references to all the files

Change-Id: I3e9f6447ec34c09ea2d61f29ac343386a1e122b9
Reviewed-on: http://gerrit.chromium.org/gerrit/4762
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
This commit is contained in:
J. Richard Barnette 2011-07-26 14:36:52 -07:00 committed by Richard Barnette
parent 611d5b7b0a
commit f2206118f3
10 changed files with 45 additions and 129 deletions

View File

@ -99,7 +99,7 @@ fi
check_blacklist() {
info "Verifying that the base image does not contain a blacklisted package."
info "Generating list of packages for chromeos-base/chromeos."
local package_blacklist_file="${SCRIPTS_DIR}/chromeos_blacklist"
local package_blacklist_file="${BUILD_LIBRARY_DIR}/chromeos_blacklist"
if [ ! -e "${package_blacklist_file}" ]; then
warn "Missing blacklist file."
return
@ -236,7 +236,7 @@ emerge_to_image() {
}
# Check that the build root is sane.
"${SCRIPTS_DIR}/test_build_root" --root="${BOARD_ROOT}"
"${BUILD_LIBRARY_DIR}/test_build_root" --root="${BOARD_ROOT}"
# Freshen kernel with correct USE flags. This is a noop if we have
# the right kernel prebuilt. Factory install uses USE="initramfs".
@ -496,7 +496,7 @@ update_dev_packages() {
# building a factory install shim, as the INSTALL_MASK for it will make
# test_image fail.
if [ ${FLAGS_factory_install} -eq ${FLAGS_FALSE} ]; then
"${SCRIPTS_DIR}/test_image" \
"${BUILD_LIBRARY_DIR}/test_image" \
--root="${ROOT_FS_DIR}" \
--target="${ARCH}"
fi
@ -667,7 +667,7 @@ create_base_image() {
enable_rootfs_verification="--enable_rootfs_verification"
fi
${SCRIPTS_DIR}/create_legacy_bootloader_templates.sh \
${BUILD_LIBRARY_DIR}/create_legacy_bootloader_templates.sh \
--arch=${ARCH} \
--to="${ROOT_FS_DIR}"/boot \
--boot_args="${FLAGS_boot_args}" \
@ -676,7 +676,7 @@ create_base_image() {
# Don't test the factory install shim
if [ ${FLAGS_factory_install} -eq ${FLAGS_FALSE} ]; then
# Check that the image has been correctly created.
"${SCRIPTS_DIR}/test_image" \
"${BUILD_LIBRARY_DIR}/test_image" \
--root="${ROOT_FS_DIR}" \
--target="${ARCH}"
fi
@ -706,7 +706,7 @@ create_base_image() {
trap delete_prompt EXIT
# Create the GPT-formatted image.
${SCRIPTS_DIR}/build_gpt.sh \
${BUILD_LIBRARY_DIR}/build_gpt.sh \
--arch=${ARCH} \
--board=${FLAGS_board} \
--rootfs_partition_size=${FLAGS_rootfs_partition_size} \
@ -721,7 +721,7 @@ create_base_image() {
}
generate_au_zip () {
local lgenerateauzip="${SCRIPTS_DIR}/generate_au_zip.py"
local lgenerateauzip="${BUILD_LIBRARY_DIR}/generate_au_zip.py"
local largs="-o ${OUTPUT_DIR}"
test ! -d "${OUTPUT_DIR}" && mkdir -p "${OUTPUT_DIR}"
info "Running ${lgenerateauzip} ${largs} for generating AU updater zip file"

View File

@ -17,5 +17,6 @@ restart_in_chroot_if_needed "$@"
INSTALLER_ROOT=/usr/lib/installer
. "${INSTALLER_ROOT}/chromeos-common.sh" || exit 1
BUILD_LIBRARY_DIR=${SCRIPTS_DIR}/build_library
locate_gpt
get_default_board

View File

@ -1,40 +1,19 @@
#!/bin/bash
#
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# --- BEGIN COMMON.SH BOILERPLATE ---
# Load common CrOS utilities. Inside the chroot this file is installed in
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location.
find_common_sh() {
local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")"))
local path
SCRIPT_ROOT=$(readlink -f $(dirname "$0")/..)
. "${SCRIPT_ROOT}/common.sh" || exit 1
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
SCRIPT_ROOT=${path}
break
fi
done
}
# We're invoked only by build_image, which runs in the chroot
assert_inside_chroot
find_common_sh
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
# --- END COMMON.SH BOILERPLATE ---
INSTALLER_ROOT=/usr/lib/installer
. "${INSTALLER_ROOT}/chromeos-common.sh" || exit 1
# Load functions and constants for chromeos-install
[ -f /usr/lib/installer/chromeos-common.sh ] && \
INSTALLER_ROOT=/usr/lib/installer || \
INSTALLER_ROOT=$(dirname "$(readlink -f "$0")")
. "${INSTALLER_ROOT}/chromeos-common.sh" || \
die "Unable to load chromeos-common.sh"
# Script must be run inside the chroot.
restart_in_chroot_if_needed "$@"
BUILD_LIBRARY_DIR=${SCRIPTS_DIR}/build_library
get_default_board
@ -139,7 +118,7 @@ install_gpt $OUTDEV $(numsectors $ROOTFS_IMG) $(numsectors $STATEFUL_IMG) \
$PMBRCODE $(numsectors $ESP_IMG) false $FLAGS_rootfs_partition_size
# Emit helpful scripts for testers, etc.
${SCRIPTS_DIR}/emit_gpt_scripts.sh "${OUTDEV}" "${IMAGEDIR}"
${BUILD_LIBRARY_DIR}/emit_gpt_scripts.sh "${OUTDEV}" "${IMAGEDIR}"
sudo=
if [ ! -w "$OUTDEV" ] ; then

View File

@ -1,33 +1,17 @@
#!/bin/bash
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Helper script that generates the signed kernel image
# Helper script to generate GRUB bootloader configuration files for
# x86 platforms.
# --- BEGIN COMMON.SH BOILERPLATE ---
# Load common CrOS utilities. Inside the chroot this file is installed in
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location.
find_common_sh() {
local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")"))
local path
SCRIPT_ROOT=$(readlink -f $(dirname "$0")/..)
. "${SCRIPT_ROOT}/common.sh" || exit 1
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
SCRIPT_ROOT=${path}
break
fi
done
}
find_common_sh
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
# --- END COMMON.SH BOILERPLATE ---
get_default_board
# We're invoked only by build_image, which runs in the chroot
assert_inside_chroot
# Flags.
DEFINE_string arch "x86" \

View File

@ -1,37 +1,21 @@
#!/bin/bash
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Emit scripts to pack and unpack the partitions from a GPT disk image.
# --- BEGIN COMMON.SH BOILERPLATE ---
# Load common CrOS utilities. Inside the chroot this file is installed in
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location.
find_common_sh() {
local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")"))
local path
SCRIPT_ROOT=$(readlink -f $(dirname "$0")/..)
. "${SCRIPT_ROOT}/common.sh" || exit 1
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
SCRIPT_ROOT=${path}
break
fi
done
}
find_common_sh
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
# --- END COMMON.SH BOILERPLATE ---
# Need to be inside the chroot to load chromeos-common.sh
# We're invoked only by build_image, which runs in the chroot
assert_inside_chroot
# Load functions and constants for chromeos-install
. "/usr/lib/installer/chromeos-common.sh" || \
die "Unable to load /usr/lib/installer/chromeos-common.sh"
INSTALLER_ROOT=/usr/lib/installer
. "${INSTALLER_ROOT}/chromeos-common.sh" || exit 1
locate_gpt
set -e
@ -46,8 +30,6 @@ fi
PACK="${DIR}/pack_partitions.sh"
UNPACK="${DIR}/unpack_partitions.sh"
locate_gpt
TMP=$(mktemp)
$GPT show "$IMAGE" > $TMP

View File

@ -1,29 +1,14 @@
#!/bin/bash
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# --- BEGIN COMMON.SH BOILERPLATE ---
# Load common CrOS utilities. Inside the chroot this file is installed in
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location.
find_common_sh() {
local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")"))
local path
SCRIPT_ROOT=$(readlink -f $(dirname "$0")/..)
. "${SCRIPT_ROOT}/common.sh" || exit 1
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
SCRIPT_ROOT=${path}
break
fi
done
}
find_common_sh
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
# --- END COMMON.SH BOILERPLATE ---
# We're invoked only by build_image, which runs in the chroot
assert_inside_chroot
# Flags
DEFINE_string root "" \

View File

@ -1,29 +1,14 @@
#!/bin/bash
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# --- BEGIN COMMON.SH BOILERPLATE ---
# Load common CrOS utilities. Inside the chroot this file is installed in
# /usr/lib/crosutils. Outside the chroot we find it relative to the script's
# location.
find_common_sh() {
local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")"))
local path
SCRIPT_ROOT=$(readlink -f $(dirname "$0")/..)
. "${SCRIPT_ROOT}/common.sh" || exit 1
SCRIPT_ROOT=
for path in "${common_paths[@]}"; do
if [ -r "${path}/common.sh" ]; then
SCRIPT_ROOT=${path}
break
fi
done
}
find_common_sh
. "${SCRIPT_ROOT}/common.sh" || { echo "Unable to load common.sh"; exit 1; }
# --- END COMMON.SH BOILERPLATE ---
# We're invoked only by build_image, which runs in the chroot
assert_inside_chroot
# Flags
DEFINE_string target "x86" \
@ -75,7 +60,7 @@ done
LIBS="`sudo find $ROOT -type f -name '*.so*'`"
# Check that all .so files, plus the binaries, have the appropriate dependencies
if ! "${SCRIPTS_DIR}/check_deps" "$ROOT" $BINARIES $LIBS; then
if ! "${SCRIPTS_DIR}/build_library/check_deps" "$ROOT" $BINARIES $LIBS; then
echo test_image: Failed dependency check
EXITCODE=1
fi