if docfile.endswith("/INSTALL"):
printWarning(pkg, "install-file-in-docs", docfile)
+ def __checkLicenseFiles(self, pkg):
+
+ for docfile in pkg.docFiles():
+ if docfile.endswith("/COPYING") or docfile.endswith("/LICENSE"):
+ printWarning(pkg, "license-file-in-docs", docfile)
+
def check(self, pkg):
if pkg.isSource() or not pkg.docFiles():
self.__checkRequirements(pkg)
self.__checkUnwantedFiles(pkg)
+ self.__checkLicenseFiles(pkg)
check = DocFilesCheck()
installed packages; if this is the case for this file and it does not contain
any information that is of interest after the package has been built and
installed, do not include the file in the binary package.''',
+'license-file-in-docs',
+'''A file whose name suggests that it contains a license is
+included in the package as a document. Such files need to be marked with %license
+and not with %doc, which will install them in a special directory seperated
+from the documentation.''',
)
# DocFilesCheck.py ends here
self.current_linenum = None
self._config_files = None
self._doc_files = None
+ self._license_files = None
self._noreplace_files = None
self._ghost_files = None
self._missingok_files = None
self._doc_files = [x.name for x in self.files().values() if x.is_doc]
return self._doc_files
+ # return the list of license files
+ def licenseFiles(self):
+ if self._license_files is not None:
+ return self._license_files
+
+ self._license_files = [x.name for x in self.files().values() if x.is_license]
+ return self._license_files
+
# return the list of ghost files
def ghostFiles(self):
if self._ghost_files is not None:
is_config = property(lambda self: self.flags & rpm.RPMFILE_CONFIG)
is_doc = property(lambda self: self.flags & rpm.RPMFILE_DOC)
+ is_license = property(lambda self: self.flags & rpm.RPMFILE_LICENSE)
is_noreplace = property(lambda self: self.flags & rpm.RPMFILE_NOREPLACE)
is_ghost = property(lambda self: self.flags & rpm.RPMFILE_GHOST)
is_missingok = property(lambda self: self.flags & rpm.RPMFILE_MISSINGOK)