aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Harring <ferringb@gmail.com>2024-01-18 20:16:50 -0800
committerBrian Harring <ferringb@gmail.com>2024-01-23 11:57:59 -0800
commit2b66a5ab1f678bcebc59b36abd9254123077c45b (patch)
treefd6f7cdd4ded19660c059e18b9bcdca1db32c563
parentfeat: add check for a category is a file (diff)
downloadpkgcheck-2b66a5ab1f678bcebc59b36abd9254123077c45b.tar.gz
pkgcheck-2b66a5ab1f678bcebc59b36abd9254123077c45b.tar.bz2
pkgcheck-2b66a5ab1f678bcebc59b36abd9254123077c45b.zip
compatibilty: remove reliance on repo.category_dirs
pkgcore's `category_dirs` is a fossil that shouldn't be relied upon. My recollection is this property was from before `profiles/categories` existed, but it's just a listdir() intersection against known directories. PMS mandates categories be in `profiles/categories`, thus that functionality breaks compatibility. It will be removed from pkgcore in future semver breaks for that reason. Signed-off-by: Brian Harring <ferringb@gmail.com>
-rw-r--r--src/pkgcheck/checks/repo.py6
-rw-r--r--testdata/repos/eapis-testing/profiles/categories2
-rw-r--r--testdata/repos/eclass/profiles/categories5
-rw-r--r--testdata/repos/network/profiles/categories3
-rw-r--r--testdata/repos/overlay/profiles/categories1
-rw-r--r--testdata/repos/overlayed/profiles/categories1
-rw-r--r--testdata/repos/profiledir/profiles/categories2
-rw-r--r--testdata/repos/python/profiles/categories8
-rw-r--r--testdata/repos/standalone/profiles/categories55
-rw-r--r--testdata/repos/visibility/profiles/categories8
10 files changed, 89 insertions, 2 deletions
diff --git a/src/pkgcheck/checks/repo.py b/src/pkgcheck/checks/repo.py
index 1dcc99ad..08abe802 100644
--- a/src/pkgcheck/checks/repo.py
+++ b/src/pkgcheck/checks/repo.py
@@ -82,10 +82,12 @@ class EmptyDirsCheck(GentooRepoCheck, RepoCheck):
self.repo = self.options.target_repo
def finish(self):
+ repo_p = pathlib.Path(self.repo.location)
for cat, pkgs in sorted(self.repo.packages.items()):
# ignore entries in profiles/categories with nonexistent dirs
- if not pkgs and cat in self.repo.category_dirs:
- yield EmptyCategoryDir(pkg=RawCPV(cat, None, None))
+ if not pkgs:
+ if (repo_p / cat).exists():
+ yield EmptyCategoryDir(pkg=RawCPV(cat, None, None))
continue
for pkg in sorted(pkgs):
if not self.repo.versions[(cat, pkg)]:
diff --git a/testdata/repos/eapis-testing/profiles/categories b/testdata/repos/eapis-testing/profiles/categories
new file mode 100644
index 00000000..077b068b
--- /dev/null
+++ b/testdata/repos/eapis-testing/profiles/categories
@@ -0,0 +1,2 @@
+EapiCheck
+MissingRemoteIdCheck
diff --git a/testdata/repos/eclass/profiles/categories b/testdata/repos/eclass/profiles/categories
new file mode 100644
index 00000000..a7c758c3
--- /dev/null
+++ b/testdata/repos/eclass/profiles/categories
@@ -0,0 +1,5 @@
+EapiCheck
+EclassParseCheck
+EclassUsageCheck
+InheritsCheck
+stub
diff --git a/testdata/repos/network/profiles/categories b/testdata/repos/network/profiles/categories
new file mode 100644
index 00000000..83f6db7f
--- /dev/null
+++ b/testdata/repos/network/profiles/categories
@@ -0,0 +1,3 @@
+FetchablesUrlCheck
+HomepageUrlCheck
+MetadataUrlCheck
diff --git a/testdata/repos/overlay/profiles/categories b/testdata/repos/overlay/profiles/categories
new file mode 100644
index 00000000..367e18ec
--- /dev/null
+++ b/testdata/repos/overlay/profiles/categories
@@ -0,0 +1 @@
+UnusedInMastersCheck
diff --git a/testdata/repos/overlayed/profiles/categories b/testdata/repos/overlayed/profiles/categories
new file mode 100644
index 00000000..39802f64
--- /dev/null
+++ b/testdata/repos/overlayed/profiles/categories
@@ -0,0 +1 @@
+stub
diff --git a/testdata/repos/profiledir/profiles/categories b/testdata/repos/profiledir/profiles/categories
new file mode 100644
index 00000000..5ab67d3f
--- /dev/null
+++ b/testdata/repos/profiledir/profiles/categories
@@ -0,0 +1,2 @@
+cat
+RedundantVersionCheck
diff --git a/testdata/repos/python/profiles/categories b/testdata/repos/python/profiles/categories
new file mode 100644
index 00000000..07e87fc9
--- /dev/null
+++ b/testdata/repos/python/profiles/categories
@@ -0,0 +1,8 @@
+app-arch
+dev-lang
+dev-python
+PythonCheck
+PythonCompatCheck
+PythonFetchableCheck
+RubyCompatCheck
+stub
diff --git a/testdata/repos/standalone/profiles/categories b/testdata/repos/standalone/profiles/categories
new file mode 100644
index 00000000..9a5bd29c
--- /dev/null
+++ b/testdata/repos/standalone/profiles/categories
@@ -0,0 +1,55 @@
+app-arch
+BadCommandsCheck
+CatBadlyFormedXml
+CatInvalidXml
+CatMetadataXmlEmptyElement
+CatMetadataXmlIndentation
+CatMetadataXmlInvalidCatRef
+CatMetadataXmlInvalidPkgRef
+DeclarationShadowedCheck
+DependencyCheck
+DescriptionCheck
+dev-lang
+dev-ruby
+DoCompressedFilesCheck
+DroppedKeywordsCheck
+EapiCheck
+EbuildReservedCheck
+EbuildUnquotedVariablesCheck
+EclassManualDepsCheck
+EclassUsageCheck
+EendMissingArgCheck
+EqualVersionsCheck
+GlobalUseCheck
+GlobCheck
+HomepageCheck
+InsintoCheck
+IuseCheck
+KeywordsCheck
+LicenseCheck
+LocalUseCheck
+ManifestCheck
+ManifestCollisionCheck
+MetadataVarCheck
+MissingSlotDepCheck
+MissingUnpackerDepCheck
+NonPosixCheck
+PackageMetadataXmlCheck
+PkgDirCheck
+PropertiesCheck
+ReadonlyVariableCheck
+RedundantDodirCheck
+RequiredUseCheck
+RestrictCheck
+RestrictTestCheck
+RustCheck
+SandboxCallCheck
+SourcingCheck
+SrcUriCheck
+StaleLiveCheck
+stub
+test
+VariableScopeCheck
+virtual
+VisibilityCheck
+WhitespaceCheck
diff --git a/testdata/repos/visibility/profiles/categories b/testdata/repos/visibility/profiles/categories
new file mode 100644
index 00000000..53471351
--- /dev/null
+++ b/testdata/repos/visibility/profiles/categories
@@ -0,0 +1,8 @@
+DependencyMoved
+DeprecatedDep
+NonsolvableDepsInDev
+NonsolvableDepsInExp
+NonsolvableDepsInStable
+stub
+UncheckableDep
+VisibilityCheck