From ee36717608248ba5cbe589a0b3c4b9c5b32afa07 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sat, 10 Oct 2009 10:26:14 +0000 Subject: [PATCH] Merged from trunk -r14525:14548 | 14526 | Ask for the output of 'emerge --info' instead of 'emerge | | arfrever | --info =$CATEGORY/$PF'. Suggested by zmedico. | | 14527 | Add back Arfrever's emerge --info change because it's good | | zmedico | and I was just confused. | | 14528 | Handle AUTOCLEAN and NOCOLOR case insensitivity inside | | zmedico | config. | | 14529 | Add a --color < y | n > option so that color output can be | | zmedico | forced. This is going to be used by emerge to force color | | | fetch output when appropriate. | | 14530 | Force consistent color output, in case we are capturing | | zmedico | fetch output through a normal pipe due to unavailability of | | | ptys. Thanks to grobian for reporting. | | 14531 | Bug #274497 - Misc spelling, grammar, and terminology | | zmedico | fixes, including URL -> URI and FOO's -> FOOs. | | 14532 | Bug #273099 - Add split-log and split-elog FEATURES for | | zmedico | splitting build logs and elog mod_save logs into category | | | subdirectories. Thanks to Sebastian Mingramm (few) for this | | | patch. | | 14533 | Add --changed-use as an alias for --reinstall=changed-use. | | zmedico | Thanks to Jeremy Olexa for the suggestion. | | 14534 | Fix error in --changed-use logic. | | zmedico | | | 14535 | Fix ugly 'Candidates' --debug output. | | zmedico | | | 14548 | Add news for 2.1.7. | | zmedico | | svn path=/main/branches/prefix/; revision=14551 --- NEWS | 6 +++++- bin/ebuild | 10 +++++++++- bin/misc-functions.sh | 6 +++--- cnf/make.conf.amd64-fbsd.diff | 2 +- cnf/make.conf.amd64.diff | 2 +- cnf/make.conf.x86-fbsd.diff | 2 +- cnf/make.conf.x86.diff | 2 +- doc/qa.docbook | 2 +- man/ebuild.1 | 5 +++++ man/ebuild.5 | 8 ++++---- man/emerge.1 | 3 +++ man/make.conf.5 | 11 ++++++++++- man/portage.5 | 4 ++-- pym/_emerge/EbuildFetcher.py | 5 +++++ pym/_emerge/actions.py | 8 -------- pym/_emerge/depgraph.py | 6 +++++- pym/_emerge/help.py | 5 +++++ pym/_emerge/main.py | 5 +++++ pym/portage/__init__.py | 27 ++++++++++++++++++++++----- pym/portage/dbapi/porttree.py | 2 +- pym/portage/elog/mod_save.py | 15 +++++++++++++-- pym/portage/getbinpkg.py | 10 +++++----- 22 files changed, 107 insertions(+), 39 deletions(-) diff --git a/NEWS b/NEWS index d9034e264..42f985d79 100644 --- a/NEWS +++ b/NEWS @@ -5,8 +5,12 @@ portage-2.2 * Add link level dependency awareness to emerge --depclean and --prune actions in order to protect against uninstallation of required libraries. -* Add license visibility filtering (GLEP 23) * Add support for generic package sets (also see RELEASE-NOTES) + +portage-2.1.7 +------------- + +* Add license visibility filtering (GLEP 23) * Add --accept-properties option for emerge which allows you to use --accept-properties=-interactive in order to temporarily exclude interactive updates. diff --git a/bin/ebuild b/bin/ebuild index 5493fba8f..dee8fe41f 100755 --- a/bin/ebuild +++ b/bin/ebuild @@ -40,6 +40,8 @@ force_help = "When used together with the digest or manifest " + \ "that do not already exist in ${DISTDIR} will be automatically fetched." parser.add_option("--force", help=force_help, action="store_true", dest="force") +parser.add_option("--color", help="enable or disable color output", + type="choice", choices=("y", "n")) parser.add_option("--debug", help="show debug output", action="store_true", dest="debug") parser.add_option("--ignore-default-opts", @@ -85,8 +87,14 @@ if debug and "python-trace" in portage.features: import portage.debug portage.debug.set_trace(True) -if portage.settings["NOCOLOR"] in ("yes","true") or not sys.stdout.isatty(): +if not opts.color == 'y' and \ + (opts.color == 'n' or \ + portage.settings.get('NOCOLOR') in ('yes', 'true') or \ + not sys.stdout.isatty()): portage.output.nocolor() + portage.settings.unlock() + portage.settings['NOCOLOR'] = 'true' + portage.settings.lock() ebuild = pargs.pop(0) diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index 40ef835d4..3ef1d0b21 100644 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -68,7 +68,7 @@ install_qa_check() { unset PORTAGE_QUIET fi - # Make sure we disallow insecure RUNPATH/RPATH's + # Make sure we disallow insecure RUNPATH/RPATHs # Don't want paths that point to the tree where the package was built # (older, broken libtools would do this). Also check for null paths # because the loader will search $PWD when it finds null paths. @@ -80,7 +80,7 @@ install_qa_check() { ) if [[ -n ${f}${x} ]] ; then vecho -ne '\a\n' - eqawarn "QA Notice: The following files contain insecure RUNPATH's" + eqawarn "QA Notice: The following files contain insecure RUNPATHs" eqawarn " Please file a bug about this at http://bugs.gentoo.org/" eqawarn " with the maintaining herd of the package." eqawarn "${f}${f:+${x:+\n}}${x}" @@ -93,7 +93,7 @@ install_qa_check() { fi fi - # TEXTREL's are baaaaaaaad + # TEXTRELs are baaaaaaaad # Allow devs to mark things as ignorable ... e.g. things that are # binary-only and upstream isn't cooperating (nvidia-glx) ... we # allow ebuild authors to set QA_TEXTRELS_arch and QA_TEXTRELS ... diff --git a/cnf/make.conf.amd64-fbsd.diff b/cnf/make.conf.amd64-fbsd.diff index 1ad4854f6..aa07d0657 100644 --- a/cnf/make.conf.amd64-fbsd.diff +++ b/cnf/make.conf.amd64-fbsd.diff @@ -37,7 +37,7 @@ +# +# CRITICAL WARNINGS: ****************************************************** # +# K6 markings are deceptive. Avoid setting -march for them. See Bug #24379. # -+# Pentium-M CPU's should not enable sse2 until at least gcc-3.4. Bug 50616. # ++# Pentium-M CPUs should not enable sse2 until at least gcc-3.4. Bug 50616. # +# GCC 3.3 doesnt support an amd64 specific -march setting, use 3.4. # +# ************************************************************************* # # diff --git a/cnf/make.conf.amd64.diff b/cnf/make.conf.amd64.diff index 397e8cb36..b4a93fe2a 100644 --- a/cnf/make.conf.amd64.diff +++ b/cnf/make.conf.amd64.diff @@ -37,7 +37,7 @@ +# +# CRITICAL WARNINGS: ****************************************************** # +# K6 markings are deceptive. Avoid setting -march for them. See Bug #24379. # -+# Pentium-M CPU's should not enable sse2 until at least gcc-3.4. Bug 50616. # ++# Pentium-M CPUs should not enable sse2 until at least gcc-3.4. Bug 50616. # +# GCC 3.3 doesnt support an amd64 specific -march setting, use 3.4. # +# ************************************************************************* # # diff --git a/cnf/make.conf.x86-fbsd.diff b/cnf/make.conf.x86-fbsd.diff index 1a49edc66..9fec4f177 100644 --- a/cnf/make.conf.x86-fbsd.diff +++ b/cnf/make.conf.x86-fbsd.diff @@ -43,7 +43,7 @@ +# +# CRITICAL WARNINGS: ****************************************************** # +# K6 markings are deceptive. Avoid setting -march for them. See Bug #24379. # -+# Pentium-M CPU's should not enable sse2 until at least gcc-3.4. Bug 50616. # ++# Pentium-M CPUs should not enable sse2 until at least gcc-3.4. Bug 50616. # +# ************************************************************************* # # +# Decent examples: diff --git a/cnf/make.conf.x86.diff b/cnf/make.conf.x86.diff index 3e9594abb..f90845111 100644 --- a/cnf/make.conf.x86.diff +++ b/cnf/make.conf.x86.diff @@ -73,7 +73,7 @@ +# +# CRITICAL WARNINGS: ****************************************************** # +# K6 markings are deceptive. Avoid setting -march for them. See Bug #24379. # -+# Pentium-M CPU's should not enable sse2 until at least gcc-3.4. Bug 50616. # ++# Pentium-M CPUs should not enable sse2 until at least gcc-3.4. Bug 50616. # +# ************************************************************************* # +# +# NOTE: the -On optimization levels are set with the letter O, not -0 (zero). diff --git a/doc/qa.docbook b/doc/qa.docbook index e121e6a95..b9ec375ec 100644 --- a/doc/qa.docbook +++ b/doc/qa.docbook @@ -17,7 +17,7 @@ Scanelf: Insecure RUNPATHs - QA Notice: The following files contain insecure RUNPATH's + QA Notice: The following files contain insecure RUNPATHs diff --git a/man/ebuild.1 b/man/ebuild.1 index 6c134c7cb..87fd63b79 100644 --- a/man/ebuild.1 +++ b/man/ebuild.1 @@ -185,6 +185,11 @@ information is not incorporated into the RPM. Run bash with the \-x option, causing it to output verbose debugging information to stdout. .TP +.BR "\-\-color < y | n >" +Enable or disable color output. This option will override \fINOCOLOR\fR +(see \fBmake.conf\fR(5)) and may also be used to force color output when stdout +is not a tty (by default, color is disabled unless stdout is a tty). +.TP .BR "\-\-force" When used together with the digest or manifest command, this option forces regeneration of diff --git a/man/ebuild.5 b/man/ebuild.5 index 56666e730..67f7e3913 100644 --- a/man/ebuild.5 +++ b/man/ebuild.5 @@ -156,8 +156,8 @@ package will be required to have a version of portage that recognizes the EAPI to which this package conforms. .TP \fBSRC_URI\fR = \fI"http://happy.com/little/${P}.tar.gz"\fR -Contains a list of URI's for the required source files. It can contain -multiple URI's for a single source file. The list is processed in order +Contains a list of URIs for the required source files. It can contain +multiple URIs for a single source file. The list is processed in order if the file was not found on any of the \fIGENTOO_MIRRORS\fR. Beginning with \fBEAPI 2\fR, the output file name of a given URI may be customized with a "->" operator on the right hand side, followed by the @@ -165,7 +165,7 @@ desired output file name. All tokens, including the operator and output file name, should be separated by whitespace. .TP \fBHOMEPAGE\fR = \fI"http://happy.com/"\fR -Should contain a list of URL's for the sources main sites and other further +Should contain a list of URIs for the sources main sites and other further package dependent information. .TP \fBKEYWORDS\fR = \fI[\-~][x86,ppc,sparc,mips,alpha,arm,hppa]\fR @@ -437,7 +437,7 @@ binaries that are not compatible with debugedit. files in \fBSRC_URI\fR will not be downloaded from the \fBGENTOO_MIRRORS\fR. .TP .I primaryuri -fetch from URL's in \fBSRC_URI\fR before \fBGENTOO_MIRRORS\fR. +fetch from URIs in \fBSRC_URI\fR before \fBGENTOO_MIRRORS\fR. .TP .I strip final binaries/libraries will not be stripped of debug symbols. diff --git a/man/emerge.1 b/man/emerge.1 index 63e9879ba..23f44286d 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -282,6 +282,9 @@ Creates binary packages for all ebuilds processed without actually merging the packages. This comes with the caveat that all build-time dependencies must already be emerged on the system. .TP +.BR "\-\-changed\-use" +This is an alias for \fB\-\-reinstall=changed\-use\fR. +.TP .BR "\-\-changelog " (\fB\-l\fR) Use this in conjunction with the \fB\-\-pretend\fR option. This will show the ChangeLog entries for all the packages that will be upgraded. diff --git a/man/make.conf.5 b/man/make.conf.5 index d16f5a113..0e7ebf888 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -367,6 +367,15 @@ a read-only NFS share. A read-only \fBDISTDIR\fR is not compatible with the \fBFEATURES\fR in order to avoid warning messages that are triggered by this incompatibility. .TP +split\-elog +Store logs created by \fBPORTAGE_ELOG_SYSTEM="save"\fR in category +subdirectories of \fBPORT_LOGDIR/elog\fR, instead of using +\fBPORT_LOGDIR/elog\fR directly. +.TP +.B split\-log +Store build logs in category subdirectories of \fBPORT_LOGDIR/build\fR, +instead of using \fBPORT_LOGDIR\fR directly. +.TP .B splitdebug Prior to stripping ELF etdyn and etexec files, the debugging info is stored for later use by various debuggers. This feature is disabled by @@ -432,7 +441,7 @@ place\-holders \\${DISTDIR}, \\${FILE} and \\${URI}. The command should be written to place the fetched file at \\${DISTDIR}/\\${FILE}. Also see \fBRESUMECOMMAND\fR. .TP -\fBGENTOO_MIRRORS\fR = \fI[URLs]\fR +\fBGENTOO_MIRRORS\fR = \fI[URIs]\fR Insert your space\-seperated list of local mirrors here. These locations are used to download files before the ones listed in the \fIebuild scripts\fR. Merging 'mirrorselect' can help. Entries in this diff --git a/man/portage.5 b/man/portage.5 index 36805f815..50e7e98e5 100644 --- a/man/portage.5 +++ b/man/portage.5 @@ -427,7 +427,7 @@ media\-other Contains variables customizing colors. See \fBcolor.map\fR(5). .TP .BR mirrors -Whenever portage encounters a mirror:// style URL it will look up the actual +Whenever portage encounters a mirror:// style URI it will look up the actual hosts here. If the mirror set is not found here, it will check the global mirrors file at /usr/portage/profiles/thirdpartymirrors. You may also set a special mirror type called "local". This list of mirrors will be checked @@ -755,7 +755,7 @@ may contain any of the characters [A\-Za\-z0\-9_\-]. It must not begin with a hyphen. .TP .BR thirdpartymirrors -Controls the mapping of mirror:// style URLs to actual lists of +Controls the mapping of mirror:// style URIs to actual lists of mirrors. Keeps us from overloading a single server. .I Format: diff --git a/pym/_emerge/EbuildFetcher.py b/pym/_emerge/EbuildFetcher.py index cf759a931..c5d7a8b0d 100644 --- a/pym/_emerge/EbuildFetcher.py +++ b/pym/_emerge/EbuildFetcher.py @@ -68,6 +68,11 @@ class EbuildFetcher(SpawnProcess): if debug: fetch_args.append("--debug") + if not self.background and nocolor not in ('yes', 'true'): + # Force consistent color output, in case we are capturing fetch + # output through a normal pipe due to unavailability of ptys. + fetch_args.append('--color=y') + self.args = fetch_args self.env = fetch_env SpawnProcess._start(self) diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 671410e16..6c897a1ab 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -2364,14 +2364,6 @@ def action_uninstall(settings, trees, ldpath_mtimes, def adjust_config(myopts, settings): """Make emerge specific adjustments to the config.""" - # To enhance usability, make some vars case insensitive by forcing them to - # lower case. - for myvar in ("AUTOCLEAN", "NOCOLOR"): - if myvar in settings: - settings[myvar] = settings[myvar].lower() - settings.backup_changes(myvar) - del myvar - # Kill noauto as it will break merges otherwise. if "noauto" in settings.features: settings.features.remove('noauto') diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 5aed66527..1d75f1809 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -1182,7 +1182,7 @@ class depgraph(object): return 0 if debug: - print("Candidates:", selected_atoms) + print("Candidates:", [str(x) for x in selected_atoms[pkg]]) root_config = self._frozen_config.roots[dep_root] vardb = root_config.trees["vartree"].dbapi @@ -1209,6 +1209,10 @@ class depgraph(object): # <=portage-2.1.6.x did. for virt_pkg, atoms in selected_atoms.items(): + if debug: + print("Candidates: %s: %s" % \ + (virt_pkg.cpv, [str(x) for x in atoms])) + # Just assume depth + 1 here for now, though it's not entirely # accurate since multilple levels of indirect virtual deps may # have been traversed. The _add_pkg call will reset the depth to diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py index 312952295..e2c7a80ea 100644 --- a/pym/_emerge/help.py +++ b/pym/_emerge/help.py @@ -291,6 +291,11 @@ def help(myopts, havecolor=1): print(" must not exist for the desired package as they cannot be used if") print(" they do not exist on the system.") print() + print(" " + green("--changed-use")) + desc = "This is an alias for --reinstall=changed-use." + for line in wrap(desc, desc_width): + print(desc_indent + line) + print() print(" "+green("--changelog")+" ("+green("-l")+" short option)") print(" When pretending, also display the ChangeLog entries for packages") print(" that will be upgraded.") diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index 9f284aecb..41c4c02a0 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -51,6 +51,7 @@ if sys.hexversion >= 0x3000000: options=[ "--ask", "--alphabetical", "--buildpkg", "--buildpkgonly", +"--changed-use", "--changelog", "--columns", "--debug", "--digest", @@ -666,6 +667,10 @@ def parse_opts(tmpcmdline, silent=False): myoptions, myargs = parser.parse_args(args=tmpcmdline) + if myoptions.changed_use is not False: + myoptions.reinstall = "changed-use" + myoptions.changed_use = False + if myoptions.deselect == "True": myoptions.deselect = True diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 7c245f4b6..dc88bd823 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -1492,6 +1492,10 @@ class config(object): ('ACCEPT_PROPERTIES', '*'), ) + # To enhance usability, make some vars case insensitive + # by forcing them to lower case. + _case_insensitive_vars = ('AUTOCLEAN', 'NOCOLOR',) + def __init__(self, clone=None, mycpv=None, config_profile_path=None, config_incrementals=None, config_root=None, target_root=None, local_config=True, env=None): @@ -2222,6 +2226,11 @@ class config(object): self._init_dirs() + for k in self._case_insensitive_vars: + if k in self: + self[k] = self[k].lower() + self.backup_changes(k) + if mycpv: self.setcpv(mycpv) @@ -6486,10 +6495,18 @@ def _prepare_workdir(mysettings): logid_time = _unicode_decode(time.strftime("%Y%m%d-%H%M%S", time.gmtime(os.stat(logid_path).st_mtime)), encoding=_encodings['content'], errors='replace') - mysettings["PORTAGE_LOG_FILE"] = os.path.join( - mysettings["PORT_LOGDIR"], "%s:%s:%s.log" % \ - (mysettings["CATEGORY"], mysettings["PF"], logid_time)) - del logid_path, logid_time + + if "split-log" in mysettings.features: + mysettings["PORTAGE_LOG_FILE"] = os.path.join( + mysettings["PORT_LOGDIR"], "build", "%s/%s:%s.log" % \ + (mysettings["CATEGORY"], mysettings["PF"], logid_time)) + else: + mysettings["PORTAGE_LOG_FILE"] = os.path.join( + mysettings["PORT_LOGDIR"], "%s:%s:%s.log" % \ + (mysettings["CATEGORY"], mysettings["PF"], logid_time)) + + util.ensure_dirs(os.path.dirname(mysettings["PORTAGE_LOG_FILE"])) + else: # NOTE: When sesandbox is enabled, the local SELinux security policies # may not allow output to be piped out of the sesandbox domain. The @@ -6588,7 +6605,7 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, @type dbkey: Dict or String @param use_cache: Enables the cache @type use_cache: Boolean - @param fetchall: Used to wrap fetch(), fetches all URI's (even ones invalid due to USE conditionals) + @param fetchall: Used to wrap fetch(), fetches all URIs (even ones invalid due to USE conditionals) @type fetchall: Boolean @param tree: Which tree to use ('vartree','porttree','bintree', etc..), defaults to 'porttree' @type tree: String diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index ef0b8a694..e955a6a57 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -433,7 +433,7 @@ class portdbapi(dbapi): def getRepositories(self): """ This function is required for GLEP 42 compliance; it will return a list of - repository ID's + repository IDs TreeMap = {id: path} """ return [k for k in self.treemap if k] diff --git a/pym/portage/elog/mod_save.py b/pym/portage/elog/mod_save.py index 44900bb0f..12d5b7122 100644 --- a/pym/portage/elog/mod_save.py +++ b/pym/portage/elog/mod_save.py @@ -22,9 +22,20 @@ def process(mysettings, key, logentries, fulltext): elogdir = os.path.join(EPREFIX, "var", "log", "portage", "elog") ensure_dirs(elogdir, uid=portage_uid, gid=portage_gid, mode=0o2770) - elogfilename = os.path.join(elogdir, path + ":" + _unicode_decode( + cat = mysettings['CATEGORY'] + pf = mysettings['PF'] + + elogfilename = pf + ":" + _unicode_decode( time.strftime("%Y%m%d-%H%M%S", time.gmtime(time.time())), - encoding=_encodings['content'], errors='replace') + ".log") + encoding=_encodings['content'], errors='replace') + ".log" + + if "split-elog" in mysettings.features: + elogfilename = os.path.join(elogdir, cat, elogfilename) + else: + elogfilename = os.path.join(elogdir, cat + ':' + elogfilename) + ensure_dirs(os.path.dirname(elogfilename), + uid=portage_uid, gid=portage_gid, mode=0o2770) + elogfile = codecs.open(_unicode_encode(elogfilename, encoding=_encodings['fs'], errors='strict'), mode='w', encoding=_encodings['content'], errors='backslashreplace') diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py index 47095afff..8fcb02288 100644 --- a/pym/portage/getbinpkg.py +++ b/pym/portage/getbinpkg.py @@ -108,7 +108,7 @@ def create_conn(baseurl,conn=None): parts = baseurl.split("://",1) if len(parts) != 2: - raise ValueError(_("Provided URL does not " + raise ValueError(_("Provided URI does not " "contain protocol identifier. '%s'") % baseurl) protocol,url_parts = parts del parts @@ -316,7 +316,7 @@ def match_in_array(array, prefix="", suffix="", match_both=1, allow_overlap=0): def dir_get_list(baseurl,conn=None): """(baseurl[,connection]) -- Takes a base url to connect to and read from. - URL should be in the for ://[:port] + URI should be in the form ://[:port] Connection is used for persistent connection instances.""" if not conn: @@ -364,7 +364,7 @@ def dir_get_list(baseurl,conn=None): def file_get_metadata(baseurl,conn=None, chunk_size=3000): """(baseurl[,connection]) -- Takes a base url to connect to and read from. - URL should be in the for ://[:port] + URI should be in the form ://[:port] Connection is used for persistent connection instances.""" if not conn: @@ -415,7 +415,7 @@ def file_get_metadata(baseurl,conn=None, chunk_size=3000): def file_get(baseurl,dest,conn=None,fcmd=None): """(baseurl,dest,fcmd=) -- Takes a base url to connect to and read from. - URL should be in the for ://[user[:pass]@][:port]""" + URI should be in the form ://[user[:pass]@][:port]""" if not fcmd: return file_get_lib(baseurl,dest,conn) @@ -443,7 +443,7 @@ def file_get(baseurl,dest,conn=None,fcmd=None): def file_get_lib(baseurl,dest,conn=None): """(baseurl[,connection]) -- Takes a base url to connect to and read from. - URL should be in the for ://[:port] + URI should be in the form ://[:port] Connection is used for persistent connection instances.""" if not conn: -- 2.26.2