Merged from trunk -r13405:13414
authorFabian Groffen <grobian@gentoo.org>
Sat, 2 May 2009 09:18:01 +0000 (09:18 -0000)
committerFabian Groffen <grobian@gentoo.org>
Sat, 2 May 2009 09:18:01 +0000 (09:18 -0000)
   | 13406   | Bug #267104 - If the statvfs f_bavail field shows            |
   | zmedico | insufficient free space and userfetch is not enabled,        |
   |         | recalculate using the f_bfree field.                         |

   | 13407   | Bug #267810 - Don't sort C/CXX/LDFLAGS in emerge --info      |
   | zmedico | output since these variables aren't really sortable in that  |
   |         | way.                                                         |

   | 13408   | Fix the code from bug #267104 to account non-root users.     |
   | zmedico |                                                              |

   | 13409   | Bug #267860 - Make JobStatusDisplay respect                  |
   | zmedico | FEATURES=notitles.                                           |

   | 13410   | Make xtermTitle() use a global variable to cache the result  |
   | zmedico | of the TERM check.                                           |

   | 13411   | Make EbuildWhitespace ignore here-documents. Thanks to Diego |
   | zmedico | Pettenò <flameeyes@g.o> for reporting.                      |

   | 13412   | Move the here-document code from the EbuildWhitespace check  |
   | zmedico | to the run_checks() function, so that all checks ignore the  |
   |         | content of here-documents.                                   |

   | 13413   | Warn about sed and epatch calls which should be moved from   |
   | zmedico | src_unpack to src_prepare. Thanks to Markus Meier            |
   |         | <maekke@g.o> for the initial patch.                          |

   | 13414   | Clarify RESTRICT=bindist docs by referring to 'built'        |
   | zmedico | packages. Thanks to Thomas Sachau <tommy@g.o> for reporting. |

svn path=/main/branches/prefix/; revision=13591

man/ebuild.5
pym/_emerge/__init__.py
pym/portage/__init__.py
pym/portage/output.py
pym/repoman/checks.py

index cbac04bac5f0c840334d954eac59cd577a7283e8..55f334ce9f67e1ffb4b9bfc590730685cf582d99 100644 (file)
@@ -424,7 +424,7 @@ checks need to be skipped for other reasons (such as proprietary binaries),
 see the \fBQA CONTROL VARIABLES\fR section for more specific exemptions.
 .TP
 .I bindist
-Distribution of binary packages is restricted.
+Distribution of built packages is restricted.
 .TP
 .I fetch
 like \fImirror\fR but the files will not be fetched via \fBSRC_URI\fR either.
index f5352c159f03eacd6bcd2de07976d54878ddc1b2..c02717620354aece4737ac3a10267b6168f68319 100644 (file)
@@ -9890,9 +9890,10 @@ class JobStatusDisplay(object):
                'newline'         : 'nel',
        }
 
-       def __init__(self, out=sys.stdout, quiet=False):
+       def __init__(self, out=sys.stdout, quiet=False, xterm_titles=True):
                object.__setattr__(self, "out", out)
                object.__setattr__(self, "quiet", quiet)
+               object.__setattr__(self, "xterm_titles", xterm_titles)
                object.__setattr__(self, "maxval", 0)
                object.__setattr__(self, "merges", 0)
                object.__setattr__(self, "_changed", False)
@@ -10112,7 +10113,8 @@ class JobStatusDisplay(object):
                else:
                        self._update(color_output.getvalue())
 
-               xtermTitle(" ".join(plain_output.split()))
+               if self.xterm_titles:
+                       xtermTitle(" ".join(plain_output.split()))
 
 class ProgressHandler(object):
        def __init__(self):
@@ -10256,7 +10258,8 @@ class Scheduler(PollScheduler):
                # being in a fragile state. For example, see bug #259954.
                self._unsatisfied_system_deps = set()
 
-               self._status_display = JobStatusDisplay()
+               self._status_display = JobStatusDisplay(
+                       xterm_titles=('notitles' not in settings.features))
                self._max_load = myopts.get("--load-average")
                max_jobs = myopts.get("--jobs")
                if max_jobs is None:
@@ -13927,9 +13930,6 @@ def action_info(settings, trees, myopts, myfiles):
                global_vals = {}
                pkgsettings = portage.config(clone=settings)
 
-               for myvar in mydesiredvars:
-                       global_vals[myvar] = set(settings.get(myvar, "").split())
-
                # Loop through each package
                # Only print settings if they differ from global settings
                header_title = "Package Settings"
@@ -13945,17 +13945,6 @@ def action_info(settings, trees, myopts, myfiles):
                                installed=True, metadata=izip(Package.metadata_keys,
                                (metadata.get(x, '') for x in Package.metadata_keys)),
                                root_config=root_config, type_name='installed')
-                       valuesmap = {}
-                       for k in auxkeys:
-                               valuesmap[k] = set(metadata[k].split())
-
-                       diff_values = {}
-                       for myvar in mydesiredvars:
-                               # If the package variable doesn't match the
-                               # current global variable, something has changed
-                               # so set diff_found so we know to print
-                               if valuesmap[myvar] != global_vals[myvar]:
-                                       diff_values[myvar] = valuesmap[myvar]
 
                        print "\n%s was built with the following:" % \
                                colorize("INFORM", str(pkg.cpv))
@@ -14011,15 +14000,9 @@ def action_info(settings, trees, myopts, myfiles):
                                print '%s="%s"' % (varname, ' '.join(str(f) for f in flags)),
                        print
 
-                       # If a difference was found, print the info for
-                       # this package.
-                       if diff_values:
-                               # Print package info
-                               for myvar in mydesiredvars:
-                                       if myvar in diff_values:
-                                               mylist = list(diff_values[myvar])
-                                               mylist.sort()
-                                               print "%s=\"%s\"" % (myvar, " ".join(mylist))
+                       for myvar in mydesiredvars:
+                               if metadata[myvar].split() != settings.get(myvar, '').split():
+                                       print "%s=\"%s\"" % (myvar, metadata[myvar])
                        print
 
                        if metadata['DEFINED_PHASES']:
index 1b7085b43a13b872ef4adea6567d7b6d55885b97..bb6c2b14c9b20bd6a8410d8421a7edd55db4a825 100644 (file)
@@ -3969,8 +3969,17 @@ def fetch(myuris, mysettings, listonly=0, fetchonly=0, locks_in_subdir=".locks",
                                        mysize = 0
                                if (size - mysize + vfs_stat.f_bsize) >= \
                                        (vfs_stat.f_bsize * vfs_stat.f_bavail):
-                                       writemsg("!!! Insufficient space to store %s in %s\n" % (myfile, mysettings["DISTDIR"]), noiselevel=-1)
-                                       has_space = False
+                                       if secpass < 2:
+                                               has_space = False
+                                       elif userfetch:
+                                               has_space = False
+                                       elif (size - mysize + vfs_stat.f_bfree) >= \
+                                               (vfs_stat.f_bfree * vfs_stat.f_bavail):
+                                               has_space = False
+
+                       if not has_space:
+                               writemsg("!!! Insufficient space to store %s in %s\n" % \
+                                       (myfile, mysettings["DISTDIR"]), noiselevel=-1)
 
                        if distdir_writable and use_locks:
 
index 1e59f172ef7972bcceb8afc617cb75cb9816e8af..0711c4b5df5e173da28bab13e566ffd03e16a1bb 100644 (file)
@@ -247,22 +247,26 @@ def nc_len(mystr):
        tmp = re.sub(esc_seq + "^m]+m", "", mystr);
        return len(tmp)
 
+_legal_terms_re = re.compile(r'^(xterm|xterm-color|Eterm|aterm|rxvt|screen|kterm|rxvt-unicode|gnome|interix)')
+_disable_xtermTitle = None
+_max_xtermTitle_len = 253
+
 def xtermTitle(mystr, raw=False):
-       if dotitles and "TERM" in os.environ and sys.stderr.isatty():
+       global _disable_xtermTitle
+       if _disable_xtermTitle is None:
+               _disable_xtermTitle = not (sys.stderr.isatty() and \
+               'TERM' in os.environ and \
+               _legal_terms_re.match(os.environ['TERM']) is not None)
+
+       if dotitles and not _disable_xtermTitle:
                # If the title string is too big then the terminal can
                # misbehave. Therefore, truncate it if it's too big.
-               max_len = 253
-               if len(mystr) > max_len:
-                       mystr = mystr[:max_len]
-               myt=os.environ["TERM"]
-               legal_terms = ["xterm","xterm-color","Eterm","aterm","rxvt","screen","kterm","rxvt-unicode","gnome","interix"]
-               for term in legal_terms:
-                       if myt.startswith(term):
-                               if not raw:
-                                       mystr = "\x1b]0;%s\x07" % mystr
-                               sys.stderr.write(mystr)
-                               sys.stderr.flush()
-                               break
+               if len(mystr) > _max_xtermTitle_len:
+                       mystr = mystr[:_max_xtermTitle_len]
+               if not raw:
+                       mystr = '\x1b]0;%s\x07' % mystr
+               sys.stderr.write(mystr)
+               sys.stderr.flush()
 
 default_xterm_title = None
 
index f1dce8b89afb38d8cd4f5acc785d5d66780a9814..78875b4c08a072c52b8e4a1e83f840b2f09b511f 100644 (file)
@@ -73,12 +73,11 @@ class EbuildWhitespace(LineCheck):
        trailing_whitespace = re.compile(r'.*([\S]$)')  
 
        def check(self, num, line):
-               if not self.leading_spaces.match(line):
+               if self.leading_spaces.match(line) is None:
                        return errors.LEADING_SPACES_ERROR
-               if not self.trailing_whitespace.match(line):
+               if self.trailing_whitespace.match(line) is None:
                        return errors.TRAILING_WHITESPACE_ERROR
 
-
 class EbuildQuote(LineCheck):
        """Ensure ebuilds have valid quoting around things like D,FILESDIR, etc..."""
 
@@ -230,6 +229,38 @@ class EapiDefinition(LineCheck):
                elif self.inherit_re.match(line) is not None:
                        self.inherit_line = line
 
+class SrcUnpackPatches(LineCheck):
+       repoman_check_name = 'ebuild.minorsyn'
+
+       src_unpack_re = re.compile(r'^src_unpack\(\)')
+       func_end_re = re.compile(r'^\}$')
+       src_prepare_tools_re = re.compile(r'\s(e?patch|sed)\s')
+
+       def new(self, pkg):
+               if pkg.metadata['EAPI'] not in ('0', '1'):
+                       self.eapi = pkg.metadata['EAPI']
+               else:
+                       self.eapi = None
+               self.in_src_unpack = None
+
+       def check(self, num, line):
+
+               if self.eapi is not None:
+
+                       if self.in_src_unpack is None and \
+                               self.src_unpack_re.match(line) is not None:
+                                       self.in_src_unpack = True
+
+                       if self.in_src_unpack is True and \
+                               self.func_end_re.match(line) is not None:
+                               self.in_src_unpack = False
+
+                       if self.in_src_unpack:
+                               m = self.src_prepare_tools_re.search(line)
+                               if m is not None:
+                                       return ("'%s'" % m.group(1)) + \
+                                               " call should be moved to src_prepare from line: %d"
+
 class EbuildPatches(LineCheck):
        """Ensure ebuilds use bash arrays for PATCHES to ensure white space safety"""
        repoman_check_name = 'ebuild.patches'
@@ -369,20 +400,36 @@ _constant_checks = tuple((c() for c in (
        EbuildPatches, EbuildQuotedA, EapiDefinition,
        IUseUndefined, ImplicitRuntimeDeps, InheritAutotools,
        EMakeParallelDisabled, EMakeParallelDisabledViaMAKEOPTS,
-       DeprecatedBindnowFlags, WantAutoDefaultValue)))
+       DeprecatedBindnowFlags, SrcUnpackPatches, WantAutoDefaultValue)))
+
+_here_doc_re = re.compile(r'.*\s<<[-]?(\w+)$')
 
 def run_checks(contents, pkg):
        checks = _constant_checks
+       here_doc_delim = None
 
        for lc in checks:
                lc.new(pkg)
        for num, line in enumerate(contents):
-               for lc in checks:
-                       ignore = lc.ignore_line
-                       if not ignore or not ignore.match(line):
-                               e = lc.check(num, line)
-                               if e:
-                                       yield lc.repoman_check_name, e % (num + 1)
+
+               # Check if we're inside a here-document.
+               if here_doc_delim is not None:
+                       if here_doc_delim.match(line):
+                               here_doc_delim = None
+               if here_doc_delim is None:
+                       here_doc = _here_doc_re.match(line)
+                       if here_doc is not None:
+                               here_doc_delim = re.compile('^%s$' % here_doc.group(1))
+
+               if here_doc_delim is None:
+                       # We're not in a here-document.
+                       for lc in checks:
+                               ignore = lc.ignore_line
+                               if not ignore or not ignore.match(line):
+                                       e = lc.check(num, line)
+                                       if e:
+                                               yield lc.repoman_check_name, e % (num + 1)
+
        for lc in checks:
                i = lc.end()
                if i is not None: