* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2011-07-10 15:31 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2011-07-10 15:31 UTC (permalink / raw
To: gentoo-commits
commit: 2e724a165d596a2cab9b4be8aa78ef3d63edfe4f
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 15:26:19 2011 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 15:26:19 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=2e724a16
Updated the bins files
---
gobs/bin/gobs_buildquerys | 181 +++++++++++++++++++++++++++++++++++++++++++++
gobs/bin/gobs_updatedb | 57 +++++++++------
gobs/bin/portage_hooks | 78 +++++++++++++++++++
3 files changed, 293 insertions(+), 23 deletions(-)
diff --git a/gobs/bin/gobs_buildquerys b/gobs/bin/gobs_buildquerys
new file mode 100755
index 0000000..bc7e320
--- /dev/null
+++ b/gobs/bin/gobs_buildquerys
@@ -0,0 +1,181 @@
+#!/usr/bin/python
+
+# Get the options from the config file set in gobs.readconf
+from gobs.readconf import get_conf_settings
+reader=get_conf_settings()
+gobs_settings_dict=reader.read_gobs_settings_all()
+# make a CM
+from gobs.ConnectionManager import connectionManager
+CM=connectionManager(gobs_settings_dict)
+#selectively import the pgsql/mysql querys
+if CM.getName()=='pgsql':
+ from gobs.querys.pgsql import *
+elif CM.getName()=='mysql':
+ from gobs.querys.mysql import *
+
+from gobs.check_setup import check_configure_guest
+from gobs.flags import gobs_use_flags
+from gobs.manifest import gobs_manifest
+from _emerge.main import emerge_main
+import portage
+import sys
+import os
+
+def log_qa_error(connection, build_dict, what_error, fail_error, config_id):
+ ebuild_id_list = []
+ qa_error_list = []
+ repoman_error = []
+ ebuild_version = build_dict['ebuild_version']
+ attDict = {}
+ packageDict = {}
+ attDict['ebuild_error'] = repoman_error
+ packageDict[ebuild_version] = attDict
+ qa_error_list.append(fail_error)
+ fail_times = check_fail_times(connection, build_dict['queue_id'], what_error)
+ if fail_times is None:
+ add_fail_times(connection, build_dict['queue_id'], what_error)
+ else:
+ if fail_times[0] > 5:
+ return
+ elif fail_times[0] == 5:
+ ebuild_id_list.append(build_dict['ebuild_id'])
+ add_qa_repoman(connection, ebuild_id_list, qa_error_list, packageDict, config_id)
+ del_old_queue(connection, build_dict['queue_id'])
+ return
+ update_fail_times(connection, build_dict['queue_id'], what_error, fail_times[0])
+
+def get_cpv_build_list(connection, build_dict, config_profile):
+ build_cpv_dict = {}
+ cpv_dict = {}
+ cpv_list = "1"
+ mysettings = portage.settings
+ #myportdb = portage.portdbapi(mysettings=mysettings)
+ myportdb = portage.portdb
+ #porttree = portage.portagetree(settings=mysettings)
+ #trees = {"/" : {"porttree":porttree}}
+ #dep_keys = ("DEPEND", "RDEPEND", "PDEPEND")
+ pkgdir = os.path.join(mysettings['PORTDIR'], build_dict['categories'] + "/" + build_dict['package'])
+ init_manifest = gobs_manifest(mysettings, pkgdir)
+ try:
+ ebuild_version_checksum_tree = portage.checksum.sha256hash(pkgdir+ "/" + build_dict['package'] + "-" + build_dict['ebuild_version'] + ".ebuild")[0]
+ except:
+ ebuild_version_checksum_tree = None
+ print ebuild_version_checksum_tree, build_dict['ebuild_checksum']
+ ebuild_version_checksum_db = have_activ_ebuild_id(connection, build_dict['ebuild_id'])
+ print 'ebuild_version_checksum_db', ebuild_version_checksum_db
+ if ebuild_version_checksum_db is None:
+ print "queue_id don't have active ebuild_id"
+ del_old_queue(connection, build_dict['queue_id'])
+ return None
+ if ebuild_version_checksum_tree != build_dict['ebuild_checksum']:
+ new_queue_id = check_revision(connection, build_dict, config_profile, ebuild_version_checksum_tree)
+ if new_queue_id is None:
+ return None
+ # FIXME use log_qa_error()
+ if check_fail_times(build_dict['queue_id'], "cpv_checksum") is False:
+ update_fail_times(build_dict['queue_id'], "cpv_checksum")
+ else:
+ add_cpv_fail(build_dict['queue_id'], "cpv_checksum")
+ return None
+ build_dict = get_package_to_build(connection,config_profile, new_queue_id)
+ categories = build_dict['categories']
+ package = build_dict['package']
+ ebuild_version = build_dict['ebuild_version']
+ ebuild_version_useflags = build_dict['build_useflags']
+ build_massage = build_dict['post_message']
+ cpv = unicode(categories + "/" + package + "-" + ebuild_version)
+ cp = unicode(categories + "/" + package)
+ init_flags = gobs_use_flags(mysettings, myportdb, cpv)
+ #mysettings['O'] = pkgdir
+ print portage.getmaskingstatus(cpv, settings=mysettings, portdb=myportdb)
+ if portage.getmaskingstatus(cpv, settings=mysettings, portdb=myportdb) != []:
+ # FIXME use log_qa_error()
+ if check_fail_times(build_dict['queue_id'], "cpv_mask") is False:
+ update_fail_times(build_dict['queue_id'], "cpv_mask")
+ else:
+ add_cpv_fail(build_dict['queue_id'], "cpv_mask")
+ return None
+ build_use_flags_list = init_flags.comper_useflags(build_dict)
+ manifest_error = init_manifest.check_file_in_manifest(myportdb, cpv, build_dict, build_use_flags_list)
+ print 'manifest_error', manifest_error
+ if manifest_error is not None:
+ what_error = "cpv_manifest"
+ log_qa_error(connection, build_dict, what_error, manifest_error, config_profile)
+ return None
+ build_cpv_dict = init_flags.get_needed_dep_useflags(build_use_flags_list)
+ print build_cpv_dict, build_use_flags_list, cpv
+ build_use_flags_dict = {}
+ if build_use_flags_list is None:
+ build_use_flags_dict['None'] = None
+ if build_cpv_dict is None:
+ build_cpv_dict = {}
+ build_cpv_dict[cpv] = build_use_flags_dict
+ else:
+ build_cpv_dict[cpv] = build_use_flags_dict
+ print build_cpv_dict
+ return build_cpv_dict
+
+def main_loop(CM, config_profile):
+ repeat = True
+ new = False
+ queue_id_list = 43280
+ #get a connection from the pool
+ conn=CM.getConnection()
+ while repeat:
+ build_cpv_dict = {}
+ build_dict = {}
+ if check_configure_guest(conn, config_profile) is not True:
+ # time.sleep(60)
+ continue # retunr to the start of the function
+ else:
+ build_dict = get_package_to_build(conn,config_profile, queue_id_list, new)
+ print "build_dict['ebuild_id'] build_dict['post_message']", build_dict['ebuild_id'], build_dict['post_message']
+ if build_dict['ebuild_id'] is None:
+ if build_dict['post_message'] is None:
+ # time.sleep(60)
+ print "build_dict none"
+ queue_id_list = queue_id_list + 1
+ print queue_id_list
+ continue # return to the start of the function
+ build_cpv_dict = get_cpv_build_list(conn, build_dict, config_profile)
+ if build_cpv_dict is None:
+ queue_id_list = queue_id_list + 1
+ continue # return to the start of the function
+ build_cpv_list = []
+ for k, v in build_cpv_dict.iteritems():
+ build_use_flags_list = []
+ for x, y in v.iteritems():
+ if y is True:
+ build_use_flags_list.append(x)
+ if y is False:
+ build_use_flags_list.append("-" + x)
+ print k, build_use_flags_list
+ if build_use_flags_list == []:
+ build_cpv_list.append("=" + k)
+ else:
+ build_use_flags = ""
+ for flags in build_use_flags_list:
+ build_use_flags = build_use_flags + flags + ","
+ build_cpv_list.append("=" + k + "[" + build_use_flags + "]")
+ print build_cpv_list
+ argscmd = []
+ # argscmd.append("--buildpkg")
+ # argscmd.append("--usepkg")
+ argscmd.append("--oneshot")
+ for build_cpv in build_cpv_list:
+ argscmd.append(build_cpv)
+ print argscmd
+ emerge_main(args=argscmd)
+ sys.exit()
+ queue_id_list = queue_id_list + 1
+ CM.putConnection(conn)
+
+def main():
+ # Main
+ config_profile = gobs_settings_dict['gobs_config']
+ #we provide the main_loop with the ConnectionManager so we can hand out connections from within the loop
+ main_loop(CM, config_profile)
+ connectionManager.closeAllConnections()
+
+if __name__ == "__main__":
+ main()
diff --git a/gobs/bin/gobs_updatedb b/gobs/bin/gobs_updatedb
index 582efa6..837cab1 100755
--- a/gobs/bin/gobs_updatedb
+++ b/gobs/bin/gobs_updatedb
@@ -7,17 +7,31 @@
import sys
import os
+from threading import Thread
+
+# Get the options from the config file set in gobs.readconf
from gobs.readconf import get_conf_settings
-from gobs.initsql import init_sql_db
-from gobs.check_setup import check_config
-from gobs.arch import arch
+reader=get_conf_settings()
+gobs_settings_dict=reader.read_gobs_settings_all()
+# make a CM
+from gobs.ConnectionManager import connectionManager
+CM=connectionManager(gobs_settings_dict)
+#selectively import the pgsql/mysql querys
+if CM.getName()=='pgsql':
+ from gobs.querys.pgsql import *
+elif CM.getName()=='mysql':
+ from gobs.querys.mysql import *
+
+from gobs.check_setup import check_make_conf
+from gobs.arch import gobs_arch
from gobs.package import gobs_package
from gobs.categories import gobs_categories
from gobs.old_cpv import gobs_old_cpv
from gobs.categories import gobs_categories
import portage
-def init_portage_settings(database, gobs_settings_dict):
+def init_portage_settings(CM, gobs_settings_dict):
+
""" Get the BASE Setup/Config for portage.settings
@type: module
@module: The SQL Backend
@@ -27,18 +41,19 @@ def init_portage_settings(database, gobs_settings_dict):
@returns new settings
"""
# check config setup
- init_check = check_config(database, gobs_settings_dict)
- init_check.check_make_conf()
+ conn=CM.getConnection()
+ check_make_conf(CM,gobs_settings_dict)
print "Check configs done"
# Get default config from the configs table and default_config=1
- config_id = database.get_default_config() # HostConfigDir = table configs id
- default_config_root = gobs_settings_dict['host_setup_root'] +"config/" + config_id[0] + "/"
+ config_id = get_default_config(conn) # HostConfigDir = table configs id
+ CM.putConnection(conn);
+ default_config_root = gobs_settings_dict['gobs_root'] +"config/" + config_id[0] + "/"
# Set config_root (PORTAGE_CONFIGROOT) to default_config_root
mysettings = portage.config(config_root = default_config_root)
print "Setting default config to:", config_id[0]
return mysettings
-def update_cpv_db(mysettings, database, gobs_settings_dict):
+def update_cpv_db(mysettings, CM, gobs_settings_dict):
"""Code to update the cpv in the database.
@type:settings
@parms: portage.settings
@@ -50,14 +65,15 @@ def update_cpv_db(mysettings, database, gobs_settings_dict):
print "Checking categories, package, ebuilds"
# Setup portdb, gobs_categories, gobs_old_cpv, package
myportdb = portage.portdbapi(mysettings=mysettings)
- init_categories = gobs_categories(database, mysettings)
- init_old_cpv = gobs_old_cpv(database, myportdb, mysettings)
- init_package = gobs_package(mysettings, database, myportdb, gobs_settings_dict)
+ init_categories = gobs_categories(CM, mysettings)
+ init_old_cpv = gobs_old_cpv(CM, myportdb, mysettings)
+ init_package = gobs_package(mysettings, CM, myportdb, gobs_settings_dict)
package_id_list_tree = []
# Will run some update checks and update package if needed
# Get categories/package list from portage
package_list_tree = myportdb.cp_all()
# Run the update package for all package in the list
+ conn=CM.getConnection()
for package_line in sorted(package_list_tree):
# split the cp to categories and package
element = package_line.split('/')
@@ -65,7 +81,7 @@ def update_cpv_db(mysettings, database, gobs_settings_dict):
package = element[1]
print "C", categories + "/" + package # C = Checking
# Check if we don't have the cp in the package table
- package_id = database.have_package_db(categories, package)
+ package_id = have_package_db(conn,categories, package)
if package_id is None:
# Add new package with ebuilds
package_id = init_package.add_new_package_db(categories, package)
@@ -77,6 +93,7 @@ def update_cpv_db(mysettings, database, gobs_settings_dict):
package_id_list_tree.append(package_id)
# Update the metadata for categories
init_categories.update_categories_db(categories)
+ CM.putConnection(conn)
# Remove any old ebuild, package and categories
init_old_cpv.mark_old_ebuild_db(categories, package, package_id)
init_old_cpv.mark_old_package_db(sorted(package_id_list_tree))
@@ -85,19 +102,13 @@ def update_cpv_db(mysettings, database, gobs_settings_dict):
def main():
# Main
- # Get the options from the config file set in gobs.readconf
- init_config = get_conf_settings()
- gobs_settings_dict = init_config.read_gobs_settings_all()
- # Init the Database
- init_sql = init_sql_db()
- database = init_sql.init_sql_backend()
# Init settings for the default config
- mysettings = init_portage_settings(database, gobs_settings_dict)
- # Update the arch db if needed
- init_arch = arch(database)
+ mysettings = init_portage_settings(CM,gobs_settings_dict)
+ init_arch = gobs_arch(CM)
init_arch.update_arch_db()
# Update the cpv db
- update_cpv_db(mysettings, database, gobs_settings_dict)
+ update_cpv_db(mysettings, CM, gobs_settings_dict)
+ CM.closeAllConnections()
if __name__ == "__main__":
main()
\ No newline at end of file
diff --git a/gobs/bin/portage_hooks b/gobs/bin/portage_hooks
new file mode 100755
index 0000000..97c2576
--- /dev/null
+++ b/gobs/bin/portage_hooks
@@ -0,0 +1,78 @@
+#!/usr/bin/python
+
+# Get the options from the config file set in gobs.readconf
+from gobs.readconf import get_conf_settings
+reader=get_conf_settings()
+gobs_settings_dict=reader.read_gobs_settings_all()
+# make a CM
+from gobs.ConnectionManager import connectionManager
+CM=connectionManager(gobs_settings_dict)
+#selectively import the pgsql/mysql querys
+if CM.getName()=='pgsql':
+ from gobs.querys.pgsql import *
+elif CM.getName()=='mysql':
+ from gobs.querys.mysql import *
+
+from gobs.package import gobs_package
+from gobs.build_log import gobs_buildlog
+from gobs.flags import gobs_use_flags
+import portage
+import os
+
+def get_build_dict_db(CM, mysettings, config_profile, gobs_settings_dict):
+ conn=CM.getConnection()
+ myportdb = portage.portdbapi(mysettings=mysettings)
+ categories = os.environ['CATEGORY']
+ package = os.environ['PN']
+ ebuild_version = os.environ['PVR']
+ cpv = categories + "/" + package + "-" + ebuild_version
+ init_package = gobs_package(mysettings, CM, myportdb, gobs_settings_dict)
+ print "cpv", cpv
+ package_id = have_package_db(conn, categories, package)
+ print "package_id", package_id
+ build_dict = {}
+ mybuild_dict = {}
+ build_dict['ebuild_version'] = ebuild_version
+ build_dict['package_id'] = package_id
+ build_dict['cpv'] = cpv
+ build_dict['categories'] = categories
+ build_dict['package'] = package
+ build_dict['config_profile'] = config_profile
+ init_useflags = gobs_use_flags(mysettings, myportdb, cpv)
+ iuse_flags_list, final_use_list = init_useflags.get_flags_looked()
+ print 'final_use_list', final_use_list
+ if final_use_list != []:
+ build_dict['build_useflags'] = final_use_list
+ else:
+ build_dict['build_useflags'] = None
+ print "build_dict['build_useflags']", build_dict['build_useflags']
+ pkgdir = os.path.join(mysettings['PORTDIR'], categories + "/" + package)
+ ebuild_version_checksum_tree = portage.checksum.sha256hash(pkgdir+ "/" + package + "-" + ebuild_version + ".ebuild")[0]
+ build_dict['checksum'] = ebuild_version_checksum_tree
+ print 'checksum' ,ebuild_version_checksum_tree
+ ebuild_id = get_ebuild_id_db_checksum(conn, build_dict)
+ print 'ebuild_id in db', ebuild_id
+ if ebuild_id is None:
+ print 'have any ebuild', get_ebuild_checksum(conn, package_id, ebuild_version)
+ init_package.update_ebuild_db(build_dict)
+ queue_id = check_revision(conn, build_dict, config_profile, ebuild_version_checksum_tree)
+ print "queue_id", queue_id
+ if queue_id is None:
+ init_package.add_new_ebuild_buildquery_db_looked(build_dict, config_profile)
+ queue_id = check_revision(conn, build_dict, config_profile, ebuild_version_checksum_tree)
+ mybuild_dict = get_package_to_build(conn, config_profile, queue_id, new = True)
+ print 'mybuild_dict', mybuild_dict
+ return mybuild_dict
+
+def main():
+ # Main
+ config_profile = gobs_settings_dict['gobs_config']
+ #we provide the main_loop with the ConnectionManager so we can hand out connections from within the loop
+ mysettings = portage.settings
+ build_dict = get_build_dict_db(CM, mysettings, config_profile, gobs_settings_dict)
+ init_buildlog = gobs_buildlog(CM ,mysettings, build_dict, config_profile)
+ init_buildlog.add_buildlog_main()
+ #connectionManager.closeAllConnections()
+
+if __name__ == "__main__":
+ main()
\ No newline at end of file
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2011-07-29 15:31 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2011-07-29 15:31 UTC (permalink / raw
To: gentoo-commits
commit: 467f8f50912235c3ea0be555f98abd394e3ece93
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 29 15:16:53 2011 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Fri Jul 29 15:16:53 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=467f8f50
Updated the bins
---
gobs/bin/gobs_buildquerys | 144 +-------------------------------------------
gobs/bin/portage_hooks | 41 +++++++------
2 files changed, 26 insertions(+), 159 deletions(-)
diff --git a/gobs/bin/gobs_buildquerys b/gobs/bin/gobs_buildquerys
index bc7e320..87f1218 100755
--- a/gobs/bin/gobs_buildquerys
+++ b/gobs/bin/gobs_buildquerys
@@ -14,160 +14,24 @@ elif CM.getName()=='mysql':
from gobs.querys.mysql import *
from gobs.check_setup import check_configure_guest
-from gobs.flags import gobs_use_flags
-from gobs.manifest import gobs_manifest
-from _emerge.main import emerge_main
+from gobs.build_queru import queruaction
import portage
import sys
import os
-def log_qa_error(connection, build_dict, what_error, fail_error, config_id):
- ebuild_id_list = []
- qa_error_list = []
- repoman_error = []
- ebuild_version = build_dict['ebuild_version']
- attDict = {}
- packageDict = {}
- attDict['ebuild_error'] = repoman_error
- packageDict[ebuild_version] = attDict
- qa_error_list.append(fail_error)
- fail_times = check_fail_times(connection, build_dict['queue_id'], what_error)
- if fail_times is None:
- add_fail_times(connection, build_dict['queue_id'], what_error)
- else:
- if fail_times[0] > 5:
- return
- elif fail_times[0] == 5:
- ebuild_id_list.append(build_dict['ebuild_id'])
- add_qa_repoman(connection, ebuild_id_list, qa_error_list, packageDict, config_id)
- del_old_queue(connection, build_dict['queue_id'])
- return
- update_fail_times(connection, build_dict['queue_id'], what_error, fail_times[0])
-
-def get_cpv_build_list(connection, build_dict, config_profile):
- build_cpv_dict = {}
- cpv_dict = {}
- cpv_list = "1"
- mysettings = portage.settings
- #myportdb = portage.portdbapi(mysettings=mysettings)
- myportdb = portage.portdb
- #porttree = portage.portagetree(settings=mysettings)
- #trees = {"/" : {"porttree":porttree}}
- #dep_keys = ("DEPEND", "RDEPEND", "PDEPEND")
- pkgdir = os.path.join(mysettings['PORTDIR'], build_dict['categories'] + "/" + build_dict['package'])
- init_manifest = gobs_manifest(mysettings, pkgdir)
- try:
- ebuild_version_checksum_tree = portage.checksum.sha256hash(pkgdir+ "/" + build_dict['package'] + "-" + build_dict['ebuild_version'] + ".ebuild")[0]
- except:
- ebuild_version_checksum_tree = None
- print ebuild_version_checksum_tree, build_dict['ebuild_checksum']
- ebuild_version_checksum_db = have_activ_ebuild_id(connection, build_dict['ebuild_id'])
- print 'ebuild_version_checksum_db', ebuild_version_checksum_db
- if ebuild_version_checksum_db is None:
- print "queue_id don't have active ebuild_id"
- del_old_queue(connection, build_dict['queue_id'])
- return None
- if ebuild_version_checksum_tree != build_dict['ebuild_checksum']:
- new_queue_id = check_revision(connection, build_dict, config_profile, ebuild_version_checksum_tree)
- if new_queue_id is None:
- return None
- # FIXME use log_qa_error()
- if check_fail_times(build_dict['queue_id'], "cpv_checksum") is False:
- update_fail_times(build_dict['queue_id'], "cpv_checksum")
- else:
- add_cpv_fail(build_dict['queue_id'], "cpv_checksum")
- return None
- build_dict = get_package_to_build(connection,config_profile, new_queue_id)
- categories = build_dict['categories']
- package = build_dict['package']
- ebuild_version = build_dict['ebuild_version']
- ebuild_version_useflags = build_dict['build_useflags']
- build_massage = build_dict['post_message']
- cpv = unicode(categories + "/" + package + "-" + ebuild_version)
- cp = unicode(categories + "/" + package)
- init_flags = gobs_use_flags(mysettings, myportdb, cpv)
- #mysettings['O'] = pkgdir
- print portage.getmaskingstatus(cpv, settings=mysettings, portdb=myportdb)
- if portage.getmaskingstatus(cpv, settings=mysettings, portdb=myportdb) != []:
- # FIXME use log_qa_error()
- if check_fail_times(build_dict['queue_id'], "cpv_mask") is False:
- update_fail_times(build_dict['queue_id'], "cpv_mask")
- else:
- add_cpv_fail(build_dict['queue_id'], "cpv_mask")
- return None
- build_use_flags_list = init_flags.comper_useflags(build_dict)
- manifest_error = init_manifest.check_file_in_manifest(myportdb, cpv, build_dict, build_use_flags_list)
- print 'manifest_error', manifest_error
- if manifest_error is not None:
- what_error = "cpv_manifest"
- log_qa_error(connection, build_dict, what_error, manifest_error, config_profile)
- return None
- build_cpv_dict = init_flags.get_needed_dep_useflags(build_use_flags_list)
- print build_cpv_dict, build_use_flags_list, cpv
- build_use_flags_dict = {}
- if build_use_flags_list is None:
- build_use_flags_dict['None'] = None
- if build_cpv_dict is None:
- build_cpv_dict = {}
- build_cpv_dict[cpv] = build_use_flags_dict
- else:
- build_cpv_dict[cpv] = build_use_flags_dict
- print build_cpv_dict
- return build_cpv_dict
-
def main_loop(CM, config_profile):
repeat = True
- new = False
- queue_id_list = 43280
#get a connection from the pool
conn=CM.getConnection()
+ init_queru = queruaction(config_profile)
+ fail_querue_dict = {}
while repeat:
- build_cpv_dict = {}
- build_dict = {}
if check_configure_guest(conn, config_profile) is not True:
# time.sleep(60)
continue # retunr to the start of the function
else:
- build_dict = get_package_to_build(conn,config_profile, queue_id_list, new)
- print "build_dict['ebuild_id'] build_dict['post_message']", build_dict['ebuild_id'], build_dict['post_message']
- if build_dict['ebuild_id'] is None:
- if build_dict['post_message'] is None:
- # time.sleep(60)
- print "build_dict none"
- queue_id_list = queue_id_list + 1
- print queue_id_list
- continue # return to the start of the function
- build_cpv_dict = get_cpv_build_list(conn, build_dict, config_profile)
- if build_cpv_dict is None:
- queue_id_list = queue_id_list + 1
- continue # return to the start of the function
- build_cpv_list = []
- for k, v in build_cpv_dict.iteritems():
- build_use_flags_list = []
- for x, y in v.iteritems():
- if y is True:
- build_use_flags_list.append(x)
- if y is False:
- build_use_flags_list.append("-" + x)
- print k, build_use_flags_list
- if build_use_flags_list == []:
- build_cpv_list.append("=" + k)
- else:
- build_use_flags = ""
- for flags in build_use_flags_list:
- build_use_flags = build_use_flags + flags + ","
- build_cpv_list.append("=" + k + "[" + build_use_flags + "]")
- print build_cpv_list
- argscmd = []
- # argscmd.append("--buildpkg")
- # argscmd.append("--usepkg")
- argscmd.append("--oneshot")
- for build_cpv in build_cpv_list:
- argscmd.append(build_cpv)
- print argscmd
- emerge_main(args=argscmd)
+ fail_querue_list = init_queru.procces_qureru(fail_querue_dict)
sys.exit()
- queue_id_list = queue_id_list + 1
CM.putConnection(conn)
def main():
diff --git a/gobs/bin/portage_hooks b/gobs/bin/portage_hooks
index 97c2576..bdb1699 100755
--- a/gobs/bin/portage_hooks
+++ b/gobs/bin/portage_hooks
@@ -1,5 +1,7 @@
#!/usr/bin/python
-
+from __future__ import print_function
+import os
+import sys
# Get the options from the config file set in gobs.readconf
from gobs.readconf import get_conf_settings
reader=get_conf_settings()
@@ -16,10 +18,10 @@ elif CM.getName()=='mysql':
from gobs.package import gobs_package
from gobs.build_log import gobs_buildlog
from gobs.flags import gobs_use_flags
+from portage.util import writemsg, writemsg_level, writemsg_stdout
import portage
-import os
-def get_build_dict_db(CM, mysettings, config_profile, gobs_settings_dict):
+def get_build_dict_db(mysettings, config_profile, gobs_settings_dict):
conn=CM.getConnection()
myportdb = portage.portdbapi(mysettings=mysettings)
categories = os.environ['CATEGORY']
@@ -27,9 +29,9 @@ def get_build_dict_db(CM, mysettings, config_profile, gobs_settings_dict):
ebuild_version = os.environ['PVR']
cpv = categories + "/" + package + "-" + ebuild_version
init_package = gobs_package(mysettings, CM, myportdb, gobs_settings_dict)
- print "cpv", cpv
+ print("cpv", cpv)
package_id = have_package_db(conn, categories, package)
- print "package_id", package_id
+ # print("package_id %s" % package_id, file=sys.stdout)
build_dict = {}
mybuild_dict = {}
build_dict['ebuild_version'] = ebuild_version
@@ -40,37 +42,38 @@ def get_build_dict_db(CM, mysettings, config_profile, gobs_settings_dict):
build_dict['config_profile'] = config_profile
init_useflags = gobs_use_flags(mysettings, myportdb, cpv)
iuse_flags_list, final_use_list = init_useflags.get_flags_looked()
- print 'final_use_list', final_use_list
+ #print 'final_use_list', final_use_list
if final_use_list != []:
build_dict['build_useflags'] = final_use_list
else:
build_dict['build_useflags'] = None
- print "build_dict['build_useflags']", build_dict['build_useflags']
+ #print "build_dict['build_useflags']", build_dict['build_useflags']
pkgdir = os.path.join(mysettings['PORTDIR'], categories + "/" + package)
ebuild_version_checksum_tree = portage.checksum.sha256hash(pkgdir+ "/" + package + "-" + ebuild_version + ".ebuild")[0]
build_dict['checksum'] = ebuild_version_checksum_tree
- print 'checksum' ,ebuild_version_checksum_tree
+ print('checksum' ,ebuild_version_checksum_tree)
ebuild_id = get_ebuild_id_db_checksum(conn, build_dict)
- print 'ebuild_id in db', ebuild_id
+ print('ebuild_id in db', ebuild_id)
if ebuild_id is None:
- print 'have any ebuild', get_ebuild_checksum(conn, package_id, ebuild_version)
+ #print 'have any ebuild', get_ebuild_checksum(conn, package_id, ebuild_version)
init_package.update_ebuild_db(build_dict)
- queue_id = check_revision(conn, build_dict, config_profile, ebuild_version_checksum_tree)
- print "queue_id", queue_id
+ ebuild_id = get_ebuild_id_db_checksum(conn, build_dict)
+ build_dict['ebuild_id'] = ebuild_id
+ queue_id = check_revision(conn, build_dict)
+ print("queue_id in db", queue_id)
if queue_id is None:
- init_package.add_new_ebuild_buildquery_db_looked(build_dict, config_profile)
- queue_id = check_revision(conn, build_dict, config_profile, ebuild_version_checksum_tree)
- mybuild_dict = get_package_to_build(conn, config_profile, queue_id, new = True)
- print 'mybuild_dict', mybuild_dict
- return mybuild_dict
+ build_dict['queue_id'] = None
+ else:
+ build_dict['queue_id'] = queue_id
+ return build_dict
def main():
# Main
config_profile = gobs_settings_dict['gobs_config']
#we provide the main_loop with the ConnectionManager so we can hand out connections from within the loop
mysettings = portage.settings
- build_dict = get_build_dict_db(CM, mysettings, config_profile, gobs_settings_dict)
- init_buildlog = gobs_buildlog(CM ,mysettings, build_dict, config_profile)
+ build_dict = get_build_dict_db( mysettings, config_profile, gobs_settings_dict)
+ init_buildlog = gobs_buildlog(mysettings, build_dict)
init_buildlog.add_buildlog_main()
#connectionManager.closeAllConnections()
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2011-07-30 1:07 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2011-07-30 1:07 UTC (permalink / raw
To: gentoo-commits
commit: 158790911ebb653146079c19a4d25a7386e0e4d0
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 30 01:07:13 2011 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sat Jul 30 01:07:13 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=15879091
Move pgsql.py part2
---
gobs/bin/gobs_buildquerys | 4 +---
gobs/bin/gobs_updatedb | 14 ++++++--------
gobs/bin/portage_hooks | 4 +---
3 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/gobs/bin/gobs_buildquerys b/gobs/bin/gobs_buildquerys
index 87f1218..7b8121b 100755
--- a/gobs/bin/gobs_buildquerys
+++ b/gobs/bin/gobs_buildquerys
@@ -9,9 +9,7 @@ from gobs.ConnectionManager import connectionManager
CM=connectionManager(gobs_settings_dict)
#selectively import the pgsql/mysql querys
if CM.getName()=='pgsql':
- from gobs.querys.pgsql import *
-elif CM.getName()=='mysql':
- from gobs.querys.mysql import *
+ from gobs.pgsql import *
from gobs.check_setup import check_configure_guest
from gobs.build_queru import queruaction
diff --git a/gobs/bin/gobs_updatedb b/gobs/bin/gobs_updatedb
index d2ff779..a9c8e4a 100755
--- a/gobs/bin/gobs_updatedb
+++ b/gobs/bin/gobs_updatedb
@@ -18,9 +18,7 @@ from gobs.ConnectionManager import connectionManager
CM=connectionManager(gobs_settings_dict)
#selectively import the pgsql/mysql querys
if CM.getName()=='pgsql':
- from gobs.querys.pgsql import *
-elif CM.getName()=='mysql':
- from gobs.querys.mysql import *
+ from gobs.pgsql import *
from gobs.check_setup import check_make_conf
from gobs.arch import gobs_arch
@@ -53,7 +51,7 @@ def init_portage_settings(CM, gobs_settings_dict):
print "Setting default config to:", config_id[0]
return mysettings
-def update_cpv_db(mysettings, CM, gobs_settings_dict):
+def update_cpv_db(mysettings, gobs_settings_dict):
"""Code to update the cpv in the database.
@type:settings
@parms: portage.settings
@@ -65,9 +63,9 @@ def update_cpv_db(mysettings, CM, gobs_settings_dict):
print "Checking categories, package, ebuilds"
# Setup portdb, gobs_categories, gobs_old_cpv, package
myportdb = portage.portdbapi(mysettings=mysettings)
- init_categories = gobs_categories(CM, mysettings)
- init_old_cpv = gobs_old_cpv(CM, myportdb, mysettings)
- init_package = gobs_package(mysettings, CM, myportdb, gobs_settings_dict)
+ init_categories = gobs_categories(mysettings)
+ init_old_cpv = gobs_old_cpv(myportdb, mysettings)
+ init_package = gobs_package(mysettings, myportdb, gobs_settings_dict)
package_id_list_tree = []
# Will run some update checks and update package if needed
# Get categories/package list from portage
@@ -107,7 +105,7 @@ def main():
init_arch = gobs_arch(CM)
init_arch.update_arch_db()
# Update the cpv db
- update_cpv_db(mysettings, CM, gobs_settings_dict)
+ update_cpv_db(mysettings, gobs_settings_dict)
CM.closeAllConnections()
if __name__ == "__main__":
diff --git a/gobs/bin/portage_hooks b/gobs/bin/portage_hooks
index bdb1699..41321df 100755
--- a/gobs/bin/portage_hooks
+++ b/gobs/bin/portage_hooks
@@ -11,9 +11,7 @@ from gobs.ConnectionManager import connectionManager
CM=connectionManager(gobs_settings_dict)
#selectively import the pgsql/mysql querys
if CM.getName()=='pgsql':
- from gobs.querys.pgsql import *
-elif CM.getName()=='mysql':
- from gobs.querys.mysql import *
+ from gobs.pgsql import *
from gobs.package import gobs_package
from gobs.build_log import gobs_buildlog
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2011-09-13 1:06 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2011-09-13 1:06 UTC (permalink / raw
To: gentoo-commits
commit: 51aa14278904aea9e8d763a116d99c61d3fce8a8
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 13 01:05:56 2011 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Tue Sep 13 01:05:56 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=51aa1427
fix a error in get_build_dict_db()
---
gobs/bin/gobs_portage_hooks | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gobs/bin/gobs_portage_hooks b/gobs/bin/gobs_portage_hooks
index aa7392b..5432545 100755
--- a/gobs/bin/gobs_portage_hooks
+++ b/gobs/bin/gobs_portage_hooks
@@ -26,7 +26,7 @@ def get_build_dict_db(mysettings, config_profile, gobs_settings_dict):
package = os.environ['PN']
ebuild_version = os.environ['PVR']
cpv = categories + "/" + package + "-" + ebuild_version
- init_package = gobs_package(mysettings, myportdb, gobs_settings_dict)
+ init_package = gobs_package(mysettings, myportdb)
print("cpv", cpv)
package_id = have_package_db(conn, categories, package)
# print("package_id %s" % package_id, file=sys.stdout)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2011-09-26 23:48 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2011-09-26 23:48 UTC (permalink / raw
To: gentoo-commits
commit: 611d495ead5b590576641aea581fc33fb25bca88
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 26 23:48:12 2011 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Mon Sep 26 23:48:12 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=611d495e
fix a error in init_portage_settings()
---
gobs/bin/gobs_updatedb | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gobs/bin/gobs_updatedb b/gobs/bin/gobs_updatedb
index 34aac67..5832ace 100755
--- a/gobs/bin/gobs_updatedb
+++ b/gobs/bin/gobs_updatedb
@@ -48,10 +48,10 @@ def init_portage_settings():
print master.log()
conn=CM.getConnection()
- check_make_conf(conn)
+ check_make_conf()
print "Check configs done"
# Get default config from the configs table and default_config=1
- config_id = get_default_config(conn) # HostConfigDir = table configs id
+ config_id = get_default_config() # HostConfigDir = table configs id
CM.putConnection(conn);
default_config_root = "/var/lib/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/" + config_id[0] + "/"
# Set config_root (PORTAGE_CONFIGROOT) to default_config_root
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2011-09-26 23:50 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2011-09-26 23:50 UTC (permalink / raw
To: gentoo-commits
commit: 6482fd1000ea38153de8077ec71f7bc8788bda13
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 26 23:50:15 2011 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Mon Sep 26 23:50:15 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=6482fd10
fix a error in init_portage_settings() part2
---
gobs/bin/gobs_updatedb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gobs/bin/gobs_updatedb b/gobs/bin/gobs_updatedb
index 5832ace..a80c270 100755
--- a/gobs/bin/gobs_updatedb
+++ b/gobs/bin/gobs_updatedb
@@ -51,7 +51,7 @@ def init_portage_settings():
check_make_conf()
print "Check configs done"
# Get default config from the configs table and default_config=1
- config_id = get_default_config() # HostConfigDir = table configs id
+ config_id = get_default_config(conn) # HostConfigDir = table configs id
CM.putConnection(conn);
default_config_root = "/var/lib/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/" + config_id[0] + "/"
# Set config_root (PORTAGE_CONFIGROOT) to default_config_root
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2011-09-28 1:17 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2011-09-28 1:17 UTC (permalink / raw
To: gentoo-commits
commit: b7da7da06b53b67ae42fcdbdf70edd034cf6de54
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 28 01:17:14 2011 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Wed Sep 28 01:17:14 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=b7da7da0
remove prints
---
gobs/bin/gobs_portage_hooks | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)
diff --git a/gobs/bin/gobs_portage_hooks b/gobs/bin/gobs_portage_hooks
index 5432545..bf574dc 100755
--- a/gobs/bin/gobs_portage_hooks
+++ b/gobs/bin/gobs_portage_hooks
@@ -27,7 +27,6 @@ def get_build_dict_db(mysettings, config_profile, gobs_settings_dict):
ebuild_version = os.environ['PVR']
cpv = categories + "/" + package + "-" + ebuild_version
init_package = gobs_package(mysettings, myportdb)
- print("cpv", cpv)
package_id = have_package_db(conn, categories, package)
# print("package_id %s" % package_id, file=sys.stdout)
build_dict = {}
@@ -49,16 +48,13 @@ def get_build_dict_db(mysettings, config_profile, gobs_settings_dict):
pkgdir = os.path.join(mysettings['PORTDIR'], categories + "/" + package)
ebuild_version_checksum_tree = portage.checksum.sha256hash(pkgdir+ "/" + package + "-" + ebuild_version + ".ebuild")[0]
build_dict['checksum'] = ebuild_version_checksum_tree
- print('checksum' ,ebuild_version_checksum_tree)
ebuild_id = get_ebuild_id_db_checksum(conn, build_dict)
- print('ebuild_id in db', ebuild_id)
if ebuild_id is None:
#print 'have any ebuild', get_ebuild_checksum(conn, package_id, ebuild_version)
init_package.update_ebuild_db(build_dict)
ebuild_id = get_ebuild_id_db_checksum(conn, build_dict)
build_dict['ebuild_id'] = ebuild_id
queue_id = check_revision(conn, build_dict)
- print("queue_id in db", queue_id)
if queue_id is None:
build_dict['queue_id'] = None
else:
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2012-04-27 20:28 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2012-04-27 20:28 UTC (permalink / raw
To: gentoo-commits
commit: 2b70c86de6cbf44a2c9a25013e0e312cba886329
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 27 20:28:17 2012 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Fri Apr 27 20:28:17 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=2b70c86d
testing logfile update part3
---
gobs/bin/gobs_updatedb | 10 ++++++----
gobs/bin/{gobs_updatedb => gobs_updatedb~} | 6 ++++--
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/gobs/bin/gobs_updatedb b/gobs/bin/gobs_updatedb
index ea21c1d..f923dd4 100755
--- a/gobs/bin/gobs_updatedb
+++ b/gobs/bin/gobs_updatedb
@@ -8,13 +8,14 @@
import sys
import os
import multiprocessing
-
+import logging
# Get the options from the config file set in gobs.readconf
from gobs.readconf import get_conf_settings
reader = get_conf_settings()
gobs_settings_dict=reader.read_gobs_settings_all()
logfile = gobs_settings_dict['gobs_logfile']
+
# make a CM
from gobs.ConnectionManager import connectionManager
CM=connectionManager(gobs_settings_dict)
@@ -29,7 +30,6 @@ from gobs.categories import gobs_categories
from gobs.old_cpv import gobs_old_cpv
from gobs.categories import gobs_categories
from gobs.sync import git_pull, sync_tree
-from gobs.build_log import write_msg_file
import portage
def init_portage_settings():
@@ -46,14 +46,14 @@ def init_portage_settings():
#git stuff
conn=CM.getConnection()
check_make_conf()
- write_msg_file("Check configs done", logfile)
+ logging.info("Check configs done")
# Get default config from the configs table and default_config=1
config_id = get_default_config(conn) # HostConfigDir = table configs id
CM.putConnection(conn);
default_config_root = "/var/lib/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/" + config_id[0] + "/"
# Set config_root (PORTAGE_CONFIGROOT) to default_config_root
mysettings = portage.config(config_root = default_config_root)
- write_msg_file(("Setting default config to:" config_id[0]), logfile)
+ logging.info("Setting default config to:", config_id[0])
return mysettings
def update_cpv_db_pool(mysettings, package_line):
@@ -112,6 +112,8 @@ def update_cpv_db(mysettings):
def main():
# Main
+ # Logging
+ logging.basicConfig(filename=gobs_settings_dict['gobs_logfile'], level=logging.INFO)
# Init settings for the default config
git_pull
if sync_tree():
diff --git a/gobs/bin/gobs_updatedb b/gobs/bin/gobs_updatedb~
similarity index 97%
copy from gobs/bin/gobs_updatedb
copy to gobs/bin/gobs_updatedb~
index ea21c1d..0e7d20c 100755
--- a/gobs/bin/gobs_updatedb
+++ b/gobs/bin/gobs_updatedb~
@@ -8,13 +8,14 @@
import sys
import os
import multiprocessing
-
+import logging
# Get the options from the config file set in gobs.readconf
from gobs.readconf import get_conf_settings
reader = get_conf_settings()
gobs_settings_dict=reader.read_gobs_settings_all()
logfile = gobs_settings_dict['gobs_logfile']
+
# make a CM
from gobs.ConnectionManager import connectionManager
CM=connectionManager(gobs_settings_dict)
@@ -29,7 +30,6 @@ from gobs.categories import gobs_categories
from gobs.old_cpv import gobs_old_cpv
from gobs.categories import gobs_categories
from gobs.sync import git_pull, sync_tree
-from gobs.build_log import write_msg_file
import portage
def init_portage_settings():
@@ -112,6 +112,8 @@ def update_cpv_db(mysettings):
def main():
# Main
+ # Logging
+ logging.basicConfig(filename=gobs_settings_dict['gobs_logfile'], level=logging.INFO)
# Init settings for the default config
git_pull
if sync_tree():
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2012-04-27 20:28 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2012-04-27 20:28 UTC (permalink / raw
To: gentoo-commits
commit: bbacf008a21877846c3be1b4e56603cb37a5aa55
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 27 20:28:33 2012 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Fri Apr 27 20:28:33 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=bbacf008
testing logfile update part4
---
gobs/bin/gobs_updatedb~ | 128 -----------------------------------------------
1 files changed, 0 insertions(+), 128 deletions(-)
diff --git a/gobs/bin/gobs_updatedb~ b/gobs/bin/gobs_updatedb~
deleted file mode 100755
index 0e7d20c..0000000
--- a/gobs/bin/gobs_updatedb~
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/usr/bin/python
-# Copyright 2006-2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-""" This code will update the sql backend with needed info for
- the Frontend and the Guest deamon. """
-
-import sys
-import os
-import multiprocessing
-import logging
-
-# Get the options from the config file set in gobs.readconf
-from gobs.readconf import get_conf_settings
-reader = get_conf_settings()
-gobs_settings_dict=reader.read_gobs_settings_all()
-logfile = gobs_settings_dict['gobs_logfile']
-
-# make a CM
-from gobs.ConnectionManager import connectionManager
-CM=connectionManager(gobs_settings_dict)
-#selectively import the pgsql/mysql querys
-if CM.getName()=='pgsql':
- from gobs.pgsql import *
-
-from gobs.check_setup import check_make_conf
-from gobs.arch import gobs_arch
-from gobs.package import gobs_package
-from gobs.categories import gobs_categories
-from gobs.old_cpv import gobs_old_cpv
-from gobs.categories import gobs_categories
-from gobs.sync import git_pull, sync_tree
-import portage
-
-def init_portage_settings():
-
- """ Get the BASE Setup/Config for portage.settings
- @type: module
- @module: The SQL Backend
- @type: dict
- @parms: config options from the config file (host_setup_root)
- @rtype: settings
- @returns new settings
- """
- # check config setup
- #git stuff
- conn=CM.getConnection()
- check_make_conf()
- write_msg_file("Check configs done", logfile)
- # Get default config from the configs table and default_config=1
- config_id = get_default_config(conn) # HostConfigDir = table configs id
- CM.putConnection(conn);
- default_config_root = "/var/lib/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/" + config_id[0] + "/"
- # Set config_root (PORTAGE_CONFIGROOT) to default_config_root
- mysettings = portage.config(config_root = default_config_root)
- write_msg_file(("Setting default config to:" config_id[0]), logfile)
- return mysettings
-
-def update_cpv_db_pool(mysettings, package_line):
- conn=CM.getConnection()
- # Setup portdb, gobs_categories, gobs_old_cpv, package
- myportdb = portage.portdbapi(mysettings=mysettings)
- init_categories = gobs_categories(mysettings)
- init_package = gobs_package(mysettings, myportdb)
- # split the cp to categories and package
- element = package_line.split('/')
- categories = element[0]
- package = element[1]
- # Check if we don't have the cp in the package table
- package_id = have_package_db(conn,categories, package)
- if package_id is None:
- # Add new package with ebuilds
- init_package.add_new_package_db(categories, package)
- # Ceck if we have the cp in the package table
- elif package_id is not None:
- # Update the packages with ebuilds
- init_package.update_package_db(categories, package, package_id)
- # Update the metadata for categories
- init_categories.update_categories_db(categories)
- CM.putConnection(conn)
-
-def update_cpv_db(mysettings):
- """Code to update the cpv in the database.
- @type:settings
- @parms: portage.settings
- @type: module
- @module: The SQL Backend
- @type: dict
- @parms: config options from the config file
- """
- print "Checking categories, package, ebuilds"
- # Setup portdb, gobs_categories, gobs_old_cpv, package
- myportdb = portage.portdbapi(mysettings=mysettings)
- package_id_list_tree = []
- # Will run some update checks and update package if needed
- # Get categories/package list from portage
- package_list_tree = myportdb.cp_all()
- # Use all exept 2 cores when multiprocessing
- pool_cores= multiprocessing.cpu_count()
- if pool_cores > "3":
- use_pool_cores = pool_cores - 2
- else
- use_pool_cores = 1
- pool = multiprocessing.Pool(processes=use_pool_cores)
- # Run the update package for all package in the list in
- # a multiprocessing pool
- for package_line in sorted(package_list_tree):
- pool.apply_async(update_cpv_db_pool, (mysettings, package_line,))
- pool.close()
- pool.join()
- print "Checking categories, package and ebuilds done"
-
-def main():
- # Main
- # Logging
- logging.basicConfig(filename=gobs_settings_dict['gobs_logfile'], level=logging.INFO)
- # Init settings for the default config
- git_pull
- if sync_tree():
- mysettings = init_portage_settings()
- init_arch = gobs_arch()
- init_arch.update_arch_db()
- # Update the cpv db
- update_cpv_db(mysettings)
- CM.closeAllConnections()
-
-if __name__ == "__main__":
- main()
\ No newline at end of file
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2012-04-27 20:30 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2012-04-27 20:30 UTC (permalink / raw
To: gentoo-commits
commit: cd74a5e19159753f6d75dff5d976a135acd4688e
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 27 20:30:40 2012 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Fri Apr 27 20:30:40 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=cd74a5e1
fix a typo in gobs_update_db
---
gobs/bin/gobs_updatedb | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gobs/bin/gobs_updatedb b/gobs/bin/gobs_updatedb
index f923dd4..4fba322 100755
--- a/gobs/bin/gobs_updatedb
+++ b/gobs/bin/gobs_updatedb
@@ -99,7 +99,7 @@ def update_cpv_db(mysettings):
pool_cores= multiprocessing.cpu_count()
if pool_cores > "3":
use_pool_cores = pool_cores - 2
- else
+ else:
use_pool_cores = 1
pool = multiprocessing.Pool(processes=use_pool_cores)
# Run the update package for all package in the list in
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2012-04-27 20:59 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2012-04-27 20:59 UTC (permalink / raw
To: gentoo-commits
commit: 327266bf7d8956adb90e073f1d41d6a101545e54
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 27 20:59:10 2012 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Fri Apr 27 20:59:10 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=327266bf
Add logging sync.py part2
---
gobs/bin/gobs_updatedb~ | 128 -----------------------------------------------
1 files changed, 0 insertions(+), 128 deletions(-)
diff --git a/gobs/bin/gobs_updatedb~ b/gobs/bin/gobs_updatedb~
deleted file mode 100755
index 4dce5ce..0000000
--- a/gobs/bin/gobs_updatedb~
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/usr/bin/python
-# Copyright 2006-2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-""" This code will update the sql backend with needed info for
- the Frontend and the Guest deamon. """
-
-import sys
-import os
-import multiprocessing
-import logging
-
-# Get the options from the config file set in gobs.readconf
-from gobs.readconf import get_conf_settings
-reader = get_conf_settings()
-gobs_settings_dict=reader.read_gobs_settings_all()
-logfile = gobs_settings_dict['gobs_logfile']
-
-# make a CM
-from gobs.ConnectionManager import connectionManager
-CM=connectionManager(gobs_settings_dict)
-#selectively import the pgsql/mysql querys
-if CM.getName()=='pgsql':
- from gobs.pgsql import *
-
-from gobs.check_setup import check_make_conf
-from gobs.arch import gobs_arch
-from gobs.package import gobs_package
-from gobs.categories import gobs_categories
-from gobs.old_cpv import gobs_old_cpv
-from gobs.categories import gobs_categories
-from gobs.sync import git_pull, sync_tree
-import portage
-
-def init_portage_settings():
-
- """ Get the BASE Setup/Config for portage.settings
- @type: module
- @module: The SQL Backend
- @type: dict
- @parms: config options from the config file (host_setup_root)
- @rtype: settings
- @returns new settings
- """
- # check config setup
- #git stuff
- conn=CM.getConnection()
- check_make_conf()
- logging.info("Check configs done")
- # Get default config from the configs table and default_config=1
- config_id = get_default_config(conn) # HostConfigDir = table configs id
- CM.putConnection(conn);
- default_config_root = "/var/lib/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/" + config_id[0] + "/"
- # Set config_root (PORTAGE_CONFIGROOT) to default_config_root
- mysettings = portage.config(config_root = default_config_root)
- logging.info("Setting default config to:", config_id[0])
- return mysettings
-
-def update_cpv_db_pool(mysettings, package_line):
- conn=CM.getConnection()
- # Setup portdb, gobs_categories, gobs_old_cpv, package
- myportdb = portage.portdbapi(mysettings=mysettings)
- init_categories = gobs_categories(mysettings)
- init_package = gobs_package(mysettings, myportdb)
- # split the cp to categories and package
- element = package_line.split('/')
- categories = element[0]
- package = element[1]
- # Check if we don't have the cp in the package table
- package_id = have_package_db(conn,categories, package)
- if package_id is None:
- # Add new package with ebuilds
- init_package.add_new_package_db(categories, package)
- # Ceck if we have the cp in the package table
- elif package_id is not None:
- # Update the packages with ebuilds
- init_package.update_package_db(categories, package, package_id)
- # Update the metadata for categories
- init_categories.update_categories_db(categories)
- CM.putConnection(conn)
-
-def update_cpv_db(mysettings):
- """Code to update the cpv in the database.
- @type:settings
- @parms: portage.settings
- @type: module
- @module: The SQL Backend
- @type: dict
- @parms: config options from the config file
- """
- print "Checking categories, package, ebuilds"
- # Setup portdb, gobs_categories, gobs_old_cpv, package
- myportdb = portage.portdbapi(mysettings=mysettings)
- package_id_list_tree = []
- # Will run some update checks and update package if needed
- # Get categories/package list from portage
- package_list_tree = myportdb.cp_all()
- # Use all exept 2 cores when multiprocessing
- pool_cores= multiprocessing.cpu_count()
- if pool_cores > "3":
- use_pool_cores = pool_cores - 2
- else:
- use_pool_cores = 1
- pool = multiprocessing.Pool(processes=use_pool_cores)
- # Run the update package for all package in the list in
- # a multiprocessing pool
- for package_line in sorted(package_list_tree):
- pool.apply_async(update_cpv_db_pool, (mysettings, package_line,))
- pool.close()
- pool.join()
- print "Checking categories, package and ebuilds done"
-
-def main():
- # Main
- # Logging
- logging.basicConfig(filename=gobs_settings_dict['gobs_logfile'], level=logging.INFO)
- # Init settings for the default config
- git_pull
- sync_tree()
- mysettings = init_portage_settings()
- init_arch = gobs_arch()
- init_arch.update_arch_db()
- # Update the cpv db
- update_cpv_db(mysettings)
- CM.closeAllConnections()
-
-if __name__ == "__main__":
- main()
\ No newline at end of file
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2012-04-27 21:17 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2012-04-27 21:17 UTC (permalink / raw
To: gentoo-commits
commit: 831bc89a7f0dc7cc48790f7628eaabe0fd8a31e4
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 27 21:16:41 2012 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Fri Apr 27 21:16:41 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=831bc89a
Add logging
---
gobs/bin/gobs_updatedb | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/gobs/bin/gobs_updatedb b/gobs/bin/gobs_updatedb
index babaf38..c59ac19 100755
--- a/gobs/bin/gobs_updatedb
+++ b/gobs/bin/gobs_updatedb
@@ -53,7 +53,7 @@ def init_portage_settings():
default_config_root = "/var/lib/gobs/" + gobs_settings_dict['gobs_gitreponame'] + "/" + config_id[0] + "/"
# Set config_root (PORTAGE_CONFIGROOT) to default_config_root
mysettings = portage.config(config_root = default_config_root)
- logging.info("Setting default config to:", config_id[0])
+ logging.info("Setting default config to: %", config_id[0])
return mysettings
def update_cpv_db_pool(mysettings, package_line):
@@ -113,7 +113,9 @@ def update_cpv_db(mysettings):
def main():
# Main
# Logging
- logging.basicConfig(filename=gobs_settings_dict['gobs_logfile'], level=logging.INFO)
+ logging.basicConfig(filename=gobs_settings_dict['gobs_logfile'], \
+ format='%(levelname)s: %(asctime)s %(message)s', level=logging.INFO)
+ logging.info("Update db started.")
# Sync portage and profile/settings
git_pull
sync_tree()
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2012-04-28 1:04 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2012-04-28 1:04 UTC (permalink / raw
To: gentoo-commits
commit: b2f757cb0f6bb873fe7c6cdeeee043eec922c891
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 28 01:04:33 2012 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sat Apr 28 01:04:33 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=b2f757cb
fix the multiprocessing code
---
gobs/bin/gobs_updatedb | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/gobs/bin/gobs_updatedb b/gobs/bin/gobs_updatedb
index d162ff2..12d33c0 100755
--- a/gobs/bin/gobs_updatedb
+++ b/gobs/bin/gobs_updatedb
@@ -97,11 +97,14 @@ def update_cpv_db(mysettings):
package_list_tree = myportdb.cp_all()
# Use all exept 2 cores when multiprocessing
pool_cores= multiprocessing.cpu_count()
+ print "pool_cores", pool_cores
if pool_cores > "3":
use_pool_cores = pool_cores - 2
else:
use_pool_cores = 1
+ print "use_pool_cores", use_pool_cores
pool = multiprocessing.Pool(processes=use_pool_cores)
+ sys.exit()
# Run the update package for all package in the list in
# a multiprocessing pool
for package_line in sorted(package_list_tree):
@@ -123,7 +126,6 @@ def main():
mysettings = init_portage_settings()
init_arch = gobs_arch()
init_arch.update_arch_db()
- sys.exit()
# Update the cpv db
update_cpv_db(mysettings)
CM.closeAllConnections()
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2012-04-28 1:14 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2012-04-28 1:14 UTC (permalink / raw
To: gentoo-commits
commit: b01077005c7cea192e76bebb66e95aa3baf042ab
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 28 01:14:44 2012 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sat Apr 28 01:14:44 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=b0107700
fix the multiprocessing code part2
---
gobs/bin/gobs_updatedb | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/gobs/bin/gobs_updatedb b/gobs/bin/gobs_updatedb
index 12d33c0..d7bfbee 100755
--- a/gobs/bin/gobs_updatedb
+++ b/gobs/bin/gobs_updatedb
@@ -88,7 +88,7 @@ def update_cpv_db(mysettings):
@type: dict
@parms: config options from the config file
"""
- print "Checking categories, package, ebuilds"
+ logging.info("Checking categories, package, ebuilds")
# Setup portdb, gobs_categories, gobs_old_cpv, package
myportdb = portage.portdbapi(mysettings=mysettings)
package_id_list_tree = []
@@ -97,21 +97,18 @@ def update_cpv_db(mysettings):
package_list_tree = myportdb.cp_all()
# Use all exept 2 cores when multiprocessing
pool_cores= multiprocessing.cpu_count()
- print "pool_cores", pool_cores
- if pool_cores > "3":
+ if pool_cores >= 3:
use_pool_cores = pool_cores - 2
else:
use_pool_cores = 1
- print "use_pool_cores", use_pool_cores
pool = multiprocessing.Pool(processes=use_pool_cores)
- sys.exit()
# Run the update package for all package in the list in
# a multiprocessing pool
for package_line in sorted(package_list_tree):
pool.apply_async(update_cpv_db_pool, (mysettings, package_line,))
pool.close()
pool.join()
- print "Checking categories, package and ebuilds done"
+ logging.info("Checking categories, package and ebuilds done")
def main():
# Main
@@ -129,6 +126,7 @@ def main():
# Update the cpv db
update_cpv_db(mysettings)
CM.closeAllConnections()
+ logging.info("Update db ... Done.")
if __name__ == "__main__":
main()
\ No newline at end of file
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2012-04-29 14:43 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2012-04-29 14:43 UTC (permalink / raw
To: gentoo-commits
commit: 6cf9a8559b9c696cb067ec05f7ed5ecda0455d06
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 29 14:43:13 2012 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sun Apr 29 14:43:13 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=6cf9a855
adding updatedb to job host deamon part2
---
gobs/bin/gobs_host_jobs~ | 55 ----------------------------------------------
1 files changed, 0 insertions(+), 55 deletions(-)
diff --git a/gobs/bin/gobs_host_jobs~ b/gobs/bin/gobs_host_jobs~
deleted file mode 100755
index 87e856e..0000000
--- a/gobs/bin/gobs_host_jobs~
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/python
-# Copyright 2006-2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-from __future__ import print_function
-
-from gobs.init_setup_profile import setup_profile_main
-from gobs.readconf import get_conf_settings
-from gobs.updatedb import update_db_main
-
-reader = get_conf_settings()
-gobs_settings_dict=reader.read_gobs_settings_all()
-
-# make a CM
-from gobs.ConnectionManager import connectionManager
-CM=connectionManager(gobs_settings_dict)
-#selectively import the pgsql/mysql querys
-if CM.getName()=='pgsql':
- from gobs.pgsql import *
-import logging
-
-def main():
- # Main
- config_profile = gobs_settings_dict['gobs_config']
- # Logging
- logging.basicConfig(filename=gobs_settings_dict['gobs_logfile'], \
- format='%(levelname)s: %(asctime)s %(message)s', level=logging.INFO)
- repeat = True
- logging.info("Job deamon started.")
- while repeat:
- conn = CM.getConnection()
- job = check_job_list(conn, config_profile)
-
- if job is None:
- time.sleep(60)
- CM.putConnection(conn)
- continue
- else:
- logging.info("Job: %s Type: %s Config: %s", job[1], job[0], config_profile)
- if job[0] == "updatedb":
- update_job_list(conn, "Runing", job[1])
- logging.info("Job %s is runing. Config: %s", job[0], config_profile)
- result = update_db_main()
- if result is True
- update_job_list(conn, "Done", job[1])
- logging.info("Job %s is done. Config: %s", job[0], config_profile)
- else:
- update_job_list(conn, "Fail", job[1])
- logging.info("Job %s did fail. Config: %s", job[0], config_profile)
- repeat = False
- CM.putConnection(conn)
- time.sleep(60)
-
-if __name__ == "__main__":
- main()
\ No newline at end of file
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2012-04-29 15:58 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2012-04-29 15:58 UTC (permalink / raw
To: gentoo-commits
commit: d03e1c767009281dcdad253882d48ec18da49a26
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 29 15:58:30 2012 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sun Apr 29 15:58:30 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=d03e1c76
fix a typo in gobs_host_jobs
---
gobs/bin/gobs_host_jobs | 2 +-
gobs/bin/gobs_host_jobs~ | 55 ----------------------------------------------
2 files changed, 1 insertions(+), 56 deletions(-)
diff --git a/gobs/bin/gobs_host_jobs b/gobs/bin/gobs_host_jobs
index c5d80a1..1eac84a 100755
--- a/gobs/bin/gobs_host_jobs
+++ b/gobs/bin/gobs_host_jobs
@@ -41,7 +41,7 @@ def main():
update_job_list(conn, "Runing", job[1])
logging.info("Job %s is runing. Config: %s", job[0], config_profile)
result = update_db_main()
- if result is True
+ if result is True:
update_job_list(conn, "Done", job[1])
logging.info("Job %s is done. Config: %s", job[0], config_profile)
else:
diff --git a/gobs/bin/gobs_host_jobs~ b/gobs/bin/gobs_host_jobs~
deleted file mode 100755
index 87e856e..0000000
--- a/gobs/bin/gobs_host_jobs~
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/python
-# Copyright 2006-2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-from __future__ import print_function
-
-from gobs.init_setup_profile import setup_profile_main
-from gobs.readconf import get_conf_settings
-from gobs.updatedb import update_db_main
-
-reader = get_conf_settings()
-gobs_settings_dict=reader.read_gobs_settings_all()
-
-# make a CM
-from gobs.ConnectionManager import connectionManager
-CM=connectionManager(gobs_settings_dict)
-#selectively import the pgsql/mysql querys
-if CM.getName()=='pgsql':
- from gobs.pgsql import *
-import logging
-
-def main():
- # Main
- config_profile = gobs_settings_dict['gobs_config']
- # Logging
- logging.basicConfig(filename=gobs_settings_dict['gobs_logfile'], \
- format='%(levelname)s: %(asctime)s %(message)s', level=logging.INFO)
- repeat = True
- logging.info("Job deamon started.")
- while repeat:
- conn = CM.getConnection()
- job = check_job_list(conn, config_profile)
-
- if job is None:
- time.sleep(60)
- CM.putConnection(conn)
- continue
- else:
- logging.info("Job: %s Type: %s Config: %s", job[1], job[0], config_profile)
- if job[0] == "updatedb":
- update_job_list(conn, "Runing", job[1])
- logging.info("Job %s is runing. Config: %s", job[0], config_profile)
- result = update_db_main()
- if result is True
- update_job_list(conn, "Done", job[1])
- logging.info("Job %s is done. Config: %s", job[0], config_profile)
- else:
- update_job_list(conn, "Fail", job[1])
- logging.info("Job %s did fail. Config: %s", job[0], config_profile)
- repeat = False
- CM.putConnection(conn)
- time.sleep(60)
-
-if __name__ == "__main__":
- main()
\ No newline at end of file
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2012-04-29 16:05 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2012-04-29 16:05 UTC (permalink / raw
To: gentoo-commits
commit: 690f76e57ac106ea8a354e6410f3697c53991448
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 29 16:05:08 2012 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sun Apr 29 16:05:08 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=690f76e5
fix a typo in gobs_host_jobs part2
---
gobs/bin/gobs_host_jobs | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/gobs/bin/gobs_host_jobs b/gobs/bin/gobs_host_jobs
index 1eac84a..0cd5396 100755
--- a/gobs/bin/gobs_host_jobs
+++ b/gobs/bin/gobs_host_jobs
@@ -17,7 +17,9 @@ CM=connectionManager(gobs_settings_dict)
#selectively import the pgsql/mysql querys
if CM.getName()=='pgsql':
from gobs.pgsql import *
+
import logging
+import time
def main():
# Main
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2012-04-29 16:38 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2012-04-29 16:38 UTC (permalink / raw
To: gentoo-commits
commit: a61dd904063c8ebf15984102de5320a02895ce02
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 29 16:38:14 2012 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sun Apr 29 16:38:14 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=a61dd904
adding add/del build querys for configs part2
---
gobs/bin/gobs_host_jobs | 40 ++++++++++++++++++++--------------------
1 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/gobs/bin/gobs_host_jobs b/gobs/bin/gobs_host_jobs
index 09189d7..721351e 100755
--- a/gobs/bin/gobs_host_jobs
+++ b/gobs/bin/gobs_host_jobs
@@ -50,26 +50,26 @@ def main():
else:
update_job_list(conn, "Fail", job[1])
logging.info("Job %s did fail. Config: %s", job[0], config_profile)
- elif job[0] == "addbuildquery":
- update_job_list(conn, "Runing", job[1])
- logging.info("Job %s is runing. Config: %s", job[0], config_profile)
- result = add_buildquery_main(config_profile)
- if result is True:
- update_job_list(conn, "Done", job[1])
- logging.info("Job %s is done. Config: %s", job[0], config_profile)
- else:
- update_job_list(conn, "Fail", job[1])
- logging.info("Job %s did fail. Config: %s", job[0], config_profile)
- elif job[0] == "delbuildquery":
- update_job_list(conn, "Runing", job[1])
- logging.info("Job %s is runing. Config: %s", job[0], config_profile)
- result = del_buildquery_main(config_profile)
- if result is True:
- update_job_list(conn, "Done", job[1])
- logging.info("Job %s is done. Config: %s", job[0], config_profile)
- else:
- update_job_list(conn, "Fail", job[1])
- logging.info("Job %s did fail. Config: %s", job[0], config_profile)
+ elif job[0] == "addbuildquery":
+ update_job_list(conn, "Runing", job[1])
+ logging.info("Job %s is runing. Config: %s", job[0], config_profile)
+ result = add_buildquery_main(config_profile)
+ if result is True:
+ update_job_list(conn, "Done", job[1])
+ logging.info("Job %s is done. Config: %s", job[0], config_profile)
+ else:
+ update_job_list(conn, "Fail", job[1])
+ logging.info("Job %s did fail. Config: %s", job[0], config_profile)
+ elif job[0] == "delbuildquery":
+ update_job_list(conn, "Runing", job[1])
+ logging.info("Job %s is runing. Config: %s", job[0], config_profile)
+ result = del_buildquery_main(config_profile)
+ if result is True:
+ update_job_list(conn, "Done", job[1])
+ logging.info("Job %s is done. Config: %s", job[0], config_profile)
+ else:
+ update_job_list(conn, "Fail", job[1])
+ logging.info("Job %s did fail. Config: %s", job[0], config_profile)
repeat = False
CM.putConnection(conn)
time.sleep(60)
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2012-12-21 20:35 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2012-12-21 20:35 UTC (permalink / raw
To: gentoo-commits
commit: bb404456a8fbf0d9e0308b6d674d84cd66179cd2
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 21 20:34:49 2012 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Fri Dec 21 20:34:49 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=bb404456
'connectionManager' object has no attribute 'getConnection'
---
gobs/bin/gobs_guest_jobs | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gobs/bin/gobs_guest_jobs b/gobs/bin/gobs_guest_jobs
index 5494b83..9c4296f 100755
--- a/gobs/bin/gobs_guest_jobs
+++ b/gobs/bin/gobs_guest_jobs
@@ -20,7 +20,7 @@ def main():
gobs_settings_dict=reader.read_gobs_settings_all()
config_profile = gobs_settings_dict['gobs_config']
CM=connectionManager()
- conn = CM.getConnection()
+ conn = CM.newConnection()
config_id = get_config_id(conn, config_profile)
add_gobs_logs(conn, "Job and build deamon started.", "info", config_id)
init_build_job = build_job_action(conn, config_id)
@@ -33,7 +33,7 @@ def main():
procces_build_jobs()
repeat = True
time.sleep(6)
- CM.putConnection(conn)
+ conn.close
if __name__ == "__main__":
main()
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/
@ 2012-12-21 20:39 Magnus Granberg
0 siblings, 0 replies; 20+ messages in thread
From: Magnus Granberg @ 2012-12-21 20:39 UTC (permalink / raw
To: gentoo-commits
commit: 0c793bdfa9905d603d3d0c8d342000a3fe9f9c23
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 21 20:38:59 2012 +0000
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Fri Dec 21 20:38:59 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=0c793bdf
Update the bins with some more code
---
gobs/bin/gobs_guest_jobs | 8 ++++++--
gobs/bin/gobs_host_jobs | 4 ++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/gobs/bin/gobs_guest_jobs b/gobs/bin/gobs_guest_jobs
index 9c4296f..2333d62 100755
--- a/gobs/bin/gobs_guest_jobs
+++ b/gobs/bin/gobs_guest_jobs
@@ -13,6 +13,7 @@ import portage
import sys
import os
import time
+from multiprocessing import Process
def main():
repeat = True
@@ -25,14 +26,17 @@ def main():
add_gobs_logs(conn, "Job and build deamon started.", "info", config_id)
init_build_job = build_job_action(conn, config_id)
while repeat:
+ if not conn.is_connected() is True:
+ conn.reconnect(attempts=2, delay=1)
jobs_main(conn, config_profile)
if check_configure_guest(conn, config_id) is not True:
time.sleep(6)
continue
else:
- procces_build_jobs()
+ p = Process(target=init_build_job.procces_build_jobs,)
+ p.start()
+ p.join()
repeat = True
- time.sleep(6)
conn.close
if __name__ == "__main__":
diff --git a/gobs/bin/gobs_host_jobs b/gobs/bin/gobs_host_jobs
index 5273430..162ac43 100755
--- a/gobs/bin/gobs_host_jobs
+++ b/gobs/bin/gobs_host_jobs
@@ -15,7 +15,7 @@ def main():
gobs_settings_dict=reader.read_gobs_settings_all()
config_profile = gobs_settings_dict['gobs_config']
CM=connectionManager()
- conn = CM.getConnection()
+ conn = CM.newConnection()
config_id = get_config_id(conn, config_profile)
add_gobs_logs(conn, "Job deamon started", "info", config_id)
repeat = True
@@ -23,7 +23,7 @@ def main():
jobs_main(conn, config_profile)
repeat = False
time.sleep(60)
- CM.putConnection(conn)
+ conn.close
if __name__ == "__main__":
main()
\ No newline at end of file
^ permalink raw reply related [flat|nested] 20+ messages in thread
end of thread, other threads:[~2012-12-21 20:39 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-10 15:31 [gentoo-commits] dev/zorry:master commit in: gobs/bin/ Magnus Granberg
-- strict thread matches above, loose matches on Subject: below --
2011-07-29 15:31 Magnus Granberg
2011-07-30 1:07 Magnus Granberg
2011-09-13 1:06 Magnus Granberg
2011-09-26 23:48 Magnus Granberg
2011-09-26 23:50 Magnus Granberg
2011-09-28 1:17 Magnus Granberg
2012-04-27 20:28 Magnus Granberg
2012-04-27 20:28 Magnus Granberg
2012-04-27 20:30 Magnus Granberg
2012-04-27 20:59 Magnus Granberg
2012-04-27 21:17 Magnus Granberg
2012-04-28 1:04 Magnus Granberg
2012-04-28 1:14 Magnus Granberg
2012-04-29 14:43 Magnus Granberg
2012-04-29 15:58 Magnus Granberg
2012-04-29 16:05 Magnus Granberg
2012-04-29 16:38 Magnus Granberg
2012-12-21 20:35 Magnus Granberg
2012-12-21 20:39 Magnus Granberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox