Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-commits
Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: gentoo-commits@g.o
From: "André Erdmann" <dywi@...>
Subject: proj/R_overlay:master commit in: roverlay/
Date: Mon, 25 Jun 2012 18:19:49 +0000 (UTC)
commit:     edd8719acc718698e597ff4cebe52aa520237d17
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Mon Jun 25 18:12:07 2012 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Mon Jun 25 18:12:07 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=edd8719a

extend PackageInfo

---
 roverlay/packageinfo.py |   80 +++++++++++++++++++++++++++++++---------------
 1 files changed, 54 insertions(+), 26 deletions(-)

diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py
index 712b5a6..fdce322 100644
--- a/roverlay/packageinfo.py
+++ b/roverlay/packageinfo.py
@@ -136,19 +136,22 @@ class PackageInfo ( object ):
 			return self._info [key_low]
 
 		# 'virtual' keys - calculate result
-		elif key_low == 'distdir':
-			if 'package_dir' in self._info:
-				return self._info ['package_dir']
-
-			elif 'package_file' in self._info:
-				return os.path.dirname ( self._info ['package_file'] )
+		elif key_low == 'name':
+			# no special name, using package_name
+			return self._info ['package_name']
+
+		elif key_low == 'package_file':
+			# assuming that origin is in self._info
+			return os.path.join (
+				self._info ['origin'].distdir,
+				self._info ['package_filename']
+			)
 
-			#elif 'origin' in self._info:
+		elif key_low == 'distdir':
+			if 'origin' in self._info:
+				return self._info ['origin'].distdir
 			else:
-				return os.path.join (
-					config.get_or_fail ( ['DISTFILES', 'root' ] ),
-					self._info ['origin']
-				)
+				return os.path.dirname ( self._info ['package_file'] )
 
 		elif key_low == 'has_suggests':
 			if 'has_suggests' in self._info:
@@ -164,9 +167,17 @@ class PackageInfo ( object ):
 			# comment from ebuild:
 			## calculate SRC_URI using self._data ['origin'],
 			## either here or in eclass
-			return "http://TODO!!!/" + self._info ['package_filename']
+
 			#return "**packageinfo needs information from sync module!"
 
+			if 'origin' in self._info:
+				return self._info ['origin'].get_src_uri (
+					self._info ['package_filename']
+				)
+			else:
+				return "http://localhost/R-packages/" + \
+					self._info ['package_filename']
+
 
 		# fallback
 		if do_fallback:
@@ -228,6 +239,9 @@ class PackageInfo ( object ):
 			elif key == 'filepath':
 				self._use_filepath ( value )
 
+			elif key == 'filename':
+				self._use_filename ( value )
+
 			elif key == 'origin':
 				self ['origin'] = value
 
@@ -243,16 +257,13 @@ class PackageInfo ( object ):
 		self._update_lock.release()
 	# --- end of update (**kw) ---
 
-	def _use_filepath ( self, _filepath ):
+	def _use_filename ( self, _filename ):
 		"""auxiliary method for update(**kw)
 
 		arguments:
-		* _filepath --
+		* _filename --
 		"""
-
-		filepath = os.path.abspath ( _filepath )
-
-		filename_with_ext = os.path.basename ( filepath )
+		filename_with_ext = _filename
 
 		# remove .tar.gz .tar.bz2 etc.
 		filename = PackageInfo.PKGSUFFIX_REGEX.sub ( '', filename_with_ext )
@@ -281,25 +292,42 @@ class PackageInfo ( object ):
 			)
 			raise
 
-
-
 		# using package name as name (unless modified later),
 		#  using pkg_version for the ebuild version
 		self ['name']             = package_name
 		self ['ebuild_verstr']    = version_str
 
-
 		# for DescriptionReader
-		self ['package_file']     = filepath
 		self ['package_name']     = package_name
 
 		self ['package_filename'] = filename_with_ext
+	# --- end of _use_filename (...) ---
 
-		# keys never used (FIXME remove or use)
-		#self ['filename']        = filename
-		#self ['filepath']        = filepath
-		#self ['package_version'] = package_version
+	def _use_filepath ( self, _filepath ):
+		"""auxiliary method for update(**kw)
+
+		arguments:
+		* _filepath --
+		"""
+		LOGGER.info (
+			'Please note that _use_filepath is only meant for testing.'
+		)
+		filepath = os.path.abspath ( _filepath )
+		self ['package_file'] = filepath
+		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
+		)
+	# --- end of __str__ (...) ---


Navigation:
Lists: gentoo-commits: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
proj/R_overlay:master commit in: roverlay/
Next by thread:
proj/R_overlay:master commit in: roverlay/
Previous by date:
proj/R_overlay:master commit in: roverlay/config/
Next by date:
gentoo-x86 commit in sys-cluster/openmpi: openmpi-1.4.4.ebuild openmpi-1.5.5.ebuild openmpi-1.4.2.ebuild openmpi-1.6-r1.ebuild openmpi-1.5.4-r3.ebuild ChangeLog openmpi-1.4.3.ebuild


Updated Jun 26, 2012

Summary: Archive of the gentoo-commits mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.