From: Fabian Groffen Date: Mon, 2 Jul 2007 17:31:24 +0000 (-0000) Subject: Merged from trunk 7090:7126 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=ab4362b0200fae5c4765e6728599cf9f418cb327;p=portage.git Merged from trunk 7090:7126 +------------------------------------------------------------------------+ | 7091 | For bug #183639, give a more informative message with the | | zmedico | package.provided warning. | |---------+--------------------------------------------------------------| | 7093 | Test for existence of the getRepositories method since | | zmedico | bindbapi doesn't have it atm. | |---------+--------------------------------------------------------------| | 7094 | Add a 0xAAAA00 rgb color code to represent the darkyellow | | zmedico | color that some terminals have instead of brown. | |---------+--------------------------------------------------------------| | 7096 | print a notice when a repository/overlay does not have a | | genone | name | |---------+--------------------------------------------------------------| | 7097 | ewarn when merging a package and the source | | genone | repository/overlay does not have a name | |---------+--------------------------------------------------------------| | 7098 | apply additional phase filters as otherwise some messages | | genone | are logged in both unmerge and merge | |---------+--------------------------------------------------------------| | 7099 | Remove old wheel group warnings since portage stopped using | | zmedico | this group long ago. | |---------+--------------------------------------------------------------| | 7100 | Add docs for /etc/portage/color.map and a few misc man page | | zmedico | fixes. Thanks to Arfrever Frehtes Taifersar Arahesis | | | in bug #183758. | |---------+--------------------------------------------------------------| | 7102 | Add a QA warning for invalid values of RESTRICT. Thanks to | | zmedico | peper for the patch. | |---------+--------------------------------------------------------------| | 7104 | For bug #180045, try to merge PDEPEND as soon as possible so | | zmedico | that it behaves more like RDEPEND. | |---------+--------------------------------------------------------------| | 7106 | Add medium-soft support to DepPriority.__str__(). | | zmedico | | |---------+--------------------------------------------------------------| | 7108 | Update --buildpkgonly logic to account for | | zmedico | DepPriority.MEDIUM_SOFT. | |---------+--------------------------------------------------------------| | 7110 | Revert --buildpkgonly logic back because it was already | | zmedico | correct. | |---------+--------------------------------------------------------------| | 7112 | For bug #131030, update the warning about potential for | | zmedico | emerge --sync overwrite or delete files in ${PORTDIR}. Add | | | references to the PKGDIR and DISTDIR docs. | |---------+--------------------------------------------------------------| | 7114 | s/PORTAGE_EXTRA_RSYNC_OPTS/PORTAGE_RSYNC_OPTS/ for | | zmedico | correctness. | |---------+--------------------------------------------------------------| | 7116 | If necessary, resample the leaf nodes so that they include | | zmedico | all nodes whose hard deps are satisfied. | |---------+--------------------------------------------------------------| | 7118 | Move medium priority out of ignore_priority_range and handle | | zmedico | it separately. | |---------+--------------------------------------------------------------| | 7120 | Flatten restrict for the RESTRICT.invalid check. | | zmedico | | |---------+--------------------------------------------------------------| | 7122 | Clean up the selected_nodes logic in depgraph.altlist(). | | zmedico | | |---------+--------------------------------------------------------------| | 7124 | Clone asap_nodes so that iteration is safe for node removal. | | zmedico | | |---------+--------------------------------------------------------------| | 7126 | Prefer asap_nodes more aggressively over any other nodes | | zmedico | whenever possible. If no asap_nodes can be selected for a | | | given iteration, they will be ignored for the next | | | iteration. | +------------------------------------------------------------------------+ svn path=/main/branches/prefix/; revision=7128 --- diff --git a/bin/repoman b/bin/repoman index c5bd8adef..6809bc980 100755 --- a/bin/repoman +++ b/bin/repoman @@ -174,6 +174,7 @@ qahelp={ "PDEPEND.syntax":"Syntax error in PDEPEND (usually an extra/missing space/parenthesis)", "LICENSE.syntax":"Syntax error in LICENSE (usually an extra/missing space/parenthesis)", "PROVIDE.syntax":"Syntax error in PROVIDE (usually an extra/missing space/parenthesis)", + "RESTRICT.syntax":"Syntax error in RESTRICT (usually an extra/missing space/parenthesis)", "SRC_URI.syntax":"Syntax error in SRC_URI (usually an extra/missing space/parenthesis)", "ebuild.syntax":"Error generating cache entry for ebuild; typically caused by ebuild syntax error", "ebuild.output":"A simple sourcing of the ebuild produces output; this breaks ebuild policy.", @@ -183,6 +184,7 @@ qahelp={ "IUSE.invalid":"This ebuild has a variable in IUSE that is not in the use.desc or use.local.desc file", "LICENSE.invalid":"This ebuild is listing a license that doesnt exist in portages license/ dir.", "KEYWORDS.invalid":"This ebuild contains KEYWORDS that are not listed in profiles/arch.list or for which no valid profile was found", + "RESTRICT.invalid":"This ebuild contains invalid RESTRICT values.", "ebuild.nostable":"There are no ebuilds that are marked as stable for your ARCH", "ebuild.allmasked":"All ebuilds are masked for this package (Package level only)", "ebuild.majorsyn":"This ebuild has a major syntax error that may cause the ebuild to fail partially or fully", @@ -217,6 +219,7 @@ qawarnings=[ "IUSE.invalid", "KEYWORDS.stupid", "KEYWORDS.missing", +"RESTRICT.invalid", "ebuild.minorsyn", "ebuild.badheader", "file.size", @@ -240,6 +243,8 @@ for x in missingvars: qacats.append(x) qawarnings.append(x) +valid_restrict = frozenset(["binchecks", "bindist", "fetch", "mirror", + "primaryuri", "strip", "test", "userpriv"]) verbose=0 quiet=0 @@ -1466,6 +1471,23 @@ for x in scanlist: stats["KEYWORDS.invalid"] += 1 fails["KEYWORDS.invalid"].append(x+"/"+y+".ebuild: %s (profile invalid)" % mykey) + #restrict checks + myrestrict = None + try: + myrestrict = portage.dep.use_reduce( + portage.dep.paren_reduce(myaux["RESTRICT"]), matchall=1) + except portage.exception.InvalidDependString, e: + stats["RESTRICT.syntax"] = stats["RESTRICT.syntax"] + 1 + fails["RESTRICT.syntax"].append(mykey+".ebuild RESTRICT: "+str(e)) + del e + if myrestrict: + myrestrict = set(portage.flatten(myrestrict)) + mybadrestrict = myrestrict.difference(valid_restrict) + if mybadrestrict: + stats["RESTRICT.invalid"] += len(mybadrestrict) + for mybad in mybadrestrict: + fails["RESTRICT.invalid"].append(x+"/"+y+".ebuild: %s" % mybad) + #syntax checks myear = time.gmtime(os.stat(checkdir+"/"+y+".ebuild")[ST_MTIME])[0] gentoo_copyright = re.compile(r'^# Copyright ((1999|200\d)-)?' + str(myear) + r' Gentoo Foundation') diff --git a/cnf/make.conf b/cnf/make.conf index 6695183c3..d51f09f3b 100644 --- a/cnf/make.conf +++ b/cnf/make.conf @@ -79,18 +79,28 @@ # PORTDIR is the location of the portage tree. This is the repository # for all profile information as well as all ebuilds. If you change # this, you must update your /etc/make.profile symlink accordingly. +# ***Warning*** +# Data stored inside PORTDIR is in peril of being overwritten or deleted by +# the emerge --sync command. The default value of PORTAGE_RSYNC_OPTS +# will protect the default locations of DISTDIR and PKGDIR, but users are +# warned that any other locations inside PORTDIR are not necessarily safe +# for data storage. #PORTDIR=@DOMAIN_PREFIX@/usr/portage # # DISTDIR is where all of the source code tarballs will be placed for # emerges. The source code is maintained here unless you delete # it. The entire repository of tarballs for Gentoo is 9G. This is # considerably more than any user will ever download. 2-3G is -# a large DISTDIR. +# a large DISTDIR. Note that locations under /usr/portage are not +# necessarily safe for data storage. See the PORTDIR documentation +# for more information. #DISTDIR=@DOMAIN_PREFIX@/usr/portage/distfiles # # PKGDIR is the location of binary packages that you can have created # with '--buildpkg' or '-b' while emerging a package. This can get -# up to several hundred megs, or even a few gigs. +# up to several hundred megs, or even a few gigs. Note that +# locations under /usr/portage are not necessarily safe for data +# storage. See the PORTDIR documentation for more information. #PKGDIR=@DOMAIN_PREFIX@/usr/portage/packages # # PORT_LOGDIR is the location where portage will store all the logs it diff --git a/man/color.map.5 b/man/color.map.5 new file mode 100644 index 000000000..f76276100 --- /dev/null +++ b/man/color.map.5 @@ -0,0 +1,89 @@ +.TH "COLOR.MAP" "5" "Jun 2007" "Portage 2.1.3" "Portage" +.SH "NAME" +color.map \- custom color settings for Portage +.SH "SYNOPSIS" +.B /etc/portage/color.map +.SH "DESCRIPTION" +This file contains variables that define color classes used by Portage. +Portage will check this file first for color classes settings. If no setting +of given color class is found in /etc/portage/color.map, Portage uses default +value defined internally. +.SH "VARIABLES" +.TP +\fBBAD\fR = \fI"0xFF5555"\fR +Defines color used for some words occuring in bad context. +.TP +\fBBRACKET\fR = \fI"0x5555FF"\fR +Defines color used for brackets. +.TP +\fBGOOD\fR = \fI"0x55FF55"\fR +Defines color used for some words occuring in good context. +.TP +\fBHILITE\fR = \fI"0x00AAAA"\fR +Defines color used for highlighted words. +.TP +\fBINFORM\fR = \fI"0x00AA00"\fR +Defines color used for informational words. +.TP +\fBMERGE_LIST_PROGRESS\fR = \fI"0xFFFF55"\fR +Defines color used for numbers used in merge progress lists. +.TP +\fBPKG_MERGE\fR = \fI"0x00AA00"\fR +Defines color used for packages planned to be merged. +.TP +\fBPKG_MERGE_ARG\fR = \fI"0x00AA00"\fR +Defines color used for packages planned to be merged and given as command line +arguments. +.TP +\fBPKG_MERGE_SYSTEM\fR = \fI"0x55FF55"\fR +Defines color used for packages planned to be merged and belonging to +system set. +.TP +\fBPKG_MERGE_WORLD\fR = \fI"0x55FF55"\fR +Defines color used for packages planned to be merged and belonging to +world set. +.TP +\fBPKG_NOMERGE\fR = \fI"0x0000AA"\fR +Defines color used for packages not planned to be merged. +.TP +\fBPKG_NOMERGE_ARG\fR = \fI"0x0000AA"\fR +Defines color used for packages not planned to be merged and given as command +line arguments. +.TP +\fBPKG_NOMERGE_SYSTEM\fR = \fI"0x5555FF"\fR +Defines color used for packages not planned to be merged and belonging to +system set. +.TP +\fBPKG_NOMERGE_WORLD\fR = \fI"0x5555FF"\fR +Defines color used for packages not planned to be merged and belonging to +world set. +.TP +\fBSECURITY_WARN\fR = \fI"0xFF5555"\fR +Defines color used for security warnings. +.TP +\fBUNMERGE_WARN\fR = \fI"0xFF5555"\fR +Defines color used for unmerge warnings. +.TP +\fBWARN\fR = \fI"0xFFFF55"\fR +Defines color used for warnings. +.SH "REPORTING BUGS" +Please report bugs via http://bugs.gentoo.org/ +.SH "AUTHORS" +.nf +Arfrever Frehtes Taifersar Arahesis +.fi +.SH "FILES" +.TP +.B /etc/portage/color.map +Contains variables customizing colors. +.TP +.B /etc/make.conf +Contains other variables. +.SH "SEE ALSO" +.BR make.conf (5), +.BR portage (5), +.BR emerge (1), +.BR ebuild (1), +.BR ebuild (5) +.TP +The \fI/usr/lib/portage/pym/portage/output.py\fR Python module. diff --git a/man/ebuild.1 b/man/ebuild.1 index 740c452da..8e4a0d67d 100644 --- a/man/ebuild.1 +++ b/man/ebuild.1 @@ -1,4 +1,4 @@ -.TH "EBUILD" "1" "Dec 2005" "Portage 2.1" "Portage" +.TH "EBUILD" "1" "Jun 2007" "Portage 2.1.3" "Portage" .SH "NAME" ebuild \- a low level interface to the Portage system .SH "SYNOPSIS" @@ -178,13 +178,17 @@ Mike Frysinger .fi .SH "FILES" .TP -\fB/etc/make.conf\fR +.B /etc/make.conf Contains variables for the build\-process and overwrites those in make.globals. +.TP +.B /etc/portage/color.map +Contains variables customizing colors. .SH "SEE ALSO" .BR emerge (1), .BR ebuild (5), -.BR make.conf (5) +.BR make.conf (5), +.BR color.map (5) .TP The \fI/usr/sbin/ebuild.sh\fR script. .TP diff --git a/man/ebuild.5 b/man/ebuild.5 index 148486649..6aea9d437 100644 --- a/man/ebuild.5 +++ b/man/ebuild.5 @@ -1,4 +1,4 @@ -.TH "EBUILD" "5" "Jan 2007" "Portage 2.1.2" "Portage" +.TH "EBUILD" "5" "Jun 2007" "Portage 2.1.3" "Portage" .SH "NAME" ebuild \- the internal format, variables, and functions in an ebuild script .SH "DESCRIPTION" @@ -869,7 +869,7 @@ Achim Gottinger Mark Guertin Nicholas Jones Mike Frysinger -Arfrever Frehtes Taifersar Arahesis +Arfrever Frehtes Taifersar Arahesis .fi .SH "FILES" .TP @@ -877,12 +877,16 @@ The \fI/usr/sbin/ebuild.sh\fR script. .TP The helper apps in \fI@PORTAGE_BASE@/bin\fR. .TP -\fB/etc/make.conf\fR +.B /etc/make.conf Contains variables for the build\-process and overwrites those in make.defaults. .TP -\fB/etc/make.globals\fR +.B /etc/make.globals Contains the default variables for the build\-process, you should edit \fI/etc/make.conf\fR instead. +.TP +.B /etc/portage/color.map +Contains variables customizing colors. .SH "SEE ALSO" .BR ebuild (1), -.BR make.conf (5) +.BR make.conf (5), +.BR color.map (5) diff --git a/man/emerge.1 b/man/emerge.1 index 25041de50..fed38d86e 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -1,4 +1,4 @@ -.TH "EMERGE" "1" "Dec 2006" "Portage 2.1" "Portage" +.TH "EMERGE" "1" "Jun 2007" "Portage 2.1.3" "Portage" .SH "NAME" emerge \- Command\-line interface to the Portage system .SH "SYNOPSIS" @@ -578,6 +578,9 @@ Contains variables for the build process, overriding those in \fBmake.globals\fR. \fBYou should edit this file instead of the ones listed below\fR. .TP +.B /etc/portage/color.map +Contains variables customizing colors. +.TP .B /etc/dispatch\-conf.conf Contains settings to handle automatic updates/backups of configuration files. @@ -610,6 +613,7 @@ this file\fR. .BR ebuild (1), .BR ebuild (5), .BR make.conf (5), +.BR color.map (5), .BR portage (5) .LP A number of helper applications reside in \fI@PORTAGE_BASE@bin\fR. diff --git a/man/make.conf.5 b/man/make.conf.5 index 0f33e53c2..4cb5b8bad 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -1,4 +1,4 @@ -.TH "MAKE.CONF" "5" "Jan 2007" "Portage 2.1.2" "Portage" +.TH "MAKE.CONF" "5" "Jun 2007" "Portage 2.1.3" "Portage" .SH "NAME" make.conf \- custom settings for Portage .SH "SYNOPSIS" @@ -96,7 +96,9 @@ This variable is passed by the \fIebuild scripts\fR to the \fIconfigure\fR as \fI\-\-target=${CTARGET}\fR only if it is defined. .TP \fBDISTDIR\fR = \fI[path]\fR -Defines the location of your local source file repository. +Defines the location of your local source file repository. Note +that locations under /usr/portage are not necessarily safe for data storage. +See the \fBPORTDIR\fR documentation for more information. .br Defaults to /usr/portage/distfiles. .TP @@ -325,7 +327,9 @@ Defines if color should be disabled by default. Defaults to false. .TP \fBPKGDIR\fR = \fI[path]\fR -Defines the location where created .tbz2 binary packages will be stored. +Defines the location where created .tbz2 binary packages will be stored. Note +that locations under /usr/portage are not necessarily safe for data storage. +See the \fBPORTDIR\fR documentation for more information. .br Defaults to /usr/portage/packages. .TP @@ -420,18 +424,19 @@ Defaults to /var/tmp. This variable controls permissions for \fIWORKDIR\fR (see \fBebuild\fR(5)). .TP \fBPORTDIR\fR = \fI[path]\fR -Defines the location of your Portage tree. +Defines the location of the Portage tree. This is the repository for all +profile information as well as all ebuilds. If you change this, you must update +your /etc/make.profile symlink accordingly. .br Defaults to /usr/portage. .br \fB***Warning***\fR .br -Storing data such as distfiles and binary packages in PORTDIR can -be potentially dangerous. The default emerge configuration defaults to this -behavior (which will work fine), however if you deviate from the default -configuration by changing PKGDIR or DISTDIR, emerge \-\-sync may inadvertedly -delete all your distfiles/binary packages. Please make sure to set -\fBPORTAGE_EXTRA_RSYNC_OPTS\fR properly to insure the safety of files in PORTDIR. +Data stored inside \fBPORTDIR\fR is in peril of being overwritten or deleted by +the emerge \-\-sync command. The default value of +\fBPORTAGE_RSYNC_OPTS\fR will protect the default locations of +\fBDISTDIR\fR and \fBPKGDIR\fR, but users are warned that any other locations +inside \fBPORTDIR\fR are not necessarily safe for data storage. .TP \fBPORTDIR_OVERLAY\fR = \fI"[path] [different\-path] [etc...]"\fR Defines the directories in which user made ebuilds may be stored and not @@ -529,16 +534,19 @@ Saleem Abdulrasool .fi .SH "FILES" .TP -\fB/etc/make.conf\fR +.B /etc/make.conf Contains variables for the build\-process and overwrites those in make.defaults. .TP -\fB/etc/make.globals\fR +.B /etc/make.globals Contains the default variables for the build\-process, you should edit \fI/etc/make.conf\fR instead. .TP -\fB/usr/portage/profiles/use.desc\fR +.B /etc/portage/color.map +Contains variables customizing colors. +.TP +.B /usr/portage/profiles/use.desc Contains a list of all global USE flags. .TP -\fB/usr/portage/profiles/use.local.desc\fR +.B /usr/portage/profiles/use.local.desc Contains a list of all local USE variables. .SH "SEE ALSO" .BR emerge (1), diff --git a/man/portage.5 b/man/portage.5 index 18db63344..e1855efbb 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -1,4 +1,4 @@ -.TH "PORTAGE" "5" "Dec 2005" "Portage 2.1" "Portage" +.TH "PORTAGE" "5" "Jun 2007" "Portage 2.1.3" "Portage" .SH NAME portage \- the heart of Gentoo .SH "DESCRIPTION" @@ -41,6 +41,7 @@ virtuals .BR /etc/portage/ .nf bashrc +color.map modules package.keywords package.mask @@ -365,6 +366,9 @@ If needed, this file can be used to set up a special environment for ebuilds, different from the standard root environment. The syntax is the same as for any other bash script. .TP +.BR color.map +Contains variables customizing colors. See \fBcolor.map\fR(5). +.TP .BR modules This file can be used to override the metadata cache implementation. In practice, portdbapi.auxdbmodule is the only variable that the user will want to @@ -728,4 +732,5 @@ Drake Wyrm .BR emerge (1), .BR ebuild (1), .BR ebuild (5), -.BR make.conf (5) +.BR make.conf (5), +.BR color.map (5) diff --git a/pym/emerge/__init__.py b/pym/emerge/__init__.py index 8f42fcabd..e114dcf79 100644 --- a/pym/emerge/__init__.py +++ b/pym/emerge/__init__.py @@ -631,13 +631,15 @@ class DepPriority(object): levels: MEDIUM The upper boundary for medium dependencies. + MEDIUM_SOFT The upper boundary for medium-soft dependencies. SOFT The upper boundary for soft dependencies. MIN The lower boundary for soft dependencies. """ - __slots__ = ("__weakref__", "satisfied", "buildtime", "runtime") + __slots__ = ("__weakref__", "satisfied", "buildtime", "runtime", "runtime_post") MEDIUM = -1 - SOFT = -2 - MIN = -4 + MEDIUM_SOFT = -2 + SOFT = -3 + MIN = -6 def __init__(self, **kwargs): for myattr in self.__slots__: if myattr == "__weakref__": @@ -650,11 +652,15 @@ class DepPriority(object): return 0 if self.runtime: return -1 + if self.runtime_post: + return -2 if self.buildtime: - return -2 - if self.runtime: return -3 - return -4 + if self.runtime: + return -4 + if self.runtime_post: + return -5 + return -6 def __lt__(self, other): return self.__int__() < other def __le__(self, other): @@ -674,8 +680,10 @@ class DepPriority(object): myvalue = self.__int__() if myvalue > self.MEDIUM: return "hard" - if myvalue > self.SOFT: + if myvalue > self.MEDIUM_SOFT: return "medium" + if myvalue > self.SOFT: + return "medium-soft" return "soft" class FakeVartree(portage.vartree): @@ -1305,7 +1313,7 @@ class depgraph(object): # Post Depend -- Add to the list without a parent, as it depends # on a package being present AND must be built after that package. if not self.select_dep(myroot, edepend["PDEPEND"], myparent=mp, - myuse=myuse, priority=DepPriority(), rev_deps=True, + myuse=myuse, priority=DepPriority(runtime_post=True), parent_arg=arg): return 0 except ValueError, e: @@ -1578,7 +1586,7 @@ class depgraph(object): # package will not be merged and a warning will be displayed. cp = portage.dep_getkey(depstring) if cp in self._args_atoms and depstring in self._args_atoms[cp]: - self._pprovided_args.append(arg) + self._pprovided_args.append((arg, depstring)) if myparent: # The parent is added after it's own dep_check call so that it @@ -2087,32 +2095,34 @@ class depgraph(object): if "portage" == portage.catsplit(portage.dep_getkey(cpv))[-1]: asap_nodes.append(node) break - ignore_priority_range = [None] - ignore_priority_range.extend( - xrange(DepPriority.MIN, DepPriority.MEDIUM + 1)) + ignore_priority_soft_range = [None] + ignore_priority_soft_range.extend( + xrange(DepPriority.MIN, DepPriority.SOFT + 1)) tree_mode = "--tree" in self.myopts + # Tracks whether or not the current iteration should prefer asap_nodes + # if available. This is set to False when the previous iteration + # failed to select any nodes. It is reset whenever nodes are + # successfully selected. + prefer_asap = True while not mygraph.empty(): - ignore_priority = None - nodes = None - if asap_nodes: + selected_nodes = None + if prefer_asap and asap_nodes: """ASAP nodes are merged before their soft deps.""" + asap_nodes = [node for node in asap_nodes \ + if mygraph.contains(node)] for node in asap_nodes: - if not mygraph.contains(node): - asap_nodes.remove(node) - continue if not mygraph.child_nodes(node, ignore_priority=DepPriority.SOFT): - nodes = [node] + selected_nodes = [node] asap_nodes.remove(node) break - if not nodes: - for ignore_priority in ignore_priority_range: + if not selected_nodes and \ + not (prefer_asap and asap_nodes): + for ignore_priority in ignore_priority_soft_range: nodes = get_nodes(ignore_priority=ignore_priority) if nodes: break - selected_nodes = None - if nodes: - if ignore_priority <= DepPriority.SOFT: + if nodes: if ignore_priority is None and not tree_mode: # Greedily pop all of these nodes since no relationship # has been ignored. This optimization destroys --tree @@ -2131,30 +2141,65 @@ class depgraph(object): if not selected_nodes: # settle for a root node selected_nodes = [nodes[0]] - else: + if not selected_nodes: + nodes = get_nodes(ignore_priority=DepPriority.MEDIUM) + if nodes: """Recursively gather a group of nodes that RDEPEND on eachother. This ensures that they are merged as a group and get their RDEPENDs satisfied as soon as possible.""" - def gather_deps(mergeable_nodes, selected_nodes, node): + def gather_deps(ignore_priority, + mergeable_nodes, selected_nodes, node): if node in selected_nodes: return True if node not in mergeable_nodes: return False selected_nodes.add(node) for child in mygraph.child_nodes(node, - ignore_priority=DepPriority.SOFT): - if not gather_deps( + ignore_priority=ignore_priority): + if not gather_deps(ignore_priority, mergeable_nodes, selected_nodes, child): return False return True mergeable_nodes = set(nodes) - for node in nodes: - selected_nodes = set() - if gather_deps( - mergeable_nodes, selected_nodes, node): + if prefer_asap and asap_nodes: + nodes = asap_nodes + for ignore_priority in xrange(DepPriority.SOFT, + DepPriority.MEDIUM_SOFT + 1): + for node in nodes: + selected_nodes = set() + if gather_deps(ignore_priority, + mergeable_nodes, selected_nodes, node): + break + else: + selected_nodes = None + if selected_nodes: break - else: - selected_nodes = None + + if prefer_asap and asap_nodes and not selected_nodes: + # We failed to find any asap nodes to merge, so ignore + # them for the next iteration. + prefer_asap = False + continue + + if selected_nodes and ignore_priority > DepPriority.SOFT: + # Try to merge ignored medium deps as soon as possible. + for node in selected_nodes: + children = set(mygraph.child_nodes(node)) + soft = children.difference( + mygraph.child_nodes(node, + ignore_priority=DepPriority.SOFT)) + medium_soft = children.difference( + mygraph.child_nodes(node, + ignore_priority=DepPriority.MEDIUM_SOFT)) + medium_soft.difference_update(soft) + for child in medium_soft: + if child in selected_nodes: + continue + if child in asap_nodes: + continue + # TODO: Try harder to make these nodes get + # merged absolutely as soon as possible. + asap_nodes.append(child) if not selected_nodes: if not myblockers.is_empty(): @@ -2215,6 +2260,10 @@ class depgraph(object): print "!!! disabling USE flags that trigger optional dependencies." sys.exit(1) + # At this point, we've succeeded in selecting one or more nodes, so + # it's now safe to reset the prefer_asap to it's default state. + prefer_asap = True + for node in selected_nodes: retlist.append(list(node)) mygraph.remove(node) @@ -2988,6 +3037,14 @@ class depgraph(object): sys.stdout.write(text) if self._pprovided_args: + arg_refs = {} + for arg_atom in self._pprovided_args: + arg, atom = arg_atom + arg_refs[arg_atom] = [] + cp = portage.dep_getkey(atom) + for set_name, pkg_set in self._sets.iteritems(): + if cp in pkg_set and atom in pkg_set[cp]: + arg_refs[arg_atom].append(set_name) msg = [] msg.append(bad("\nWARNING: ")) if len(self._pprovided_args) > 1: @@ -2996,10 +3053,24 @@ class depgraph(object): else: msg.append("A requested package will not be " + \ "merged because it is listed in\n") - msg.append(" package.provided:\n\n") - for arg in self._pprovided_args: - msg.append(" " + arg + "\n") + msg.append("package.provided:\n\n") + problems_sets = set() + for (arg, atom), refs in arg_refs.iteritems(): + ref_string = "" + if refs: + problems_sets.update(refs) + refs.sort() + ref_string = ", ".join(["'%s'" % name for name in refs]) + ref_string = " pulled in by " + ref_string + msg.append(" %s%s\n" % (colorize("INFORM", arg), ref_string)) msg.append("\n") + if "world" in problems_sets: + msg.append("This problem can be solved in one of the following ways:\n\n") + msg.append(" A) Use emaint to clean offending packages from world (if not installed).\n") + msg.append(" B) Uninstall offending packages (cleans them from world).\n") + msg.append(" C) Remove offending entries from package.provided.\n\n") + msg.append("The best course of action depends on the reason that an offending\n") + msg.append("package.provided entry exists.\n\n") sys.stderr.write("".join(msg)) def calc_changelog(self,ebuildpath,current,next): diff --git a/pym/portage/data.py b/pym/portage/data.py index eb33e6684..5ff416b56 100644 --- a/pym/portage/data.py +++ b/pym/portage/data.py @@ -1,14 +1,14 @@ # data.py -- Calculated/Discovered Data Values # Copyright 1998-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Id:$ +# $Id: $ if not hasattr(__builtins__, "set"): from sets import Set as set import os, sys, pwd, grp -from portage.const import wheelgid, rootuid, portageuser, portagegroup from portage.util import writemsg +from portage.const import rootuid, portageuser, portagegroup from portage.output import green,red from portage.output import create_color_func bad = create_color_func("BAD") @@ -67,18 +67,13 @@ def portage_group_warning(): secpass=0 uid=os.getuid() -wheelgroup=grp.getgrgid(wheelgid)[0] +wheelgid=0 -if uid==0 or uid==int(rootuid): +if uid==int(rootuid): secpass=2 try: - if (not secpass) and (wheelgid in os.getgroups()): - secpass=1 + wheelgid=grp.getgrnam("wheel")[2] except KeyError: - writemsg("portage initialization: your system doesn't have a '%s' group.\n" % wheelgroup) - writemsg("Please fix this as it is a normal system requirement. '%s' is GID %d\n" % (wheelgroup, wheelgid)) - writemsg("`emerge baselayout` and a config update with dispatch-conf, etc-update\n") - writemsg("or cfg-update should remedy this problem.\n") pass #Discover the uid and gid of the portage user/group @@ -89,17 +84,12 @@ try: secpass=1 except KeyError: portage_uid=0 - portage_gid=wheelgid - writemsg("\n") - writemsg( red("portage: "+portageuser+" user or group missing. Please update baselayout\n")) - writemsg( red(" and merge portage user(250) and group(250) into your passwd\n")) - writemsg( red(" and group files. Non-root compilation is disabled until then.\n")) - writemsg( " Also note that non-root/wheel users will need to be added to\n") - writemsg( " the portage group to do portage commands.\n") + portage_gid=0 writemsg("\n") - writemsg( " For the defaults, line 1 goes into passwd, and 2 into group.\n") - writemsg(green(" portage:x:250:250:portage:/var/tmp/portage:/bin/false\n")) - writemsg(green(" portage::250:portage\n")) + writemsg( red("portage: "+portageuser+" user or group missing.i\n")) + writemsg( red(" In Prefix Portage this is quite dramatic\n")) + writemsg( red(" since it means you have thrown away yourself.\n")) + writemsg( " Re-add yourself, or rebootstrap Gentoo Prefix.\n") writemsg("\n") portage_group_warning() diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 71ff993ba..128e5b166 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -91,6 +91,8 @@ class portdbapi(dbapi): repo_name = open(repo_name_path, 'r').readline().strip() self.treemap[repo_name] = path except (OSError,IOError): + writemsg("Note: The repository at %s does not have a profiles/repo_name entry.\n" % path \ + + " This can reduce the functionality of the repository in some cases.\n") pass self.auxdbmodule = self.mysettings.load_best_module("portdbapi.auxdbmodule") diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 06530e4a2..7c8eeecc2 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -24,6 +24,8 @@ from portage import listdir, dep_expand, flatten, key_expand, \ doebuild_environment, doebuild, env_update, \ abssymlink, movefile, _movefile, bsd_chflags +from portage.elog.messages import ewarn + import os, sys, stat, errno, commands, copy, time from itertools import izip @@ -1701,13 +1703,18 @@ class dblink(object): # do we have a origin repository name for the current package repopath = os.sep.join(self.settings["O"].split(os.sep)[:-2]) - if mydbapi != None: + # bindbapi has no getRepositories() method + if mydbapi and hasattr(mydbapi, "getRepositories"): + foundname = False for reponame in mydbapi.getRepositories(): if mydbapi.getRepositoryPath(reponame) == repopath: fd = open(os.path.join(self.dbtmpdir, "repository"), "w") fd.write(reponame+"\n") fd.close() + foundname = True break + if not foundname: + ewarn("Could not determine name of source repository at %s" % repopath, phase="preinst", key=self.mycpv) # write local package counter for recording lcfile = open(os.path.join(self.dbtmpdir, "COUNTER"),"w") diff --git a/pym/portage/elog/__init__.py b/pym/portage/elog/__init__.py index cbe9f47fa..ef040faa9 100644 --- a/pym/portage/elog/__init__.py +++ b/pym/portage/elog/__init__.py @@ -41,7 +41,8 @@ def _combine_logentries(logentries): return rValue _elog_atexit_handlers = [] -def elog_process(cpv, mysettings): +_preserve_logentries = {} +def elog_process(cpv, mysettings, phasefilter=None): ebuild_logentries = collect_ebuild_messages(os.path.join(mysettings["T"], "logging")) all_logentries = collect_messages() if all_logentries.has_key(cpv): @@ -49,8 +50,18 @@ def elog_process(cpv, mysettings): else: all_logentries[cpv] = ebuild_logentries - my_elog_classes = set(mysettings.get("PORTAGE_ELOG_CLASSES", "").split()) + for key in _preserve_logentries.keys(): + if all_logentries.has_key(key): + all_logentries[key] = _merge_logentries(_preserve_logentries[key], all_logentries[key]) + else: + all_logentries[key] = _preserve_logentries[key] + del _preserve_logentries[key] + + if phasefilter != None: + for key in all_logentries: + all_logentries[key], _preserve_logentries[key] = phasefilter(all_logentries[key]) + my_elog_classes = set(mysettings.get("PORTAGE_ELOG_CLASSES", "").split()) for key in all_logentries: default_logentries = filter_loglevels(all_logentries[key], my_elog_classes) diff --git a/pym/portage/elog/filtering.py b/pym/portage/elog/filtering.py index e8a5430fd..b41f64e48 100644 --- a/pym/portage/elog/filtering.py +++ b/pym/portage/elog/filtering.py @@ -3,6 +3,8 @@ # Distributed under the terms of the GNU General Public License v2 # $Id: __init__.py 6458 2007-04-30 02:31:30Z genone $ +from portage.const import EBUILD_PHASES + def filter_loglevels(logentries, loglevels): # remove unwanted entries from all logentries rValue = {} @@ -15,3 +17,22 @@ def filter_loglevels(logentries, loglevels): rValue[phase].append((msgtype, msgcontent)) return rValue +def filter_phases(logentries, phases): + rValue1 = {} + rValue2 = {} + phases = map(str.lower, phases) + for phase in logentries: + if phase in phases: + rValue1[phase] = logentries[phase] + else: + rValue2[phase] = logentries[phase] + return (rValue1, rValue2) + +def filter_mergephases(logentries): + myphases = EBUILD_PHASES[:] + myphases.remove("prerm") + myphases.remove("postrm") + return filter_phases(logentries, myphases) + +def filter_unmergephases(logentries): + return filter_phases(logentries, ["prerm", "postrm", "other"]) diff --git a/pym/portage/output.py b/pym/portage/output.py index 49a2fd995..aec440ed9 100644 --- a/pym/portage/output.py +++ b/pym/portage/output.py @@ -113,7 +113,9 @@ codes["white"] = codes["0xFFFFFF"] codes["lightgray"] = codes["0xAAAAAA"] codes["darkteal"] = codes["turquoise"] -codes["darkyellow"] = codes["brown"] +# Some terminals have darkyellow instead of brown. +codes["0xAAAA00"] = codes["brown"] +codes["darkyellow"] = codes["0xAAAA00"] codes["fuscia"] = codes["fuchsia"] codes["white"] = codes["bold"]