diff options
author | Mykyta Holubakha <hilobakho@gmail.com> | 2017-06-22 05:20:52 +0300 |
---|---|---|
committer | Mykyta Holubakha <hilobakho@gmail.com> | 2017-06-22 05:20:52 +0300 |
commit | 6bfa49b84f7d5bcfc63b9e97938d7069c9288465 (patch) | |
tree | 7a4a39538c8643d9dc2f557e49f55a2d9c6ce8c8 | |
parent | Numerous improvements and fixes (diff) | |
download | pomu-6bfa49b84f7d5bcfc63b9e97938d7069c9288465.tar.gz pomu-6bfa49b84f7d5bcfc63b9e97938d7069c9288465.tar.bz2 pomu-6bfa49b84f7d5bcfc63b9e97938d7069c9288465.zip |
Initial manifest generation using repoman cli
-rw-r--r-- | pomu/package.py | 21 | ||||
-rw-r--r-- | pomu/repo/repo.py | 5 | ||||
-rw-r--r-- | pomu/source/portage.py | 2 |
3 files changed, 26 insertions, 2 deletions
diff --git a/pomu/package.py b/pomu/package.py index 7b7ec55..803320b 100644 --- a/pomu/package.py +++ b/pomu/package.py @@ -7,6 +7,8 @@ A package is supposed to be created by a package source from a set of files. from os import path, walk, makedirs from shutil import copy2 +import subprocess + from pomu.util.fs import strip_prefix from pomu.util.result import Result @@ -65,6 +67,25 @@ class Package(): return Result.Err('You do not have enough permissions') return Result.Ok() + def gen_manifests(self, dst): + """ + Generate manifests for the installed package. + TODO: use portage APIs instead of calling repoman. + """ + dirs = [x for wd, f in self.files if y.endswith('.ebuild')] + dirs = list(set(dirs)) + res = [] + for d_ in dirs: + d = path.join(dst, d) + ret = subprocess.run(['repoman', 'manifest'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + cwd=d) + if r != 0: + return Result.Err('Failed to generate manifest at', d) + if path.exists(path.join(d, 'Manifest')): + res.append(path.join(d, 'Manifest')) + return Result.Ok(res) + def __str__(self): s = '' diff --git a/pomu/repo/repo.py b/pomu/repo/repo.py index 6434ed3..8f694ba 100644 --- a/pomu/repo/repo.py +++ b/pomu/repo/repo.py @@ -27,9 +27,12 @@ class Repository(): def merge(self, package): """Merge a package into the repository""" r = self.repo - package.merge(self.root).expect('Failed to merge package') + package.merge_into(self.root).expect('Failed to merge package') for wd, f in package.files: r.index.add(path.join(dst, f)) + manifests = package.gen_manifests(self.root).expect() + for m in manifests: + r.index.add(m) with open(path.join(self.pomu_dir, package.name), 'w') as f: f.write('{}/{}'.format(wd, f)) r.index.add(path.join(self.pomu_dir, package.name)) diff --git a/pomu/source/portage.py b/pomu/source/portage.py index 6e58873..fe0f4ce 100644 --- a/pomu/source/portage.py +++ b/pomu/source/portage.py @@ -75,7 +75,7 @@ class PortageSource(): @classmethod def fetch_package(cls, pkg): - return pkg.fetch() + return pkg.fetch() def sanity_check(repo, category, name, vernum, suff, rev, slot): |