diff options
author | Mykyta Holubakha <hilobakho@gmail.com> | 2017-05-31 02:12:49 +0300 |
---|---|---|
committer | Mykyta Holubakha <hilobakho@gmail.com> | 2017-05-31 02:12:49 +0300 |
commit | 387ab52669d0bf73e11b68f0989afacd315ab012 (patch) | |
tree | a31fee26f9abac83218c1ee12d47b837be82affb | |
parent | Renamed pomu.py to cli.py (diff) | |
download | pomu-387ab52669d0bf73e11b68f0989afacd315ab012.tar.gz pomu-387ab52669d0bf73e11b68f0989afacd315ab012.tar.bz2 pomu-387ab52669d0bf73e11b68f0989afacd315ab012.zip |
Finish repo initialization
-rw-r--r-- | pomu/cli.py | 1 | ||||
-rw-r--r-- | pomu/repo/init.py | 9 |
2 files changed, 6 insertions, 4 deletions
diff --git a/pomu/cli.py b/pomu/cli.py index d36426b..a34ab21 100644 --- a/pomu/cli.py +++ b/pomu/cli.py @@ -60,6 +60,7 @@ def status(globalvars): return if pomu_status(globalvars.repo_path): print('pomu is initialized at', globalvars.repo_path) + return print('pomu is not initialized') else: for repo in portage_repos(): diff --git a/pomu/repo/init.py b/pomu/repo/init.py index 67dc021..19ac289 100644 --- a/pomu/repo/init.py +++ b/pomu/repo/init.py @@ -20,7 +20,7 @@ def init_plain_repo(create, repo_path): return Result.Err('you do not have enough permissions to create the git repository') Repo.init(repo_path) try: - init_pomu(repo_path).unwrap() + return Result.Ok(init_pomu(repo_path).unwrap()) except ResultException as e: rmtree(repo_path) return Result.Err(str(e)) @@ -51,7 +51,7 @@ def init_portage_repo(create, repo, repo_dir): return Result.Error('you do not have enough permissions to setup a portage repo') Repo.init(repo_path) try: - init_pomu(repo_path).unwrap() + return Result.Ok(init_pomu(repo_path).unwrap()) except ResultException as e: rmtree(repo_path) return Result.Err(str(e)) @@ -73,6 +73,7 @@ def init_pomu(repo_path, name=''): open(path.join(pomu_path, '.sentinel'), 'w').close() except PermissionError: return Result.Err('you do not have enough permissions to modify the repo') - r.index.add(pomu_path) + r.index.add([path.join('metadata', 'pomu')]) r.index.commit('Initialized pomu') - return Result.Ok('Initialized repository ' + name + ' successfully') + ret = Result.Ok('Initialized repository ' + name + ' successfully') + return ret |