From 26c2e935c1b1fa05775e61f231bc4bfa6713960b Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Fri, 14 Jun 2024 16:49:03 +0100 Subject: [PATCH] Drop cros-workon.eclass and replace with git-r3.eclass The cros_workon tool has been replaced with a simpler flatcar_workon tool based around git-r3. Signed-off-by: James Le Cuirot --- bash_completion | 115 +---- build_library/build_image_util.sh | 9 +- build_packages | 16 +- cros_workon | 420 ------------------ flatcar_workon | 172 +++++++ .../app-admin/locksmith/locksmith-9999.ebuild | 8 +- .../app-admin/mayday/mayday-9999.ebuild | 8 +- .../sdnotify-proxy/sdnotify-proxy-9999.ebuild | 12 +- .../app-admin/toolbox/toolbox-9999.ebuild | 8 +- .../updateservicectl-9999.ebuild | 8 +- .../afterburn/afterburn-9999.ebuild | 10 +- .../coreos-cloudinit-9999.ebuild | 8 +- .../coreos-init/coreos-init-9999.ebuild | 8 +- .../emerge-gitclone-9999.ebuild | 9 +- .../nova-agent-watcher-9999.ebuild | 8 +- .../coreos-base/ue-rs/ue-rs-9999.ebuild | 10 +- .../update-ssh-keys-9999.ebuild | 10 +- .../update_engine/update_engine-9999.ebuild | 7 +- .../coreos/config/.bash_profile | 1 - .../coreos-overlay/eclass/cros-workon.eclass | 185 -------- .../profiles/coreos/base/make.defaults | 6 +- .../baselayout/baselayout-9999.ebuild | 8 +- .../sys-apps/ignition/ignition-9999.ebuild | 8 +- .../seismograph/seismograph-9999.ebuild | 7 +- .../bootengine/bootengine-9999.ebuild | 9 +- .../nss-usrfiles/nss-usrfiles-9999.ebuild | 8 +- setup_board | 9 +- update_chroot | 16 +- workon/.gitignore | 1 + 29 files changed, 269 insertions(+), 835 deletions(-) delete mode 100755 cros_workon create mode 100755 flatcar_workon delete mode 100644 sdk_container/src/third_party/coreos-overlay/eclass/cros-workon.eclass create mode 100644 workon/.gitignore diff --git a/bash_completion b/bash_completion index be99b65e68..cbfd8f723c 100644 --- a/bash_completion +++ b/bash_completion @@ -106,124 +106,28 @@ _autotest_complete() { _complete_board_sysroot_flag && return 0 } -# Complete cros_workon's argument. +# Complete flatcar_workon's argument. # # TODO(petkov): We should probably extract the list of commands from -# cros_workon --help, just like we do for flags (see _flag_complete). +# flatcar_workon --help, just like we do for flags (see _flag_complete). # # TODO(petkov): Currently, this assumes that the command is the first # argument. In practice, the command is the first non-flag # argument. I.e., this should be fixed to support something like -# "cros_workon --all list". -_complete_cros_workon_command() { +# "flatcar_workon --all list". +_complete_flatcar_workon_command() { [ ${COMP_CWORD} -eq 1 ] || return 1 local command="${COMP_WORDS[1]}" - COMPREPLY=($(compgen -W "start stop list iterate" -- "$command")) + COMPREPLY=($(compgen -W "start stop list" -- "$command")) return 0 } -# Prints the full path to the cros_workon executable, handling tilde -# expansion for the current user. -_cros_workon_executable() { - local cros_workon="${COMP_WORDS[0]}" - if [[ "$cros_workon" == '~/'* ]]; then - cros_workon="$HOME/${cros_workon#'~/'}" - fi - echo "$cros_workon" -} - -# Lists the workon (or live, if --all is passed in) ebuilds. Lists -# both the full names (e.g., chromeos-base/metrics) as well as just -# the ebuild names (e.g., metrics). -_cros_workon_list() { - local cros_workon=$(_cros_workon_executable) - ${cros_workon} list $1 | sed 's,\(.\+\)/\(.\+\),\1/\2 \2,' -} - -# Completes the current cros_workon argument assuming it's a -# package/ebuild name. -_complete_cros_workon_package() { - [ ${COMP_CWORD} -gt 1 ] || return 1 - local package="${COMP_WORDS[COMP_CWORD]}" - local command="${COMP_WORDS[1]}" - # If "start", complete based on all workon packages. - if [[ ${command} == "start" ]]; then - COMPREPLY=($(compgen -W "$(_cros_workon_list --all)" -- "$package")) - return 0 - fi - # If "stop" or "iterate", complete based on all live packages. - if [[ ${command} == "stop" ]] || [[ ${command} == "iterate" ]]; then - COMPREPLY=($(compgen -W "$(_cros_workon_list)" -- "$package")) - return 0 - fi - return 1 -} - -# Complete cros_workon arguments. -_cros_workon() { +# Complete flatcar_workon arguments. +_flatcar_workon() { COMPREPLY=() _flag_complete && return 0 _complete_board_sysroot_flag && return 0 - _complete_cros_workon_command && return 0 - _complete_cros_workon_package && return 0 - return 0 -} - -_list_repo_commands() { - local repo=${COMP_WORDS[0]} - "$repo" help --all | grep -E '^ ' | sed 's/ \([^ ]\+\) .\+/\1/' -} - -_list_repo_branches() { - local repo=${COMP_WORDS[0]} - "$repo" branches 2>&1 | grep \| | sed 's/[ *][Pp ] *\([^ ]\+\) .*/\1/' -} - -_list_repo_projects() { - local repo=${COMP_WORDS[0]} - "$repo" manifest -o /dev/stdout 2> /dev/null \ - | grep 'project name=' \ - | sed 's/.\+name="\([^"]\+\)".\+/\1/' -} - -# Complete repo's argument. -_complete_repo_command() { - [ ${COMP_CWORD} -eq 1 ] || return 1 - local command=${COMP_WORDS[1]} - COMPREPLY=($(compgen -W "$(_list_repo_commands)" -- "$command")) - return 0 -} - -_complete_repo_arg() { - [ ${COMP_CWORD} -gt 1 ] || return 1 - local command=${COMP_WORDS[1]} - local current=${COMP_WORDS[COMP_CWORD]} - if [[ ${command} == "abandon" ]]; then - if [[ ${COMP_CWORD} -eq 2 ]]; then - COMPREPLY=($(compgen -W "$(_list_repo_branches)" -- "$current")) - else - COMPREPLY=($(compgen -W "$(_list_repo_projects)" -- "$current")) - fi - return 0 - fi - if [[ ${command} == "help" ]]; then - [ ${COMP_CWORD} -eq 2 ] && \ - COMPREPLY=($(compgen -W "$(_list_repo_commands)" -- "$current")) - return 0 - fi - if [[ ${command} == "start" ]]; then - [ ${COMP_CWORD} -gt 2 ] && \ - COMPREPLY=($(compgen -W "$(_list_repo_projects)" -- "$current")) - return 0 - fi - return 1 -} - -# Complete repo arguments. -_complete_repo() { - COMPREPLY=() - _complete_repo_command && return 0 - _complete_repo_arg && return 0 + _complete_flatcar_workon_command && return 0 return 0 } @@ -234,8 +138,7 @@ complete -o bashdefault -o default -F _board_sysroot \ image_to_usb.sh \ mod_image_for_test.sh complete -o bashdefault -o default -o nospace -F _autotest_complete autotest -complete -F _cros_workon cros_workon -complete -F _complete_repo repo +complete -F _flatcar_workon flatcar_workon ### Local Variables: ### mode: shell-script diff --git a/build_library/build_image_util.sh b/build_library/build_image_util.sh index c2863b7bd1..4abef8f0ef 100755 --- a/build_library/build_image_util.sh +++ b/build_library/build_image_util.sh @@ -340,14 +340,13 @@ get_metadata() { if [ -z "${val}" ]; then # The grep invocation gives errors when the ebuild file is not present. # This can happen when the binary packages from ./build_packages are outdated. - val="$(grep "CROS_WORKON_PROJECT=" "${ebuild_path}" | cut -d '"' -f 2)" + val="$(grep "EGIT_REPO_URI=" "${ebuild_path}" | cut -d '"' -f 2)" if [ -n "${val}" ]; then - val="https://github.com/${val}" # All github.com/flatcar projects specify their commit local commit="" - commit="$(grep "CROS_WORKON_COMMIT=" "${ebuild_path}" | cut -d '"' -f 2)" + commit="$(grep "EGIT_COMMIT=" "${ebuild_path}" | cut -d '"' -f 2)" if [ -n "${commit}" ]; then - val="${val}/commit/${commit}" + val="${val%.git}/commit/${commit}" fi fi fi @@ -539,7 +538,7 @@ insert_extra_slsa() { # Add an entry to the image's package.provided package_provided() { - local p profile="${BUILD_DIR}/configroot/etc/portage/profile" + local p profile="${BUILD_DIR}/configroot/etc/portage/profile" for p in "$@"; do info "Writing $p to package.provided and soname.provided" echo "$p" >> "${profile}/package.provided" diff --git a/build_packages b/build_packages index a5d6d52f10..4ca38aec2f 100755 --- a/build_packages +++ b/build_packages @@ -27,7 +27,7 @@ DEFINE_string getbinpkgver "" \ DEFINE_boolean toolchainpkgonly "${FLAGS_FALSE}" \ "Use binary packages only for the board toolchain." DEFINE_boolean workon "${FLAGS_TRUE}" \ - "Automatically rebuild updated cros-workon packages." + "Automatically rebuild updated flatcar-workon packages." DEFINE_boolean fetchonly "${FLAGS_FALSE}" \ "Don't build anything, instead only fetch what is needed." DEFINE_boolean rebuild "${FLAGS_FALSE}" \ @@ -169,16 +169,16 @@ if [[ "${FLAGS_debug_emerge}" -eq "${FLAGS_TRUE}" ]]; then EMERGE_FLAGS+=( --debug ) fi -# Build cros_workon packages when they are changed. -CROS_WORKON_PKGS=() -if [ "${FLAGS_workon}" -eq "${FLAGS_TRUE}" ]; then - CROS_WORKON_PKGS+=( $("${SRC_ROOT}/scripts/cros_workon" list --board=${FLAGS_board}) ) +# Build flatcar_workon packages when they are changed. +WORKON_PKGS=() +if [[ ${FLAGS_workon} -eq "${FLAGS_TRUE}" ]]; then + mapfile -t WORKON_PKGS < <("${SRC_ROOT}"/scripts/flatcar_workon list --board="${FLAGS_board}") fi -if [[ ${#CROS_WORKON_PKGS[@]} -gt 0 ]]; then +if [[ ${#WORKON_PKGS[@]} -gt 0 ]]; then EMERGE_FLAGS+=( - --reinstall-atoms="${CROS_WORKON_PKGS[*]}" - --usepkg-exclude="${CROS_WORKON_PKGS[*]}" + --reinstall-atoms="${WORKON_PKGS[*]}" + --usepkg-exclude="${WORKON_PKGS[*]}" ) fi diff --git a/cros_workon b/cros_workon deleted file mode 100755 index 1d899c94eb..0000000000 --- a/cros_workon +++ /dev/null @@ -1,420 +0,0 @@ -#!/bin/bash - -# 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. - -# This script moves ebuilds between 'stable' and 'live' states. -# By default 'stable' ebuilds point at and build from source at the -# last known good commit. Moving an ebuild to 'live' (via cros_workon start) -# is intended to support development. The current source tip is fetched, -# source modified and built using the unstable 'live' (9999) ebuild. - -. "$(dirname "$0")/common.sh" || exit 1 - -assert_not_root_user - -# Script must be run inside the chroot - -DEFINE_string board "${DEFAULT_BOARD}" \ - "The board to set package keywords for." -DEFINE_boolean host "${FLAGS_FALSE}" \ - "Uses the host instead of board" -DEFINE_string remote "" \ - "For non-workon projects, the git remote to use." -DEFINE_string revision "" \ - "Use to override the manifest defined default revision used for a project" -DEFINE_string command "git status" \ - "The command to be run by forall." -DEFINE_boolean all "${FLAGS_FALSE}" \ - "Apply to all possible packages for the given command" - -FLAGS_HELP="usage: $0 [flags] [|.|--all] -commands: - start: Moves an ebuild to live (intended to support development) - stop: Moves an ebuild to stable (use last known good) - info: Print package name, repo name, and source directory. - list: List of live ebuilds (workon ebuilds if --all) - list-all: List all of the live ebuilds for all setup boards - iterate: For each ebuild, cd to the source dir and run a command" -FLAGS "$@" || { [ "${FLAGS_help}" = "${FLAGS_TRUE}" ] && exit 0; } || exit 1 -eval set -- "${FLAGS_ARGV}" - - -# eat the workon command keywords: start, stop or list. -WORKON_CMD=$1 -shift - -# Board dir config - -# If both are specified, just use host, because board does not -# have to be specified and may come from default, in which case -# there's no way to override. -[ -n "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_TRUE} ] && \ - FLAGS_board="" # kill board -if [ -z "${FLAGS_board}" ] && \ - [ "${FLAGS_host}" = ${FLAGS_FALSE} ] && \ - [ "${WORKON_CMD}" != "list-all" ]; then - flags_help - die "You must specify either --host or --board=" -fi - -if [ -n "${FLAGS_board}" ]; then - BOARD_DIR=/build/"${FLAGS_board}" # --board specified - EQUERYCMD=equery-"${FLAGS_board}" - EBUILDCMD=ebuild-"${FLAGS_board}" - PORTAGEQCMD=portageq-"${FLAGS_board}" - BOARD_STR="${FLAGS_board}" -else - BOARD_DIR="" # --host specified - EQUERYCMD=equery - EBUILDCMD=ebuild - PORTAGEQCMD=portageq - BOARD_STR="host" -fi - -WORKON_DIR=${CHROOT_TRUNK_DIR}/.config/cros_workon -CONFIG_DIR=${BOARD_DIR}/etc/portage -KEYWORDS_DIR=${CONFIG_DIR}/package.keywords -MASK_DIR=${CONFIG_DIR}/package.mask -UNMASK_DIR=${CONFIG_DIR}/package.unmask -WORKON_FILE=${WORKON_DIR}/${FLAGS_board:-host} -MASK_WORKON_FILE=${WORKON_FILE}.mask -KEYWORDS_FILE=${KEYWORDS_DIR}/cros-workon -MASK_FILE=${MASK_DIR}/cros-workon -UNMASK_FILE=${UNMASK_DIR}/cros-workon -CHROME_ATOM=chromeos-base/chromeos-chrome - -mkdir -p "${WORKON_DIR}" || die "mkdir -p ${WORKON_DIR}" -touch "${WORKON_FILE}" "${MASK_WORKON_FILE}" || \ - die "touch ${WORKON_FILE} ${MASK_WORKON_FILE}" -cmds=( - "mkdir -p '${KEYWORDS_DIR}' '${MASK_DIR}' '${UNMASK_DIR}'" - - # Clobber and re-create the WORKON_FILE symlinks every time. This - # is a trivial operation and eliminates all kinds of corner cases - # as well as any possible future renames of WORKON_FILE. - # In particular, chroot is usually built as "amd64-host" but becomes - # just "host" after installation. crosbug.com/23096 - "ln -sf '${WORKON_FILE}' '${KEYWORDS_FILE}'" - "ln -sf '${MASK_WORKON_FILE}' '${MASK_FILE}'" - "ln -sf '${WORKON_FILE}' '${UNMASK_FILE}'" -) -# If the board dir doesn't exist yet, we don't want to create it as -# that'll screw up ./setup_board later on. -if [[ -d ${BOARD_DIR:-/} ]] ; then - sudo_multi "${cmds[@]}" -else - die "${BOARD_STR} has not been setup yet" -fi - - -find_keyword_workon_ebuilds() { - local keyword="${1}" - local overlay - - # NOTE: overlay may be a symlink, and we have to use ${overlay}/ - for overlay in ${PORTDIR_OVERLAY}; do - # only look up ebuilds named 9999 to eliminate duplicates - find ${overlay}/*-* -maxdepth 2 -type f -name '*9999.ebuild' \ - -exec grep -l 'inherit.*cros-workon' {} + 2>/dev/null | \ - xargs grep -l "KEYWORDS=.*${keyword}.*" - done -} - -ebuild_to_package() { - # This changes the absolute path to ebuilds into category/package. - sed -e 's/.*\/\([^/]*\)\/\([^/]*\)\/.*\.ebuild/\1\/\2/' -} - -show_project_ebuild_map() { - local keyword="$1" - - # Column 1: Repo name - # Column 2: Package name - for EBUILD in $(find_keyword_workon_ebuilds ${keyword}); do - ( - eval $(grep -E '^CROS_WORKON' "${EBUILD}") - CP=$(echo "$EBUILD" | ebuild_to_package) - echo "${CROS_WORKON_PROJECT}" "${CP}" - ) - done -} - -show_project_path_map() { - # Column 1: Repo name - # Column 2: Source directory - repo list | awk -F ' : ' '{ print $2, $1 }' -} - -show_workon_ebuilds() { - local keyword="$1" - find_keyword_workon_ebuilds "${keyword}" | ebuild_to_package | sort -u -} - -show_workon_info() { - local atoms="$1" - local keyword="$2" - local sort="sort -k1b,1" - # Column 1: Package name - # Column 2: Repo name - # Column 3: Source directory (if present locally) - join \ - <(echo "${atoms}" | sed -e 's/ /\n/g' | ${sort}) \ - <(join -a 1 -e - -o 1.2,1.1,2.2 \ - <(show_project_ebuild_map "${keyword}" | ${sort}) \ - <(show_project_path_map | ${sort}) \ - | ${sort}) -} - -# Canonicalize package name to category/package. -canonicalize_name () { - local pkgfile - local pkgname - - if grep -qx "=$1-9999" "${WORKON_FILE}" ; then - echo $1 - return 0 - fi - - if ! pkgfile=$(ACCEPT_KEYWORDS="~${ARCH}" ${EQUERYCMD} \ - which --include-masked $1); then - warn "error looking up package $1" 1>&2 - return 1 - fi - - pkgname=$(echo "${pkgfile}" |awk -F '/' '{ print $(NF-2) "/" $(NF-1) }') - - # TODO(rcui): remove special casing of chromeos-chrome here when we make it - # inherit from cros-workon class. Tracked in chromium-os:19259. - if [ "${pkgname}" != "${CHROME_ATOM}" ] && \ - ! grep -q "cros-workon" ${pkgfile}; then - warn "${pkgname} is not a cros-workon package" 1>&2 - return 1 - fi - echo "${pkgname}" - return 0 -} - -# Canonicalize a list of names. -canonicalize_names () { - local atoms=$1 - local names="" - local atom - - for atom in ${atoms}; do - local name=$(canonicalize_name "${atom}") - [ -n "${name}" ] || return 1 - names+=" ${name}" - done - - echo "${names}" -} - -# Locate the package name based on the current directory -locate_package () { - local projectname=$(git config --get remote.cros.projectname || - git config --get remote.cros-internal.projectname) - if [ -z "${projectname}" ]; then - die "No project in git config: Can not cros_workon . here" - fi - local reponame=$(show_project_ebuild_map | - grep "^${projectname} " | cut -d" " -f2) - if [ -z "${reponame}" ]; then - die "No matching package for ${projectname}: Can not cros_workon . here" - else - echo "${reponame}" - fi -} - -# Display ebuilds currently part of the live branch and open for development. -show_live_ebuilds () { - sed -n 's/^=\(.*\)-9999$/\1/p' "${WORKON_FILE}" -} - -# Display ebuilds currently part of the live branch and open for development -# for any board that currently has live ebuilds. -show_all_live_ebuilds () { - local workon_file - for workon_file in ${WORKON_DIR}/*; do - if [[ -s ${workon_file} && ${workon_file} != *.mask ]] ; then - echo -e "${V_BOLD_GREEN}$(basename ${workon_file}):${V_VIDOFF}" - sed -n 's/^=\(.*\)-9999$/ \1/p' "${workon_file}" - echo "" - fi - done -} - -# This is called only for "cros-workon start". We dont handle the -# "stop" case since the local changes are ignored anyway since the -# 9999.ebuild is masked and we dont want to deal with what to do with -# the user's local changes. -regen_manifest_and_sync() { - # Nothing to do unless you are working on the minilayout - local manifest=${CHROOT_TRUNK_DIR}/.repo/manifest.xml - if [ $(basename $(readlink -f ${manifest})) != "minilayout.xml" ]; then - if [ -z "$(git config -f "${CHROOT_TRUNK_DIR}/.repo/manifests.git/config" \ - --get manifest.groups)" ]; then - # Reaching here means that it's a full manifest w/out any groups set- - # literal full manifest. - return - fi - fi - - local need_repo_sync= - local pkgname - for pkgname in $(show_live_ebuilds); do - local pkgpath="$(${EQUERYCMD} which "${pkgname}")" - local pkginfo="$(${EBUILDCMD} "${pkgpath}" info | - grep -v 'pkg_info() is not defined')" - if [ -z "${pkginfo}" ]; then - continue # No package information available - fi - - eval "${pkginfo}" - local trunkdir=$(readlink -m "${CHROOT_TRUNK_DIR}") - - local i=0 - need_repo_sync='yes' - for S in "${CROS_WORKON_SRCDIR[@]}"; do - local srcdir=$(readlink -m "${S}") - local revision="${FLAGS_revision:+--revision=${FLAGS_revision}}" - if [ -z "${FLAGS_remote}" ]; then - loman add --workon "${CROS_WORKON_PROJECT[i]}" ${revision} - else - loman add --remote "${FLAGS_remote}" ${revision} \ - "${CROS_WORKON_PROJECT[i]}" "${srcdir#${trunkdir}/}" - fi - : $(( ++i )) - done - done - if [ -n "${need_repo_sync}" ]; then - echo "Please run \"repo sync\" now." - fi -} - -chrome_to_live () { - # Switch to using repo manifest checkout of chromium src. - # Run chrome_set_ver to set DEPS - - # No chromium/src.git project checked out, meaning user not using - # gerrit_source.xml - if [ ! -d "${CHROOT_TRUNK_DIR}/chromium/src/.git" ]; then - return - fi - - info "Setting Chrome dependencies to the correct revision." - chrome_set_ver - if [ -n "${CHROME_ORIGIN}" ] && [ "${CHROME_ORIGIN}" != GERRIT_SOURCE ]; then - warn "CHROME_ORIGIN is already set to ${CHROME_ORIGIN}" - warn "To use the new GERRIT_SOURCE workflow, please unset it." - warn "Run 'unset CHROME_ORIGIN' to reset to the default source location." - fi -} - -# Move a stable ebuild to the live development catgeory. The ebuild -# src_unpack step fetches the package source for local development. -ebuild_to_live () { - local atoms=$1 - local atoms_success=() - local atom - - for atom in ${atoms}; do - if ! grep -qx "=${atom}-9999" "${WORKON_FILE}" ; then - echo "=${atom}-9999" >> "${WORKON_FILE}" || \ - die "Could not update ${WORKON_FILE} with ${atom}" - echo "<${atom}-9999" >> "${MASK_WORKON_FILE}" || \ - die "Could not update ${MASK_WORKON_FILE} with ${atom}" - atoms_success+=( ${atom} ) - if [ "${atom}" = "${CHROME_ATOM}" ]; then - chrome_to_live - fi - else - warn "Already working on ${atom}" - fi - done - [ ${#atoms_success[@]} -gt 0 ] && regen_manifest_and_sync && \ - info "Started working on '${atoms_success[*]}' for '${BOARD_STR}'" -} - -# Move a live development ebuild back to stable. -ebuild_to_stable () { - local atoms=$1 - local atoms_success=() - local atom - - for atom in ${atoms}; do - if grep -qx "=${atom}-9999" "${WORKON_FILE}" "${MASK_WORKON_FILE}" ; then - sed -i -e "/^=${atom/\//\\/}-9999\$/d" "${WORKON_FILE}" || \ - die "Could not update ${WORKON_FILE} with ${atom}" - sed -i -e "/^<${atom/\//\\/}-9999\$/d" "${MASK_WORKON_FILE}" || \ - die "Could not update ${WORKON_FILE} with ${atom}" - atoms_success+=( ${atom} ) - else - warn "Not working on ${atom}" - fi - done - [ ${#atoms_success[@]} -gt 0 ] && \ - info "Stopped working on '${atoms_success[*]}' for '${BOARD_STR}'" -} - -# Run a command on all or a set of repos. -ebuild_iterate() { - local atoms=$1 - local atom - - for atom in ${atoms}; do - info "Running \"${FLAGS_command}\" on ${atom}" - eval $(${EBUILDCMD} $(${EQUERYCMD} which ${atom}) info) - for S in "${CROS_WORKON_SRCDIR[@]}"; do - (cd "${S}" && bash -c "${FLAGS_command}") - done - done -} - -# Only call portageq when absolutely required, and when we do, only run it -# once -- it's a slow beast and can easily take hundreds of milliseconds :(. -if [[ ${WORKON_CMD} != "list" || ${FLAGS_all} != ${FLAGS_FALSE} ]] ; then - portageq_vars="ARCH PORTDIR_OVERLAY" - unset ${portageq_vars} - eval $(${PORTAGEQCMD} envvar -v ${portageq_vars}) -fi - -# --all makes commands operate on different lists -if [ ${FLAGS_all} = "${FLAGS_TRUE}" ]; then - case ${WORKON_CMD} in - start|info) ATOM_LIST=$(show_workon_ebuilds ${ARCH});; - stop|iterate) ATOM_LIST=$(show_live_ebuilds);; - list) ;; - *) die "--all is invalid for the given command";; - esac -else # not selected --all - case ${WORKON_CMD} in - start|stop|info|iterate) - ATOM_LIST=$@ - if [ -z "${ATOM_LIST}" ]; then - die "${WORKON_CMD}: No packages specified" - fi - if [ "${ATOM_LIST}" = "." ]; then - ATOM_LIST=$(locate_package) - fi - if ! ATOM_LIST=$(canonicalize_names "${ATOM_LIST}"); then - die "Error parsing package list" - fi;; - *) ;; - esac -fi - -case ${WORKON_CMD} in - start) ebuild_to_live "${ATOM_LIST}" ;; - stop) ebuild_to_stable "${ATOM_LIST}" ;; - info) show_workon_info "${ATOM_LIST}" "${ARCH}" ;; - list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || \ - show_workon_ebuilds ${ARCH} ;; - list-all) show_all_live_ebuilds ;; - iterate) ebuild_iterate "${ATOM_LIST}" ;; - *) - flags_help - die "$(basename $0): command '${WORKON_CMD}' not recognized" - ;; -esac diff --git a/flatcar_workon b/flatcar_workon new file mode 100755 index 0000000000..157c89d1c1 --- /dev/null +++ b/flatcar_workon @@ -0,0 +1,172 @@ +#!/bin/bash +# Copyright (c) 2024 The Flatcar Maintainers. +# Distributed under the terms of the GNU General Public License v2 + +. "${0%/*}"/common.sh || exit 1 + +DEFINE_string board "${DEFAULT_BOARD}" \ + "The board to set package keywords for." + +FLAGS_HELP="usage: $0 [flags] +commands: + start: Moves an ebuild to live (intended to support development) + stop: Moves an ebuild to stable (use last known good) + list: List of live ebuilds" +FLAGS "$@" || { [[ ${FLAGS_help} = "${FLAGS_TRUE}" ]] && exit 0; } || exit 1 +eval set -- "${FLAGS_ARGV}" + +set -euo pipefail + +# /etc/portage under either / or /build/. +ETC_PORTAGE=${FLAGS_board+/build/${FLAGS_board}}/etc/portage + +# If the board dir doesn't exist yet, we don't want to create it as that'll +# screw up ./setup_board later on. +[[ -d ${ETC_PORTAGE} ]] || + die "${FLAGS_board} has not been setup yet" + +find_ebuild() { + if [[ -z ${1-} ]]; then + flags_help + exit 1 + fi + + # Exact atom does not need to be given. Resolve to an ebuild with equery. + EBUILD=$(equery which --include-masked "$1") + + [[ -n ${EBUILD} ]] || + die "Package matching \"$1\" could not be found." + + PN=${EBUILD%/*} + PN=${PN##*/} + + CAT=${EBUILD%/*/*} + CAT=${CAT##*/} + + CP=${CAT}/${PN} +} + +add_if_needed() { + grep -Fxq "$1" "$2" 2>/dev/null || sudo tee -a "$2" >/dev/null <<< "$1" +} + +start() { + export PORTAGE_TMPDIR + PORTAGE_TMPDIR=$(mktemp -d) + trap 'rm -rf -- "${PORTAGE_TMPDIR}"' EXIT + + # Load the ebuild environment to reliably pull out variables. + "ebuild${FLAGS_board+-}${FLAGS_board-}" "${EBUILD}" setup + # shellcheck disable=SC1090 + . "${PORTAGE_TMPDIR}"/portage/*/*/temp/environment + + [[ -n ${EGIT_REPO_URI-} ]] || + die "${EBUILD} is not live because it does not set EGIT_REPO_URI." + + [[ -z ${EGIT_COMMIT-} ]] || + die "${EBUILD} is not live because it sets EGIT_COMMIT." + + ### v--- Taken from git-r3.eclass ---v + + if [[ $(declare -p EGIT_REPO_URI) == "declare -a"* ]]; then + repos=( "${EGIT_REPO_URI[@]}" ) + else + # shellcheck disable=SC2206 + repos=( ${EGIT_REPO_URI} ) + fi + + repo_name=${repos[0]#*://*/} + + # strip the trailing slash + repo_name=${repo_name%/} + + # strip common prefixes to make paths more likely to match + # e.g. git://X/Y.git vs https://X/git/Y.git + # (but just one of the prefixes) + case "${repo_name}" in + # gnome.org... who else? + browse/*) repo_name=${repo_name#browse/};; + # cgit can proxy requests to git + cgit/*) repo_name=${repo_name#cgit/};; + # pretty common + git/*) repo_name=${repo_name#git/};; + # gentoo.org + gitroot/*) repo_name=${repo_name#gitroot/};; + # sourceforge + p/*) repo_name=${repo_name#p/};; + # kernel.org + pub/scm/*) repo_name=${repo_name#pub/scm/};; + esac + # ensure a .git suffix, same reason + repo_name=${repo_name%.git}.git + # now replace all the slashes + repo_name=${repo_name//\//_} + + # get the name and do some more processing: + # 1) kill .git suffix, + # 2) underscore (remaining) non-variable characters, + # 3) add preceding underscore if it starts with a digit, + # 4) uppercase. + override_name=${repo_name##*/} + override_name=${override_name%.git} + override_name=${override_name//[^a-zA-Z0-9_]/_} + override_name=${override_name^^} + + ### ^--- Taken from git-r3.eclass ---^ + + GIT_WORKTREE=/home/sdk/trunk/src/scripts/workon/${repo_name} + sudo mkdir -p "${ETC_PORTAGE}"/{env,package.accept_keywords,package.env} + + add_if_needed \ + "EGIT_OVERRIDE_REPO_${override_name}=\"${GIT_WORKTREE}\" # ${CP}" \ + "${ETC_PORTAGE}"/env/workon.conf + + add_if_needed \ + "${CP} workon.conf" \ + "${ETC_PORTAGE}"/package.env/workon.conf + + add_if_needed \ + "${CP} **" \ + "${ETC_PORTAGE}"/package.accept_keywords/workon.conf + + if [[ ! -e ${GIT_WORKTREE} ]]; then + mkdir -p "${GIT_WORKTREE%/*}" + git clone "${repos[0]}" "${GIT_WORKTREE}" + fi + + return 0 +} + +stop() { + [[ -e ${ETC_PORTAGE}/env/workon.conf ]] && + sudo sed -i "/# ${CP//\//\\/}\$/d" "${ETC_PORTAGE}"/env/workon.conf + + [[ -e ${ETC_PORTAGE}/package.accept_keywords/workon.conf ]] && + sudo sed -i "/^${CP//\//\\/} /d" "${ETC_PORTAGE}"/package.accept_keywords/workon.conf + + [[ -e ${ETC_PORTAGE}/package.env/workon.conf ]] && + sudo sed -i "/^${CP//\//\\/} /d" "${ETC_PORTAGE}"/package.env/workon.conf + + return 0 +} + +list() { + [[ -e ${ETC_PORTAGE}/package.env/workon.conf ]] && + sed '/\bworkon\.conf\b/s:\s.*::' "${ETC_PORTAGE}"/package.env/workon.conf + + return 0 +} + +case "$1" in + start) + find_ebuild "${2-}" + start ;; + stop) + find_ebuild "${2-}" + stop ;; + list) + list ;; + *) + flags_help + die "$0: command \"$1\" not recognized" ;; +esac diff --git a/sdk_container/src/third_party/coreos-overlay/app-admin/locksmith/locksmith-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/app-admin/locksmith/locksmith-9999.ebuild index bf2a9993df..7d14a7af5a 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-admin/locksmith/locksmith-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-admin/locksmith/locksmith-9999.ebuild @@ -2,16 +2,14 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -CROS_WORKON_PROJECT="flatcar/locksmith" -CROS_WORKON_LOCALNAME="locksmith" -CROS_WORKON_REPO="https://github.com" +EGIT_REPO_URI="https://github.com/flatcar/locksmith.git" COREOS_GO_PACKAGE="github.com/flatcar/locksmith" -inherit cros-workon systemd coreos-go +inherit git-r3 systemd coreos-go if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64 ~arm64" else - CROS_WORKON_COMMIT="439d44f24b24f679d08f309399f6bb2f82614637" # flatcar-master + EGIT_COMMIT="439d44f24b24f679d08f309399f6bb2f82614637" # flatcar-master KEYWORDS="amd64 arm64" fi diff --git a/sdk_container/src/third_party/coreos-overlay/app-admin/mayday/mayday-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/app-admin/mayday/mayday-9999.ebuild index 7aaf9801c4..5165fa61bf 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-admin/mayday/mayday-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-admin/mayday/mayday-9999.ebuild @@ -2,16 +2,14 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -CROS_WORKON_PROJECT="flatcar/mayday" -CROS_WORKON_LOCALNAME="mayday" -CROS_WORKON_REPO="https://github.com" +EGIT_REPO_URI="https://github.com/flatcar/mayday.git" COREOS_GO_PACKAGE="github.com/flatcar/mayday" -inherit coreos-go cros-workon +inherit coreos-go git-r3 if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64 ~arm64" else - CROS_WORKON_COMMIT="9de08c8f9f4360fe52cb3a56a7fb8f4bc4e75dcc" # flatcar-master + EGIT_COMMIT="9de08c8f9f4360fe52cb3a56a7fb8f4bc4e75dcc" # flatcar-master KEYWORDS="amd64 arm64" fi diff --git a/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild index 09741cb18f..bcebaaea94 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-admin/sdnotify-proxy/sdnotify-proxy-9999.ebuild @@ -2,22 +2,20 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -CROS_WORKON_PROJECT="kinvolk/sdnotify-proxy" -CROS_WORKON_LOCALNAME="sdnotify-proxy" -CROS_WORKON_REPO="https://github.com" -COREOS_GO_PACKAGE="github.com/coreos/sdnotify-proxy" +EGIT_REPO_URI="https://github.com/flatcar/sdnotify-proxy.git" +COREOS_GO_PACKAGE="github.com/flatcar/sdnotify-proxy" COREOS_GO_GO111MODULE="off" -inherit coreos-go cros-workon +inherit coreos-go git-r3 if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64 ~arm64" else - CROS_WORKON_COMMIT="0f8ef1aa86c59fc6d54eadaffb248feaccd1018b" # master + EGIT_COMMIT="0f8ef1aa86c59fc6d54eadaffb248feaccd1018b" # master KEYWORDS="amd64 arm64" fi DESCRIPTION="sdnotify-proxy" -HOMEPAGE="https://github.com/coreos/sdnotify-proxy" +HOMEPAGE="https://github.com/flatcar/sdnotify-proxy" SRC_URI="" LICENSE="Apache-2.0" diff --git a/sdk_container/src/third_party/coreos-overlay/app-admin/toolbox/toolbox-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/app-admin/toolbox/toolbox-9999.ebuild index c8766101cb..7279599632 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-admin/toolbox/toolbox-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-admin/toolbox/toolbox-9999.ebuild @@ -2,18 +2,16 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -CROS_WORKON_PROJECT="flatcar/toolbox" -CROS_WORKON_LOCALNAME="toolbox" -CROS_WORKON_REPO="https://github.com" +EGIT_REPO_URI="https://github.com/flatcar/toolbox.git" if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64 ~arm64" else - CROS_WORKON_COMMIT="fce9ba2bbd55e1835af72952bfbb7aed6be75606" # flatcar-master + EGIT_COMMIT="fce9ba2bbd55e1835af72952bfbb7aed6be75606" # flatcar-master KEYWORDS="amd64 arm64" fi -inherit cros-workon +inherit git-r3 DESCRIPTION="toolbox" HOMEPAGE="https://github.com/flatcar/toolbox" diff --git a/sdk_container/src/third_party/coreos-overlay/app-admin/updateservicectl/updateservicectl-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/app-admin/updateservicectl/updateservicectl-9999.ebuild index 1b45eaafdf..27e8d85b36 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-admin/updateservicectl/updateservicectl-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-admin/updateservicectl/updateservicectl-9999.ebuild @@ -2,17 +2,15 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -CROS_WORKON_PROJECT="flatcar/updateservicectl" -CROS_WORKON_LOCALNAME="updateservicectl" -CROS_WORKON_REPO="https://github.com" +EGIT_REPO_URI="https://github.com/flatcar/updateservicectl.git" COREOS_GO_PACKAGE="github.com/flatcar/updateservicectl" COREOS_GO_GO111MODULE="on" -inherit cros-workon coreos-go +inherit git-r3 coreos-go if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64 ~arm64" else - CROS_WORKON_COMMIT="446f13594465503a3fdfc9106fd8a0c3123249c2" # main + EGIT_COMMIT="446f13594465503a3fdfc9106fd8a0c3123249c2" # main KEYWORDS="amd64 arm64" fi diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/afterburn/afterburn-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/afterburn/afterburn-9999.ebuild index 23c8ecee23..7b71048f97 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/afterburn/afterburn-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/afterburn/afterburn-9999.ebuild @@ -3,14 +3,12 @@ EAPI=8 -CROS_WORKON_PROJECT="coreos/afterburn" -CROS_WORKON_LOCALNAME="afterburn" -CROS_WORKON_REPO="https://github.com" +EGIT_REPO_URI="https://github.com/coreos/afterburn.git" if [[ ${PV} == 9999 ]]; then KEYWORDS="~amd64 ~arm64" else - CROS_WORKON_COMMIT="aa1be7dba724403457dee0fabed16e15be3ef4e0" # v5.6.0 + EGIT_COMMIT="aa1be7dba724403457dee0fabed16e15be3ef4e0" # v5.6.0 KEYWORDS="amd64 arm64" fi @@ -349,7 +347,7 @@ CRATES=" zvariant_utils@1.0.1 " -inherit cargo cros-workon systemd +inherit cargo git-r3 systemd DESCRIPTION="A tool for collecting instance metadata from various providers" HOMEPAGE="https://github.com/coreos/afterburn" @@ -372,7 +370,7 @@ PATCHES=( ) src_unpack() { - cros-workon_src_unpack + git-r3_src_unpack cargo_src_unpack } diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-cloudinit/coreos-cloudinit-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-cloudinit/coreos-cloudinit-9999.ebuild index 2e0da6c532..5aaad9ccb5 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-cloudinit/coreos-cloudinit-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-cloudinit/coreos-cloudinit-9999.ebuild @@ -2,17 +2,15 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -CROS_WORKON_PROJECT="flatcar/coreos-cloudinit" -CROS_WORKON_LOCALNAME="coreos-cloudinit" -CROS_WORKON_REPO="https://github.com" +EGIT_REPO_URI="https://github.com/flatcar/coreos-cloudinit.git" COREOS_GO_PACKAGE="github.com/flatcar/coreos-cloudinit" COREOS_GO_GO111MODULE="on" -inherit cros-workon systemd toolchain-funcs udev coreos-go +inherit git-r3 systemd toolchain-funcs udev coreos-go if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64 ~arm64" else - CROS_WORKON_COMMIT="f78b9f7b484497c610c8a159aa971234d384d215" # flatcar-master + EGIT_COMMIT="f78b9f7b484497c610c8a159aa971234d384d215" # flatcar-master KEYWORDS="amd64 arm64" fi diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/coreos-init-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/coreos-init-9999.ebuild index dae32f390c..09fa0e8734 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/coreos-init-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-init/coreos-init-9999.ebuild @@ -3,20 +3,18 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -CROS_WORKON_PROJECT="flatcar/init" -CROS_WORKON_LOCALNAME="init" -CROS_WORKON_REPO="https://github.com" +EGIT_REPO_URI="https://github.com/flatcar/init.git" if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64 ~arm ~arm64 ~x86" else - CROS_WORKON_COMMIT="05e3d8b9c0f8e95d5044db5133b3e75d205f6d91" # flatcar-master + EGIT_COMMIT="05e3d8b9c0f8e95d5044db5133b3e75d205f6d91" # flatcar-master KEYWORDS="amd64 arm arm64 x86" fi PYTHON_COMPAT=( python3_{9..11} ) -inherit cros-workon systemd python-any-r1 +inherit git-r3 systemd python-any-r1 DESCRIPTION="Init scripts for CoreOS" HOMEPAGE="http://www.coreos.com/" diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/emerge-gitclone/emerge-gitclone-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/emerge-gitclone/emerge-gitclone-9999.ebuild index b1a83e976a..113067d692 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/emerge-gitclone/emerge-gitclone-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/emerge-gitclone/emerge-gitclone-9999.ebuild @@ -2,21 +2,18 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -CROS_WORKON_PROJECT="flatcar/flatcar-dev-util" -CROS_WORKON_REPO="https://github.com" -CROS_WORKON_LOCALNAME="dev" -CROS_WORKON_LOCALDIR="src/platform" +EGIT_REPO_URI="https://github.com/flatcar/flatcar-dev-util.git" if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64 ~arm ~arm64 ~x86" else - CROS_WORKON_COMMIT="00396595376d8d6a3c4b9251ba94e9de2d7a9e39" # flatcar-master + EGIT_COMMIT="00396595376d8d6a3c4b9251ba94e9de2d7a9e39" # flatcar-master KEYWORDS="amd64 arm arm64 x86" fi PYTHON_COMPAT=( python3_{6..11} ) -inherit cros-workon python-single-r1 +inherit git-r3 python-single-r1 DESCRIPTION="emerge utilities for Flatcar developer images" HOMEPAGE="https://github.com/flatcar/flatcar-dev-util/" diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/nova-agent-watcher/nova-agent-watcher-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/nova-agent-watcher/nova-agent-watcher-9999.ebuild index c0b1218f0e..caf1b73e96 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/nova-agent-watcher/nova-agent-watcher-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/nova-agent-watcher/nova-agent-watcher-9999.ebuild @@ -2,17 +2,15 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -CROS_WORKON_PROJECT="coreos/nova-agent-watcher" -CROS_WORKON_LOCALNAME="nova-agent-watcher" -CROS_WORKON_REPO="https://github.com" +EGIT_REPO_URI="https://github.com/coreos/nova-agent-watcher.git" COREOS_GO_PACKAGE="github.com/coreos/nova-agent-watcher" COREOS_GO_GO111MODULE="off" -inherit cros-workon systemd coreos-go +inherit git-r3 systemd coreos-go if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64 ~arm64" else - CROS_WORKON_COMMIT="2262401fe363cfdcc4c6f02144622466d506de43" + EGIT_COMMIT="2262401fe363cfdcc4c6f02144622466d506de43" KEYWORDS="amd64 arm64" fi diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/ue-rs/ue-rs-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/ue-rs/ue-rs-9999.ebuild index 7a597e52c4..69fe6c3817 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/ue-rs/ue-rs-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/ue-rs/ue-rs-9999.ebuild @@ -3,14 +3,12 @@ EAPI=8 -CROS_WORKON_PROJECT="flatcar/ue-rs" -CROS_WORKON_LOCALNAME="ue-rs" -CROS_WORKON_REPO="https://github.com" +EGIT_REPO_URI="https://github.com/flatcar/ue-rs.git" if [[ ${PV} == 9999 ]]; then KEYWORDS="~amd64 ~arm64" else - CROS_WORKON_COMMIT="9b6ddb0226208450bcef9da4ac5ba8bc2a47a87c" # trunk + EGIT_COMMIT="9b6ddb0226208450bcef9da4ac5ba8bc2a47a87c" # trunk KEYWORDS="amd64 arm64" fi @@ -197,7 +195,7 @@ CRATES=" zeroize@1.6.0 " -inherit cargo cros-workon +inherit cargo git-r3 DESCRIPTION="Prototype Omaha Rust implementation" HOMEPAGE="https://github.com/flatcar/ue-rs" @@ -214,7 +212,7 @@ RDEPEND=" " src_unpack() { - cros-workon_src_unpack + git-r3_src_unpack cargo_src_unpack } diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/update-ssh-keys/update-ssh-keys-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/coreos-base/update-ssh-keys/update-ssh-keys-9999.ebuild index 3643334865..720b11ceeb 100644 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/update-ssh-keys/update-ssh-keys-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/update-ssh-keys/update-ssh-keys-9999.ebuild @@ -3,14 +3,12 @@ EAPI=8 -CROS_WORKON_PROJECT="flatcar/update-ssh-keys" -CROS_WORKON_LOCALNAME="update-ssh-keys" -CROS_WORKON_REPO="https://github.com" +EGIT_REPO_URI="https://github.com/flatcar/update-ssh-keys.git" if [[ ${PV} == 9999 ]]; then KEYWORDS="~amd64 ~arm64" else - CROS_WORKON_COMMIT="2a2aa89cd6eda6202de62b8870ca50945c836c54" # flatcar-master + EGIT_COMMIT="2a2aa89cd6eda6202de62b8870ca50945c836c54" # flatcar-master KEYWORDS="amd64 arm64" fi @@ -65,7 +63,7 @@ CRATES=" windows_x86_64_msvc@0.48.5 " -inherit cargo cros-workon +inherit cargo git-r3 DESCRIPTION="Utility for managing OpenSSH authorized public keys" HOMEPAGE="https://github.com/flatcar/update-ssh-keys" @@ -80,6 +78,6 @@ SLOT="0" RDEPEND="! /dev/null - - if [[ "${PV}" == "9999" ]]; then - local_copy || die "Cannot create a local copy" - else - if [[ -z "${CROS_WORKON_COMMIT}" ]]; then - die "CROS_WORKON_COMMIT is unset" - fi - - # Try cloning from a local repo first - local_clone && return - - # There is no good way to ensure repo-maintained git trees - # always have exactly what ebuilds need so fall back gracefully - # to fetching remotely. Also, when ebuilds only specify a git - # hash there isn't a way to know which branch that is on. To be - # safe use git-r3's "mirror" mode to fetch all remote branches. - ewarn "Falling back to fetching from remote git repository..." - - EGIT_CLONE_TYPE=mirror - EGIT_REPO_URI="${CROS_WORKON_REPO}/${CROS_WORKON_PROJECT}.git" - EGIT_CHECKOUT_DIR="${S}" - EGIT_COMMIT="${CROS_WORKON_COMMIT}" - git-r3_src_unpack - fi -} - -# TODO(marineam): This is used by cros_workon to deal manage -# 'minilayout' manifests but we don't bother with that in CoreOS. -# Do a pass on the cros_workon tool to give it a freshening too... -cros-workon_pkg_info() { - echo "CROS_WORKON_SRCDIR=(\"$(get_path)\")" - echo "CROS_WORKON_PROJECT=(\"${CROS_WORKON_PROJECT}\")" -} - -# get the semver of the git repo that is being built -get_semver() { - # get git tag/sha - local v - v=$(git describe --long --dirty) || die - - # strip a leading v from the tag - v=${v#v} - - # replace first - with +, to attach git sha/dirty as semver metadata - v=${v/-/+} - - echo ${v} -} - -EXPORT_FUNCTIONS src_unpack pkg_info - diff --git a/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/make.defaults b/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/make.defaults index eeded5e9ff..581f3a7b8d 100644 --- a/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/make.defaults +++ b/sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/make.defaults @@ -1,10 +1,8 @@ # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. # Distributed under the terms of the GNU General Public License v2 -# ChromeOS-specific: CROS_WORKON_TREE for cros-workon -# TESTS USE_EXPAND for autotest -USE_EXPAND="${USE_EXPAND} CROS_WORKON_TREE TESTS" -USE_EXPAND_HIDDEN="${USE_EXPAND_HIDDEN} CROS_WORKON_TREE" +# ChromeOS-specific: TESTS USE_EXPAND for autotest +USE_EXPAND="${USE_EXPAND} TESTS" # Use go_version_* flags to indicate which major version was used. # For now this is only informational and set by coreos-go.eclass diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/baselayout/baselayout-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-apps/baselayout/baselayout-9999.ebuild index cb046dca95..ae7fca3965 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-apps/baselayout/baselayout-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-apps/baselayout/baselayout-9999.ebuild @@ -2,19 +2,17 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -CROS_WORKON_PROJECT="flatcar/baselayout" -CROS_WORKON_LOCALNAME="baselayout" -CROS_WORKON_REPO="https://github.com" +EGIT_REPO_URI="https://github.com/flatcar/baselayout.git" if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64 ~arm ~arm64 ~x86" else - CROS_WORKON_COMMIT="937a45faef0f7fa88d3d2c3f7ba60a7f3e2e82f7" # flatcar-master + EGIT_COMMIT="937a45faef0f7fa88d3d2c3f7ba60a7f3e2e82f7" # flatcar-master KEYWORDS="amd64 arm arm64 x86" fi TMPFILES_OPTIONAL=1 -inherit cros-workon multilib systemd tmpfiles +inherit git-r3 multilib systemd tmpfiles DESCRIPTION="Filesystem baselayout for CoreOS" HOMEPAGE="http://www.coreos.com/" diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/ignition/ignition-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-apps/ignition/ignition-9999.ebuild index ff5f321194..75e03703be 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-apps/ignition/ignition-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-apps/ignition/ignition-9999.ebuild @@ -2,17 +2,15 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -CROS_WORKON_PROJECT="coreos/ignition" -CROS_WORKON_LOCALNAME="ignition" -CROS_WORKON_REPO="https://github.com" +EGIT_REPO_URI="https://github.com/coreos/ignition.git" COREOS_GO_PACKAGE="github.com/flatcar/ignition/v2" COREOS_GO_GO111MODULE="off" -inherit coreos-go cros-workon systemd udev +inherit coreos-go git-r3 systemd udev if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64 ~arm64" else - CROS_WORKON_COMMIT="09c99e0305adc1377b87964a39ad2d009aec9b12" # v2.19.0 + EGIT_COMMIT="09c99e0305adc1377b87964a39ad2d009aec9b12" # v2.19.0 KEYWORDS="amd64 arm64" fi diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/seismograph/seismograph-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-apps/seismograph/seismograph-9999.ebuild index 9ee7de91bf..d3721e5f85 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-apps/seismograph/seismograph-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-apps/seismograph/seismograph-9999.ebuild @@ -2,17 +2,16 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -CROS_WORKON_PROJECT="flatcar/seismograph" -CROS_WORKON_REPO="https://github.com" +EGIT_REPO_URI="https://github.com/flatcar/seismograph.git" if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64 ~arm ~arm64 ~x86" else - CROS_WORKON_COMMIT="0d57463de18df81741375d628852c521542b6836" # flatcar-master + EGIT_COMMIT="0d57463de18df81741375d628852c521542b6836" # flatcar-master KEYWORDS="amd64 arm arm64 x86" fi -inherit autotools cros-workon +inherit autotools git-r3 DESCRIPTION="CoreOS Disk Utilities (e.g. cgpt)" LICENSE="BSD" diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/bootengine/bootengine-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-kernel/bootengine/bootengine-9999.ebuild index 75931c150b..cbe45f4791 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/bootengine/bootengine-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/bootengine/bootengine-9999.ebuild @@ -2,19 +2,16 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -CROS_WORKON_PROJECT="flatcar/bootengine" -CROS_WORKON_LOCALNAME="bootengine" -CROS_WORKON_OUTOFTREE_BUILD=1 -CROS_WORKON_REPO="https://github.com" +EGIT_REPO_URI="https://github.com/flatcar/bootengine.git" if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64 ~arm ~arm64 ~x86" else - CROS_WORKON_COMMIT="fb2631ce5e6a21d044c8dca73f59db01f9d5abcf" # flatcar-master + EGIT_COMMIT="fb2631ce5e6a21d044c8dca73f59db01f9d5abcf" # flatcar-master KEYWORDS="amd64 arm arm64 x86" fi -inherit cros-workon +inherit git-r3 DESCRIPTION="CoreOS Bootengine" SRC_URI="" diff --git a/sdk_container/src/third_party/coreos-overlay/sys-libs/nss-usrfiles/nss-usrfiles-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-libs/nss-usrfiles/nss-usrfiles-9999.ebuild index 2a307491c7..3a195878d2 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-libs/nss-usrfiles/nss-usrfiles-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-libs/nss-usrfiles/nss-usrfiles-9999.ebuild @@ -2,18 +2,16 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -CROS_WORKON_PROJECT="flatcar/nss-altfiles" -CROS_WORKON_LOCALNAME="nss-altfiles" -CROS_WORKON_REPO="https://github.com" +EGIT_REPO_URI="https://github.com/flatcar/nss-altfiles.git" if [[ "${PV}" == 9999 ]]; then KEYWORDS="~amd64 ~arm ~arm64 ~x86" else - CROS_WORKON_COMMIT="c8e05a08a2e28eb48c6c788e3007d94f8d8de5cd" # flatcar-master + EGIT_COMMIT="c8e05a08a2e28eb48c6c788e3007d94f8d8de5cd" # flatcar-master KEYWORDS="amd64 arm arm64 x86" fi -inherit cros-workon toolchain-funcs +inherit git-r3 toolchain-funcs DESCRIPTION="NSS module for data sources under /usr on for CoreOS" HOMEPAGE="https://github.com/coreos/nss-altfiles" diff --git a/setup_board b/setup_board index dd9a006386..ecc689decf 100755 --- a/setup_board +++ b/setup_board @@ -97,10 +97,10 @@ generate_all_wrappers() { _generate_wrapper ${wrapper} done - wrapper="/usr/local/bin/cros_workon-${BOARD_VARIANT}" + wrapper="/usr/local/bin/flatcar_workon-${BOARD_VARIANT}" sudo_clobber "${wrapper}" <