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/pm/, PMSTestSuite/
Date: Tue, 31 May 2011 12:14:38 +0000 (UTC)	[thread overview]
Message-ID: <bf3905892670dd294eb8ae5680920b09d1c77230.mgorny@gentoo> (raw)

commit:     bf3905892670dd294eb8ae5680920b09d1c77230
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue May 31 11:44:32 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue May 31 11:44:32 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=bf390589

Pass cpvs to PM.merge()/unmerge(). Unmerge only when merged.

---
 PMSTestSuite/pm/__init__.py  |    8 ++++----
 PMSTestSuite/pm/portagepm.py |   13 ++++++++-----
 PMSTestSuite/testrunner.py   |   12 ++++++++----
 3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/PMSTestSuite/pm/__init__.py b/PMSTestSuite/pm/__init__.py
index 9838822..cc6d3d5 100644
--- a/PMSTestSuite/pm/__init__.py
+++ b/PMSTestSuite/pm/__init__.py
@@ -51,9 +51,9 @@ class PackageManager(object):
 		"""
 		self.repo_paths.append(repo.path)
 
-	def merge(self, atoms):
+	def merge(self, cpvs):
 		"""
-		Run PM to merge <atoms>.
+		Run PM to merge <cpvs>.
 
 		Returns True if PM run successfully, False otherwise. Please note that
 		this return code may not have anything to do with ebuilds actually
@@ -61,9 +61,9 @@ class PackageManager(object):
 		"""
 		raise NotImplementedError('Please override the merge() method.')
 
-	def unmerge(self, atoms):
+	def unmerge(self, cpvs):
 		"""
-		Run PM to unmerge <atoms>.
+		Run PM to unmerge <cpvs>.
 
 		Returns True if PM run successfully, False otherwise. Please note that
 		this return code may not have anything to do with ebuilds actually

diff --git a/PMSTestSuite/pm/portagepm.py b/PMSTestSuite/pm/portagepm.py
index 9d5fa0b..d73406b 100644
--- a/PMSTestSuite/pm/portagepm.py
+++ b/PMSTestSuite/pm/portagepm.py
@@ -35,14 +35,17 @@ class PortagePM(PackageManager):
 			subprocess.check_call([self.repoman_path, 'manifest'])
 		os.chdir(startdir)
 
-	def merge(self, atoms):
-		ret = subprocess.call([self.emerge_path] + self.pm_options + atoms,
+	def call_emerge(self, cpvs, opts = []):
+		return subprocess.call([self.emerge_path] + opts + self.pm_options
+				+ ['=%s' % cpv for cpv in cpvs],
 				env = {'PORTDIR_OVERLAY': ' '.join(self.repo_paths)})
+
+	def merge(self, cpvs):
+		ret = self.call_emerge(cpvs)
 		return ret == 0
 
-	def unmerge(self, atoms):
-		ret = subprocess.call([self.emerge_path, '--unmerge'] + self.pm_options + atoms,
-				env = {'PORTDIR_OVERLAY': ' '.join(self.repo_paths)})
+	def unmerge(self, cpvs):
+		ret = self.call_emerge(cpvs, ['--unmerge'])
 		return ret == 0
 
 	_vardb = None

diff --git a/PMSTestSuite/testrunner.py b/PMSTestSuite/testrunner.py
index 76f7071..703ae31 100644
--- a/PMSTestSuite/testrunner.py
+++ b/PMSTestSuite/testrunner.py
@@ -8,10 +8,14 @@ class TestRunnerCLI(EbuildGenCLI):
 			return ret
 
 		self.pm.append_repository(self.repository)
-		atoms = ['=%s' % t.p for t in self.test_library]
-		print('-> Unmerging already-merged test ebuilds...')
-		self.pm.unmerge(atoms)
+		cpvs = [t.p for t in self.test_library]
+
+		installedcpvs = self.pm.lookup_vardb(cpvs)
+		if installedcpvs:
+			print('-> Unmerging already-merged test ebuilds...')
+			self.pm.unmerge(installedcpvs)
+
 		print('-> Running PM...')
-		self.pm.merge(atoms)
+		self.pm.merge(cpvs)
 
 		return 0



             reply	other threads:[~2011-05-31 12:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-31 12:14 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-06-16 17:22 [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/pm/, PMSTestSuite/ Michał Górny
2011-06-16 17:22 Michał Górny
2011-06-15 16:14 Michał Górny
2011-06-15 16:14 Michał Górny
2011-06-11  6:32 Michał Górny
2011-06-06  7:29 Michał Górny
2011-05-31 12:14 Michał Górny
2011-05-31  8:10 Michał Górny
2011-05-31  8:10 Michał Górny
2011-05-29 18:57 Michał Górny
2011-05-29 18:57 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=bf3905892670dd294eb8ae5680920b09d1c77230.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