SHA256
1
0
forked from pool/rpmlint
rpmlint/try-harder-with-spec-name.diff

42 lines
1.4 KiB
Diff

--- SpecCheck.py
+++ SpecCheck.py
@@ -169,18 +169,22 @@
# lookup spec file
files = pkg.files()
- for f in files.keys():
- if f.endswith('.spec'):
- self._spec_file = pkg.dirName() + "/" + f
- break
+ if (pkg.name + ".spec") in files.keys():
+ self._spec_file = pkg.name + ".spec"
+ else:
+ for f in files.keys():
+ if f.endswith('.spec'):
+ self._spec_file = f
+ break
+
if not self._spec_file:
printError(pkg, "no-spec-file")
else:
- if f != pkg.name + ".spec":
- printError(pkg, "invalid-spec-name", f)
+ if self._spec_file != pkg.name + ".spec":
+ printError(pkg, "invalid-spec-name", self._spec_file)
# check content of spec file
- spec_lines = Pkg.readlines(self._spec_file)
+ spec_lines = Pkg.readlines(pkg.dirName() + "/" + self._spec_file)
self.check_spec(pkg, spec_lines)
def check_spec(self, pkg, spec_lines):
@@ -219,7 +223,7 @@
}
if self._spec_file:
- if use_utf8 and not Pkg.is_utf8(self._spec_file):
+ if use_utf8 and not Pkg.is_utf8(pkg.dirName() + "/" + self._spec_file):
printError(pkg, "non-utf8-spec-file", self._spec_file)
# gather info from spec lines