diff options
author | Andreas Grapentin <andreas@grapentin.org> | 2019-02-09 01:30:59 +0100 |
---|---|---|
committer | Andreas Grapentin <andreas@grapentin.org> | 2019-02-09 01:30:59 +0100 |
commit | cbdf2b4860381760d5670fc693681a6627c14b9f (patch) | |
tree | 672c026206d3fa4ab51148eef88430cd3d6c750f | |
parent | a1cd337245a67c2864a11a4be145137c2f3760d5 (diff) |
finalizing repo relationship integrity checks
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | README.rst | 21 | ||||
-rw-r--r-- | parabola_repolint/linter_checks/pkgbuild_validity.py | 2 | ||||
-rw-r--r-- | parabola_repolint/linter_checks/repo_integrity.py | 79 | ||||
-rw-r--r-- | parabola_repolint/repocache.py | 10 |
5 files changed, 106 insertions, 7 deletions
@@ -1,5 +1,6 @@ TODO +geckodriver.log # config files *.conf @@ -52,6 +52,13 @@ for the list of entries in a repo.db, check whether more than one valid PKGBUILD exists that creates the entry. The check reports an issue for each repo.db entry that has more than one producing PKGBUILD. +pkgentry_missing_pkgfile +~~~~~~~~~~~~~~~~~~~~~~~~ + +for the list of entries in a repo.db, check wether a built package exists that +backs the entry. The check reports an issue for each repo.db entry that is not +associatable with a valid built package. + pkgfile_missing_pkgbuild ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -66,6 +73,20 @@ for the list of built packages, check whether more than one valid PKGBUILD exists that creates the package. The check reports an issue for each built package that has more than one producing PKGBUILD. +pkgfile_missing_pkgentry +~~~~~~~~~~~~~~~~~~~~~~~~ + +for the list of built packages, check wether a repo.db entry exists that refers +to the package. The check reports an issue for each built package that is not +referred to by a repo.db entry. + +pkgfile_duplicate_pkgentries +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +for the list of built packages, check that at most one repo.db entry exists +that refers to the package. The check reports an issue for each built package +that is referred to by multiple repo.db entries. + PKGBUILD validity checks ------------------------ diff --git a/parabola_repolint/linter_checks/pkgbuild_validity.py b/parabola_repolint/linter_checks/pkgbuild_validity.py index 99060b9..170b22a 100644 --- a/parabola_repolint/linter_checks/pkgbuild_validity.py +++ b/parabola_repolint/linter_checks/pkgbuild_validity.py @@ -75,7 +75,7 @@ class UnsupportedArches(LinterCheckBase): unsup[pkgname] = unsup[pkgname].union(unsup_pkg) if unsup: - unsup_str = '; '.join(['%s: %s' % (p, ','.join(u)) for p,u in unsup.items()]) + unsup_str = '; '.join(['%s: %s' % (p, ','.join(u)) for p, u in unsup.items()]) raise LinterIssue(pkgbuild, unsup_str) def format(self, issues): diff --git a/parabola_repolint/linter_checks/repo_integrity.py b/parabola_repolint/linter_checks/repo_integrity.py index 374be5f..f28d0b2 100644 --- a/parabola_repolint/linter_checks/repo_integrity.py +++ b/parabola_repolint/linter_checks/repo_integrity.py @@ -154,6 +154,33 @@ class PkgEntryDuplicatePkgbuilds(LinterCheckBase): return "\n".join(sorted(result)) + +# pylint: disable=no-self-use +class PkgEntryMissingPkgFile(LinterCheckBase): + ''' + for the list of entries in a repo.db, check wether a built package exists that + backs the entry. The check reports an issue for each repo.db entry that is not + associatable with a valid built package. +''' + + name = 'pkgentry_missing_pkgfile' + check_type = LinterCheckType.PKGENTRY + + header = 'repo.db entries with no valid built package' + + def check(self, pkgentry): + ''' run the check ''' + if not pkgentry.pkgfiles: + raise LinterIssue(pkgentry) + + def format(self, issues): + ''' format the list of found issues ''' + result = [] + for issue in issues: + result.append(' %s' % issue[0]) + return "\n".join(sorted(result)) + + # pylint: disable=no-self-use class PkgFileMissingPkgbuild(LinterCheckBase): ''' @@ -204,3 +231,55 @@ class PkgFileDuplicatePkgbuilds(LinterCheckBase): for issue in issues: result.append(' %s (%s)' % (issue[0], ','.join(issue[1]))) return "\n".join(sorted(result)) + + +# pylint: disable=no-self-use +class PkgFileMissingPkgEntry(LinterCheckBase): + ''' + for the list of built packages, check wether a repo.db entry exists that refers + to the package. The check reports an issue for each built package that is not + referred to by a repo.db entry. +''' + + name = 'pkgfile_missing_pkgentry' + check_type = LinterCheckType.PKGFILE + + header = 'built packages without a referring repo.db entry' + + def check(self, pkgfile): + ''' run the check ''' + if not pkgfile.pkgentries: + raise LinterIssue(pkgfile) + + def format(self, issues): + ''' format the list of found issues ''' + result = [] + for issue in issues: + result.append(' %s' % issue[0]) + return "\n".join(sorted(result)) + + +# pylint: disable=no-self-use +class PkgFileDuplicatePkgEntries(LinterCheckBase): + ''' + for the list of built packages, check that at most one repo.db entry exists + that refers to the package. The check reports an issue for each built package + that is referred to by multiple repo.db entries. +''' + + name = 'pkgfile_duplicate_pkgentries' + check_type = LinterCheckType.PKGFILE + + header = 'built packages with duplicate referring repo.db entries' + + def check(self, pkgfile): + ''' run the check ''' + if len(pkgfile.pkgentries) > 1: + raise LinterIssue(pkgfile, pkgfile.pkgentries) + + def format(self, issues): + ''' format the list of found issues ''' + result = [] + for issue in issues: + result.append(' %s (%s)' % (issue[0], ','.join(issue[1]))) + return "\n".join(sorted(result)) diff --git a/parabola_repolint/repocache.py b/parabola_repolint/repocache.py index 89cbe3e..c6e29d1 100644 --- a/parabola_repolint/repocache.py +++ b/parabola_repolint/repocache.py @@ -42,15 +42,11 @@ class PkgFile(): pkgbuild_cache = repo.pkgbuild_cache.get(repoarch, {}) self._pkgbuilds = pkgbuild_cache.get(self.pkgname, []) - if not self._pkgbuilds and self.pkgname.endswith('-debug'): - self._pkgbuilds = pkgbuild_cache.get(self.pkgname[:-6], []) for pkgbuild in self._pkgbuilds: pkgbuild.register_pkgfile(self, repoarch) pkgentries_cache = repo.pkgentries_cache.get(repoarch, {}) self._pkgentries = pkgentries_cache.get(self.pkgname, []) - if not self._pkgentries and self.pkgname.endswith('-debug'): - self._pkgentries = pkgentries_cache.get(self.pkgname[:-6], []) for pkgentry in self._pkgentries: pkgentry.register_pkgfile(self, repoarch) @@ -140,8 +136,6 @@ class PkgEntry(): pkgbuild_cache = repo.pkgbuild_cache.get(repoarch, {}) self._pkgbuilds = pkgbuild_cache.get(self.pkgname, []) - if not self._pkgbuilds and self.pkgname.endswith('-debug'): - self._pkgbuilds = pkgbuild_cache.get(self.pkgname[:-6], []) for pkgbuild in self._pkgbuilds: pkgbuild.register_pkgentry(self, repoarch) @@ -471,6 +465,10 @@ class Repo(): for arch in pkgbuild.arches.intersection(CONFIG.parabola.arches): if arch not in self._pkgbuild_cache: self._pkgbuild_cache[arch] = {} + pkgname = '%s-debug' % pkgbuild.srcinfo[arch].pkgbase['pkgbase'] + if pkgname not in self._pkgbuild_cache[arch]: + self._pkgbuild_cache[arch][pkgname] = [] + self._pkgbuild_cache[arch][pkgname].append(pkgbuild) for pkgname in pkgbuild.srcinfo[arch].pkginfo: if pkgname not in self._pkgbuild_cache[arch]: self._pkgbuild_cache[arch][pkgname] = [] |