* [gentoo-commits] proj/portage:master commit in: pym/portage/_sets/, pym/_emerge/
@ 2011-06-05 16:13 Zac Medico
0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2011-06-05 16:13 UTC (permalink / raw
To: gentoo-commits
commit: 0f799b2a045dfa74ba011123bf5ea6186f44941d
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 5 16:13:35 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jun 5 16:13:35 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0f799b2a
Enable atom::repo in the @selected package set.
---
pym/_emerge/create_world_atom.py | 10 ++++++++--
pym/portage/_sets/files.py | 6 +++---
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/pym/_emerge/create_world_atom.py b/pym/_emerge/create_world_atom.py
index 5496418..d0141f7 100644
--- a/pym/_emerge/create_world_atom.py
+++ b/pym/_emerge/create_world_atom.py
@@ -1,6 +1,8 @@
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+from portage.dep import _repo_separator
+
def create_world_atom(pkg, args_set, root_config):
"""Create a new atom for the world file if one does not exist. If the
argument atom is precise enough to identify a specific slot then a slot
@@ -14,6 +16,8 @@ def create_world_atom(pkg, args_set, root_config):
return None
cp = arg_atom.cp
new_world_atom = cp
+ if arg_atom.repo:
+ new_world_atom += _repo_separator + arg_atom.repo
sets = root_config.sets
portdb = root_config.trees["porttree"].dbapi
vardb = root_config.trees["vartree"].dbapi
@@ -64,11 +68,13 @@ def create_world_atom(pkg, args_set, root_config):
matched_slots.add(mydb.aux_get(cpv, ["SLOT"])[0])
if len(matched_slots) == 1:
new_world_atom = slot_atom
+ if arg_atom.repo:
+ new_world_atom += _repo_separator + arg_atom.repo
if new_world_atom == sets["selected"].findAtomForPackage(pkg):
# Both atoms would be identical, so there's nothing to add.
return None
- if not slotted:
+ if not slotted and not arg_atom.repo:
# Unlike world atoms, system atoms are not greedy for slots, so they
# can't be safely excluded from world if they are slotted.
system_atom = sets["system"].findAtomForPackage(pkg)
diff --git a/pym/portage/_sets/files.py b/pym/portage/_sets/files.py
index 8c8aeef..f19ecf6 100644
--- a/pym/portage/_sets/files.py
+++ b/pym/portage/_sets/files.py
@@ -1,4 +1,4 @@
-# Copyright 2007 Gentoo Foundation
+# Copyright 2007-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import errno
@@ -209,7 +209,7 @@ class WorldSelectedSet(EditablePackageSet):
description = "Set of packages that were directly installed by the user"
def __init__(self, eroot):
- super(WorldSelectedSet, self).__init__()
+ super(WorldSelectedSet, self).__init__(allow_repo=True)
# most attributes exist twice as atoms and non-atoms are stored in
# separate files
self._lock = None
@@ -222,7 +222,7 @@ class WorldSelectedSet(EditablePackageSet):
self._mtime2 = None
def _validate(self, atom):
- return ValidAtomValidator(atom)
+ return ValidAtomValidator(atom, allow_repo=True)
def _validate2(self, setname):
return setname.startswith(SETPREFIX)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/_sets/, pym/_emerge/
@ 2013-02-21 22:25 Zac Medico
0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2013-02-21 22:25 UTC (permalink / raw
To: gentoo-commits
commit: 2c7155b8419eb1b7ba99760a962093ad19e2ce8f
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 21 22:23:57 2013 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Feb 21 22:24:35 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2c7155b8
_world_atom: avoid world set lock reentrance
This fixes a case with FEATURE=parallel-install, where a call from
_world_atom to the global event loop could result in reentrace and
lock interference.
---
pym/_emerge/Scheduler.py | 19 ++++++++++++++-----
pym/portage/_sets/files.py | 6 +++++-
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py
index 4b29c71..5930550 100644
--- a/pym/_emerge/Scheduler.py
+++ b/pym/_emerge/Scheduler.py
@@ -1896,11 +1896,21 @@ class Scheduler(PollScheduler):
root_config = pkg.root_config
world_set = root_config.sets["selected"]
world_locked = False
- if hasattr(world_set, "lock"):
- world_set.lock()
- world_locked = True
+ atom = None
+
+ if pkg.operation != "uninstall":
+ # Do this before acquiring the lock, since it queries the
+ # portdbapi which can call the global event loop, triggering
+ # a concurrent call to this method or something else that
+ # needs an exclusive (non-reentrant) lock on the world file.
+ atom = create_world_atom(pkg, args_set, root_config)
try:
+
+ if hasattr(world_set, "lock"):
+ world_set.lock()
+ world_locked = True
+
if hasattr(world_set, "load"):
world_set.load() # maybe it's changed on disk
@@ -1912,8 +1922,7 @@ class Scheduler(PollScheduler):
for s in pkg.root_config.setconfig.active:
world_set.remove(SETPREFIX+s)
else:
- atom = create_world_atom(pkg, args_set, root_config)
- if atom:
+ if atom is not None:
if hasattr(world_set, "add"):
self._status_msg(('Recording %s in "world" ' + \
'favorites file...') % atom)
diff --git a/pym/portage/_sets/files.py b/pym/portage/_sets/files.py
index b839582..2fb64de 100644
--- a/pym/portage/_sets/files.py
+++ b/pym/portage/_sets/files.py
@@ -1,4 +1,4 @@
-# Copyright 2007-2012 Gentoo Foundation
+# Copyright 2007-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import errno
@@ -296,10 +296,14 @@ class WorldSelectedSet(EditablePackageSet):
ensure_dirs(os.path.dirname(self._filename), gid=portage_gid, mode=0o2750, mask=0o2)
def lock(self):
+ if self._lock is not None:
+ raise AssertionError("already locked")
self._ensure_dirs()
self._lock = lockfile(self._filename, wantnewlockfile=1)
def unlock(self):
+ if self._lock is None:
+ raise AssertionError("not locked")
unlockfile(self._lock)
self._lock = None
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-02-21 22:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-05 16:13 [gentoo-commits] proj/portage:master commit in: pym/portage/_sets/, pym/_emerge/ Zac Medico
-- strict thread matches above, loose matches on Subject: below --
2013-02-21 22:25 Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox