diff options
author | Anas Nashif <anas.nashif@intel.com> | 2013-05-10 16:25:54 -0400 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2013-05-29 04:41:52 -0400 |
commit | 5320e7c1e0bd81bb123bcd0b816d2d7456dc1ae6 (patch) | |
tree | 349a38e051821af049c555c07db41697cb107dbd | |
parent | 64e6591a2548a8d8045e59ae3cf7557f01168fe4 (diff) | |
download | rpmlint-5320e7c1e0bd81bb123bcd0b816d2d7456dc1ae6.tar.gz rpmlint-5320e7c1e0bd81bb123bcd0b816d2d7456dc1ae6.tar.bz2 rpmlint-5320e7c1e0bd81bb123bcd0b816d2d7456dc1ae6.zip |
handle %license
-rw-r--r-- | DocFilesCheck.py | 12 | ||||
-rw-r--r-- | Pkg.py | 10 |
2 files changed, 22 insertions, 0 deletions
diff --git a/DocFilesCheck.py b/DocFilesCheck.py index 4463579..f668aed 100644 --- a/DocFilesCheck.py +++ b/DocFilesCheck.py @@ -71,6 +71,12 @@ class DocFilesCheck(AbstractCheck.AbstractCheck): 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(): @@ -78,6 +84,7 @@ class DocFilesCheck(AbstractCheck.AbstractCheck): self.__checkRequirements(pkg) self.__checkUnwantedFiles(pkg) + self.__checkLicenseFiles(pkg) check = DocFilesCheck() @@ -94,6 +101,11 @@ included in the package. Such instructions are often not relevant for already 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 @@ -421,6 +421,7 @@ class Pkg: 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 @@ -572,6 +573,14 @@ class Pkg: 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: @@ -894,6 +903,7 @@ class PkgFile(object): 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) |