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/
Date: Fri,  5 Aug 2011 17:09:26 +0000 (UTC)	[thread overview]
Message-ID: <b995b38d6e8c93bc98e5d22a580128bc2275fbb3.mgorny@gentoo> (raw)

commit:     b995b38d6e8c93bc98e5d22a580128bc2275fbb3
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  5 15:33:22 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Aug  5 15:33:22 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=b995b38d

Support use multiple --package-manager and --pm-options args.

---
 pmstestsuite/cli.py |   47 ++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 36 insertions(+), 11 deletions(-)

diff --git a/pmstestsuite/cli.py b/pmstestsuite/cli.py
index 0c492e1..52e14cc 100644
--- a/pmstestsuite/cli.py
+++ b/pmstestsuite/cli.py
@@ -32,12 +32,23 @@ class PMSTestSuiteCLI(object):
 	@type repository: L{EbuildRepository}
 	"""
 
+	_defpm = 'portage'
+
 	def __init__(self):
 		"""
 		Initialize the class. Set the option parser up.
 		"""
 		opt = OptionParser(version = PV)
 
+		def add_pmopts(opt, optstr, optval, parser):
+			try:
+				p = parser.values.pm[-1]
+			except IndexError:
+				p = self._defpm
+			if not hasattr(parser.values, 'pmopts'):
+				setattr(parser.values, 'pmopts', {})
+			parser.values.pmopts[p] = optval
+
 		opt.add_option('-l', '--library', dest='library_name',
 				help='Test library to use (default: standard)',
 				default='standard')
@@ -49,12 +60,13 @@ class PMSTestSuiteCLI(object):
 		opt.add_option('-o', '--output-module', dest='outputmod',
 				help='Output module to use',
 				default='cli')
-		# XXX: get list, autodetect, more magic
 		opt.add_option('-p', '--package-manager', dest='pm',
-				help='Package manager to use',
-				default='portage')
-		opt.add_option('-P', '--pm-options', dest='pmopts',
-				help='Additional options to pass to the Package Manager (shell-quoted)')
+				help='Package manager to use (can be specified multiple times)',
+				action='append', default=[])
+		opt.add_option('-P', '--pm-options', callback=add_pmopts,
+				help='Additional options to pass to the Package Manager (shell-quoted,'
+					' apply to the parser specified before it)',
+				action='callback', type='string')
 		opt.add_option('-r', '--repository-name', dest='repo_name',
 				help='Name of the repository to store ebuilds in')
 		opt.add_option('-R', '--repository-path', dest='repo_path',
@@ -85,6 +97,11 @@ class PMSTestSuiteCLI(object):
 		opt.prog = os.path.basename(prog)
 		(opts, args) = opt.parse_args(list(args))
 
+		if not opts.pm:
+			opts.pm = [self._defpm]
+		if not hasattr(opts, 'pmopts'):
+			setattr(opts, 'pmopts', {})
+
 		if opts.repo_path and opts.repo_name:
 			opt.error('--repository-path and --repository-name are mutually exclusive')
 
@@ -95,16 +112,24 @@ class PMSTestSuiteCLI(object):
 		else:
 			opt.error('Output module not available: %s' % opts.outputmod)
 
+		pmset = set(opts.pm)
+		self.pms = []
 		for x in get_package_managers():
-			if x.name == opts.pm:
+			if x.name in pmset:
 				try:
-					self.pm = x.inst()
+					pm = x.inst()
 				except Exception as e:
 					opt.error(e)
-				break
-		else:
-			opt.error('Package manager not supported: %s' % opts.pm)
-		self.pm.pm_options = shlex.split(opts.pmopts) if opts.pmopts else []
+				pm.pm_options = shlex.split(opts.pmopts[x.name]) \
+						if x.name in opts.pmopts else []
+				self.pms.append(pm)
+				pmset.remove(x.name)
+		if pmset:
+			opt.error('PM(s) not supported: %s' % ', '.join(pmset))
+
+		self.pm = self.pms.pop()
+		if self.pms:
+			raise NotImplementedError('Using multiple PMs not implemented yet')
 
 		os.umask(0o22)
 



             reply	other threads:[~2011-08-05 17:10 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-05 17:09 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-06-20  8:01 [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/ Michał Górny
2012-01-04 16:33 Michał Górny
2012-01-03 15:52 Michał Górny
2012-01-03 15:52 Michał Górny
2012-01-03 15:52 Michał Górny
2012-01-03 15:52 Michał Górny
2011-08-21  8:19 Michał Górny
2011-08-20  6:23 Michał Górny
2011-08-13  7:38 Michał Górny
2011-08-08 22:15 Michał Górny
2011-08-05 21:36 Michał Górny
2011-08-05 17:09 Michał Górny
2011-08-05 17:09 Michał Górny
2011-08-05 17:09 Michał Górny
2011-08-05 17:09 Michał Górny
2011-08-05 17:09 Michał Górny
2011-08-05 17:09 Michał Górny
2011-08-05 10:04 Michał Górny
2011-08-03 20:17 Michał Górny
2011-08-03 20:17 Michał Górny
2011-08-03 20:17 Michał Górny
2011-08-03 20:17 Michał Górny
2011-08-03  8:17 Michał Górny
2011-08-02 18:53 Michał Górny
2011-07-18  6:49 Michał Górny
2011-06-24 18:03 [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/ Michał Górny
2011-06-22 19:53 Michał Górny
2011-06-21 17:58 Michał Górny
2011-06-21 17:54 Michał Górny
2011-06-21 17:54 Michał Górny
2011-06-16 19:49 Michał Górny
2011-06-15 16:14 Michał Górny
2011-06-13 19:16 Michał Górny
2011-06-11  6:32 Michał Górny
2011-06-09  5:48 Michał Górny
2011-06-07 16:48 Michał Górny
2011-06-07 16:48 Michał Górny
2011-06-07 15:20 Michał Górny
2011-06-06  5:56 Michał Górny
2011-06-03 16:25 Michał Górny
2011-05-31 21:06 Michał Górny
2011-05-31 19:18 Michał Górny
2011-05-31 17:19 Michał Górny
2011-05-31 17:19 Michał Górny
2011-05-29 17:46 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=b995b38d6e8c93bc98e5d22a580128bc2275fbb3.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