public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/, pym/portage/util/
@ 2012-09-11 17:48 Zac Medico
  0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2012-09-11 17:48 UTC (permalink / raw
  To: gentoo-commits

commit:     9f735963c000f0e925b513c5378b2552476c0e8e
Author:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 11 17:22:05 2012 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Sep 11 17:46:57 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9f735963

Only validate .desktop files that are installed into XDG-compliant locations.

This replaces the existing error blacklist, and therefore removes the repoman check.

---
 bin/repoman                            |   24 -------------
 pym/portage/package/ebuild/doebuild.py |    7 +++-
 pym/portage/util/_desktop_entry.py     |   57 ++------------------------------
 3 files changed, 9 insertions(+), 79 deletions(-)

diff --git a/bin/repoman b/bin/repoman
index 53d138c..bc2ac9b 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -78,7 +78,6 @@ from portage.output import bold, create_color_func, \
 	green, nocolor, red
 from portage.output import ConsoleStyleFile, StyleWriter
 from portage.util import writemsg_level
-from portage.util._desktop_entry import validate_desktop_entry
 from portage.package.ebuild.digestgen import digestgen
 from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
 
@@ -303,7 +302,6 @@ def ParseArgs(argv, qahelp):
 
 qahelp={
 	"CVS/Entries.IO_error":"Attempting to commit, and an IO error was encountered access the Entries file",
-	"desktop.invalid":"desktop-file-validate reports errors in a *.desktop file",
 	"ebuild.invalidname":"Ebuild files with a non-parseable or syntactically incorrect name (or using 2.1 versioning extensions)",
 	"ebuild.namenomatch":"Ebuild files that do not have the same name as their parent directory",
 	"changelog.ebuildadded":"An ebuild was added but the ChangeLog was not modified",
@@ -406,7 +404,6 @@ qawarnings = set((
 "digest.unused",
 "ebuild.notadded",
 "ebuild.nesteddie",
-"desktop.invalid",
 "DEPEND.badmasked","RDEPEND.badmasked","PDEPEND.badmasked",
 "DEPEND.badindev","RDEPEND.badindev","PDEPEND.badindev",
 "DEPEND.badmaskedindev","RDEPEND.badmaskedindev","PDEPEND.badmaskedindev",
@@ -1054,10 +1051,6 @@ dev_keywords = dev_keywords(profiles)
 stats={}
 fails={}
 
-# provided by the desktop-file-utils package
-desktop_file_validate = find_binary("desktop-file-validate")
-desktop_pattern = re.compile(r'.*\.desktop$')
-
 for x in qacats:
 	stats[x]=0
 	fails[x]=[]
@@ -1630,23 +1623,6 @@ for x in effective_scanlist:
 				stats["file.name"] += 1
 				fails["file.name"].append("%s/files/%s: char '%s'" % \
 					(checkdir, y, m.group(0)))
-
-			if desktop_file_validate and desktop_pattern.match(y):
-				cmd_output = validate_desktop_entry(full_path)
-				if cmd_output:
-					# Note: in the future we may want to grab the
-					# warnings in addition to the errors. We're
-					# just doing errors now since we don't want
-					# to generate too much noise at first.
-					error_re = re.compile(r'.*\s*error:\s*(.*)')
-					for line in cmd_output:
-						error_match = error_re.match(line)
-						if error_match is None:
-							continue
-						stats["desktop.invalid"] += 1
-						fails["desktop.invalid"].append(
-							relative_path + ': %s' % error_match.group(1))
-
 	del mydigests
 
 	if check_changelog and "ChangeLog" not in checkdirlist:

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 471a5da..a6426ee 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 aa730de..2973d12 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:


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-09-11 17:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-11 17:48 [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/, pym/portage/util/ Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox