summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-12-28 10:23:55 +0000
committerZac Medico <zmedico@gentoo.org>2007-12-28 10:23:55 +0000
commita026a4e0c40a5b0c00ead3490ce5a100597c014d (patch)
tree5eba5954f9c018fd7632636b676d34bb4fbe259b /bin
parenta59558d2806b343d366da3c166ca03721e444ba7 (diff)
downloadportage-a026a4e0c40a5b0c00ead3490ce5a100597c014d.tar.gz
portage-a026a4e0c40a5b0c00ead3490ce5a100597c014d.tar.bz2
portage-a026a4e0c40a5b0c00ead3490ce5a100597c014d.zip
Bug #201498 - Use desktop-file-validate to validate *.desktop
files inside ${FILESDIR} and generate a "desktop.invalid" qa warning if an error is detected. Thanks to Betelgeuse for the initial patch. svn path=/main/trunk/; revision=9059
Diffstat (limited to 'bin')
-rwxr-xr-xbin/repoman28
1 files changed, 27 insertions, 1 deletions
diff --git a/bin/repoman b/bin/repoman
index 26e438822..d5d073b81 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -8,6 +8,7 @@
# that last one is tricky because multiple profiles need to be checked.
import codecs
+import commands
import errno
import formatter
import logging
@@ -234,6 +235,7 @@ def ParseArgs(args, 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",
"digest.partial":"Digest files do not contain all corresponding URI elements",
"digest.assumed":"Existing digest must be assumed correct (Package level only)",
"digestentry.unused":"Digest/Manifest entry has no matching SRC_URI entry",
@@ -311,6 +313,7 @@ qawarnings=[
"ebuild.nostable",
"ebuild.allmasked",
"ebuild.nesteddie",
+"desktop.invalid",
"digest.assumed",
"digest.missing",
"digestentry.unused",
@@ -795,6 +798,10 @@ else:
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]=[]
@@ -1152,8 +1159,10 @@ for x in scanlist:
# use filesdirlist as a stack, appending directories as needed so people can't hide > 20k files in a subdirectory.
while filesdirlist:
y = filesdirlist.pop(0)
+ relative_path = os.path.join(x, "files", y)
+ full_path = os.path.join(repodir, relative_path)
try:
- mystat = os.stat(checkdir+"/files/"+y)
+ mystat = os.stat(full_path)
except OSError, oe:
if oe.errno == 2:
# don't worry about it. it likely was removed via fix above.
@@ -1178,6 +1187,23 @@ for x in scanlist:
fails["file.name"].append("%s/files/%s: char '%s'" % (checkdir, y, c))
break
+ if desktop_file_validate and desktop_pattern.match(y):
+ status, cmd_output = commands.getstatusoutput(
+ "'%s' '%s'" % (desktop_file_validate, full_path))
+ if os.WIFEXITED(status) and os.WEXITSTATUS(status) != os.EX_OK:
+ # 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.splitlines():
+ 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 "ChangeLog" not in checkdirlist: