aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harder <radhermit@gmail.com>2020-12-26 16:54:03 -0700
committerTim Harder <radhermit@gmail.com>2020-12-26 16:54:03 -0700
commit28a84574c8341c14a56d90003e1ced570986dee5 (patch)
treec4750f2810a70bd5e19764dbcf8ac8cde0d0e9c1 /src/pkgcheck/scripts
parentgit: add initial incremental profile scanning support (diff)
downloadpkgcheck-28a84574c8341c14a56d90003e1ced570986dee5.tar.gz
pkgcheck-28a84574c8341c14a56d90003e1ced570986dee5.tar.bz2
pkgcheck-28a84574c8341c14a56d90003e1ced570986dee5.zip
pkgcheck scan: add support for profile file target restrictions
Diffstat (limited to 'src/pkgcheck/scripts')
-rw-r--r--src/pkgcheck/scripts/pkgcheck.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/pkgcheck/scripts/pkgcheck.py b/src/pkgcheck/scripts/pkgcheck.py
index 5c1357aa..26465590 100644
--- a/src/pkgcheck/scripts/pkgcheck.py
+++ b/src/pkgcheck/scripts/pkgcheck.py
@@ -416,17 +416,23 @@ def _setup_scan(parser, namespace, args):
def generate_restricts(repo, targets):
"""Generate scanning restrictions from given targets."""
- eclasses = set()
+ eclasses = []
+ profiles = []
+ profiles_base = os.path.realpath(repo.config.profiles_base)
+
for target in targets:
path = os.path.realpath(target)
# prefer path restrictions if it's in the target repo
if os.path.exists(path) and path in repo:
- # support direct eclass path targets
- if target.endswith('.eclass') and path in repo:
- eclasses.add(os.path.basename(target)[:-7])
- continue
- else:
- yield _path_restrict(path, repo)
+ # support direct eclass and profiles file targets
+ if os.path.isfile(path):
+ if target.endswith('.eclass'):
+ eclasses.append(os.path.basename(target)[:-7])
+ continue
+ elif path.startswith(profiles_base):
+ profiles.append(target)
+ continue
+ yield _path_restrict(path, repo)
else:
try:
# assume it's a package restriction
@@ -440,9 +446,10 @@ def generate_restricts(repo, targets):
f"{repo.repo_id!r} repo doesn't contain: {target!r}")
raise PkgcheckUserException(str(e))
- # support eclass target restrictions
if eclasses:
yield base.eclass_scope, frozenset(eclasses)
+ if profiles:
+ yield base.profiles_scope, frozenset(profiles)
@scan.bind_delayed_default(1000, 'filter')