public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/repository/
Date: Wed,  1 Jun 2011 12:30:17 +0000 (UTC)	[thread overview]
Message-ID: <9b8e3b50dd05b6a799a919c40e992dd1f987e9c4.mgorny@gentoo> (raw)

commit:     9b8e3b50dd05b6a799a919c40e992dd1f987e9c4
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  1 12:15:18 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jun  1 12:15:18 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=9b8e3b50

Update files dict in add_category() instead of spawning a new write.

---
 PMSTestSuite/repository/__init__.py |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/PMSTestSuite/repository/__init__.py b/PMSTestSuite/repository/__init__.py
index 70f3727..9af204a 100644
--- a/PMSTestSuite/repository/__init__.py
+++ b/PMSTestSuite/repository/__init__.py
@@ -49,7 +49,7 @@ class EbuildRepository(object):
 			if tail in ('eclass', 'profiles'):
 				pass
 			elif tail not in self.categories:
-				self.add_category(tail)
+				self.add_category(tail, files)
 
 			fp = os.path.join(self.path, fn)
 			if not os.path.exists(os.path.dirname(fp)):
@@ -63,8 +63,11 @@ class EbuildRepository(object):
 		dirs = frozenset([os.path.join(self.path, os.path.dirname(f)) for f in files])
 		pm.remanifest(dirs)
 
-	def add_category(self, catname):
-		""" Add category <catname> to profiles/categories. """
+	def add_category(self, catname, files):
+		"""
+		Add category <catname> to profiles/categories. Update
+		the profiles/categories file in <files> dict.
+		"""
 		raise ValueError("The repository doesn't support %s category." % catname)
 		
 class NewEbuildRepository(EbuildRepository):
@@ -87,11 +90,10 @@ class NewEbuildRepository(EbuildRepository):
 		f.close()
 
 		EbuildRepository.__init__(self, path)
-		
-	def add_category(self, catname):
+
+	def add_category(self, catname, files):
+		# XXX: profiles/categories can contain new categories already
+		# and they may not be in self.categories
 		self.categories.append(catname)
 		newcats = '\n'.join(self.categories)
-		files = {
-			os.path.join('profiles', 'categories'): newcats
-		}
-		self.write_files(files)
+		files[os.path.join('profiles', 'categories')] = newcats



             reply	other threads:[~2011-06-01 12:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-01 12:30 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-01-03 18:59 [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/repository/ Michał Górny
2011-06-23 21:14 [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/repository/ Michał Górny
2011-06-14 12:35 Michał Górny
2011-06-07 15:20 Michał Górny
2011-06-03  5:54 Michał Górny
2011-06-03  5:54 Michał Górny
2011-06-01 12:30 Michał Górny
2011-06-01 12:30 Michał Górny
2011-06-01 12:30 Michał Górny
2011-06-01 12:30 Michał Górny
2011-06-01 12:30 Michał Górny
2011-06-01 12:30 Michał Górny
2011-06-01 12:30 Michał Górny
2011-05-24 14:28 Michał Górny
2011-05-24  8:11 Michał Górny

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=9b8e3b50dd05b6a799a919c40e992dd1f987e9c4.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --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