"variable.invalidchar":"A variable contains an invalid character that is not part of the ASCII character set",
"variable.readonly":"Assigning a readonly variable",
"LIVEVCS.stable":"This ebuild is a live checkout from a VCS but has stable keywords.",
+ "LIVEVCS.unmasked":"This ebuild is a live checkout from a VCS but has keywords and is not masked in the global package.mask.",
"IUSE.invalid":"This ebuild has a variable in IUSE that is not in the use.desc or use.local.desc file",
"IUSE.undefined":"This ebuild does not define IUSE (style guideline says to define IUSE even when empty)",
"LICENSE.invalid":"This ebuild is listing a license that doesnt exist in portages license/ dir.",
"virtual.unavailable",
"usage.obsolete",
"upstream.workaround",
-"LIVEVCS.stable"
+"LIVEVCS.stable",
+"LIVEVCS.unmasked",
))
non_ascii_re = re.compile(r'[^\x00-\x7f]')
kwlist = set()
liclist = set()
uselist = set()
+global_pmasklines = []
for path in portdb.porttrees:
try:
if x:
uselist.add(use_prefix + x[0])
+ global_pmasklines.append(portage.util.grabfile_package(
+ os.path.join(path, 'profiles', 'package.mask'), recursive=1))
+
desc_path = os.path.join(path, 'profiles', 'profiles.desc')
try:
desc_file = codecs.open(_unicode_encode(desc_path,
repoman_settings['PORTAGE_ARCHLIST'] = ' '.join(sorted(kwlist))
repoman_settings.backup_changes('PORTAGE_ARCHLIST')
+global_pmasklines = portage.util.stack_lists(global_pmasklines, incremental=1)
+global_pmaskdict = {}
+for x in global_pmasklines:
+ global_pmaskdict.setdefault(portage.dep_getkey(x), []).append(x)
+del global_pmasklines
+
+def has_global_mask(pkg):
+ mask_atoms = global_pmaskdict.get(pkg.cp)
+ if mask_atoms:
+ pkg_list = [pkg]
+ for x in mask_atoms:
+ if portage.dep.match_from_list(x, pkg_list):
+ return x
+ return None
+
# Ensure that profile sub_path attributes are unique. Process in reverse order
# so that profiles with duplicate sub_path from overlays will override
# profiles with the same sub_path from parent repos.
bad_stable_keywords)
del bad_stable_keywords
+ if keywords and not has_global_mask(pkg):
+ stats["LIVEVCS.unmasked"] += 1
+ fails["LIVEVCS.unmasked"].append(relative_path)
+
if options.ignore_arches:
arches = [[repoman_settings["ARCH"], repoman_settings["ARCH"],
repoman_settings["ACCEPT_KEYWORDS"].split()]]
.B LIVEVCS.stable
Ebuild is a live ebuild (cvs, git, darcs, svn, etc) checkout with stable keywords.
.TP
+.B LIVEVCS.unmasked
+Ebuild is a live ebuild (cvs, git, darcs, svn, etc) checkout but has keywords
+and is not masked in the global package.mask.
+.TP
.B PDEPEND.bad
User-visible ebuilds with bad PDEPEND settings (matched against *visible* ebuilds)
.TP
mydata = mytbz2.get_data()
updated_items = update_dbentries([mylist], mydata)
mydata.update(updated_items)
- mydata["PF"] = mynewpkg + "\n"
- mydata["CATEGORY"] = mynewcat+"\n"
+ mydata[_unicode_encode('PF',
+ encoding=_encodings['repo.content'])] = \
+ _unicode_encode(mynewpkg + "\n",
+ encoding=_encodings['repo.content'])
+ mydata[_unicode_encode('CATEGORY',
+ encoding=_encodings['repo.content'])] = \
+ _unicode_encode(mynewcat + "\n",
+ encoding=_encodings['repo.content'])
if mynewpkg != myoldpkg:
- ebuild_data = mydata.get(myoldpkg+".ebuild")
+ ebuild_data = mydata.pop(_unicode_encode(myoldpkg + '.ebuild',
+ encoding=_encodings['repo.content']), None)
if ebuild_data is not None:
- mydata[mynewpkg+".ebuild"] = ebuild_data
- del mydata[myoldpkg+".ebuild"]
+ mydata[_unicode_encode(mynewpkg + '.ebuild',
+ encoding=_encodings['repo.content'])] = ebuild_data
+
mytbz2.recompose_mem(portage.xpak.xpak_mem(mydata))
self.dbapi.cpv_remove(mycpv)
if the file is not owned by this package.
"""
- os = _os_merge
-
filename = _unicode_decode(filename,
encoding=_encodings['content'], errors='strict')
destroot = _unicode_decode(destroot,
encoding=_encodings['content'], errors='strict')
+ # The given filename argument might have a different encoding than the
+ # the filenames contained in the contents, so use separate wrapped os
+ # modules for each. The basename is more likely to contain non-ascii
+ # characters than the directory path, so use os_filename_arg for all
+ # operations involving the basename of the filename arg.
+ os_filename_arg = _os_merge
+ os = _os_merge
+
+ try:
+ _unicode_encode(filename,
+ encoding=_encodings['merge'], errors='strict')
+ except UnicodeEncodeError:
+ # The package appears to have been merged with a
+ # different value of sys.getfilesystemencoding(),
+ # so fall back to utf_8 if appropriate.
+ try:
+ _unicode_encode(filename,
+ encoding=_encodings['fs'], errors='strict')
+ except UnicodeEncodeError:
+ pass
+ else:
+ os_filename_arg = portage.os
+
destfile = normalize_path(
- os.path.join(destroot, filename.lstrip(os.path.sep)))
+ os_filename_arg.path.join(destroot,
+ filename.lstrip(os_filename_arg.path.sep)))
pkgfiles = self.getcontents()
if pkgfiles and destfile in pkgfiles:
return destfile
if pkgfiles:
- basename = os.path.basename(destfile)
+ basename = os_filename_arg.path.basename(destfile)
if self._contents_basenames is None:
+
+ try:
+ for x in pkgfiles:
+ _unicode_encode(x,
+ encoding=_encodings['merge'],
+ errors='strict')
+ except UnicodeEncodeError:
+ # The package appears to have been merged with a
+ # different value of sys.getfilesystemencoding(),
+ # so fall back to utf_8 if appropriate.
+ try:
+ for x in pkgfiles:
+ _unicode_encode(x,
+ encoding=_encodings['fs'],
+ errors='strict')
+ except UnicodeEncodeError:
+ pass
+ else:
+ os = portage.os
+
self._contents_basenames = set(
os.path.basename(x) for x in pkgfiles)
if basename not in self._contents_basenames:
# Use stat rather than lstat since we want to follow
# any symlinks to the real parent directory.
- parent_path = os.path.dirname(destfile)
+ parent_path = os_filename_arg.path.dirname(destfile)
try:
- parent_stat = os.stat(parent_path)
+ parent_stat = os_filename_arg.stat(parent_path)
except EnvironmentError, e:
if e.errno != errno.ENOENT:
raise
del e
return False
if self._contents_inodes is None:
+
+ if os is _os_merge:
+ try:
+ for x in pkgfiles:
+ _unicode_encode(x,
+ encoding=_encodings['merge'],
+ errors='strict')
+ except UnicodeEncodeError:
+ # The package appears to have been merged with a
+ # different value of sys.getfilesystemencoding(),
+ # so fall back to utf_8 if appropriate.
+ try:
+ for x in pkgfiles:
+ _unicode_encode(x,
+ encoding=_encodings['fs'],
+ errors='strict')
+ except UnicodeEncodeError:
+ pass
+ else:
+ os = portage.os
+
self._contents_inodes = {}
parent_paths = set()
for x in pkgfiles:
self._contents_inodes[inode_key] = p_path_list
if p_path not in p_path_list:
p_path_list.append(p_path)
+
p_path_list = self._contents_inodes.get(
(parent_stat.st_dev, parent_stat.st_ino))
if p_path_list:
for p_path in p_path_list:
- x = os.path.join(p_path, basename)
+ x = os_filename_arg.path.join(p_path, basename)
if x in pkgfiles:
return x
@rtype: dict
@return: a dictionary mapping color classes to color codes
"""
- # FIXME: use config_root iso / (breaks Prefix)
- # We can use ObjectProxy to implement lazy initialization of
- # codes and _styles, and add an init(config_root="/") function
- # that can be called in order adjust the location that color.map
- # is read from.
global codes, _styles
myfile = os.path.join(config_root, COLOR_MAP_FILE)
ansi_code_pattern = re.compile("^[0-9;]*m$")
dict containing only the updated items."""
updated_items = {}
for k, mycontent in mydata.iteritems():
- if k not in ignored_dbentries:
+ k_unicode = _unicode_decode(k,
+ encoding=_encodings['repo.content'], errors='replace')
+ if k_unicode not in ignored_dbentries:
+ mycontent = _unicode_decode(mycontent,
+ encoding=_encodings['repo.content'], errors='replace')
orig_content = mycontent
for update_cmd in update_iter:
mycontent = update_dbentry(update_cmd, mycontent)
if mycontent != orig_content:
- updated_items[k] = mycontent
+ updated_items[k] = _unicode_encode(mycontent,
+ encoding=_encodings['repo.content'],
+ errors='backslashreplace')
return updated_items
def fixdbentries(update_iter, dbdir):
updated_items = update_dbentries(update_iter, mydata)
for myfile, mycontent in updated_items.iteritems():
file_path = os.path.join(dbdir, myfile)
- write_atomic(file_path, mycontent)
+ write_atomic(file_path, mycontent, encoding=_encodings['repo.content'])
return len(updated_items) > 0
def grab_updates(updpath, prev_mtimes=None):
def xpak_mem(mydata):
"""Create an xpack segement from a map object."""
+
+ mydata_encoded = {}
+ for k, v in mydata.iteritems():
+ k = _unicode_encode(k,
+ encoding=_encodings['repo.content'], errors='backslashreplace')
+ v = _unicode_encode(v,
+ encoding=_encodings['repo.content'], errors='backslashreplace')
+ mydata_encoded[k] = v
+ mydata = mydata_encoded
+ del mydata_encoded
+
indexglob = _unicode_encode('')
indexpos=0
dataglob = _unicode_encode('')