From fababd8c911a5d8927a2ce02a6448972a92e3b3b Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Thu, 14 Aug 2008 19:25:26 +0000 Subject: [PATCH] Merged from trunk 11399:11408 | 11400 | Disable "waiting for lock" messages when in background mode. | | zmedico | Thanks to Thargor for reporting. | | 11401 | Bug #234478 - Fix config._getMissingLicenses() to only | | zmedico | access USE when LICENSE is conditional since otherwise USE | | | hasn't necessarily been calculated. | | 11402 | Create a single EAPI section to contain all of the EAPI | | zmedico | subsections and replace sect[1-3] elements with "section" | | | elements which have unbounded depth. | | 11404 | Fix quoting for iteration over PROFILE_PATHS. | | zmedico | | | 11405 | Make Scheduler._choose_pkg() parallelize more aggressively | | zmedico | in cases when it will not result in a less optimal build | | | order. This works by modifying the behavior of | | | Scheduler._dependent_on_scheduled_merges() so that two cases | | | of dependence are ignored: * A given dependency will be | | | merged later anyway (due to dep cycles) and therefore | | | delaying the merge of the parent package will not result in | | | a more optimal build order. * A given dependency is an | | | "uninstall" operation and it also is not a direct | | | dependency, therefore it should be irrelevant to build order | | | optimization. | | 11406 | The fpformat module is deprecated and will be removed in | | zmedico | py3k. The % string interpolation operator should be used | | | instead. Thanks to Ali Polatel for this patch. | | 11407 | * Fix parse_metadata_use() to raise ParseError instead of | | zmedico | the ExpatError that was reported by grobian. * Define | | | __all__. | svn path=/main/branches/prefix/; revision=11409 --- bin/ebuild.sh | 2 +- doc/package/ebuild.docbook | 3 ++ doc/package/ebuild/eapi/0.docbook | 12 +++--- doc/package/ebuild/eapi/1.docbook | 16 ++++---- doc/package/ebuild/eapi/2.docbook | 44 ++++++++++----------- doc/package/ebuild/helper_functions.docbook | 32 +++++++-------- doc/package/ebuild/phases.docbook | 16 ++++---- pym/_emerge/__init__.py | 29 ++++++++++---- pym/portage/__init__.py | 10 ++++- pym/portage/locks.py | 10 ++++- pym/repoman/utilities.py | 18 ++++++++- 11 files changed, 120 insertions(+), 72 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 7119fcdd3..0ff5ab4a1 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -1527,7 +1527,7 @@ source_all_bashrcs() { IFS=$'\n' local path_array=($PROFILE_PATHS) restore_IFS - for x in ${path_array[@]} ; do + for x in "${path_array[@]}" ; do [ -f "${x}/profile.bashrc" ] && qa_source "${x}/profile.bashrc" done diff --git a/doc/package/ebuild.docbook b/doc/package/ebuild.docbook index 162b79c53..ecd88017a 100644 --- a/doc/package/ebuild.docbook +++ b/doc/package/ebuild.docbook @@ -2,7 +2,10 @@ Ebuild &package_ebuild_phases; &package_ebuild_helper_functions; +
+EAPI &package_ebuild_eapi_0; &package_ebuild_eapi_1; &package_ebuild_eapi_2; +
diff --git a/doc/package/ebuild/eapi/0.docbook b/doc/package/ebuild/eapi/0.docbook index 72e998b9c..d00861ccf 100644 --- a/doc/package/ebuild/eapi/0.docbook +++ b/doc/package/ebuild/eapi/0.docbook @@ -1,8 +1,8 @@ - +
EAPI 0 - +
Phases - +
Default src_compile Phase Function src_compile() { @@ -14,6 +14,6 @@ src_compile() { fi } - - - +
+
+
diff --git a/doc/package/ebuild/eapi/1.docbook b/doc/package/ebuild/eapi/1.docbook index ad84ae6f9..ca421352f 100644 --- a/doc/package/ebuild/eapi/1.docbook +++ b/doc/package/ebuild/eapi/1.docbook @@ -1,8 +1,8 @@ - +
EAPI 1 - +
Phases - +
Default src_compile Phase Function Support for the ECONF_SOURCE variable, which is also supported @@ -18,9 +18,9 @@ src_compile() { fi } - - - +
+
+
SLOT Dependencies Any valid atom can be constrained to match a specific SLOT. This is @@ -50,5 +50,5 @@ src_compile() { - - +
+
diff --git a/doc/package/ebuild/eapi/2.docbook b/doc/package/ebuild/eapi/2.docbook index 8e152f21d..1a4073e5e 100644 --- a/doc/package/ebuild/eapi/2.docbook +++ b/doc/package/ebuild/eapi/2.docbook @@ -1,8 +1,8 @@ - +
EAPI 2_pre1 - +
Helpers - +
doman Language codes in file names are now used for path translation. @@ -29,11 +29,11 @@ - - - +
+
+
USE Dependencies - +
Unconditional USE Dependencies Syntax Examples @@ -61,8 +61,8 @@
- - +
+
Conditional USE Dependencies Syntax Examples @@ -94,14 +94,14 @@
- - - - +
+
+
+
EAPI 2_pre2 - +
Phases - +
New src_configure Phase Function The configure portion of the src_compile function has been @@ -164,8 +164,8 @@ src_compile() { - - +
+
Default Phase Functions The default pkg_nofetch and src_* phase functions are now @@ -261,8 +261,8 @@ src_compile() { - - +
+
Default Phase Function Alias A function named "default" is redefined for each phase so that it @@ -271,6 +271,6 @@ src_compile() { src_compile phase is equivalent to a call to the function named default_src_compile. - - - +
+
+
diff --git a/doc/package/ebuild/helper_functions.docbook b/doc/package/ebuild/helper_functions.docbook index 9c417afb9..1a4737c5b 100644 --- a/doc/package/ebuild/helper_functions.docbook +++ b/doc/package/ebuild/helper_functions.docbook @@ -1,31 +1,31 @@ - +
Helper Functions - +
Output - +
ebegin Like einfo, we output a helpful message and then hint that the following operation may take some time to complete. Once the task is finished, you need to call eend. - - +
+
eend Followup the ebegin message with an appropriate "OK" or "!!" (for errors) marker. If status is non-zero, then the additional error message is displayed. - - +
+
einfo Same as elog, but should be used when the message isn't important to the user (like progress or status messages during the build process). - - +
+
elog If you need to display a message that you wish the user to read @@ -33,18 +33,18 @@ but adds a little more to the output so as to catch the user's eye. The message will also be logged by portage for later review. - - +
+
eqawarn Same as einfo, but should be used when showing a QA warning to the user. - - +
+
ewarn Same as einfo, but should be used when showing a warning to the user. - - - +
+
+
diff --git a/doc/package/ebuild/phases.docbook b/doc/package/ebuild/phases.docbook index 383c605ce..2cb1b4447 100644 --- a/doc/package/ebuild/phases.docbook +++ b/doc/package/ebuild/phases.docbook @@ -1,4 +1,4 @@ - +
Ebuild Phases Ebuild execution is divided into a series of phases. In order @@ -40,13 +40,13 @@ - +
Interaction with previous installed version The order for upgrade and downgrade operations changed in version 2.1.5, but the order for reinstall operations remained unchanged. - +
Upgrade/downgrade order used by versions less than 2.1.5 (deprecated) @@ -64,8 +64,8 @@ - - +
+
Upgrade/downgrade order starting with version 2.1.5 The new order for upgrades and downgrades is identical to the order used @@ -95,6 +95,6 @@ pkg_preinst) and store the result in a global variable to be accessed by pkg_postinst when it is called. - - - +
+
+
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index e2cc67160..f6fa77b4b 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -24,7 +24,6 @@ import array from collections import deque import fcntl import formatter -import fpformat import logging import select import shlex @@ -8716,7 +8715,7 @@ class JobStatusDisplay(object): avg = os.getloadavg() except OSError, e: return str(e) - return ", ".join(fpformat.fix(x, digits) for x in avg) + return ", ".join(("%%.%df" % digits ) % x for x in avg) def display(self): """ @@ -9642,6 +9641,7 @@ class Scheduler(PollScheduler): self._add_packages() pkg_queue = self._pkg_queue failed_pkgs = self._failed_pkgs + portage.locks._quiet = self._background portage.elog._emerge_elog_listener = self._elog_listener rval = os.EX_OK @@ -9649,6 +9649,7 @@ class Scheduler(PollScheduler): self._main_loop() finally: self._main_loop_cleanup() + portage.locks._quiet = False portage.elog._emerge_elog_listener = None if failed_pkgs: rval = failed_pkgs[-1].returncode @@ -9683,8 +9684,10 @@ class Scheduler(PollScheduler): self._prune_digraph() chosen_pkg = None + later = set(self._pkg_queue) for pkg in self._pkg_queue: - if not self._dependent_on_scheduled_merges(pkg): + later.remove(pkg) + if not self._dependent_on_scheduled_merges(pkg, later): chosen_pkg = pkg break @@ -9699,10 +9702,17 @@ class Scheduler(PollScheduler): return chosen_pkg - def _dependent_on_scheduled_merges(self, pkg): + def _dependent_on_scheduled_merges(self, pkg, later): """ Traverse the subgraph of the given packages deep dependencies to see if it contains any scheduled merges. + @param pkg: a package to check dependencies for + @type pkg: Package + @param later: packages for which dependence should be ignored + since they will be merged later than pkg anyway and therefore + delaying the merge of pkg will not result in a more optimal + merge order + @type later: set @rtype: bool @returns: True if the package is dependent, False otherwise. """ @@ -9712,14 +9722,19 @@ class Scheduler(PollScheduler): dependent = False traversed_nodes = set([pkg]) - node_stack = graph.child_nodes(pkg) + direct_deps = graph.child_nodes(pkg) + node_stack = direct_deps + direct_deps = frozenset(direct_deps) while node_stack: node = node_stack.pop() if node in traversed_nodes: continue traversed_nodes.add(node) - if not (node.installed and node.operation == "nomerge") and \ - node not in completed_tasks: + if not ((node.installed and node.operation == "nomerge") or \ + (node.operation == "uninstall" and \ + node not in direct_deps) or \ + node in completed_tasks or \ + node in later): dependent = True break node_stack.extend(graph.child_nodes(node)) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 260f38680..bc805115d 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -2377,9 +2377,15 @@ class config(object): cpv_slot = "%s:%s" % (cpv, metadata["SLOT"]) for atom in match_to_list(cpv_slot, cpdict.keys()): acceptable_licenses.update(cpdict[atom]) - license_struct = portage.dep.paren_reduce(metadata["LICENSE"]) + + license_str = metadata["LICENSE"] + if "?" in license_str: + use = metadata["USE"].split() + else: + use = [] + license_struct = portage.dep.use_reduce( - license_struct, uselist=metadata["USE"].split()) + portage.dep.paren_reduce(license_str), uselist=use) license_struct = portage.dep.dep_opconvert(license_struct) return self._getMaskedLicenses(license_struct, acceptable_licenses) diff --git a/pym/portage/locks.py b/pym/portage/locks.py index 5c88bfcf6..10f15998c 100644 --- a/pym/portage/locks.py +++ b/pym/portage/locks.py @@ -14,6 +14,10 @@ import portage.const HARDLINK_FD = -2 +# Used by emerge in order to disable the "waiting for lock" message +# so that it doesn't interfere with the status display. +_quiet = False + def lockdir(mydir): return lockfile(mydir,wantnewlockfile=1) def unlockdir(mylock): @@ -84,7 +88,11 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, # resource temp unavailable; eg, someone beat us to the lock. if flags & os.O_NONBLOCK: raise TryAgain(mypath) - if waiting_msg is None: + + global _quiet + if _quiet: + pass + elif waiting_msg is None: if isinstance(mypath, int): print "waiting for lock on fd %i" % myfd else: diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py index b537536bf..10f267272 100644 --- a/pym/repoman/utilities.py +++ b/pym/repoman/utilities.py @@ -6,6 +6,18 @@ """This module contains utility functions to help repoman find ebuilds to scan""" +__all__ = [ + "detect_vcs_conflicts", + "editor_is_executable", + "FindPackagesToScan", + "FindPortdir", + "format_qa_output", + "get_commit_message_with_editor", + "get_commit_message_with_stdin", + "have_profile_dir", + "parse_metadata_use" +] + import commands import errno import itertools @@ -15,6 +27,7 @@ import sys from xml.dom import minidom from xml.dom import NotFoundErr +from xml.parsers.expat import ExpatError from portage import output from portage.output import red, green from portage.process import find_binary @@ -97,7 +110,10 @@ def parse_metadata_use(mylines, uselist=None): returns a dict of the form a list of flags""" if uselist is None: uselist = [] - metadatadom = minidom.parse(mylines) + try: + metadatadom = minidom.parse(mylines) + except ExpatError, e: + raise exception.ParseError("metadata.xml: %s" % (e,)) try: usetag = metadatadom.getElementsByTagName("use") -- 2.26.2