1 |
commit: e147d01855031095e123178d50e88d7ae1efcb34 |
2 |
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Apr 28 14:01:04 2012 +0000 |
4 |
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Apr 28 14:01:04 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=e147d018 |
7 |
|
8 |
fix config-root for --sync |
9 |
|
10 |
--- |
11 |
gobs/pym/sync.py | 23 +++++++++++++++++------ |
12 |
1 files changed, 17 insertions(+), 6 deletions(-) |
13 |
|
14 |
diff --git a/gobs/pym/sync.py b/gobs/pym/sync.py |
15 |
index e992e9c..3fcf31d 100644 |
16 |
--- a/gobs/pym/sync.py |
17 |
+++ b/gobs/pym/sync.py |
18 |
@@ -5,8 +5,16 @@ import errno |
19 |
import logging |
20 |
import sys |
21 |
from git import * |
22 |
-from _emerge.actions import load_emerge_config, action_sync |
23 |
-from _emerge.main import parse_opts |
24 |
+from _emerge.main import emerge_main |
25 |
+ |
26 |
+from gobs.readconf import get_conf_settings |
27 |
+reader=get_conf_settings() |
28 |
+gobs_settings_dict=reader.read_gobs_settings_all() |
29 |
+from gobs.ConnectionManager import connectionManager |
30 |
+CM=connectionManager(gobs_settings_dict) |
31 |
+#selectively import the pgsql/mysql querys |
32 |
+if CM.getName()=='pgsql': |
33 |
+ from gobs.pgsql import * |
34 |
|
35 |
def git_pull(): |
36 |
logging.info("Git pull") |
37 |
@@ -18,15 +26,18 @@ def git_pull(): |
38 |
logging.info("Git pull ... Done.") |
39 |
|
40 |
def sync_tree(): |
41 |
- settings, trees, mtimedb = load_emerge_config() |
42 |
- portdb = trees[settings["ROOT"]]["porttree"].dbapi |
43 |
+ conn=CM.getConnection() |
44 |
+ config_id = get_default_config(conn) # HostConfigDir = table configs id |
45 |
+ CM.putConnection(conn) |
46 |
+ default_config_root = "/var/lib/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/" + config_id[0] + "/" |
47 |
tmpcmdline = [] |
48 |
tmpcmdline.append("--sync") |
49 |
tmpcmdline.append("--quiet") |
50 |
- myaction, myopts, myfiles = parse_opts(tmpcmdline) |
51 |
+ tmpcmdline.append("--config_root=" + default_config_root) |
52 |
+ print("tmpcmdline: %s", default_config_root) |
53 |
logging.info("Emerge --sync") |
54 |
fail_sync = 0 |
55 |
- #fail_sync = action_sync(settings, trees, mtimedb, myopts, myaction) |
56 |
+ #fail_sync = emerge_main(args=tmpcmdline) |
57 |
if fail_sync is True: |
58 |
logging.warning("Emerge --sync fail!") |
59 |
else: |