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:master commit in: roverlay/overlay/pkgdir/metadata/
Date: Thu, 25 Apr 2013 16:44:19 +0000 (UTC)	[thread overview]
Message-ID: <1366901816.632a4ef48b9c09c2a5714cf85a2238f7254eac40.dywi@gentoo> (raw)

commit:     632a4ef48b9c09c2a5714cf85a2238f7254eac40
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Apr 25 14:56:56 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Apr 25 14:56:56 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=632a4ef4

metadata creation: use data from older packages

Metadata creation will now use "older" packages (older by version) if
there's no package with enough information and a higher version available.

---
 roverlay/overlay/pkgdir/metadata/__init__.py |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/roverlay/overlay/pkgdir/metadata/__init__.py b/roverlay/overlay/pkgdir/metadata/__init__.py
index fb6f374..2ed8686 100644
--- a/roverlay/overlay/pkgdir/metadata/__init__.py
+++ b/roverlay/overlay/pkgdir/metadata/__init__.py
@@ -22,6 +22,8 @@ USE_FULL_DESCRIPTION = True
 class MetadataJob ( object ):
 	"""R package description data -> metadata.xml interface."""
 
+	DATA_KEYS = frozenset (( 'Description', 'Title' ))
+
 	def __init__ ( self, filepath, logger ):
 		"""Initializes a MetadataJob.
 
@@ -48,8 +50,17 @@ class MetadataJob ( object ):
 		arguments:
 		* package_info --
 		"""
-		if package_info.has ( 'desc_data' ) and \
-			package_info.compare_version ( self._package_info ) > 0:
+
+		if package_info.compare_version ( self._package_info ) > 0:
+			desc_data = package_info.get (
+				'desc_data', fallback_value=None, do_fallback=True
+			)
+			if desc_data and any (
+				desc_data.get ( key, None ) for key in self.DATA_KEYS
+			):
+				# another solution would be to merge data from several
+				# PackageInfo instances (while preferring pkgs with higher
+				# versions), doesn't make sense for one metadata field, though
 				self._package_info = package_info
 	# --- end of update (...) ---
 
@@ -58,6 +69,8 @@ class MetadataJob ( object ):
 			self._package_info = None
 		for package_info in package_info_iter:
 			self.update ( package_info )
+
+		return self._package_info
 	# --- end of update_using_iterable (...) ---
 
 	def _create ( self ):


             reply	other threads:[~2013-04-25 16:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-25 16:44 André Erdmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-09-05 16:01 [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/metadata/ André Erdmann
2013-04-25 16:44 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=1366901816.632a4ef48b9c09c2a5714cf85a2238f7254eac40.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