aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMykyta Holubakha <hilobakho@gmail.com>2017-07-09 14:40:33 +0300
committerMykyta Holubakha <hilobakho@gmail.com>2017-07-18 23:26:27 +0300
commitcc41d610f76c6de326ec50626ff55a47cde0bc84 (patch)
treebc847deaf37f4dba911d1d52144659b355f38e48 /pomu/repo/repo.py
parentOverhauled patching support (diff)
downloadpomu-cc41d610f76c6de326ec50626ff55a47cde0bc84.tar.gz
pomu-cc41d610f76c6de326ec50626ff55a47cde0bc84.tar.bz2
pomu-cc41d610f76c6de326ec50626ff55a47cde0bc84.zip
Further work on patching
fixed some commands with patching started work on integrating user changes generation of patches and commit messages added get_packages() method to Repository allow adding non-existant (in-memory) patches to packages
Diffstat (limited to 'pomu/repo/repo.py')
-rw-r--r--pomu/repo/repo.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/pomu/repo/repo.py b/pomu/repo/repo.py
index b60f6c1..1530dfa 100644
--- a/pomu/repo/repo.py
+++ b/pomu/repo/repo.py
@@ -1,4 +1,5 @@
"""Subroutines with repositories"""
+123
from os import path, rmdir, makedirs
from shutil import copy2
@@ -135,6 +136,11 @@ class Repository():
return self._get_package(category, name, slot)
return Result.Err('Package not found')
+ def get_packages(self):
+ with open(path.join(self.pomu_dir, 'world'), 'r') as f:
+ lines = [x.strip() for x in f.readlines() if x.strip() != '']
+ return lines
+
def portage_repos():
"""Yield the repositories configured for portage"""
@@ -192,12 +198,18 @@ class MergedPackage(Package):
self.add_patch(patch)
return Result.Ok()
- def add_patch(self, patch):
+ def add_patch(self, patch, name=None): # patch is a path, unless name is passed
pkgdir = path.join(self.root, 'metadata', 'pomu', self.category, self.name)
if self.slot != '0':
pkgdir = path.join(pkgdir, self.slot)
patch_dir = path.join(pkgdir, 'patches')
makedirs(patch_dir, exist_ok=True)
- copy2(patch, patch_dir)
- with open(path.join(pkgdir, 'PATCH_ORDER'), 'w+') as f:
- f.write(path.basename(patch) + '\n')
+ if name is None:
+ copy2(patch, patch_dir)
+ with open(path.join(pkgdir, 'PATCH_ORDER'), 'w+') as f:
+ f.write(path.basename(patch) + '\n')
+ else:
+ with open(path.join(patch_dir, name), 'w') as f:
+ f.write(patch)
+ with open(path.join(pkgdir, 'PATCH_ORDER'), 'w+') as f:
+ f.write(name + '\n')