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/
Date: Tue, 7 Jun 2011 14:54:52 +0000 (UTC) [thread overview]
Message-ID: <a1b14f1a741d3e83f16a68db4f19fc45be1abab6.mgorny@gentoo> (raw)
commit: a1b14f1a741d3e83f16a68db4f19fc45be1abab6
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 7 14:45:58 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jun 7 14:45:58 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=a1b14f1a
Add some initial code for pkgcore support.
---
PMSTestSuite/pm/__init__.py | 3 +-
PMSTestSuite/pm/pkgcorepm.py | 59 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+), 1 deletions(-)
diff --git a/PMSTestSuite/pm/__init__.py b/PMSTestSuite/pm/__init__.py
index 54204da..7731d74 100644
--- a/PMSTestSuite/pm/__init__.py
+++ b/PMSTestSuite/pm/__init__.py
@@ -104,6 +104,7 @@ def get_package_managers():
""" Return the list of supported Package Managers. """
from PMSTestSuite.pm.portagepm import PortagePM
+ from PMSTestSuite.pm.pkgcorepm import PkgCorePM
class PMWrapper(object):
""" A wrapper class which stringifies into a name of particular PM. """
@@ -129,4 +130,4 @@ def get_package_managers():
% self._pmclass.pkg)
return self._pmclass()
- return [PMWrapper(x) for x in (PortagePM,)]
+ return [PMWrapper(x) for x in (PortagePM, PkgCorePM)]
diff --git a/PMSTestSuite/pm/pkgcorepm.py b/PMSTestSuite/pm/pkgcorepm.py
new file mode 100644
index 0000000..4e5a525
--- /dev/null
+++ b/PMSTestSuite/pm/pkgcorepm.py
@@ -0,0 +1,59 @@
+# vim:fileencoding=utf-8
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
+
+import os, os.path, subprocess
+
+from PMSTestSuite.pm.portagepm import PortagePM
+
+class PkgCorePM(PortagePM):
+ """
+ A class implementing the interfaces to the pkgcore PM.
+
+ Right now it subclasses PortagePM because it needs repoman to do
+ the Manifests.
+ """
+ name = 'pkgcore'
+ pkg = 'sys-apps/pkgcore'
+
+ pmerge_path = '/usr/bin/pmerge'
+
+ common_pmerge_opts = ['--oneshot']
+
+ @classmethod
+ def is_available(cls):
+ try:
+ import pkgcore
+ except ImportError:
+ return False
+
+ ret = True
+ for prog in (cls.pmerge_path, cls.repoman_path):
+ ret &= os.access(prog, os.X_OK)
+ return ret
+
+ def spawn_pmerge(self, cpvs, opts = []):
+ return subprocess.Popen([self.pmerge_path]
+ + self.common_pmerge_opts + opts + self.pm_options
+ + ['=%s' % cpv for cpv in cpvs])
+
+ def call_pmerge(self, *args, **kwargs):
+ p = self.spawn_pmerge(*args, **kwargs)
+ return p.wait()
+
+ def merge(self, cpvs):
+ ret = self.call_pmerge(cpvs)
+ return ret == 0
+
+ def unmerge(self, cpvs):
+ ret = self.call_pmerge(cpvs, ['--unmerge'])
+ return ret == 0
+
+ def merge_async(self, cpvs):
+ return self.spawn_pmerge(cpvs).pid
+
+ def append_repository(self, repo):
+ raise NotImplementedError('PkgCorePM does not support adding repositories yet.')
+
+ # XXX: vardb and stuff
+ # portage's get_userpriv_group() required by repoman
next reply other threads:[~2011-06-07 14:55 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-07 14:54 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-08-08 21:31 [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/pm/ Michał Górny
2011-08-05 19:54 Michał Górny
2011-08-05 17:09 Michał Górny
2011-08-05 17:09 Michał Górny
2011-08-03 20:17 Michał Górny
2011-08-03 20:17 Michał Górny
2011-07-31 15:10 Michał Górny
2011-06-23 9:51 [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/pm/ Michał Górny
2011-06-23 9:51 Michał Górny
2011-06-23 9:51 Michał Górny
2011-06-23 9:51 Michał Górny
2011-06-21 21:25 Michał Górny
2011-06-21 20:58 Michał Górny
2011-06-21 20:58 Michał Górny
2011-06-21 20:58 Michał Górny
2011-06-21 20:58 Michał Górny
2011-06-21 20:58 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-21 17:54 Michał Górny
2011-06-21 17:54 Michał Górny
2011-06-21 15:26 Michał Górny
2011-06-21 15:26 Michał Górny
2011-06-20 19:20 Michał Górny
2011-06-16 19:49 Michał Górny
2011-06-16 19:49 Michał Górny
2011-06-14 12:35 Michał Górny
2011-06-07 17:16 Michał Górny
2011-06-07 17:16 Michał Górny
2011-06-07 15:20 Michał Górny
2011-06-06 7:36 Michał Górny
2011-05-31 21:06 Michał Górny
2011-05-31 19:18 Michał Górny
2011-05-31 19:18 Michał Górny
2011-05-31 12:14 Michał Górny
2011-05-31 12:14 Michał Górny
2011-05-29 18:57 Michał Górny
2011-05-29 18:57 Michał Górny
2011-05-26 9:45 Michał Górny
2011-05-25 16:24 Michał Górny
2011-05-25 16:24 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=a1b14f1a741d3e83f16a68db4f19fc45be1abab6.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