SHA256
1
0
forked from pool/rpmlint

add 0007-Validate-Appdata-also-when-appstream-util-is-unavail.patch

OBS-URL: https://build.opensuse.org/package/show/devel:openSUSE:Factory:rpmlint/rpmlint?expand=0&rev=521
This commit is contained in:
Dirk Mueller 2017-10-10 11:18:19 +00:00 committed by Git OBS Bridge
parent 92b014372d
commit 8982407c4d
3 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,51 @@
From 33b3aab641f6f71f33fd87f1e1b41ea2e74f48e3 Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
Date: Sun, 1 Oct 2017 14:36:40 +0200
Subject: [PATCH 7/7] Validate Appdata also when appstream-util is unavailable
When the dependency isn't installed, we can at least still
validate whether the input is valid XML or not. As we're
not printing any validation results anyway this is good
enough.
---
AppDataCheck.py | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/AppDataCheck.py b/AppDataCheck.py
index 20302d8..b714f31 100644
--- a/AppDataCheck.py
+++ b/AppDataCheck.py
@@ -10,6 +10,7 @@ import AbstractCheck
import Config
from Filter import addDetails, printError
from Pkg import getstatusoutput
+import xml.etree.ElementTree as ET
STANDARD_BIN_DIRS = ['/bin/', '/sbin/', '/usr/bin/', '/usr/sbin/']
DEFAULT_APPDATA_CHECKER = ('appstream-util', 'validate-relax')
@@ -32,13 +33,18 @@ class AppDataCheck(AbstractCheck.AbstractFilesCheck):
checker = appdata_checker
if checker[0] == "appstream-util" and not self.network_enabled:
checker += ("--nonet",)
- print(checker)
+ validation_failed = False
try:
st = getstatusoutput(checker + (f,))
+ # Return code nonzero?
+ validation_failed = (st[0] != 0)
except OSError:
- # ignore if the checker is not installed
- return
- if st[0]:
+ # checker is not installed, do a validation manually
+ try:
+ ET.parse(pkg.dirName() + filename)
+ except ET.ParseError:
+ validation_failed = True
+ if validation_failed:
printError(pkg, 'invalid-appdata-file', filename)
--
2.14.1

View File

@ -2,6 +2,7 @@
Tue Oct 10 09:06:23 UTC 2017 - dmueller@suse.com
- add 0001-Avoid-false-positives-on-is_elf-check.patch (bsc#1057216)
add 0007-Validate-Appdata-also-when-appstream-util-is-unavail.patch
- Update rpmlint-checks to version master:
* Fix false positives for -theme- -> -branding- rename
* Stop leaking filedescriptors

View File

@ -84,6 +84,7 @@ Patch65: 0001-split-wrong-script-interpreter-into-env-script-inter.patch
Patch66: 0001-Handle-post-scripts-that-contain-non-ascii-character.patch
Patch67: omit_BUILDROOT_from_pyo_files.patch
Patch68: 0001-Avoid-false-positives-on-is_elf-check.patch
Patch69: 0007-Validate-Appdata-also-when-appstream-util-is-unavail.patch
Patch70: rpmlint-all-pie.patch
BuildRequires: obs-service-format_spec_file
BuildRequires: python3-flake8