From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 663601382C5 for ; Sun, 20 Dec 2020 02:29:04 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8B977E0965; Sun, 20 Dec 2020 02:29:03 +0000 (UTC) Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5DDE8E0965 for ; Sun, 20 Dec 2020 02:29:03 +0000 (UTC) Received: by mail-qk1-f177.google.com with SMTP id v126so1520605qkd.11 for ; Sat, 19 Dec 2020 18:29:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pRes096jPdcdSDkXNC76uLDk6mFMnz04AhWOp7hlJVg=; b=EmUGKfe6l5MxdSCdSvoxvL691fGZI+os/AJ7XQ6PCPjjw6AtHJBW2v9FMgfRdcX3b2 uudUwC+WKk+UWMNSwabqw8Vbq9+LIwcTtg1Nb342ClPuUqwexK27xl0NTuYKy+VkZLpl q/o1EMUysvg66C9V3vfVVISSqWu/iHM7ZchthWu3O2rl1wRtRfydEN/sg3KHuPQc1EoB SCxmYx1hOq5SfvhWvyCK3rpzithcpwqOWzgt6ASiLQSkpL0YublJGrsD6An2UfdGR+Pk tCEWL4nD2Fm//hjex2PZ+2X6AyAj+EZUfGm04CSpD8uaiHiXvZyUAkDDU6YOPgE1IrSr N/pg== X-Gm-Message-State: AOAM531R7/uTnNQgVOCBoeYVhUkjAZHd0pr8QH/zjtpE4oZzboUt0z8R Ejxfqb3G3FjsE6vBPdVwxM740RMD9MGUbQ== X-Google-Smtp-Source: ABdhPJyevG0HWyKCvOJFmiTxT0b5HWs+ZF3drrMUb/aqesLJCi5BGVK4MF4JSDcN2/QHJNVTAgV2hw== X-Received: by 2002:a37:a309:: with SMTP id m9mr11869714qke.477.1608431342278; Sat, 19 Dec 2020 18:29:02 -0800 (PST) Received: from localhost ([208.104.103.123]) by smtp.gmail.com with ESMTPSA id z20sm8502330qtb.31.2020.12.19.18.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Dec 2020 18:29:01 -0800 (PST) From: Matt Turner To: gentoo-catalyst@lists.gentoo.org Cc: Matt Turner Subject: [gentoo-catalyst] [PATCH 6/7] targets: Remove make_destpath() function Date: Sat, 19 Dec 2020 21:28:47 -0500 Message-Id: <20201220022848.249207-6-mattst88@gentoo.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201220022848.249207-1-mattst88@gentoo.org> References: <20201220022848.249207-1-mattst88@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 24c2dc5b-609f-4941-ac38-a1321af7f7bb X-Archives-Hash: 0bd687d2c97ad28abc9c226c100111be It just read clst_root_path, exported it as ROOT, and ensured that a directory existed at $ROOT. Setting and resetting clst_* variables adds a lot of confusion, so just use ROOT directly. Signed-off-by: Matt Turner --- targets/embedded/chroot.sh | 15 ++++++-------- targets/netboot/controller.sh | 2 +- targets/netboot/pkg.sh | 2 +- targets/stage1/chroot.sh | 12 ++++++----- targets/stage1/controller.sh | 4 ++-- targets/support/chroot-functions.sh | 32 ++++++----------------------- 6 files changed, 23 insertions(+), 44 deletions(-) diff --git a/targets/embedded/chroot.sh b/targets/embedded/chroot.sh index 2fbba278..11068388 100755 --- a/targets/embedded/chroot.sh +++ b/targets/embedded/chroot.sh @@ -2,14 +2,11 @@ source /tmp/chroot-functions.sh -# Setup the environment -export DESTROOT="${clst_root_path}" -export clst_root_path="/" +echo "Installing dependencies..." +ROOT=/ run_merge -o "${clst_embedded_packages}" -echo "Installing dependencies into ${DESTROOT}..." -run_merge -o "${clst_embedded_packages}" +export ROOT="${clst_root_path}" +mkdir -p "$ROOT" -export clst_root_path="${DESTROOT}" -export INSTALL_MASK="${clst_install_mask}" - -run_merge -1 -O "${clst_embedded_packages}" +INSTALL_MASK="${clst_install_mask}" \ + run_merge -1 -O "${clst_embedded_packages}" diff --git a/targets/netboot/controller.sh b/targets/netboot/controller.sh index 9a6e14d2..cc946c2c 100755 --- a/targets/netboot/controller.sh +++ b/targets/netboot/controller.sh @@ -6,7 +6,7 @@ case ${1} in build_packages) echo ">>> Building packages ..." shift - clst_root_path="/" \ + ROOT="/" \ clst_packages="$*" \ exec_in_chroot \ ${clst_shdir}/${clst_target}/pkg.sh diff --git a/targets/netboot/pkg.sh b/targets/netboot/pkg.sh index 2ec27062..2ad9491c 100755 --- a/targets/netboot/pkg.sh +++ b/targets/netboot/pkg.sh @@ -10,4 +10,4 @@ show_debug # START BUILD -run_merge ${clst_packages} +ROOT="$ROOT" run_merge ${clst_packages} diff --git a/targets/stage1/chroot.sh b/targets/stage1/chroot.sh index 33d5c3c9..b733fc57 100755 --- a/targets/stage1/chroot.sh +++ b/targets/stage1/chroot.sh @@ -33,9 +33,9 @@ if [ -n "${clst_update_seed}" ]; then if [ "${clst_update_seed}" == "yes" ]; then echo "Updating seed stage..." if [ -n "${clst_update_seed_command}" ]; then - clst_root_path=/ run_merge --buildpkg=n "${clst_update_seed_command}" + ROOT=/ run_merge --buildpkg=n "${clst_update_seed_command}" else - clst_root_path=/ run_merge --update --deep --newuse --complete-graph --rebuild-if-new-ver gcc + ROOT=/ run_merge --update --deep --newuse --complete-graph --rebuild-if-new-ver gcc fi elif [ "${clst_update_seed}" != "no" ]; then echo "Invalid setting for update_seed: ${clst_update_seed}" @@ -50,7 +50,9 @@ fi # Clear USE [ -e ${clst_make_conf} ] && sed -i -e "/^USE=\"${BINDIST} ${USE}\"/d" ${clst_make_conf} -make_destpath "${clst_root_path}" + +export ROOT="${clst_root_path}" +mkdir -p "$ROOT" ## START BUILD # First, we drop in a known-good baselayout @@ -59,7 +61,7 @@ run_merge --oneshot --nodeps sys-apps/baselayout sed -i "/USE=\"${USE} -build\"/d" ${clst_make_conf} echo "$locales" > /etc/locale.gen -for etc in /etc "${clst_root_path}"/etc; do +for etc in /etc "$ROOT"/etc; do echo "LANG=C.UTF8" > ${etc}/env.d/02locale done update_env_settings @@ -84,7 +86,7 @@ run_merge --oneshot "${buildpkgs[@]}" # not run locale-gen when ROOT is set. Since we've set LANG, we need to run # locale-gen explicitly. if [ -x "$(command -v locale-gen)" ]; then - locale-gen --destdir "${clst_root_path}"/ || die "locale-gen failed" + locale-gen --destdir "$ROOT"/ || die "locale-gen failed" fi # Why are we removing these? Don't we need them for final make.conf? diff --git a/targets/stage1/controller.sh b/targets/stage1/controller.sh index f9dd4b9b..ab127114 100755 --- a/targets/stage1/controller.sh +++ b/targets/stage1/controller.sh @@ -10,8 +10,8 @@ case "$1" in cp "${clst_shdir}/stage1/build.py" "${clst_chroot_path}/tmp" # Setup "ROOT in chroot" dir - install -d "${clst_chroot_path}/${clst_root_path}/etc" - install -d "${clst_chroot_path}/${clst_root_path}${clst_port_conf}" + install -d "${clst_stage_path}/etc" + install -d "${clst_stage_path}/${clst_port_conf}" # Setup make.conf and make.profile link in "ROOT in chroot": copy_to_chroot "${clst_chroot_path}${clst_make_conf}" "${clst_root_path}${clst_port_conf}" diff --git a/targets/support/chroot-functions.sh b/targets/support/chroot-functions.sh index d125756f..2aec018e 100755 --- a/targets/support/chroot-functions.sh +++ b/targets/support/chroot-functions.sh @@ -60,7 +60,7 @@ setup_features() { if [ -n "${clst_CCACHE}" ] then features+=(ccache) - clst_root_path=/ run_merge --oneshot --noreplace dev-util/ccache + ROOT=/ run_merge --oneshot --noreplace dev-util/ccache fi if [ -n "${clst_DISTCC}" ] @@ -75,9 +75,9 @@ setup_features() { # reinstall if it isn't found. if [ "$(getent passwd distcc | cut -d: -f1)" != "distcc" ] then - clst_root_path=/ run_merge --oneshot sys-devel/distcc + ROOT=/ run_merge --oneshot sys-devel/distcc else - clst_root_path=/ run_merge --oneshot --noreplace sys-devel/distcc + ROOT=/ run_merge --oneshot --noreplace sys-devel/distcc fi sed -i '/USE="${USE} -avahi -gtk -gnome"/d' ${clst_make_conf} mkdir -p /etc/distcc @@ -96,7 +96,7 @@ setup_features() { if [ -n "${clst_ICECREAM}" ] then - clst_root_path=/ run_merge --oneshot --noreplace sys-devel/icecream + ROOT=/ run_merge --oneshot --noreplace sys-devel/icecream # This sets up automatic cross-icecc-fu according to # http://www.gentoo-wiki.info/HOWTO_Setup_An_ICECREAM_Compile_Cluster @@ -193,7 +193,6 @@ cleanup_icecream() { } cleanup_stages() { - make_destpath if [ -n "${clst_DISTCC}" ] then cleanup_distcc @@ -238,26 +237,7 @@ die() { exit 1 } -make_destpath() { - # ROOT is / by default, so remove any ROOT= settings from make.conf - sed -i '/ROOT=/d' ${clst_make_conf} - export ROOT=/ - if [ "${1}" != "/" -a -n "${1}" ] - then - echo "ROOT=\"${1}\"" >> ${clst_make_conf} - export ROOT=${1} - fi - if [ ! -d ${ROOT} ] - then - install -d ${ROOT} - fi -} - run_merge() { - # Sets up the ROOT= parameter - # with no options ROOT=/ - make_destpath ${clst_root_path} - export EMERGE_WARNING_DELAY=0 export CLEAN_DELAY=0 [[ $CONFIG_PROTECT != "-*"* ]] && export CONFIG_PROTECT="-*" @@ -265,12 +245,12 @@ run_merge() { if [ -n "${clst_VERBOSE}" ] then echo "ROOT=${ROOT} emerge ${emerge_opts[@]} -pt $@" || exit 1 - emerge ${emerge_opts[@]} -pt $@ || exit 3 + ROOT="$ROOT" emerge ${emerge_opts[@]} -pt $@ || exit 3 fi echo "emerge ${emerge_opts[@]} $@" || exit 1 - emerge ${emerge_opts[@]} $@ || exit 1 + ROOT="$ROOT" emerge ${emerge_opts[@]} $@ || exit 1 } show_debug() { -- 2.26.2