From 836a70aacc76c776ba9963a5f98302ae854b5f03 Mon Sep 17 00:00:00 2001 From: Andrew Jeddeloh Date: Fri, 20 Jul 2018 10:21:14 -0700 Subject: [PATCH 1/4] bin: remove dead symlinks --- bin/cros_au_test_harness | 1 - bin/cros_run_vm_test | 1 - bin/cros_run_vm_update | 1 - bin/ctest | 1 - 4 files changed, 4 deletions(-) delete mode 120000 bin/cros_au_test_harness delete mode 120000 bin/cros_run_vm_test delete mode 120000 bin/cros_run_vm_update delete mode 120000 bin/ctest diff --git a/bin/cros_au_test_harness b/bin/cros_au_test_harness deleted file mode 120000 index daa10b912c..0000000000 --- a/bin/cros_au_test_harness +++ /dev/null @@ -1 +0,0 @@ -../../platform/crostestutils/au_test_harness/cros_au_test_harness.py \ No newline at end of file diff --git a/bin/cros_run_vm_test b/bin/cros_run_vm_test deleted file mode 120000 index bafd171c3e..0000000000 --- a/bin/cros_run_vm_test +++ /dev/null @@ -1 +0,0 @@ -../../platform/crostestutils/cros_run_vm_test \ No newline at end of file diff --git a/bin/cros_run_vm_update b/bin/cros_run_vm_update deleted file mode 120000 index ba61312218..0000000000 --- a/bin/cros_run_vm_update +++ /dev/null @@ -1 +0,0 @@ -../../platform/crostestutils/cros_run_vm_update \ No newline at end of file diff --git a/bin/ctest b/bin/ctest deleted file mode 120000 index cb76d89795..0000000000 --- a/bin/ctest +++ /dev/null @@ -1 +0,0 @@ -../../platform/crostestutils/ctest/ctest.py \ No newline at end of file From 1718adb22ac2d6447052ee95f162cc92c58c948b Mon Sep 17 00:00:00 2001 From: Andrew Jeddeloh Date: Mon, 23 Jul 2018 16:34:48 -0700 Subject: [PATCH 2/4] *: remove dev image The dev image has been broken for some time. Some bits are left because the dev container (not broken) still uses them. They should be renamed. --- build_image | 21 ++------------------- build_library/dev_image_util.sh | 30 +----------------------------- build_library/disk_layout.json | 24 ------------------------ common.sh | 1 - image_to_vm.sh | 13 ++----------- lib/cros_vm_constants.sh | 1 - start_devserver | 17 ----------------- 7 files changed, 5 insertions(+), 102 deletions(-) delete mode 100755 start_devserver diff --git a/build_image b/build_image index 640a92f2b5..0ee30b30fa 100755 --- a/build_image +++ b/build_image @@ -31,7 +31,7 @@ DEFINE_boolean enable_rootfs_verification ${FLAGS_TRUE} \ DEFINE_string base_pkg "coreos-base/coreos" \ "The base portage package to base the build off of (only applies to prod images)" DEFINE_string base_dev_pkg "coreos-base/coreos-dev" \ - "The base portage package to base the build off of (only applies to dev images)" + "The base portage package to base the build off of (only applies to dev containers)" DEFINE_string torcx_manifest "${DEFAULT_BUILD_ROOT}/torcx/${DEFAULT_BOARD}/latest/torcx_manifest.json" \ "The torcx manifest describing torcx packages for this image (or blank for none)" DEFINE_string torcx_root "${DEFAULT_BUILD_ROOT}/torcx" \ @@ -57,12 +57,11 @@ This script is used to build a CoreOS image. CoreOS comes in many different forms. This scripts can be used to build the following: prod - Production image for CoreOS. This image is for booting. -dev - Developer image. Like base but with additional developer packages. container - Developer image with single filesystem, bootable by nspawn. Examples: -build_image --board= [dev] [prod] [container] - builds developer and production images. +build_image --board= [prod] [container] - builds developer and production images. ... " show_help_if_requested "$@" @@ -113,12 +112,10 @@ fi . "${BUILD_LIBRARY_DIR}/vm_image_util.sh" || exit 1 PROD_IMAGE=0 -DEV_IMAGE=0 CONTAINER=0 for arg in "$@"; do case "${arg}" in prod) PROD_IMAGE=1 ;; - dev) DEV_IMAGE=1 ;; container) CONTAINER=1 ;; *) die_notrace "Unknown image type ${arg}" ;; esac @@ -146,8 +143,6 @@ fi mkdir -p "${BUILD_DIR}" DISK_LAYOUT="${FLAGS_disk_layout:-base}" -DEV_DISK_LAYOUT="${FLAGS_disk_layout:-devel}" - CONTAINER_LAYOUT="${FLAGS_disk_layout:-container}" if [[ -n "${FLAGS_developer_data}" ]]; then @@ -169,14 +164,6 @@ fi fix_mtab -if [[ "${DEV_IMAGE}" -eq 1 ]]; then - IMAGE_BUILD_TYPE="dev" - create_dev_image ${COREOS_DEVELOPER_IMAGE_NAME} ${DEV_DISK_LAYOUT} ${FLAGS_group} ${FLAGS_base_dev_pkg} - if [[ ${FLAGS_extract_update} -eq ${FLAGS_TRUE} ]]; then - extract_update "${COREOS_DEVELOPER_IMAGE_NAME}" "${DEV_DISK_LAYOUT}" - fi -fi - if [[ "${CONTAINER}" -eq 1 ]]; then IMAGE_BUILD_TYPE="container" create_dev_image "${COREOS_DEVELOPER_CONTAINER_NAME}" "${CONTAINER_LAYOUT}" "${FLAGS_group}" ${FLAGS_base_dev_pkg} @@ -236,10 +223,6 @@ if [[ "${PROD_IMAGE}" -eq 1 ]]; then echo "CoreOS Production image created as ${COREOS_PRODUCTION_IMAGE_NAME}" print_image_to_vm fi -if [[ "${DEV_IMAGE}" -eq 1 ]]; then - echo "Developer image created as ${COREOS_DEVELOPER_IMAGE_NAME}" - print_image_to_vm dev -fi command_completed diff --git a/build_library/dev_image_util.sh b/build_library/dev_image_util.sh index ccc20d2b1a..536bd1ec27 100755 --- a/build_library/dev_image_util.sh +++ b/build_library/dev_image_util.sh @@ -54,38 +54,17 @@ EOF eselect profile set --force $(get_board_profile $BOARD)/dev } -detect_dev_url() { - local port=":8080" - local host=$(hostname --fqdn 2>/dev/null) - if [[ -z "${host}" ]]; then - host=$(ip addr show scope global | \ - awk '$1 == "inet" { sub(/[/].*/, "", $2); print $2; exit }') - fi - if [[ -n "${host}" ]]; then - echo "http://${host}${port}" - fi -} - create_dev_image() { local image_name=$1 local disk_layout=$2 local update_group=$3 local base_pkg="$4" - local devserver=$(detect_dev_url) - local auserver="" if [ -z "${base_pkg}" ]; then echo "did not get base package!" exit 1 fi - if [[ -n "${devserver}" ]]; then - info "Using ${devserver} for local dev server URL." - auserver="${devserver}/update" - else - info "Unable do detect local dev server address." - fi - info "Building developer image ${image_name}" local root_fs_dir="${BUILD_DIR}/rootfs" local image_contents="${image_name%.bin}_contents.txt" @@ -102,14 +81,7 @@ create_dev_image() { write_licenses "${root_fs_dir}" "${BUILD_DIR}/${image_licenses}" # Setup portage for emerge and gmerge - configure_dev_portage "${root_fs_dir}" "${devserver}" - - sudo_append "${root_fs_dir}/etc/coreos/update.conf" < Date: Mon, 23 Jul 2018 16:49:58 -0700 Subject: [PATCH 3/4] bin: remove dead scripts We don't use any of this and it doesn't work or does nothing. Remove it. --- bin/cros_start_vm | 1 - bin/cros_stop_vm | 1 - bin/cros_workon_make | 32 ---------------------- bin/proxy-gw | 63 -------------------------------------------- 4 files changed, 97 deletions(-) delete mode 120000 bin/cros_start_vm delete mode 120000 bin/cros_stop_vm delete mode 100755 bin/cros_workon_make delete mode 100755 bin/proxy-gw diff --git a/bin/cros_start_vm b/bin/cros_start_vm deleted file mode 120000 index c5a8a0ae6b..0000000000 --- a/bin/cros_start_vm +++ /dev/null @@ -1 +0,0 @@ -../../platform/dev/host/cros_start_vm \ No newline at end of file diff --git a/bin/cros_stop_vm b/bin/cros_stop_vm deleted file mode 120000 index ba70171957..0000000000 --- a/bin/cros_stop_vm +++ /dev/null @@ -1 +0,0 @@ -../../platform/dev/host/cros_stop_vm \ No newline at end of file diff --git a/bin/cros_workon_make b/bin/cros_workon_make deleted file mode 100755 index bf47de2627..0000000000 --- a/bin/cros_workon_make +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2010 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. -# -# Simple wrapper script to build a cros_workon package incrementally. -# You must already be cros_workon'ing the package in question. - -# --- 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=("$(dirname "$(readlink -f "$0")")/.." /usr/lib/crosutils) - local path - - SCRIPT_ROOT="${common_paths[0]}" - 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" || exit 1 -# --- END COMMON.SH BOILERPLATE --- - -die_notrace \ - "error: Please run cros_workon_make from chroot:/usr/bin/cros_workon_make" diff --git a/bin/proxy-gw b/bin/proxy-gw deleted file mode 100755 index 19fe3da6b8..0000000000 --- a/bin/proxy-gw +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -# Copyright (c) 2012 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. - -# $1 = hostname, $2 = port -# -# Use socat to connect to the specified host and port via one of the proxies -# defined in the environment, if the target host does not appear in the -# no_proxy environment variable. - -DEST_HOST="$1" -DEST_PORT="$2" - -# Determine whether the destination host is in the "no_proxy" list. -use_proxy="true" -GLOBIGNORE="*" -for a_host in ${no_proxy//,/ } ; do - case "${a_host}" in - "*") # A "*" matches all hosts. - use_proxy="false" - break - ;; - .*) # Items of the form ".some.fqdn" imply match-at-end. - if [[ "${DEST_HOST}" == *"${a_host}" ]]; then - use_proxy="false" - break - fi - ;; - ${DEST_HOST}) # Items of the form "some.fqdn" imply exact-match. - use_proxy="false" - break - ;; - esac -done - -if [[ -n "${all_proxy}" ]]; then - PROXY="${all_proxy}" - TYPE=SOCKS4 - PORT_ATTR=socksport -elif [[ -n "${https_proxy}" ]]; then - PROXY="${https_proxy}" - TYPE=PROXY - PORT_ATTR=proxyport -elif [[ -n "${http_proxy}" ]]; then - PROXY="${http_proxy}" - TYPE=PROXY - PORT_ATTR=proxyport -else - use_proxy="false" -fi - -if [[ "${use_proxy}" == "true" ]]; then - PROXY="${PROXY#*://}" - PROXY="${PROXY%%/*}" - PROXY_HOST="${PROXY%%:*}" - PROXY_PORT="${PROXY##*:}" - PARMS="${PROXY_HOST}:${DEST_HOST}:${DEST_PORT},${PORT_ATTR}=${PROXY_PORT}" - socat_args=( "${TYPE}:${PARMS}" ) -else - socat_args=( TCP:"${DEST_HOST}":"${DEST_PORT}" ) -fi -exec socat STDIO "${socat_args[@]}" From 16d5f052751636e7657f2f326d0bf3e56b1d55b0 Mon Sep 17 00:00:00 2001 From: Andrew Jeddeloh Date: Mon, 23 Jul 2018 17:06:51 -0700 Subject: [PATCH 4/4] build_image: rename dev_image to dev_container --- build_image | 4 ++-- build_library/{dev_image_util.sh => dev_container_util.sh} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename build_library/{dev_image_util.sh => dev_container_util.sh} (99%) diff --git a/build_image b/build_image index 0ee30b30fa..ca490b7bc1 100755 --- a/build_image +++ b/build_image @@ -106,7 +106,7 @@ fi . "${BUILD_LIBRARY_DIR}/board_options.sh" || exit 1 . "${BUILD_LIBRARY_DIR}/build_image_util.sh" || exit 1 . "${BUILD_LIBRARY_DIR}/prod_image_util.sh" || exit 1 -. "${BUILD_LIBRARY_DIR}/dev_image_util.sh" || exit 1 +. "${BUILD_LIBRARY_DIR}/dev_container_util.sh" || exit 1 . "${BUILD_LIBRARY_DIR}/test_image_content.sh" || exit 1 . "${BUILD_LIBRARY_DIR}/torcx_manifest.sh" || exit 1 . "${BUILD_LIBRARY_DIR}/vm_image_util.sh" || exit 1 @@ -166,7 +166,7 @@ fix_mtab if [[ "${CONTAINER}" -eq 1 ]]; then IMAGE_BUILD_TYPE="container" - create_dev_image "${COREOS_DEVELOPER_CONTAINER_NAME}" "${CONTAINER_LAYOUT}" "${FLAGS_group}" ${FLAGS_base_dev_pkg} + create_dev_container "${COREOS_DEVELOPER_CONTAINER_NAME}" "${CONTAINER_LAYOUT}" "${FLAGS_group}" ${FLAGS_base_dev_pkg} fi if [[ "${PROD_IMAGE}" -eq 1 ]]; then diff --git a/build_library/dev_image_util.sh b/build_library/dev_container_util.sh similarity index 99% rename from build_library/dev_image_util.sh rename to build_library/dev_container_util.sh index 536bd1ec27..8a48829a78 100755 --- a/build_library/dev_image_util.sh +++ b/build_library/dev_container_util.sh @@ -54,7 +54,7 @@ EOF eselect profile set --force $(get_board_profile $BOARD)/dev } -create_dev_image() { +create_dev_container() { local image_name=$1 local disk_layout=$2 local update_group=$3