public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] dev/zorry:master commit in: gobs/bin/, ebuild/dev-python/gobs/files/, gobs/pym/
@ 2012-04-27 18:14 Magnus Granberg
  0 siblings, 0 replies; only message in thread
From: Magnus Granberg @ 2012-04-27 18:14 UTC (permalink / raw
  To: gentoo-commits

commit:     40bf59174ba5175e2056ba5c1b0e4804e7eafed5
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 27 18:14:28 2012 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Fri Apr 27 18:14:28 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=40bf5917

testing logfile update

---
 ebuild/dev-python/gobs/files/gobs.conf |    2 +
 gobs/bin/gobs_updatedb                 |    8 +-
 gobs/pym/flags.py~                     |  219 --------------------------------
 gobs/pym/readconf.py                   |    3 +
 4 files changed, 10 insertions(+), 222 deletions(-)

diff --git a/ebuild/dev-python/gobs/files/gobs.conf b/ebuild/dev-python/gobs/files/gobs.conf
index b93df1d..5650449 100644
--- a/ebuild/dev-python/gobs/files/gobs.conf
+++ b/ebuild/dev-python/gobs/files/gobs.conf
@@ -11,3 +11,5 @@ SQLPASSWD=buildhost
 # Gobs git repo name for the setups/configs
 GOBSGITREPONAME=tinderboxs_configs
 GOBSCONFIG=jasmin.ume.nu/hardened
+# Main logfile
+LOGFILE=/var/log/gobs

diff --git a/gobs/bin/gobs_updatedb b/gobs/bin/gobs_updatedb
index 5beb6b2..ea21c1d 100755
--- a/gobs/bin/gobs_updatedb
+++ b/gobs/bin/gobs_updatedb
@@ -12,8 +12,9 @@ import multiprocessing
 
 # Get the options from the config file set in gobs.readconf
 from gobs.readconf import get_conf_settings
-reader=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)
@@ -28,6 +29,7 @@ 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():
@@ -44,14 +46,14 @@ def init_portage_settings():
 	#git stuff
 	conn=CM.getConnection()
 	check_make_conf()
-	print "Check configs done"
+	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)
-	print "Setting default config to:", config_id[0]
+	write_msg_file(("Setting default config to:" config_id[0]), logfile)
 	return mysettings
 
 def update_cpv_db_pool(mysettings, package_line):

diff --git a/gobs/pym/flags.py~ b/gobs/pym/flags.py~
deleted file mode 100644
index 7ccf90b..0000000
--- a/gobs/pym/flags.py~
+++ /dev/null
@@ -1,219 +0,0 @@
-from __future__ import print_function
-from _emerge.main import parse_opts
-from _emerge.depgraph import backtrack_depgraph, depgraph, resume_depgraph
-from _emerge.create_depgraph_params import create_depgraph_params
-from _emerge.actions import load_emerge_config
-import portage
-import os
-
-class gobs_use_flags(object):
-	
-	def __init__(self, mysettings, myportdb, cpv):
-		self._mysettings = mysettings
-		self._myportdb = myportdb
-		self._cpv = cpv
-	
-	def get_iuse(self):
-		"""Gets the current IUSE flags from the tree
-		To be used when a gentoolkit package object is not needed
-		@type: cpv: string 
-		@param cpv: cat/pkg-ver
-		@rtype list
-		@returns [] or the list of IUSE flags
-		"""
-		return self._myportdb.aux_get(self._cpv, ["IUSE"])[0].split()
-		
-	def reduce_flag(self, flag):
-		"""Absolute value function for a USE flag
-		@type flag: string
-		@param flag: the use flag to absolute.
-		@rtype: string
-		@return absolute USE flag
-		"""
-		if flag[0] in ["+","-"]:
-			return flag[1:]
-		else:
-			return flag
-
-	def reduce_flags(self, the_list):
-		"""Absolute value function for a USE flag list
-		@type the_list: list
-		@param the_list: the use flags to absolute.
-		@rtype: list
-		@return absolute USE flags
-		"""
-		r=[]
-		for member in the_list:
-			r.append(self.reduce_flag(member))
-		return r
-
-	def filter_flags(self, use, use_expand_hidden, usemasked, useforced):
-		"""Filter function to remove hidden or otherwise not normally
-		visible USE flags from a list.
-		@type use: list
-		@param use: the USE flag list to be filtered.
-		@type use_expand_hidden: list
-		@param  use_expand_hidden: list of flags hidden.
-		@type usemasked: list
-		@param usemasked: list of masked USE flags.
-		@type useforced: list
-		@param useforced: the forced USE flags.
-		@rtype: list
-		@return the filtered USE flags.
-		"""
-		# clean out some environment flags, since they will most probably
-		# be confusing for the user
-		for f in use_expand_hidden:
-			f=f.lower() + "_"
-			for x in use:
-				if f in x:
-					use.remove(x)
-		# clean out any arch's
-		archlist = self._mysettings["PORTAGE_ARCHLIST"].split()
-		for a in use[:]:
-			if a in archlist:
-				use.remove(a)
-		# dbl check if any from usemasked  or useforced are still there
-		masked = usemasked + useforced
-		for a in use[:]:
-			if a in masked:
-				use.remove(a)
-		return use
-
-	def get_all_cpv_use(self):
-		"""Uses portage to determine final USE flags and settings for an emerge
-		@type cpv: string
-		@param cpv: eg cat/pkg-ver
-		@rtype: lists
-		@return  use, use_expand_hidden, usemask, useforce
-		"""
-		use = None
-		self._mysettings.unlock()
-		try:
-			self._mysettings.setcpv(self._cpv, use_cache=None, mydb=self._myportdb)
-			use = self._mysettings['PORTAGE_USE'].split()
-			use_expand_hidden = self._mysettings["USE_EXPAND_HIDDEN"].split()
-			usemask = list(self._mysettings.usemask)
-			useforce =  list(self._mysettings.useforce)
-		except KeyError:
-			self._mysettings.reset()
-			self._mysettings.lock()
-			return [], [], [], []
-		# reset cpv filter
-		self._mysettings.reset()
-		self._mysettings.lock()
-		return use, use_expand_hidden, usemask, useforce
-
-	def get_all_cpv_use_looked(self):
-		"""Uses portage to determine final USE flags and settings for an emerge
-		@type cpv: string
-		@param cpv: eg cat/pkg-ver
-		@rtype: lists
-		@return  use, use_expand_hidden, usemask, useforce
-		"""
-		# use = self._mysettings['PORTAGE_USE'].split()
-		use = os.environ['USE'].split()
-		use_expand_hidden = self._mysettings["USE_EXPAND_HIDDEN"].split()
-		usemask = list(self._mysettings.usemask)
-		useforce = list(self._mysettings.useforce)
-		return use, use_expand_hidden, usemask, useforce
-
-	def get_all_cpv_use_pkg(self, pkg, settings):
-		"""Uses portage to determine final USE flags and settings for an emerge
-		@type cpv: string
-		@param cpv: eg cat/pkg-ver
-		@rtype: lists
-		@return  use, use_expand_hidden, usemask, useforce
-		"""
-		# use = self._mysettings['PORTAGE_USE'].split()
-		use_list = list(pkg.use.enabled)
-		use_expand_hidden = settings["USE_EXPAND_HIDDEN"].split()
-		usemask = list(settings.usemask)
-		useforced = list(settings.useforce)
-		return use_list, use_expand_hidden, usemask, useforced
-
-	def get_flags(self):
-		"""Retrieves all information needed to filter out hidden, masked, etc.
-		USE flags for a given package.
-
-		@type cpv: string
-		@param cpv: eg. cat/pkg-ver
-		@type final_setting: boolean
-		@param final_setting: used to also determine the final
-		enviroment USE flag settings and return them as well.
-		@rtype: list or list, list
-		@return IUSE or IUSE, final_flags
-		"""
-		final_use, use_expand_hidden, usemasked, useforced = self.get_all_cpv_use()
-		iuse_flags = self.filter_flags(self.get_iuse(), use_expand_hidden, usemasked, useforced)
-		#flags = filter_flags(use_flags, use_expand_hidden, usemasked, useforced)
-		final_flags = self.filter_flags(final_use, use_expand_hidden, usemasked, useforced)
-		return iuse_flags, final_flags
-
-	def get_flags_looked(self):
-		"""Retrieves all information needed to filter out hidden, masked, etc.
-		USE flags for a given package.
-
-		@type cpv: string
-		@param cpv: eg. cat/pkg-ver
-		@type final_setting: boolean
-		@param final_setting: used to also determine the final
-		enviroment USE flag settings and return them as well.
-		@rtype: list or list, list
-		@return IUSE or IUSE, final_flags
-		"""
-		final_use, use_expand_hidden, usemasked, useforced = self.get_all_cpv_use_looked()
-		iuse_flags = self.filter_flags(self.get_iuse(), use_expand_hidden, usemasked, useforced)
-		#flags = filter_flags(use_flags, use_expand_hidden, usemasked, useforced)
-		final_flags = self.filter_flags(final_use, use_expand_hidden, usemasked, useforced)
-		return iuse_flags, final_flags
-
-	def get_flags_pkg(self, pkg, settings):
-		"""Retrieves all information needed to filter out hidden, masked, etc.
-		USE flags for a given package.
-		@type cpv: string
-		@param cpv: eg. cat/pkg-ver
-		@type final_setting: boolean
-		@param final_setting: used to also determine the final
-		enviroment USE flag settings and return them as well.
-		@rtype: list or list, list
-		@return IUSE or IUSE, final_flags
-		"""
-		final_use, use_expand_hidden, usemasked, useforced = self.get_all_cpv_use_pkg(pkg, settings)
-		iuse_flags = self.filter_flags(list(pkg.iuse.all), use_expand_hidden, usemasked, useforced)
-		#flags = filter_flags(use_flags, use_expand_hidden, usemasked, useforced)
-		final_flags = self.filter_flags(final_use, use_expand_hidden, usemasked, useforced)
-		return iuse_flags, final_flags
-
-	def comper_useflags(self, build_dict):
-		iuse_flags, use_enable = self.get_flags()
-		iuse = []
-		print("use_enable", use_enable)
-		build_use_flags_dict = build_dict['build_useflags']
-		print("build_use_flags_dict", build_use_flags_dict)
-		build_use_flags_list = []
-		if use_enable == []:
-			if build_use_flags_dict is None:
-				return None
-		for iuse_line in iuse_flags:
-			iuse.append(self.reduce_flag(iuse_line))
-		iuse_flags_list = list(set(iuse))
-		use_disable = list(set(iuse_flags_list).difference(set(use_enable)))
-		use_flagsDict = {}
-		for x in use_enable:
-			use_flagsDict[x] = True
-		for x in use_disable:
-			use_flagsDict[x] = False
-		print("use_flagsDict", use_flagsDict)
-		for k, v in use_flagsDict.iteritems():
-			print("tree use flags", k, v)
-			print("db use flags", k, build_use_flags_dict[k])
-		if build_use_flags_dict[k] != v:
-			if build_use_flags_dict[k] is True:
-				build_use_flags_list.append(k)
-			if build_use_flags_dict[k] is False:
-				build_use_flags_list.append("-" + k)
-		if build_use_flags_list == []:
-			build_use_flags_list = None
-		print(build_use_flags_list)
-		return build_use_flags_list

diff --git a/gobs/pym/readconf.py b/gobs/pym/readconf.py
index 89d0319..a3499dc 100644
--- a/gobs/pym/readconf.py
+++ b/gobs/pym/readconf.py
@@ -33,6 +33,8 @@ class get_conf_settings(object):
 			# Buildhost setup (host/setup on guest)
 			if element[0] == 'GOBSCONFIG':
 				get_gobs_config = element[1]
+			if element[0] == 'LOGFILES':
+				get_gobs_logfile = element[1]
 			
 			open_conffile.close()
 		gobs_settings_dict = {}
@@ -43,4 +45,5 @@ class get_conf_settings(object):
 		gobs_settings_dict['sql_passwd'] = get_sql_passwd.rstrip('\n')
 		gobs_settings_dict['gobs_gitreponame'] = get_gobs_gitreponame.rstrip('\n')
 		gobs_settings_dict['gobs_config'] = get_gobs_config.rstrip('\n')
+		gobs_settings_dict['gobs_logfile'] = get_gobs_logfile.rstrip('\n')
 		return gobs_settings_dict



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-04-27 18:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-27 18:14 [gentoo-commits] dev/zorry:master commit in: gobs/bin/, ebuild/dev-python/gobs/files/, gobs/pym/ Magnus Granberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox