diff options
author | Mykyta Holubakha <hilobakho@gmail.com> | 2019-06-13 22:18:03 +0300 |
---|---|---|
committer | Mykyta Holubakha <hilobakho@gmail.com> | 2019-06-13 22:18:03 +0300 |
commit | d172112aad6ca4ee589ba8a59bfd1d4212b34192 (patch) | |
tree | cd8446f3e8581a4401aa8f8354fb582eb6fd140d /pomu/source | |
parent | Ensure show works with portage (diff) | |
download | pomu-d172112aad6ca4ee589ba8a59bfd1d4212b34192.tar.gz pomu-d172112aad6ca4ee589ba8a59bfd1d4212b34192.tar.bz2 pomu-d172112aad6ca4ee589ba8a59bfd1d4212b34192.zip |
Diffstat (limited to 'pomu/source')
-rw-r--r-- | pomu/source/file.py | 3 | ||||
-rw-r--r-- | pomu/source/portage.py | 18 |
2 files changed, 6 insertions, 15 deletions
diff --git a/pomu/source/file.py b/pomu/source/file.py index 7658435..67ecdb2 100644 --- a/pomu/source/file.py +++ b/pomu/source/file.py @@ -60,8 +60,7 @@ class LocalEbuildSource(BaseSource): uri = path.abspath(uri) dirn, basen = path.split(uri) basen = basen[:-7] - _, name, v1, v2, v3 = cpv_split(basen) - ver = ver_str(v1, v2, v3) + _, name, ver = cpv_split(basen) parent = dirn.split('/')[-1] # we need to query the impure world # TODO: write a global option which would set the impure values non-interactively diff --git a/pomu/source/portage.py b/pomu/source/portage.py index abd5851..9b5d57f 100644 --- a/pomu/source/portage.py +++ b/pomu/source/portage.py @@ -42,7 +42,7 @@ class PortagePackage(PackageBase): with open(path.join(pkgdir, 'PORTAGE_DATA'), 'r') as f: repo = f.readline().strip() - if sanity_check(repo, pkg.category, pkg.name, None, None, None, pkg.slot, ver=pkg.version): + if sanity_check(repo, pkg.category, pkg.name, pkg.version, pkg.slot): return Result.Ok(PortagePackage(repo, pkg.category, pkg.name, pkg.slot, pkg.version)) return Result.Err('Package {} not found'.format(pkg)) @@ -66,8 +66,8 @@ class PortageSource(BaseSource): pkg, _, slot = uri.partition(':') # slot may be omitted if not slot: slot = None - category, name, vernum, suff, rev = cpv_split(pkg) - res = sanity_check(repo, category, name, vernum, suff, rev, slot) + category, name, ver = cpv_split(pkg) + res = sanity_check(repo, category, name, ver, slot) if not res: return Result.Err() return Result.Ok(res) @@ -103,8 +103,7 @@ class PortageSource(BaseSource): if path.isfile(uri): if not uri.endswith('.ebuild'): return Result.Err() - _, name, v1, v2, v3 = cpv_split(path.basename(uri)) - ver = ver_str(v1, v2, v3) + _, name, ver = cpv_split(path.basename(uri)) dircomps = path.dirname(uri)[len(repo_path):].split('/') if len(dircomps) != 2: return Result.Err() @@ -126,7 +125,7 @@ class PortageSource(BaseSource): return PortagePackage.from_data_dir(metadir) -def sanity_check(repo, category, name, vernum, suff, rev, slot, ver=None): +def sanity_check(repo, category, name, ver, slot): """ Checks whether a package descriptor is valid and corresponds to a package in a configured portage repository @@ -135,13 +134,6 @@ def sanity_check(repo, category, name, vernum, suff, rev, slot, ver=None): return False if repo and repo not in list(portage_repos()): return False - if not ver: - if (rev or suff) and not vernum: - return False - if vernum: - ver = ver_str(vernum, suff, rev) - else: - ver = None pkgs = repo_pkgs(repo, category, name, ver, slot) if not pkgs: return False |