summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorMichael Palimaka <kensington@gentoo.org>2012-09-12 03:22:05 +1000
committerZac Medico <zmedico@gentoo.org>2012-09-11 10:46:57 -0700
commit9f735963c000f0e925b513c5378b2552476c0e8e (patch)
tree341feefb6961ae64ef2e5582c2b0b291459f0372 /pym
parentc512c31e3ce0f53ac3ad4d59a577503413704174 (diff)
downloadportage-9f735963c000f0e925b513c5378b2552476c0e8e.tar.gz
portage-9f735963c000f0e925b513c5378b2552476c0e8e.tar.bz2
portage-9f735963c000f0e925b513c5378b2552476c0e8e.zip
Only validate .desktop files that are installed into XDG-compliant locations.
This replaces the existing error blacklist, and therefore removes the repoman check.
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/package/ebuild/doebuild.py7
-rw-r--r--pym/portage/util/_desktop_entry.py57
2 files changed, 9 insertions, 55 deletions
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 471a5daeb..a6426eed5 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -1773,6 +1773,9 @@ def _post_src_install_uid_fix(mysettings, out):
unicode_errors = []
desktop_file_validate = \
portage.process.find_binary("desktop-file-validate") is not None
+ xdg_dirs = mysettings.get('XDG_DATA_DIRS', '/usr/share').split(':')
+ xdg_dirs = tuple(os.path.join(i, "applications") + os.sep
+ for i in xdg_dirs if i)
while True:
@@ -1821,7 +1824,9 @@ def _post_src_install_uid_fix(mysettings, out):
fpath = os.path.join(parent, fname)
if desktop_file_validate and fname.endswith(".desktop") and \
- os.path.isfile(fpath):
+ os.path.isfile(fpath) and \
+ fpath[ed_len - 1:].startswith(xdg_dirs):
+
desktop_validate = validate_desktop_entry(fpath)
if desktop_validate:
desktopfile_errors.extend(desktop_validate)
diff --git a/pym/portage/util/_desktop_entry.py b/pym/portage/util/_desktop_entry.py
index aa730ded3..2973d12ff 100644
--- a/pym/portage/util/_desktop_entry.py
+++ b/pym/portage/util/_desktop_entry.py
@@ -42,20 +42,6 @@ def parse_desktop_entry(path):
return parser
_trivial_warnings = re.compile(r' looks redundant with value ')
-_ignore_kde_key_re = re.compile(r'^\s*(configurationType\s*=|Type\s*=\s*Service)')
-_ignore_kde_types = frozenset(
- ["AkonadiAgent", "AkonadiResource", "Service", "ServiceType", "XSession"])
-
-# kdebase-data installs files with [Currency Code] sections
-# in /usr/share/locale/currency
-# kdepim-runtime installs files with [Plugin] and [Wizard]
-# sections in /usr/share/apps/akonadi/{plugins,accountwizard}
-# kdm installs files with [KCM Locale], [KDE Desktop Pattern],
-# [KdmGreeterTheme] and [Wallpaper] sections in various directories
-# libkdegames installs files with [KDE Backdeck] sections in
-# /usr/share/apps/carddecks/
-# Various KDE games install files with [KGameTheme] sections
-_ignore_kde_sections = ("Currency Code", "KCM Locale", "KDE Backdeck", "KDE Desktop Pattern", "KDE Desktop Program", "KdmGreeterTheme", "KGameTheme", "Plugin", "Wallpaper", "Wizard")
_ignored_errors = (
# Ignore error for emacs.desktop:
@@ -74,48 +60,11 @@ def validate_desktop_entry(path):
proc.wait()
if output_lines:
- # Ignore kde extensions for bug #414125 and bug #432862.
- try:
- desktop_entry = parse_desktop_entry(path)
- except ConfigParserError:
- with io.open(_unicode_encode(path,
- encoding=_encodings['fs'], errors='strict'),
- mode='r', encoding=_encodings['repo.content'],
- errors='replace') as f:
- for line in f:
- if _ignore_kde_key_re.match(line):
- # Ignore kde extensions for bug #432862.
- del output_lines[:]
- break
- else:
- if desktop_entry.has_section("Desktop Entry"):
- try:
- entry_type = desktop_entry.get("Desktop Entry", "Type")
- except ConfigParserError:
- pass
- else:
- if entry_type in _ignore_kde_types:
- del output_lines[:]
- try:
- desktop_entry.get("Desktop Entry", "Hidden")
- except ConfigParserError:
- pass
- else:
- # The "Hidden" key appears to be unique to special kde
- # service files (which don't validate well), installed
- # in /usr/share/kde4/services/ by packages like
- # nepomuk-core and kurifilter-plugins.
- del output_lines[:]
- for section in _ignore_kde_sections:
- if desktop_entry.has_section(section):
- del output_lines[:]
-
- if output_lines:
filtered_output = []
for line in output_lines:
- if line[len(path)+2:] in _ignored_errors:
- continue
- filtered_output.append(line)
+ if line[len(path)+2:] in _ignored_errors:
+ continue
+ filtered_output.append(line)
output_lines = filtered_output
if output_lines: