From c93059c9de8fd58faa08a1f85109547a8e20cc16 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Fri, 25 May 2007 20:26:09 +0000 Subject: [PATCH] Merged from trunk 6622:6625 +------------------------------------------------------------------------+ | 6623 | For bug #179766, expand USE_EXPAND variables inside the USE | | zmedico | incremental loop so that USE"-*" will not always destroy | | | them. | |---------+--------------------------------------------------------------| | 6625 | Call tcgetattr and tcsetattr on the slave end of the pty in | | zmedico | order to avoid an "invalid argument" error on Solaris. | | | Thanks to grobian. | +------------------------------------------------------------------------+ svn path=/main/branches/prefix/; revision=6626 --- pym/portage/__init__.py | 53 +++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 21f80e8bc..89d2ba8eb 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -1943,26 +1943,7 @@ class config: else: self.configdict["auto"]["USE"] = "" - use_expand_protected = [] use_expand = self.get("USE_EXPAND", "").split() - for var in use_expand: - var_lower = var.lower() - for x in self.get(var, "").split(): - # Any incremental USE_EXPAND variables have already been - # processed, so leading +/- operators are invalid here. - if x[0] == "+": - writemsg(colorize("BAD", "Invalid '+' operator in " + \ - "non-incremental variable '%s': '%s'\n" % (var, x)), - noiselevel=-1) - x = x[1:] - if x[0] == "-": - writemsg(colorize("BAD", "Invalid '-' operator in " + \ - "non-incremental variable '%s': '%s'\n" % (var, x)), - noiselevel=-1) - continue - mystr = var_lower + "_" + x - if mystr not in use_expand_protected: - use_expand_protected.append(mystr) if not self.uvlist: for x in self["USE_ORDER"].split(":"): @@ -1970,11 +1951,12 @@ class config: self.uvlist.append(self.configdict[x]) self.uvlist.reverse() - myflags = use_expand_protected[:] + myflags = [] for curdb in self.uvlist: - if "USE" not in curdb: + cur_use_expand = [x for x in use_expand if x in curdb] + mysplit = curdb.get("USE", "").split() + if not mysplit and not cur_use_expand: continue - mysplit = curdb["USE"].split() for x in mysplit: if x == "-*": myflags = [] @@ -1994,8 +1976,27 @@ class config: pass continue - if x not in myflags: - myflags.append(x) + myflags.append(x) + + for var in cur_use_expand: + var_lower = var.lower() + if var not in myincrementals: + prefix = var_lower + "_" + myflags = [x for x in myflags if not x.startswith(prefix)] + for x in curdb[var].split(): + # Any incremental USE_EXPAND variables have already been + # processed, so leading +/- operators are invalid here. + if x[0] == "+": + writemsg(colorize("BAD", "Invalid '+' operator in " + \ + "non-incremental variable '%s': '%s'\n" % (var, x)), + noiselevel=-1) + x = x[1:] + if x[0] == "-": + writemsg(colorize("BAD", "Invalid '-' operator in " + \ + "non-incremental variable '%s': '%s'\n" % (var, x)), + noiselevel=-1) + continue + myflags.append(var_lower + "_" + x) myflags = set(myflags) myflags.update(self.useforce) @@ -2292,9 +2293,9 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, **keyw # Disable the ECHO attribute so the terminal behaves properly # if the subprocess needs to read input from stdin. import termios - term_attr = termios.tcgetattr(master_fd) + term_attr = termios.tcgetattr(slave_fd) term_attr[3] &= ~termios.ECHO - termios.tcsetattr(master_fd, termios.TCSAFLUSH, term_attr) + termios.tcsetattr(slave_fd, termios.TCSAFLUSH, term_attr) # tee will always exit with an IO error, so ignore it's stderr. null_file = open('/dev/null', 'w') mypids.extend(portage.process.spawn(['tee', '-i', '-a', logfile], -- 2.26.2