* [gentoo-commits] portage r12741 - in main/trunk/pym: _emerge portage portage/dbapi
@ 2009-03-02 23:00 Zac Medico (zmedico)
0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2009-03-02 23:00 UTC (permalink / raw
To: gentoo-commits
Author: zmedico
Date: 2009-03-02 22:59:59 +0000 (Mon, 02 Mar 2009)
New Revision: 12741
Modified:
main/trunk/pym/_emerge/__init__.py
main/trunk/pym/portage/__init__.py
main/trunk/pym/portage/dbapi/porttree.py
Log:
When ACCEPT_CHOSTS is set, enable CHOST masking for unbuilt ebuilds. This
behaves as a sanity check to protect people who are cross-compiling from
accidentally merging an ebuild with CHOST set incorrectly. Thanks to Ned
Ludd <solar@g.o> for reporting the problem.
Modified: main/trunk/pym/_emerge/__init__.py
===================================================================
--- main/trunk/pym/_emerge/__init__.py 2009-03-02 22:37:58 UTC (rev 12740)
+++ main/trunk/pym/_emerge/__init__.py 2009-03-02 22:59:59 UTC (rev 12741)
@@ -1387,8 +1387,8 @@
"""
if not pkg.metadata["SLOT"]:
return False
- if pkg.built and not pkg.installed and "CHOST" in pkg.metadata:
- if not pkgsettings._accept_chost(pkg):
+ if not pkg.installed:
+ if not pkgsettings._accept_chost(pkg.cpv, pkg.metadata):
return False
eapi = pkg.metadata["EAPI"]
if not portage.eapi_is_supported(eapi):
@@ -1415,8 +1415,8 @@
pkg, settings=pkgsettings,
portdb=root_config.trees["porttree"].dbapi)
- if pkg.built and not pkg.installed and "CHOST" in pkg.metadata:
- if not pkgsettings._accept_chost(pkg):
+ if not pkg.installed:
+ if not pkgsettings._accept_chost(pkg.cpv, pkg.metadata):
mreasons.append("CHOST: %s" % \
pkg.metadata["CHOST"])
@@ -1436,6 +1436,7 @@
if metadata and not built:
pkgsettings.setcpv(cpv, mydb=metadata)
metadata["USE"] = pkgsettings["PORTAGE_USE"]
+ metadata['CHOST'] = pkgsettings.get('CHOST', '')
if metadata is None:
mreasons = ["corruption"]
else:
@@ -5468,6 +5469,7 @@
cpv=mykey, metadata=metadata, onlydeps=onlydeps)
pkgsettings.setcpv(pkg)
pkg.metadata["USE"] = pkgsettings["PORTAGE_USE"]
+ pkg.metadata['CHOST'] = pkgsettings.get('CHOST', '')
self._pkg_cache[pkg] = pkg
args.append(PackageArg(arg=x, package=pkg,
root_config=root_config))
@@ -6188,6 +6190,8 @@
onlydeps=onlydeps, root_config=root_config,
type_name=pkg_type)
metadata = pkg.metadata
+ if not built:
+ metadata['CHOST'] = pkgsettings.get('CHOST', '')
if not built and ("?" in metadata["LICENSE"] or \
"?" in metadata["PROVIDE"]):
# This is avoided whenever possible because
@@ -6521,6 +6525,7 @@
settings = self.pkgsettings[root_config.root]
settings.setcpv(pkg)
pkg.metadata["USE"] = settings["PORTAGE_USE"]
+ pkg.metadata['CHOST'] = settings.get('CHOST', '')
self._pkg_cache[pkg] = pkg
return pkg
@@ -8696,6 +8701,7 @@
pkgsettings = self.pkgsettings[myroot]
pkgsettings.setcpv(pkg)
pkg.metadata["USE"] = pkgsettings["PORTAGE_USE"]
+ pkg.metadata['CHOST'] = pkgsettings.get('CHOST', '')
self._pkg_cache[pkg] = pkg
root_config = self.roots[pkg.root]
@@ -11439,6 +11445,7 @@
settings = self.pkgsettings[root_config.root]
settings.setcpv(pkg)
pkg.metadata["USE"] = settings["PORTAGE_USE"]
+ pkg.metadata['CHOST'] = settings.get('CHOST', '')
return pkg
Modified: main/trunk/pym/portage/__init__.py
===================================================================
--- main/trunk/pym/portage/__init__.py 2009-03-02 22:37:58 UTC (rev 12740)
+++ main/trunk/pym/portage/__init__.py 2009-03-02 22:59:59 UTC (rev 12741)
@@ -2538,7 +2538,7 @@
ret.append(element)
return ret
- def _accept_chost(self, pkg):
+ def _accept_chost(self, cpv, metadata):
"""
@return True if pkg CHOST is accepted, False otherwise.
"""
@@ -2567,7 +2567,7 @@
self._accept_chost_re = re.compile("^$")
return self._accept_chost_re.match(
- pkg.metadata.get("CHOST", "")) is not None
+ metadata.get('CHOST', '')) is not None
def setinst(self,mycpv,mydbapi):
"""This updates the preferences for old-style virtuals,
Modified: main/trunk/pym/portage/dbapi/porttree.py
===================================================================
--- main/trunk/pym/portage/dbapi/porttree.py 2009-03-02 22:37:58 UTC (rev 12740)
+++ main/trunk/pym/portage/dbapi/porttree.py 2009-03-02 22:59:59 UTC (rev 12741)
@@ -856,6 +856,8 @@
aux_keys = list(self._aux_cache_keys)
metadata = {}
local_config = self.mysettings.local_config
+ chost = self.mysettings.get('CHOST', '')
+ accept_chost = self.mysettings._accept_chost
for mycpv in mylist:
metadata.clear()
try:
@@ -876,6 +878,9 @@
if self.mysettings._getMissingKeywords(mycpv, metadata):
continue
if local_config:
+ metadata['CHOST'] = chost
+ if not accept_chost(mycpv, metadata):
+ continue
metadata["USE"] = ""
if "?" in metadata["LICENSE"]:
self.doebuild_settings.setcpv(mycpv, mydb=metadata)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-03-02 23:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-02 23:00 [gentoo-commits] portage r12741 - in main/trunk/pym: _emerge portage portage/dbapi Zac Medico (zmedico)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox