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 C662A138350 for ; Mon, 30 Mar 2020 03:26:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E1C49E093A; Mon, 30 Mar 2020 03:26:58 +0000 (UTC) Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) (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 CAE05E093A for ; Mon, 30 Mar 2020 03:26:58 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id h11so6180342plk.7 for ; Sun, 29 Mar 2020 20:26:58 -0700 (PDT) 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=4FiGTYB7E8hpL+sZCCIO1IZfyrlYu2ykTyuAex4fGbY=; b=PY0zcaC/5za5l4ceOp6WErNE2wQP2Tz22VGKW+p7nY68pYawBCuFfGOBEL6MpzoN7l KOWaRauhdowGV8nTWq78O1ySJ/05HwuonKAlwm0ifj1HIAopjRGtjTxjVzGPwCjis8nM j/zH7fS29vKhjQO9gXXdRifFYHTvXYYEcuRNJWEuZHKUvTuwud6IjYzgcUElKfq7qhh2 NjAzhvbhmuPtWPI1x/FhllAwRiic9bZHRGFaCEkU3+VytxcHEfJJP5MpXCjOX9xmbOfA rE1XNxeCAVOuu12dkHMwlR0I1cg/COCULUHLWaa/wMcxRwEuemB2dLwNWTLNVKdNRe9D znpg== X-Gm-Message-State: ANhLgQ3pq9pj/8L640UglrbpksA8I6825S++OniWEMZaiin+mgJ+G6Nw qwZN/kXAQrQLbtfqzadCTUZ9+Lcf/nU= X-Google-Smtp-Source: ADFU+vtmMru7pOXUqj28zM5ytydZWzVMwyBC4vnV+DZrAq61uIGLxgeZl/flGojgSnZwK8mUWq7Mew== X-Received: by 2002:a17:90b:3653:: with SMTP id nh19mr13626490pjb.154.1585538817412; Sun, 29 Mar 2020 20:26:57 -0700 (PDT) Received: from localhost ([108.161.26.224]) by smtp.gmail.com with ESMTPSA id q12sm9092865pfs.48.2020.03.29.20.26.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Mar 2020 20:26:56 -0700 (PDT) From: Matt Turner To: gentoo-catalyst@lists.gentoo.org Cc: Matt Turner Subject: [gentoo-catalyst] [PATCH 2/2] targets: Reduce locales to C.UTF8 in stage builds Date: Sun, 29 Mar 2020 20:26:44 -0700 Message-Id: <20200330032644.3086274-2-mattst88@gentoo.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200330032644.3086274-1-mattst88@gentoo.org> References: <20200330032644.3086274-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: eb49afae-0eea-4482-892b-eb6faa2a78e5 X-Archives-Hash: dfe2261f95c58a20dece3c9d5e99b7d4 By default, glibc generates around 500 locales with more added each year. With USE=-compile-locales, glibc generates the locale archive in pkg_postinst(). Since files generated in pkg_postinst() are not recorded in the vdb, this has the advantage of allowing users to freely change the set of enabled locales (by editing /etc/locale.gen and running locale-gen). Since it is so easy for the user to generate any locales they want with locale-gen (and they probably would have anyway to rid themselves of the 499 locales they don't want!), just disable all locales except for C.UTF8 and save stage builders a lot of time. The patch works by (1) Writing /etc/locale.gen with "C.UTF8 UTF-8" (2) Setting CONFIG_PROTECT so glibc doesn't overwrite /etc/locale.gen (3) Running etc-update to reset /etc/locale.gen In order to do this I modified scripts/bootstrap.sh in commit 0aa49828ae25 (scripts/bootstrap.sh: Allow CONFIG_PROTECT). Reducing the set of locales cuts the user time (as reported by time(1)) of the stage2 and stage3 builds as well as the file size of the resulting xz'd tarballs: stage 2 stage 3 size time size time before 89M 22m42s 206M 45m5s after 77M 4m29s 195M 26m8s An alternative solution would be to set USE=compiled-locales for glibc, but that has the downside of being non-default and likely causing users to unnecessarily rebuild glibc. (We'll do this for the ISOs where we want all the locales) Note that this patch does not change the contents of /etc/locale.gen in the stage3 tarball. Closes: https://bugs.gentoo.org/686862 Signed-off-by: Matt Turner --- In order to avoid shipping ISOs with a reduced set of locales, I'm going to delay committing this patch until glibc-2.30 is stablized, which has USE=compile-locales. I'll send a corresponding patch for releng.git that enables USE=compile-locales for the ISOs. targets/stage1/chroot.sh | 1 + targets/stage2/chroot.sh | 6 ++++++ targets/stage3/chroot.sh | 7 +++++++ targets/support/chroot-functions.sh | 6 +++++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/targets/stage1/chroot.sh b/targets/stage1/chroot.sh index 88a36481..639feaa4 100755 --- a/targets/stage1/chroot.sh +++ b/targets/stage1/chroot.sh @@ -57,6 +57,7 @@ make_destpath /tmp/stage1root run_merge "--oneshot --nodeps sys-apps/baselayout" ${clst_sed} -i "/USE=\"${USE} -build\"/d" ${clst_make_conf} +echo "$locales" > /etc/locale.gen for etc in /etc /tmp/stage1root/etc; do echo "LANG=C.UTF8" > ${etc}/env.d/02locale done diff --git a/targets/stage2/chroot.sh b/targets/stage2/chroot.sh index 5fac858f..bf98d328 100755 --- a/targets/stage2/chroot.sh +++ b/targets/stage2/chroot.sh @@ -4,6 +4,12 @@ source /tmp/chroot-functions.sh # Setup the environment export FEATURES="${clst_myfeatures} nodoc noman noinfo -news" +export CONFIG_PROTECT="-* /etc/locale.gen" + +echo "$locales" > /etc/locale.gen ## START BUILD ${clst_repo_basedir}/${clst_repo_name}/scripts/bootstrap.sh ${bootstrap_opts} || exit 1 + +# Replace modified /etc/locale.gen with default +etc-update --automode -5 diff --git a/targets/stage3/chroot.sh b/targets/stage3/chroot.sh index 4f8bb0ee..e6712015 100755 --- a/targets/stage3/chroot.sh +++ b/targets/stage3/chroot.sh @@ -5,4 +5,11 @@ source /tmp/chroot-functions.sh ## START BUILD setup_pkgmgr +export CONFIG_PROTECT="-* /etc/locale.gen" + +echo "$locales" > /etc/locale.gen + run_merge "-e --update --deep --with-bdeps=y @system" + +# Replace modified /etc/locale.gen with default +etc-update --automode -5 diff --git a/targets/support/chroot-functions.sh b/targets/support/chroot-functions.sh index 2207e7b4..942fc116 100755 --- a/targets/support/chroot-functions.sh +++ b/targets/support/chroot-functions.sh @@ -286,7 +286,7 @@ run_merge() { export CLEAN_DELAY=0 export EBEEP_IGNORE=0 export EPAUSE_IGNORE=0 - export CONFIG_PROTECT="-*" + [[ $CONFIG_PROTECT != "-*"* ]] && export CONFIG_PROTECT="-*" if [[ "${clst_VERBOSE}" == "true" ]] then @@ -433,5 +433,9 @@ Comment=This is a link to the local copy of the Gentoo Linux Handbook. Icon=text-editor" > /usr/share/applications/gentoo-handbook.desktop } +readonly locales=" +C.UTF8 UTF-8 +" + # We do this everywhere, so why not put it in this script run_default_funcs -- 2.24.1