public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:overlay_wip commit in: roverlay/
Date: Tue, 24 Jul 2012 16:59:50 +0000 (UTC)	[thread overview]
Message-ID: <1343149014.6593a3562703348b5008847d92e820a75efaf921.dywi@gentoo> (raw)

commit:     6593a3562703348b5008847d92e820a75efaf921
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Jul 24 16:56:54 2012 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Jul 24 16:56:54 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=6593a356

PackageInfo: _remove_auto:ebuild_written, fix get

	geändert:   roverlay/packageinfo.py

---
 roverlay/packageinfo.py |   31 +++++++++++++++++++++++++++++--
 1 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py
index 829b798..07b2e77 100644
--- a/roverlay/packageinfo.py
+++ b/roverlay/packageinfo.py
@@ -183,8 +183,9 @@ class PackageInfo ( object ):
 				# this doesn't work if the package is in a sub directory
 				# of the repo's distdir
 				return self._info ['origin'].distdir
-			else:
+			elif 'package_file' in self._info:
 				return os.path.dirname ( self._info ['package_file'] )
+			# else fallback/KeyError
 
 		elif key_low == 'has_suggests':
 			# 'has_suggests' not in self._info -> assume False
@@ -234,6 +235,12 @@ class PackageInfo ( object ):
 	# --- end of __setitem__ (...) ---
 
 	def update_now ( self, **info ):
+		"""Updates the package info data with temporarily enabling write access.
+		Data will be readonly after calling this method.
+
+		arguments:
+		* **info --
+		"""
 		if len ( info ) == 0: return
 		with self._update_lock:
 			self.set_writeable()
@@ -374,7 +381,27 @@ class PackageInfo ( object ):
 		after entering status 'ebuild_status' (like ebuild in overlay and
 		written -> don't need the ebuild string etc.)
 		"""
-		print ( "PackageInfo._remove_auto: method stub, request ignored." )
+		with self._update_lock:
+
+			if ebuild_status == 'ebuild_written':
+				# selectively copying required keys to a new info dict
+
+				to_keep = ( 'distdir', 'desc_data', 'ebuild_file', 'version' )
+
+				# needs python >= 2.7
+				info_new = { k : self.get ( k ) for k in to_keep }
+
+				# also add an ebuild stub to the new dict (workaround, FIXME)
+				info_new ['ebuild'] = True
+
+				if 'physical_only' in self._info:
+					info_new ['physical_only'] = self._info ['physical_only']
+
+				info_old   = self._info
+				self._info = info_new
+				del info_old
+			# -- if
+		# -- lock
 	# --- end of _remove_auto (...) ---
 
 	def _use_filepath ( self, _filepath ):


WARNING: multiple messages have this Message-ID (diff)
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/
Date: Mon, 30 Jul 2012 08:52:44 +0000 (UTC)	[thread overview]
Message-ID: <1343149014.6593a3562703348b5008847d92e820a75efaf921.dywi@gentoo> (raw)
Message-ID: <20120730085244.91fCLcgrflM6p9aYWHHOSmMmV4KG3E7JVfiQMf341bg@z> (raw)

commit:     6593a3562703348b5008847d92e820a75efaf921
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Jul 24 16:56:54 2012 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Jul 24 16:56:54 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=6593a356

PackageInfo: _remove_auto:ebuild_written, fix get

	geändert:   roverlay/packageinfo.py

---
 roverlay/packageinfo.py |   31 +++++++++++++++++++++++++++++--
 1 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/roverlay/packageinfo.py b/roverlay/packageinfo.py
index 829b798..07b2e77 100644
--- a/roverlay/packageinfo.py
+++ b/roverlay/packageinfo.py
@@ -183,8 +183,9 @@ class PackageInfo ( object ):
 				# this doesn't work if the package is in a sub directory
 				# of the repo's distdir
 				return self._info ['origin'].distdir
-			else:
+			elif 'package_file' in self._info:
 				return os.path.dirname ( self._info ['package_file'] )
+			# else fallback/KeyError
 
 		elif key_low == 'has_suggests':
 			# 'has_suggests' not in self._info -> assume False
@@ -234,6 +235,12 @@ class PackageInfo ( object ):
 	# --- end of __setitem__ (...) ---
 
 	def update_now ( self, **info ):
+		"""Updates the package info data with temporarily enabling write access.
+		Data will be readonly after calling this method.
+
+		arguments:
+		* **info --
+		"""
 		if len ( info ) == 0: return
 		with self._update_lock:
 			self.set_writeable()
@@ -374,7 +381,27 @@ class PackageInfo ( object ):
 		after entering status 'ebuild_status' (like ebuild in overlay and
 		written -> don't need the ebuild string etc.)
 		"""
-		print ( "PackageInfo._remove_auto: method stub, request ignored." )
+		with self._update_lock:
+
+			if ebuild_status == 'ebuild_written':
+				# selectively copying required keys to a new info dict
+
+				to_keep = ( 'distdir', 'desc_data', 'ebuild_file', 'version' )
+
+				# needs python >= 2.7
+				info_new = { k : self.get ( k ) for k in to_keep }
+
+				# also add an ebuild stub to the new dict (workaround, FIXME)
+				info_new ['ebuild'] = True
+
+				if 'physical_only' in self._info:
+					info_new ['physical_only'] = self._info ['physical_only']
+
+				info_old   = self._info
+				self._info = info_new
+				del info_old
+			# -- if
+		# -- lock
 	# --- end of _remove_auto (...) ---
 
 	def _use_filepath ( self, _filepath ):


             reply	other threads:[~2012-07-24 17:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-24 16:59 André Erdmann [this message]
2012-07-30  8:52 ` [gentoo-commits] proj/R_overlay:master commit in: roverlay/ André Erdmann
  -- strict thread matches above, loose matches on Subject: below --
2012-07-30  8:52 André Erdmann
2012-07-30  8:52 ` [gentoo-commits] proj/R_overlay:overlay_wip " André Erdmann
2012-07-30  8:52 [gentoo-commits] proj/R_overlay:master " André Erdmann
2012-07-19 16:53 ` [gentoo-commits] proj/R_overlay:overlay_wip " André Erdmann
2012-07-18 16:49 André Erdmann

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=1343149014.6593a3562703348b5008847d92e820a75efaf921.dywi@gentoo \
    --to=dywi@mailerd.de \
    --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