diff options
author | 2019-06-09 03:43:02 +0300 | |
---|---|---|
committer | 2019-06-09 03:43:02 +0300 | |
commit | 8dfb6d113a0f4435ab49400be0c9e9760fb110b8 (patch) | |
tree | 7ac39b85dc1ea42b9dcf1a358ec3b3c83c8e96a1 /pomu | |
parent | Some more minor fixes and improvements (diff) | |
download | pomu-8dfb6d113a0f4435ab49400be0c9e9760fb110b8.tar.gz pomu-8dfb6d113a0f4435ab49400be0c9e9760fb110b8.tar.bz2 pomu-8dfb6d113a0f4435ab49400be0c9e9760fb110b8.zip |
Ensure show works with portage
Diffstat (limited to 'pomu')
-rw-r--r-- | pomu/repo/repo.py | 7 | ||||
-rw-r--r-- | pomu/source/portage.py | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/pomu/repo/repo.py b/pomu/repo/repo.py index db6b607..9b17776 100644 --- a/pomu/repo/repo.py +++ b/pomu/repo/repo.py @@ -129,6 +129,9 @@ class Repository(): with open(path.join(pkgdir, 'BACKEND'), 'r') as f: bname = f.readline().strip() backend = dispatcher.backends[bname].from_meta_dir(pkgdir) + if backend.is_err(): + return backend + backend = backend.ok() with open(path.join(pkgdir, 'VERSION'), 'r') as f: version = f.readline().strip() with open(path.join(pkgdir, 'FILES'), 'r') as f: @@ -139,7 +142,7 @@ class Repository(): patches = [x.strip() for x in f] pkg = Package(name, self.root, backend, category=category, version=version, slot=slot, files=files, patches=[path.join(pkgdir, 'patches', x) for x in patches]) pkg.__class__ = MergedPackage - return pkg + return Result.Ok(pkg) def get_package(self, name, category=None, slot=None): """Get a package by name, category and slot""" @@ -150,7 +153,7 @@ class Repository(): nam, _, slo = nam.partition(':') if (not category or category == cat) and nam == name: if not slot or (slot == '0' and not slo) or slot == slo: - return Result.Ok(self._get_package(category, name, slot or '0')) + return self._get_package(category, name, slot or '0') return Result.Err('Package not found') def get_packages(self): diff --git a/pomu/source/portage.py b/pomu/source/portage.py index d3050ac..abd5851 100644 --- a/pomu/source/portage.py +++ b/pomu/source/portage.py @@ -41,7 +41,7 @@ class PortagePackage(PackageBase): pkg = pkg.unwrap() with open(path.join(pkgdir, 'PORTAGE_DATA'), 'r') as f: - repo = f.readline() + repo = f.readline().strip() if sanity_check(repo, pkg.category, pkg.name, None, None, None, pkg.slot, ver=pkg.version): return Result.Ok(PortagePackage(repo, pkg.category, pkg.name, pkg.slot, pkg.version)) return Result.Err('Package {} not found'.format(pkg)) |