Gentoo Archives: gentoo-commits

From: "André Erdmann" <dywi@×××××××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/
Date: Tue, 26 Jun 2012 15:43:46
Message-Id: 1340725241.10cd6f63877dd53d3e19c371ea246de9f2fd1238.dywi@gentoo
commit:     10cd6f63877dd53d3e19c371ea246de9f2fd1238
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Jun 26 15:40:41 2012 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Jun 26 15:40:41 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=10cd6f63

extend PackageInfo

* distdir can now be stored in _info

	modified:   roverlay/packageinfo.py

---
 roverlay/packageinfo.py |   41 ++++++++++++++++++++---------------------
 1 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py
index fdce322..8f59439 100644
--- a/roverlay/packageinfo.py
+++ b/roverlay/packageinfo.py
@@ -143,12 +143,14 @@ class PackageInfo ( object ):
 		elif key_low == 'package_file':
 			# assuming that origin is in self._info
 			return os.path.join (
-				self._info ['origin'].distdir,
+				self.get ( 'distdir' ),
 				self._info ['package_filename']
 			)
 
 		elif key_low == 'distdir':
 			if 'origin' in self._info:
+				# this doesn't work if the package is in a sub directory
+				# of the repo's distdir
 				return self._info ['origin'].distdir
 			else:
 				return os.path.dirname ( self._info ['package_file'] )
@@ -209,6 +211,7 @@ class PackageInfo ( object ):
 	# --- end of __setitem__ (...) ---
 
 	def update_now ( self, **info ):
+		if len ( info ) == 0: return
 		with self._update_lock:
 			self.set_writeable()
 			self.update ( **info )
@@ -223,33 +226,38 @@ class PackageInfo ( object ):
 
 		raises: Exception when readonly
 		"""
-		if len ( info ) == 0 :
+		if len ( info ) == 0:
 			# nothing to do
 			return
 
 		self._writelock_acquire()
 
 		for key, value in info.items():
-			if key == 'desc' or key == 'desc_data':
-				self ['desc_data'] = value
-
-			elif key == 'ebuild':
-				self ['ebuild'] = value
 
-			elif key == 'filepath':
-				self._use_filepath ( value )
-
-			elif key == 'filename':
+			if key == 'filename':
 				self._use_filename ( value )
 
+			elif key in ( 'package_dir', 'dirpath', 'distdir' ):
+				if value is not None:
+					self ['distdir'] = value
+
 			elif key == 'origin':
 				self ['origin'] = value
 
+			elif key == 'desc' or key == 'desc_data':
+				self ['desc_data'] = value
+
+			elif key == 'ebuild':
+				self ['ebuild'] = value
+
 			elif key == 'suggests':
 				self ['has_suggests'] = value
 
 			elif key == 'depres_results' or key == 'depres_result':
-				self._use_depres_result ( value )
+				self ['has_suggests'] = value [2]
+
+			elif key == 'filepath':
+				self._use_filepath ( value )
 
 			else:
 				LOGGER.warning ( "unknown info key %s!" % key )
@@ -317,15 +325,6 @@ class PackageInfo ( object ):
 		self._use_filename ( os.path.basename ( filepath ) )
 	# --- end of _use_filepath (...) ---
 
-	def _use_depres_result ( self, result ):
-		"""auxiliary method for update(**kw)
-
-		arguments:
-		* result --
-		"""
-		self ['has_suggests'] = result [2]
-	# --- end of _use_depres_result (...) ---
-
 	def __str__ ( self ):
 		return "<PackageInfo for %s>" % self.get (
 			'package_file', fallback_value='[unknown file]', do_fallback=True