From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Px9Xl-0001Ua-Kf for garchives@archives.gentoo.org; Wed, 09 Mar 2011 02:54:34 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 88039E0574; Wed, 9 Mar 2011 02:54:24 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 3E16DE0574 for ; Wed, 9 Mar 2011 02:54:24 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A304D1B4155 for ; Wed, 9 Mar 2011 02:54:23 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id E87DD8006A for ; Wed, 9 Mar 2011 02:54:22 +0000 (UTC) From: "Arfrever Frehtes Taifersar Arahesis" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arfrever Frehtes Taifersar Arahesis" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/unmerge.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: arfrever X-VCS-Committer-Name: Arfrever Frehtes Taifersar Arahesis X-VCS-Revision: cab19378be406d18a80114d00007e12b3310586d Date: Wed, 9 Mar 2011 02:54:22 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 0bb8f06ae5a03be2bfb18741969a499c commit: cab19378be406d18a80114d00007e12b3310586d Author: Arfrever Frehtes Taifersar Arahesis Gentoo Org> AuthorDate: Wed Mar 9 02:57:23 2011 +0000 Commit: Arfrever Frehtes Taifersar Arahesis gentoo org> CommitDate: Wed Mar 9 02:57:23 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dcab19378 Bug #357009: Disallow uninstallation of currently used Python interpreter= . --- pym/_emerge/unmerge.py | 34 +++++++++++++++++++++------------- 1 files changed, 21 insertions(+), 13 deletions(-) diff --git a/pym/_emerge/unmerge.py b/pym/_emerge/unmerge.py index df95f69..a6a330c 100644 --- a/pym/_emerge/unmerge.py +++ b/pym/_emerge/unmerge.py @@ -7,6 +7,7 @@ import logging import sys import textwrap import portage +import portage.dbapi.vartree from portage import os from portage.output import bold, colorize, darkgreen, green from portage._sets import SETPREFIX @@ -314,19 +315,26 @@ def unmerge(root_config, myopts, unmerge_action, # by a concurrent process. continue =20 - if unmerge_action !=3D "clean" and \ - root_config.root =3D=3D "/" and \ - portage.match_from_list( - portage.const.PORTAGE_PACKAGE_ATOM, [pkg]): - msg =3D ("Not unmerging package %s since there is no valid " + \ - "reason for portage to unmerge itself.") % (pkg.cpv,) - for line in textwrap.wrap(msg, 75): - out.eerror(line) - # adjust pkgmap so the display output is correct - pkgmap[cp]["selected"].remove(cpv) - all_selected.remove(cpv) - pkgmap[cp]["protected"].add(cpv) - continue + if unmerge_action !=3D "clean" and root_config.root =3D=3D "/": + skip_pkg =3D False + if portage.match_from_list(portage.const.PORTAGE_PACKAGE_ATOM, [pkg]= ): + msg =3D ("Not unmerging package %s since there is no valid reason " + "for Portage to unmerge itself.") % (pkg.cpv,) + skip_pkg =3D True + elif portage.dbapi.vartree.dblink(pkg.category, pkg.pf, + settings=3Dsettings, treetype=3D"vartree", vartree=3Dvartree, + scheduler=3Dscheduler).isowner(portage._python_interpreter): + msg =3D ("Not unmerging package %s since there is no valid reason " + "for Portage to unmerge currently used Python interpreter.") % (pk= g.cpv,) + skip_pkg =3D True + if skip_pkg: + for line in textwrap.wrap(msg, 75): + out.eerror(line) + # adjust pkgmap so the display output is correct + pkgmap[cp]["selected"].remove(cpv) + all_selected.remove(cpv) + pkgmap[cp]["protected"].add(cpv) + continue =20 parents =3D [] for s in installed_sets: