public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Magnus Granberg" <zorry@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] dev/zorry:master commit in: gobs/pym/
Date: Sat, 29 Oct 2011 22:24:38 +0000 (UTC)	[thread overview]
Message-ID: <4e044fc62205c73300cd1ab942f7f235f5ea0acc.zorry@gentoo> (raw)

commit:     4e044fc62205c73300cd1ab942f7f235f5ea0acc
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 29 22:23:54 2011 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Sat Oct 29 22:23:54 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=4e044fc6

fix bugs in setup_profile

---
 gobs/pym/init_setup_profile.py |   10 ++++++----
 gobs/pym/package.py            |   36 ++++++------------------------------
 gobs/pym/pgsql.py              |    6 +++++-
 3 files changed, 17 insertions(+), 35 deletions(-)

diff --git a/gobs/pym/init_setup_profile.py b/gobs/pym/init_setup_profile.py
index 6f640d9..23a2056 100644
--- a/gobs/pym/init_setup_profile.py
+++ b/gobs/pym/init_setup_profile.py
@@ -45,10 +45,12 @@ def setup_profile_main(args=None):
 			# Set config_root (PORTAGE_CONFIGROOT)  to default_config_root
 			mysettings = portage.config(config_root = default_config_root)
 			myportdb = portage.portdbapi(mysettings=mysettings)
-			init_package = gobs_package
+			init_package = gobs_package(mysettings, myportdb)
 			# get the cp list
-			package_list_tree = package_list_tree = myportdb.cp_all()(mysettings, myportdb)
+			package_list_tree = package_list_tree = myportdb.cp_all()
 			print "Setting default config to:", config_id
+			config_id_list = []
+			config_id_list.append(config_id)
 			for package_line in sorted(package_list_tree):
 				build_dict = {}
 				packageDict = {}
@@ -59,7 +61,7 @@ def setup_profile_main(args=None):
 				package = element[1]
 				print "C", categories + "/" + package			# C = Checking
 				pkgdir = mysettings['PORTDIR'] + "/" + categories + "/" + package
-				config_cpv_listDict = gobs_package.config_match_cp(categories, package, config_id)
+				config_cpv_listDict = init_package.config_match_cp(categories, package, config_id_list)
 				packageDict['ebuild_version_tree'] = config_cpv_listDict['ebuild_version']
 				build_dict['checksum'] = portage.checksum.sha256hash(pkgdir + "/" + package + "-" + config_cpv_listDict['ebuild_version'] + ".ebuild")[0]
 				build_dict['package_id'] = have_package_db(categories, package)
@@ -67,7 +69,7 @@ def setup_profile_main(args=None):
 				ebuild_id = get_ebuild_id_db_checksum(connection, build_dict)
 				if ebuild_id is not None:
 					ebuild_id_list.append(ebuild_id)
-					gobs_package.add_new_ebuild_buildquery_db(ebuild_id_list, packageDict, config_cpv_listDict)
+					init_package.add_new_ebuild_buildquery_db(ebuild_id_list, packageDict, config_cpv_listDict)
 		if args[0] is "-del":
 			config_id = args[1]
 			querue_id_list = get_queue_id_list_config(conn, config_id)

diff --git a/gobs/pym/package.py b/gobs/pym/package.py
index bbd5998..3bd614e 100644
--- a/gobs/pym/package.py
+++ b/gobs/pym/package.py
@@ -28,7 +28,7 @@ class gobs_package(object):
 		mysettings_setup = portage.config(config_root = my_new_setup)
 		return mysettings_setup
 
-	def config_match_ebuild(self, categories, package):
+	def config_match_ebuild(self, categories, package, config_list_all):
 		conn=CM.getConnection()
 		config_cpv_listDict ={}
 		# Get a list from table configs/setups with default_config=Fales and active = True
@@ -67,32 +67,6 @@ class gobs_package(object):
 		CM.putConnection(conn)
 		return config_cpv_listDict
 
-	def config_match_cp(self, categories, package, config_id):
-		config_cpv_listDict ={}
-		# Get latest cpv from portage with the config
-		latest_ebuild = self._myportdb_setup.xmatch('bestmatch-visible', categories + "/" + package)
-		latest_ebuild_version = unicode("")
-		# Check if could get cpv from portage
-		if latest_ebuild != "":
-			# Get the version of cpv
-			latest_ebuild_version = portage.versions.cpv_getversion(latest_ebuild)
-			# Get the iuse and use flags for that config/setup
-			init_useflags = gobs_use_flags(self._mysettings, self._myportdb, latest_ebuild)
-			iuse_flags_list, final_use_list = init_useflags.get_flags()
-			iuse_flags_list2 = []
-			for iuse_line in iuse_flags_list:
-				iuse_flags_list2.append( init_useflags.reduce_flag(iuse_line))
-				# Dic the needed info
-				attDict = {}
-				attDict['ebuild_version'] = latest_ebuild_version
-				attDict['useflags'] = final_use_list
-				attDict['iuse'] = iuse_flags_list2
-				attDict['package'] = package
-				attDict['categories'] = categories
-				config_cpv_listDict[config_id] = attDict
-		# Clean some cache
-		return config_cpv_listDict
-
 	def get_ebuild_metadata(self, ebuild_line):
 		# Get the auxdbkeys infos for the ebuild
 		try:
@@ -156,7 +130,7 @@ class gobs_package(object):
 		conn=CM.getConnection()
 		# Get the needed info from packageDict and config_cpv_listDict and put that in buildqueue
 		# Only add it if ebuild_version in packageDict and config_cpv_listDict match
-		if config_cpv_listDict != {}:
+		if config_cpv_listDict not None:
 			message = None
 			# Unpack config_cpv_listDict
 			for k, v in config_cpv_listDict.iteritems():
@@ -212,7 +186,8 @@ class gobs_package(object):
 		ebuild_list_tree = self._myportdb.cp_list((categories + "/" + package), use_cache=1, mytree=None)
 		if ebuild_list_tree == []:
 			return None
-		config_cpv_listDict = self.config_match_ebuild(categories, package)
+		config_list_all  = get_config_list(conn)
+		config_cpv_listDict = self.config_match_ebuild(categories, package, config_list_all)
 		config_id  = get_default_config(conn)
 		packageDict ={}
 		for ebuild_line in sorted(ebuild_list_tree):
@@ -262,7 +237,8 @@ class gobs_package(object):
 			package_metadataDict = self.get_package_metadataDict(pkgdir, package)
 			update_new_package_metadata(conn,package_id, package_metadataDict)
 			# Get config_cpv_listDict
-			config_cpv_listDict = self.config_match_ebuild(categories, package)
+			config_list_all  = get_config_list(conn)
+			config_cpv_listDict = self.config_match_ebuild(categories, package, config_list_all)
 			config_id  = get_default_config(conn)
 			packageDict ={}
 			for ebuild_line in sorted(ebuild_list_tree):

diff --git a/gobs/pym/pgsql.py b/gobs/pym/pgsql.py
index 606c624..1d7ee48 100644
--- a/gobs/pym/pgsql.py
+++ b/gobs/pym/pgsql.py
@@ -84,7 +84,11 @@ def get_config_list(connection):
   cursor = connection.cursor()
   sqlQ = 'SELECT id FROM configs WHERE default_config = False AND active = True'
   cursor.execute(sqlQ)
-  return cursor.fetchall()
+  entries = cursor.fetchall()
+  if entries == ():
+    return None
+  else:
+    return entries
 
 def get_config_list_all(connection):
   cursor = connection.cursor()



             reply	other threads:[~2011-10-29 22:24 UTC|newest]

Thread overview: 174+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-29 22:24 Magnus Granberg [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-04-25  0:34 [gentoo-commits] dev/zorry:master commit in: gobs/pym/ Magnus Granberg
2013-04-24  0:37 Magnus Granberg
2013-04-24  0:11 Magnus Granberg
2013-03-22 19:05 Magnus Granberg
2013-01-27 12:03 Magnus Granberg
2013-01-26 22:23 Magnus Granberg
2013-01-22 21:06 Magnus Granberg
2013-01-22 20:59 Magnus Granberg
2013-01-22 20:56 Magnus Granberg
2012-12-29 12:12 Magnus Granberg
2012-12-27 23:52 Magnus Granberg
2012-12-27 23:09 Magnus Granberg
2012-12-22 11:45 Magnus Granberg
2012-12-21 23:50 Magnus Granberg
2012-12-21 23:31 Magnus Granberg
2012-12-21 23:23 Magnus Granberg
2012-12-21 20:41 Magnus Granberg
2012-12-21 20:31 Magnus Granberg
2012-12-21 17:33 Magnus Granberg
2012-12-21  2:24 Magnus Granberg
2012-12-21  2:11 Magnus Granberg
2012-12-21  1:50 Magnus Granberg
2012-12-21  1:49 Magnus Granberg
2012-12-21  1:44 Magnus Granberg
2012-12-19  2:17 Magnus Granberg
2012-12-17  1:18 Magnus Granberg
2012-12-17  0:33 Magnus Granberg
2012-12-16 20:50 Magnus Granberg
2012-12-16 20:45 Magnus Granberg
2012-12-15 16:14 Magnus Granberg
2012-12-15  0:31 Magnus Granberg
2012-12-14 14:17 Magnus Granberg
2012-12-13 22:57 Magnus Granberg
2012-12-13 15:18 Magnus Granberg
2012-12-13 15:15 Magnus Granberg
2012-12-13 15:09 Magnus Granberg
2012-12-12  0:29 Magnus Granberg
2012-12-12  0:14 Magnus Granberg
2012-12-12  0:11 Magnus Granberg
2012-12-12  0:09 Magnus Granberg
2012-12-12  0:04 Magnus Granberg
2012-12-12  0:00 Magnus Granberg
2012-12-11 23:52 Magnus Granberg
2012-12-11 23:48 Magnus Granberg
2012-12-11 23:38 Magnus Granberg
2012-12-07 14:58 Magnus Granberg
2012-12-07 14:33 Magnus Granberg
2012-12-07 14:29 Magnus Granberg
2012-12-07 14:22 Magnus Granberg
2012-12-07  0:07 Magnus Granberg
2012-12-07  0:02 Magnus Granberg
2012-12-06 23:56 Magnus Granberg
2012-12-06 23:52 Magnus Granberg
2012-12-06  2:51 Magnus Granberg
2012-12-06  2:41 Magnus Granberg
2012-12-06  2:34 Magnus Granberg
2012-12-06  2:22 Magnus Granberg
2012-12-06  2:18 Magnus Granberg
2012-12-06  0:11 Magnus Granberg
2012-12-06  0:08 Magnus Granberg
2012-12-06  0:04 Magnus Granberg
2012-12-02 11:53 Magnus Granberg
2012-12-02 11:49 Magnus Granberg
2012-12-02  0:06 Magnus Granberg
2012-12-02  0:05 Magnus Granberg
2012-12-01 23:58 Magnus Granberg
2012-12-01 23:35 Magnus Granberg
2012-12-01 23:33 Magnus Granberg
2012-12-01 23:28 Magnus Granberg
2012-12-01 23:24 Magnus Granberg
2012-12-01 23:12 Magnus Granberg
2012-12-01 23:03 Magnus Granberg
2012-12-01 22:58 Magnus Granberg
2012-12-01 11:31 Magnus Granberg
2012-12-01 11:26 Magnus Granberg
2012-07-18  0:10 Magnus Granberg
2012-07-17 15:02 Magnus Granberg
2012-07-17 13:00 Magnus Granberg
2012-07-17  1:07 Magnus Granberg
2012-07-17  0:38 Magnus Granberg
2012-07-17  0:18 Magnus Granberg
2012-06-27 15:26 Magnus Granberg
2012-06-27 15:15 Magnus Granberg
2012-06-27 14:57 Magnus Granberg
2012-06-27 14:43 Magnus Granberg
2012-06-27 14:39 Magnus Granberg
2012-06-27 14:24 Magnus Granberg
2012-06-27 14:19 Magnus Granberg
2012-06-27 14:14 Magnus Granberg
2012-06-27 14:11 Magnus Granberg
2012-06-27 14:07 Magnus Granberg
2012-06-04 23:45 Magnus Granberg
2012-06-03 22:18 Magnus Granberg
2012-05-25  0:15 Magnus Granberg
2012-05-20 14:33 Magnus Granberg
2012-05-20 14:29 Magnus Granberg
2012-05-09 23:12 Magnus Granberg
2012-05-07 23:44 Magnus Granberg
2012-05-07 23:39 Magnus Granberg
2012-05-07 23:35 Magnus Granberg
2012-05-07 23:31 Magnus Granberg
2012-05-07 23:25 Magnus Granberg
2012-05-06 10:47 Magnus Granberg
2012-05-02 14:33 Magnus Granberg
2012-05-01 10:00 Magnus Granberg
2012-05-01  0:15 Magnus Granberg
2012-05-01  0:02 Magnus Granberg
2012-04-30 16:45 Magnus Granberg
2012-04-30 14:33 Magnus Granberg
2012-04-30 14:17 Magnus Granberg
2012-04-30 14:15 Magnus Granberg
2012-04-30 13:13 Magnus Granberg
2012-04-30 13:12 Magnus Granberg
2012-04-29 15:56 Magnus Granberg
2012-04-29 13:24 Magnus Granberg
2012-04-29 13:17 Magnus Granberg
2012-04-28 19:29 Magnus Granberg
2012-04-28 17:24 Magnus Granberg
2012-04-28 17:03 Magnus Granberg
2012-04-28 16:09 Magnus Granberg
2012-04-28 16:07 Magnus Granberg
2012-04-28 16:05 Magnus Granberg
2012-04-28 14:29 Magnus Granberg
2012-04-28 14:20 Magnus Granberg
2012-04-28 14:01 Magnus Granberg
2012-04-28 12:37 Magnus Granberg
2012-04-28  1:53 Magnus Granberg
2012-04-28  1:25 Magnus Granberg
2012-04-28  0:51 Magnus Granberg
2012-04-27 21:03 Magnus Granberg
2012-04-27 20:42 Magnus Granberg
2012-04-27 20:33 Magnus Granberg
2012-04-27 18:27 Magnus Granberg
2012-04-27 18:23 Magnus Granberg
2011-10-31 21:32 Magnus Granberg
2011-10-29 22:48 Magnus Granberg
2011-10-29 22:38 Magnus Granberg
2011-10-29 22:28 Magnus Granberg
2011-10-29  0:21 Magnus Granberg
2011-10-29  0:19 Magnus Granberg
2011-10-19 21:31 Magnus Granberg
2011-10-19 21:28 Magnus Granberg
2011-10-19 20:20 Magnus Granberg
2011-10-13 10:41 Magnus Granberg
2011-10-12 10:33 Magnus Granberg
2011-10-12 10:26 Magnus Granberg
2011-10-11 23:51 Magnus Granberg
2011-10-11 23:32 Magnus Granberg
2011-10-11 11:20 Magnus Granberg
2011-10-10 23:57 Magnus Granberg
2011-10-10 23:49 Magnus Granberg
2011-10-10 23:46 Magnus Granberg
2011-10-10 23:43 Magnus Granberg
2011-10-10 23:30 Magnus Granberg
2011-10-09 21:49 Magnus Granberg
2011-09-30 13:38 Magnus Granberg
2011-09-30 13:33 Magnus Granberg
2011-09-30 13:17 Magnus Granberg
2011-09-28  1:41 Magnus Granberg
2011-09-28  1:39 Magnus Granberg
2011-09-28  1:04 Magnus Granberg
2011-09-27 23:43 Magnus Granberg
2011-09-27 11:05 Magnus Granberg
2011-09-13 23:06 Magnus Granberg
2011-09-13  1:02 Magnus Granberg
2011-09-01 23:34 Magnus Granberg
2011-08-31 23:31 Magnus Granberg
2011-08-31  2:05 Magnus Granberg
2011-08-30 23:41 Magnus Granberg
2011-07-29 15:31 Magnus Granberg
2011-04-24 22:21 Magnus Granberg
2011-04-23 15:26 Magnus Granberg
2011-04-23 14:28 Magnus Granberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4e044fc62205c73300cd1ab942f7f235f5ea0acc.zorry@gentoo \
    --to=zorry@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox