Dirk Mueller 2018-01-15 22:40:03 +00:00 committed by Git OBS Bridge
parent 15fc6a460e
commit cc9be002a2

View File

@ -1,4 +1,4 @@
From e6594808fdf6c1fcb4175c523582ab7c358839f0 Mon Sep 17 00:00:00 2001
From 8de78fa8b0cd9a2fe4156b841429ac8d55b39909 Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
Date: Fri, 29 Sep 2017 09:12:33 +0200
Subject: [PATCH] Improve XDG Menu checks stability
@ -14,17 +14,17 @@ rpmlint errors. Also separate the code a little and cleaning it up.
create mode 100644 test/binary/menuxdg1-0-0.noarch.rpm
create mode 100644 test/test_menuxdg.py
Index: rpmlint-rpmlint-1.10/MenuXDGCheck.py
===================================================================
--- rpmlint-rpmlint-1.10.orig/MenuXDGCheck.py
+++ rpmlint-rpmlint-1.10/MenuXDGCheck.py
diff --git a/MenuXDGCheck.py b/MenuXDGCheck.py
index 9995255..66912ea 100644
--- a/MenuXDGCheck.py
+++ b/MenuXDGCheck.py
@@ -8,15 +8,15 @@
import os
try:
- from ConfigParser import RawConfigParser
+ import ConfigParser as cfgparser
except:
except ImportError:
- from configparser import RawConfigParser
+ import configparser as cfgparser
@ -37,14 +37,17 @@ Index: rpmlint-rpmlint-1.10/MenuXDGCheck.py
class MenuXDGCheck(AbstractCheck.AbstractFilesCheck):
@@ -27,6 +27,51 @@ class MenuXDGCheck(AbstractCheck.Abstrac
@@ -25,7 +25,52 @@ class MenuXDGCheck(AbstractCheck.AbstractFilesCheck):
# $ echo $XDG_DATA_DIRS/applications
# /var/lib/menu-xdg:/usr/share
AbstractCheck.AbstractFilesCheck.__init__(
self, "MenuXDGCheck", r"(?:/usr/share|/etc/opt/.*/share|/opt/.*)/applications/.*\.desktop$")
- self, "MenuXDGCheck", r"/usr/share/applications/.*\.desktop$")
+ self, "MenuXDGCheck", r'(?:/usr|/etc/opt|/opt/.*)/share/applications/.*\.desktop$')
+
+ def parse_desktop_file(self, pkg, root, f, filename):
+ cfp = cfgparser.RawConfigParser()
+ try:
+ with open(f) as inputf:
+ with open(f, 'rb') as inputf:
+ cfp.readfp(inputf, filename)
+ except cfgparser.DuplicateSectionError as e:
+ printError(
@ -85,11 +88,10 @@ Index: rpmlint-rpmlint-1.10/MenuXDGCheck.py
+ if not found:
+ printWarning(
+ pkg, 'desktopfile-without-binary', filename, binary)
+
def check_file(self, pkg, filename):
root = pkg.dirName()
f = root + filename
@@ -43,25 +88,7 @@ class MenuXDGCheck(AbstractCheck.Abstrac
@@ -43,25 +88,7 @@ class MenuXDGCheck(AbstractCheck.AbstractFilesCheck):
if not is_utf8(f):
printError(pkg, 'non-utf8-desktopfile', filename)