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 8D7C41382C5 for ; Sat, 27 Feb 2021 01:20:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D0C22E088D; Sat, 27 Feb 2021 01:20:13 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 B6262E088D for ; Sat, 27 Feb 2021 01:20:13 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A4495335DEF for ; Sat, 27 Feb 2021 01:20:12 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E150E46B for ; Sat, 27 Feb 2021 01:20:10 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1614388571.cb354edf61a133798e81e7059bdfcaeb25c13982.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/_compat_upgrade/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/_compat_upgrade/binpkg_multi_instance.py X-VCS-Directories: lib/portage/_compat_upgrade/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: cb354edf61a133798e81e7059bdfcaeb25c13982 X-VCS-Branch: master Date: Sat, 27 Feb 2021 01:20:10 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 5ecad2c8-9689-4b3c-a6da-394388f518e6 X-Archives-Hash: a64ad16bac8c7fb14f316c93df44b81a commit: cb354edf61a133798e81e7059bdfcaeb25c13982 Author: Zac Medico gentoo org> AuthorDate: Fri Feb 26 23:15:09 2021 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Feb 27 01:16:11 2021 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=cb354edf make.globals: make FEATURES=-binpkg-multi-instance sticky for existing installs Add a _compat_upgrade.binpkg_multi_instance script that the ebuild can call in pkg_preinst in order to maintain a backward-compatible FEATURES=-binpkg-multi-instance default on existing installs where enabling binpkg-multi-instance could cause disruption. Bug: https://bugs.gentoo.org/772785 Signed-off-by: Zac Medico gentoo.org> .../_compat_upgrade/binpkg_multi_instance.py | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lib/portage/_compat_upgrade/binpkg_multi_instance.py b/lib/portage/_compat_upgrade/binpkg_multi_instance.py new file mode 100644 index 000000000..b4aabe8b2 --- /dev/null +++ b/lib/portage/_compat_upgrade/binpkg_multi_instance.py @@ -0,0 +1,33 @@ +# Copyright 2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +import portage +from portage import os +from portage.const import GLOBAL_CONFIG_PATH + +COMPAT_FEATURES = 'FEATURES="${FEATURES} -binpkg-multi-instance"' + + +def main(): + """ + If the current installation is still has binpkg-multi-instance + disabled, then patch make.globals inside ${ED} to maintain backward + compatibility. This is intended to be called from the ebuild as + follows: + + pkg_preinst() { + python_setup + env -u FEATURES -u PORTAGE_REPOSITORIES \ + PYTHONPATH="${D}$(python_get_sitedir)${PYTHONPATH:+:${PYTHONPATH}}" \ + "${PYTHON}" -m portage._compat_upgrade.binpkg_multi_instance || die + } + """ + if 'binpkg-multi-instance' not in portage.settings.features: + portage.output.EOutput().einfo('Setting make.globals default {} for backward compatibility'.format(COMPAT_FEATURES)) + config_path = os.path.join(os.environ['ED'], GLOBAL_CONFIG_PATH.lstrip(os.sep), 'make.globals') + with open(config_path, 'at') as f: + f.write("{}\n".format(COMPAT_FEATURES)) + + +if __name__ == '__main__': + main()