public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/cache/
@ 2011-02-07  0:29 Zac Medico
  0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2011-02-07  0:29 UTC (permalink / raw
  To: gentoo-commits

commit:     ad0f4abd188e3ba183f2ebd80eb23e1a7e919ed6
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Feb  7 00:13:22 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Feb  7 00:29:08 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ad0f4abd

cache.sqlite: handle sqlite ImportError

This will fix bug #353836.

---
 pym/portage/cache/sqlite.py |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/pym/portage/cache/sqlite.py b/pym/portage/cache/sqlite.py
index 2e13be3..d15b6ec 100644
--- a/pym/portage/cache/sqlite.py
+++ b/pym/portage/cache/sqlite.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import sys
@@ -8,11 +8,6 @@ from portage import os
 from portage import _unicode_decode
 from portage.util import writemsg
 from portage.localization import _
-try:
-	import sqlite3 as db_module # sqlite3 is optional with >=python-2.5
-except ImportError:
-	from pysqlite2 import dbapi2 as db_module
-DBError = db_module.Error
 
 if sys.hexversion >= 0x3000000:
 	basestring = str
@@ -25,12 +20,11 @@ class database(fs_template.FsBased):
 	# to calculate the number of pages requested, according to the following
 	# equation: cache_bytes = page_bytes * page_count
 	cache_bytes = 1024 * 1024 * 10
-	_db_module = db_module
-	_db_error = DBError
 	_db_table = None
 
 	def __init__(self, *args, **config):
 		super(database, self).__init__(*args, **config)
+		self._import_sqlite()
 		self._allowed_keys = ["_mtime_", "_eclasses_"]
 		self._allowed_keys.extend(self._known_keys)
 		self._allowed_keys.sort()
@@ -49,6 +43,19 @@ class database(fs_template.FsBased):
 		self._db_init_connection(config)
 		self._db_init_structures()
 
+	def _import_sqlite(self):
+		# sqlite3 is optional with >=python-2.5
+		try:
+			import sqlite3 as db_module
+		except ImportError:
+			try:
+				from pysqlite2 import dbapi2 as db_module
+			except ImportError as e:
+				raise cache_errors.InitializationError(self.__class__, e)
+
+		self._db_module = db_module
+		self._db_error = db_module.Error
+
 	def _db_escape_string(self, s):
 		"""meta escaping, returns quoted string for use in sql statements"""
 		if not isinstance(s, basestring):



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/cache/
@ 2011-02-08 20:48 Zac Medico
  0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2011-02-08 20:48 UTC (permalink / raw
  To: gentoo-commits

commit:     bba4f8075c9d5456917955adc819944c49b62d1a
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  8 06:35:14 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Feb  8 20:45:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bba4f807

cache.ebuild_xattr: don't import ENODATA globally

ENODATA is undefined on FreeBSD. This will fix bug #354057.

---
 pym/portage/cache/ebuild_xattr.py |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/pym/portage/cache/ebuild_xattr.py b/pym/portage/cache/ebuild_xattr.py
index 1d7e26f..6b388fa 100644
--- a/pym/portage/cache/ebuild_xattr.py
+++ b/pym/portage/cache/ebuild_xattr.py
@@ -4,6 +4,8 @@
 
 __all__ = ['database']
 
+import errno
+
 import portage
 from portage.cache import fs_template
 from portage.versions import catsplit
@@ -11,7 +13,6 @@ from portage import cpv_getkey
 from portage import os
 from portage import _encodings
 from portage import _unicode_decode
-from errno import ENODATA,ENOSPC,E2BIG
 portage.proxy.lazyimport.lazyimport(globals(),
 	'xattr')
 
@@ -58,16 +59,16 @@ class database(fs_template.FsBased):
 		except IOError as e:
 			# ext based give wrong errno
 			# http://bugzilla.kernel.org/show_bug.cgi?id=12793
-			if e.errno in (E2BIG,ENOSPC):
+			if e.errno in (errno.E2BIG, errno.ENOSPC):
 				result = len(s)-100
 			else:
-				raise e
+				raise
 
 		try:
 			self.__remove(path,'test_max')
 		except IOError as e:
-			if e.errno is not ENODATA:
-				raise e
+			if e.errno != errno.ENODATA:
+				raise
 
 		return result
 
@@ -87,7 +88,7 @@ class database(fs_template.FsBased):
 		try:
 			return xattr.get(path,key,namespace=self.ns)
 		except IOError as e:
-			if not default is None and ENODATA == e.errno:
+			if not default is None and errno.ENODATA == e.errno:
 				return default
 			else:
 				raise NoValueException()



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/cache/
@ 2011-05-12 20:13 Zac Medico
  0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2011-05-12 20:13 UTC (permalink / raw
  To: gentoo-commits

commit:     f78c4c37db15172e092db99fe8ef96d26ff9bc7d
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 12 18:42:08 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 12 19:19:49 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=f78c4c37

cache.sqlite: handle readonly

---
 pym/portage/cache/sqlite.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/portage/cache/sqlite.py b/pym/portage/cache/sqlite.py
index d15b6ec..4eb340b 100644
--- a/pym/portage/cache/sqlite.py
+++ b/pym/portage/cache/sqlite.py
@@ -31,7 +31,7 @@ class database(fs_template.FsBased):
 		self.location = os.path.join(self.location, 
 			self.label.lstrip(os.path.sep).rstrip(os.path.sep))
 
-		if not os.path.exists(self.location):
+		if not self.readonly and not os.path.exists(self.location):
 			self._ensure_dirs()
 
 		config.setdefault("autocommit", self.autocommits)
@@ -72,7 +72,8 @@ class database(fs_template.FsBased):
 		connection_kwargs = {}
 		connection_kwargs["timeout"] = config["timeout"]
 		try:
-			self._ensure_dirs()
+			if not self.readonly:
+				self._ensure_dirs()
 			self._db_connection = self._db_module.connect(
 				database=_unicode_decode(self._dbpath), **connection_kwargs)
 			self._db_cursor = self._db_connection.cursor()



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/cache/
@ 2011-05-12 20:13 Zac Medico
  0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2011-05-12 20:13 UTC (permalink / raw
  To: gentoo-commits

commit:     2cbaaedecba82946546068aae55ce2492322aace
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 12 18:58:27 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 12 19:19:58 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2cbaaede

cache.volatile: discard "perms" param

---
 pym/portage/cache/volatile.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/pym/portage/cache/volatile.py b/pym/portage/cache/volatile.py
index e671904..0bf6bab 100644
--- a/pym/portage/cache/volatile.py
+++ b/pym/portage/cache/volatile.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import copy
@@ -11,6 +11,7 @@ class database(template.database):
 
 	def __init__(self, *args, **config):
 		config.pop("gid", None)
+		config.pop("perms", None)
 		super(database, self).__init__(*args, **config)
 		self._data = {}
 		self.__iter__ = self._data.__iter__



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/cache/
@ 2011-05-12 20:13 Zac Medico
  0 siblings, 0 replies; 5+ messages in thread
From: Zac Medico @ 2011-05-12 20:13 UTC (permalink / raw
  To: gentoo-commits

commit:     2db51f451849304c36d6dd00d168ef3e1eaccb68
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 12 19:04:54 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 12 19:20:18 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=2db51f45

cache.sqlite: handle readonly more

---
 pym/portage/cache/sqlite.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/pym/portage/cache/sqlite.py b/pym/portage/cache/sqlite.py
index 4eb340b..fcc62ff 100644
--- a/pym/portage/cache/sqlite.py
+++ b/pym/portage/cache/sqlite.py
@@ -78,7 +78,7 @@ class database(fs_template.FsBased):
 				database=_unicode_decode(self._dbpath), **connection_kwargs)
 			self._db_cursor = self._db_connection.cursor()
 			self._db_cursor.execute("PRAGMA encoding = %s" % self._db_escape_string("UTF-8"))
-			if not self._ensure_access(self._dbpath):
+			if not self.readonly and not self._ensure_access(self._dbpath):
 				raise cache_errors.InitializationError(self.__class__, "can't ensure perms on %s" % self._dbpath)
 			self._db_init_cache_size(config["cache_bytes"])
 			self._db_init_synchronous(config["synchronous"])



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-12 20:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-12 20:13 [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/cache/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2011-05-12 20:13 Zac Medico
2011-05-12 20:13 Zac Medico
2011-02-08 20:48 Zac Medico
2011-02-07  0:29 Zac Medico

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