From b7be5d49c6aec87a9d26bb284807476813310cf7 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Mon, 2 Jun 2008 20:40:08 +0000 Subject: [PATCH] Merged from trunk 10521:10541 | 10523 | Make PackageSet._setAtoms() use existing Atom instances when | | zmedico | available. | | 10525 | Fix EditablePackageSet.update() to create Atom instances | | zmedico | when necessary. | | 10526 | Make --skipfirst tolerate masked packages by dropping them | | zmedico | (similar to how it would drop a package that has an | | | unsatisfied dependency). | | 10528 | Revert changes wrt argument atoms in the previous commit | | zmedico | since it's not really useful. | | 10529 | Update the UnsatisfiedResumeDep display to distinguish | | zmedico | masked packages from those with unsatisfied dependencies. | | 10532 | Update the --skipfirst dropped packages warning to mention | | zmedico | "masking" in addition to unsatisfied dependencies. | | 10533 | Reference depgraph.UnsatisfiedResumeDep instead of | | zmedico | mydepgraph since the latter can trigger an UnboundLocalError | | | in some cases (^C for example). | | 10535 | Mention masked packages in another --resume message. | | zmedico | | | 10538 | Fix typo. | | zmedico | | | 10541 | Filter PORTAGE_BINPKG_FILE in save_ebuild_env(). | | zmedico | | svn path=/main/branches/prefix/; revision=10545 --- bin/isolated-functions.sh | 1 + pym/_emerge/__init__.py | 46 +++++++++++++++++++++++++-------------- pym/portage/sets/base.py | 33 ++++++++++++++++++---------- 3 files changed, 52 insertions(+), 28 deletions(-) diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index ddb8e040e..d12fb64a7 100755 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -487,6 +487,7 @@ save_ebuild_env() { LAST_E_CMD LAST_E_LEN LD_PRELOAD MISC_FUNCTIONS_ARGS MOPREFIX \ NORMAL PKGDIR PKGUSE PKG_LOGDIR PKG_TMPDIR \ PORTAGE_ACTUAL_DISTDIR PORTAGE_ARCHLIST PORTAGE_BASHRC \ + PORTAGE_BINPKG_FILE \ PORTAGE_BINPKG_TAR_OPTS PORTAGE_BINPKG_TMPFILE PORTAGE_BUILDDIR \ PORTAGE_COLORMAP PORTAGE_CONFIGROOT PORTAGE_DEBUG \ PORTAGE_DEPCACHEDIR PORTAGE_GID PORTAGE_INST_GID \ diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 495a5fa49..119737cec 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -5264,7 +5264,7 @@ class depgraph(object): continue try: - myfavkey = create_world_atom(pkg, args_set, root_config) + myfavkey = create_world_atom(x, args_set, root_config) if myfavkey: if myfavkey in added_favorites: continue @@ -5305,9 +5305,11 @@ class depgraph(object): if not isinstance(mergelist, list): mergelist = [] + skipfirst = "--skipfirst" in self.myopts fakedb = self.mydbapi trees = self.trees serialized_tasks = [] + masked_tasks = [] for x in mergelist: if not (isinstance(x, list) and len(x) == 4): continue @@ -5341,8 +5343,11 @@ class depgraph(object): root_config = self.roots[pkg.root] if "merge" == pkg.operation and \ not visible(root_config.settings, pkg): - self._unsatisfied_deps_for_display.append( - ((pkg.root, "="+pkg.cpv), {"myparent":None})) + if skipfirst: + masked_tasks.append(Dependency(root=pkg.root, parent=pkg)) + else: + self._unsatisfied_deps_for_display.append( + ((pkg.root, "="+pkg.cpv), {"myparent":None})) fakedb[myroot].cpv_inject(pkg) serialized_tasks.append(pkg) @@ -5358,6 +5363,7 @@ class depgraph(object): self.myparams.add("selective") favorites = resume_data.get("favorites") + args_set = self._sets["args"] if isinstance(favorites, list): args = self._load_favorites(favorites) else: @@ -5386,13 +5392,13 @@ class depgraph(object): # masked. if not self._create_graph(allow_unsatisfied=True): return False - if self._unsatisfied_deps: + if masked_tasks or self._unsatisfied_deps: # This probably means that a required package # was dropped via --skipfirst. It makes the # resume list invalid, so convert it to a # UnsatisfiedResumeDep exception. raise self.UnsatisfiedResumeDep( - self._unsatisfied_deps) + masked_tasks + self._unsatisfied_deps) self._serialized_tasks_cache = None try: self.altlist() @@ -8506,7 +8512,7 @@ def action_build(settings, trees, mtimedb, else: break except (portage.exception.PackageNotFound, - mydepgraph.UnsatisfiedResumeDep), e: + depgraph.UnsatisfiedResumeDep), e: if show_spinner: print from textwrap import wrap @@ -8526,21 +8532,28 @@ def action_build(settings, trees, mtimedb, out.eerror(indent + str(tuple(task))) out.eerror("") - if isinstance(e, mydepgraph.UnsatisfiedResumeDep): - out.eerror("One or more expected dependencies " + \ - "are not installed:") + if isinstance(e, depgraph.UnsatisfiedResumeDep): + out.eerror("One or packages are either masked or " + \ + "have missing dependencies:") out.eerror("") indent = " " for dep in e.value: - out.eerror(indent + str(dep.atom) + " pulled in by:") - out.eerror(2 * indent + str(dep.parent)) - out.eerror("") + if dep.atom is None: + out.eerror(indent + "Masked package:") + out.eerror(2 * indent + str(dep.parent)) + out.eerror("") + else: + out.eerror(indent + str(dep.atom) + " pulled in by:") + out.eerror(2 * indent + str(dep.parent)) + out.eerror("") msg = "The resume list contains packages " + \ - "with dependencies that have not been " + \ - "installed yet. Please restart/continue " + \ + "that are either masked or have " + \ + "unsatisfied dependencies. " + \ + "Please restart/continue " + \ "the operation manually, or use --skipfirst " + \ "to skip the first package in the list and " + \ - "any other packages that may have missing dependencies." + "any other packages that may be " + \ + "masked or have missing dependencies." for line in wrap(msg, 72): out.eerror(line) elif isinstance(e, portage.exception.PackageNotFound): @@ -8560,7 +8573,8 @@ def action_build(settings, trees, mtimedb, if success: if dropped_tasks: portage.writemsg("!!! One or more packages have been " + \ - "dropped due to unsatisfied dependencies:\n\n", + "dropped due to\n" + \ + "!!! masking or unsatisfied dependencies:\n\n", noiselevel=-1) for task in dropped_tasks: portage.writemsg(" " + str(task) + "\n", noiselevel=-1) diff --git a/pym/portage/sets/base.py b/pym/portage/sets/base.py index d9f2a8d91..717b16322 100644 --- a/pym/portage/sets/base.py +++ b/pym/portage/sets/base.py @@ -61,13 +61,18 @@ class PackageSet(object): self._atoms.clear() self._nonatoms.clear() for a in atoms: - a = a.strip() - if not a: - continue - try: - self._atoms.add(Atom(a)) - except InvalidAtom: - self._nonatoms.add(a) + if not isinstance(a, Atom): + if isinstance(a, basestring): + a = a.strip() + if not a: + continue + try: + a = Atom(a) + except InvalidAtom: + self._nonatoms.add(a) + continue + self._atoms.add(a) + self._updateAtomMap() def load(self): @@ -153,11 +158,15 @@ class EditablePackageSet(PackageSet): modified = False normal_atoms = [] for a in atoms: - if isvalidatom(a): - normal_atoms.append(a) - else: - modified = True - self._nonatoms.add(a) + if not isinstance(a, Atom): + try: + a = Atom(a) + except InvalidAtom: + modified = True + self._nonatoms.add(a) + continue + normal_atoms.append(a) + if normal_atoms: modified = True self._atoms.update(normal_atoms) -- 2.26.2