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
<title>Ebuild</title>
&package_ebuild_phases;
&package_ebuild_helper_functions;
+<section id='package-ebuild-eapi'>
+<title>EAPI</title>
&package_ebuild_eapi_0;
&package_ebuild_eapi_1;
&package_ebuild_eapi_2;
+</section>
</chapter>
-<sect1 id='package-ebuild-eapi-0'>
+<section id='package-ebuild-eapi-0'>
<title>EAPI 0</title>
- <sect2 id='package-ebuild-eapi-0-phases'>
+ <section id='package-ebuild-eapi-0-phases'>
<title>Phases</title>
- <sect3 id='package-ebuild-eapi-0-phases-default-src-compile'>
+ <section id='package-ebuild-eapi-0-phases-default-src-compile'>
<title>Default src_compile Phase Function</title>
<programlisting>
src_compile() {
fi
}
</programlisting>
- </sect3>
- </sect2>
-</sect1>
+ </section>
+ </section>
+</section>
-<sect1 id='package-ebuild-eapi-1'>
+<section id='package-ebuild-eapi-1'>
<title>EAPI 1</title>
- <sect2 id='package-ebuild-eapi-1-phases'>
+ <section id='package-ebuild-eapi-1-phases'>
<title>Phases</title>
- <sect3 id='package-ebuild-eapi-1-phases-default-src-compile'>
+ <section id='package-ebuild-eapi-1-phases-default-src-compile'>
<title>Default src_compile Phase Function</title>
<para>
Support for the ECONF_SOURCE variable, which is also supported
fi
}
</programlisting>
- </sect3>
- </sect2>
- <sect2 id='package-ebuild-eapi-1-slot-deps'>
+ </section>
+ </section>
+ <section id='package-ebuild-eapi-1-slot-deps'>
<title>SLOT Dependencies</title>
<para>
Any valid atom can be constrained to match a specific SLOT. This is
</tbody>
</tgroup>
</table>
- </sect2>
-</sect1>
+ </section>
+</section>
-<sect1 id='package-ebuild-eapi-2_pre1'>
+<section id='package-ebuild-eapi-2_pre1'>
<title>EAPI 2_pre1</title>
- <sect2 id='package-ebuild-eapi-2-helpers'>
+ <section id='package-ebuild-eapi-2-helpers'>
<title>Helpers</title>
- <sect3 id='package-ebuild-eapi-2-helpers-doman'>
+ <section id='package-ebuild-eapi-2-helpers-doman'>
<title>doman</title>
<para>
Language codes in file names are now used for path translation.
</tbody>
</tgroup>
</table>
- </sect3>
- </sect2>
- <sect2 id='package-ebuild-eapi-2-use-deps'>
+ </section>
+ </section>
+ <section id='package-ebuild-eapi-2-use-deps'>
<title>USE Dependencies</title>
- <sect3 id='package-ebuild-eapi-2-use-deps-unconditional'>
+ <section id='package-ebuild-eapi-2-use-deps-unconditional'>
<title>Unconditional USE Dependencies</title>
<table><title>Syntax Examples</title>
<tgroup cols='2' align='left' >
</tbody>
</tgroup>
</table>
- </sect3>
- <sect3 id='package-ebuild-eapi-2-use-deps-conditional'>
+ </section>
+ <section id='package-ebuild-eapi-2-use-deps-conditional'>
<title>Conditional USE Dependencies</title>
<table><title>Syntax Examples</title>
<tgroup cols='2' align='left' >
</tbody>
</tgroup>
</table>
- </sect3>
- </sect2>
-</sect1>
-<sect1 id='package-ebuild-eapi-2_pre2'>
+ </section>
+ </section>
+</section>
+<section id='package-ebuild-eapi-2_pre2'>
<title>EAPI 2_pre2</title>
- <sect2 id='package-ebuild-eapi-2-phases'>
+ <section id='package-ebuild-eapi-2-phases'>
<title>Phases</title>
- <sect3 id='package-ebuild-eapi-2-phases-src-configure'>
+ <section id='package-ebuild-eapi-2-phases-src-configure'>
<title>New src_configure Phase Function</title>
<para>
The configure portion of the src_compile function has been
</tbody>
</tgroup>
</table>
- </sect3>
- <sect3 id='package-ebuild-eapi-2-phases-default-functions'>
+ </section>
+ <section id='package-ebuild-eapi-2-phases-default-functions'>
<title>Default Phase Functions</title>
<para>
The default pkg_nofetch and src_* phase functions are now
</tbody>
</tgroup>
</table>
- </sect3>
- <sect3 id='package-ebuild-eapi-2-phases-default-function-alias'>
+ </section>
+ <section id='package-ebuild-eapi-2-phases-default-function-alias'>
<title>Default Phase Function Alias</title>
<para>
A function named "default" is redefined for each phase so that it
src_compile phase is equivalent to a call to the function named
default_src_compile.
</para>
- </sect3>
- </sect2>
-</sect1>
+ </section>
+ </section>
+</section>
-<sect1 id='package-ebuild-helper-functions'>
+<section id='package-ebuild-helper-functions'>
<title>Helper Functions</title>
- <sect2 id='package-ebuild-helper-functions-output'>
+ <section id='package-ebuild-helper-functions-output'>
<title>Output</title>
- <sect3 id='package-ebuild-helper-functions-output-ebegin'>
+ <section id='package-ebuild-helper-functions-output-ebegin'>
<title>ebegin</title>
<para>
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.
</para>
- </sect3>
- <sect3 id='package-ebuild-helper-functions-output-eend'>
+ </section>
+ <section id='package-ebuild-helper-functions-output-eend'>
<title>eend</title>
<para>
Followup the ebegin message with an appropriate "OK" or "!!" (for errors)
marker. If status is non-zero, then the additional error message is
displayed.
</para>
- </sect3>
- <sect3 id='package-ebuild-helper-functions-output-einfo'>
+ </section>
+ <section id='package-ebuild-helper-functions-output-einfo'>
<title>einfo</title>
<para>
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).
</para>
- </sect3>
- <sect3 id='package-ebuild-helper-functions-output-elog'>
+ </section>
+ <section id='package-ebuild-helper-functions-output-elog'>
<title>elog</title>
<para>
If you need to display a message that you wish the user to read
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.
</para>
- </sect3>
- <sect3 id='package-ebuild-helper-functions-output-eqawarn'>
+ </section>
+ <section id='package-ebuild-helper-functions-output-eqawarn'>
<title>eqawarn</title>
<para>
Same as einfo, but should be used when showing a QA warning to the user.
</para>
- </sect3>
- <sect3 id='package-ebuild-helper-functions-output-ewarn'>
+ </section>
+ <section id='package-ebuild-helper-functions-output-ewarn'>
<title>ewarn</title>
<para>
Same as einfo, but should be used when showing a warning to the user.
</para>
- </sect3>
- </sect2>
-</sect1>
+ </section>
+ </section>
+</section>
-<sect1 id='package-ebuild-phases'>
+<section id='package-ebuild-phases'>
<title>Ebuild Phases</title>
<para>
Ebuild execution is divided into a series of phases. In order
</listitem>
</itemizedlist>
</para>
- <sect2 id='package-ebuild-phases-previous-installed'>
+ <section id='package-ebuild-phases-previous-installed'>
<title>Interaction with previous installed version</title>
<para>
The order for upgrade and downgrade operations changed in
version 2.1.5, but the order for reinstall operations remained unchanged.
</para>
- <sect3 id='package-ebuild-phases-before-2.1.5'>
+ <section id='package-ebuild-phases-before-2.1.5'>
<title>Upgrade/downgrade order used by versions less than 2.1.5 (deprecated)</title>
<para>
<itemizedlist>
</listitem>
</itemizedlist>
</para>
- </sect3>
- <sect3 id='package-ebuild-phases-after-2.1.5'>
+ </section>
+ <section id='package-ebuild-phases-after-2.1.5'>
<title>Upgrade/downgrade order starting with version 2.1.5</title>
<para>
The new order for upgrades and downgrades is identical to the order used
pkg_preinst) and store the result in a global variable to be accessed by
pkg_postinst when it is called.
</para>
- </sect3>
- </sect2>
-</sect1>
+ </section>
+ </section>
+</section>
from collections import deque
import fcntl
import formatter
-import fpformat
import logging
import select
import shlex
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):
"""
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
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
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
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.
"""
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))
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)
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):
# 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:
"""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
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
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")