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.
'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)
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):
# 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:
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"
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))
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']:
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:
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
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..."""
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'
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: