From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QTxgM-0001Lo-D2 for garchives@archives.gentoo.org; Tue, 07 Jun 2011 14:55:02 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EFE0C1C11A; Tue, 7 Jun 2011 14:54:53 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id A94211C11A for ; Tue, 7 Jun 2011 14:54:53 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 322121B403A for ; Tue, 7 Jun 2011 14:54:53 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 952248003C for ; Tue, 7 Jun 2011 14:54:52 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: Subject: [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/pm/ X-VCS-Repository: proj/pms-test-suite X-VCS-Files: PMSTestSuite/pm/__init__.py PMSTestSuite/pm/pkgcorepm.py X-VCS-Directories: PMSTestSuite/pm/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: a1b14f1a741d3e83f16a68db4f19fc45be1abab6 Date: Tue, 7 Jun 2011 14:54:52 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 3a91b4df8c3fcadcb874579548f99d40 commit: a1b14f1a741d3e83f16a68db4f19fc45be1abab6 Author: Micha=C5=82 G=C3=B3rny gentoo org> AuthorDate: Tue Jun 7 14:45:58 2011 +0000 Commit: Micha=C5=82 G=C3=B3rny gentoo org> CommitDate: Tue Jun 7 14:45:58 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/pms-test-suit= e.git;a=3Dcommit;h=3Da1b14f1a 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. """ =20 from PMSTestSuite.pm.portagepm import PortagePM + from PMSTestSuite.pm.pkgcorepm import PkgCorePM =20 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() =20 - 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=3Dutf-8 +# (c) 2011 Micha=C5=82 G=C3=B3rny +# 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. +=09 + Right now it subclasses PortagePM because it needs repoman to do + the Manifests. + """ + name =3D 'pkgcore' + pkg =3D 'sys-apps/pkgcore' + + pmerge_path =3D '/usr/bin/pmerge' + + common_pmerge_opts =3D ['--oneshot'] + + @classmethod + def is_available(cls): + try: + import pkgcore + except ImportError: + return False + + ret =3D True + for prog in (cls.pmerge_path, cls.repoman_path): + ret &=3D os.access(prog, os.X_OK) + return ret + + def spawn_pmerge(self, cpvs, opts =3D []): + return subprocess.Popen([self.pmerge_path] + + self.common_pmerge_opts + opts + self.pm_options + + ['=3D%s' % cpv for cpv in cpvs]) + + def call_pmerge(self, *args, **kwargs): + p =3D self.spawn_pmerge(*args, **kwargs) + return p.wait() + + def merge(self, cpvs): + ret =3D self.call_pmerge(cpvs) + return ret =3D=3D 0 + + def unmerge(self, cpvs): + ret =3D self.call_pmerge(cpvs, ['--unmerge']) + return ret =3D=3D 0 + + def merge_async(self, cpvs): + return self.spawn_pmerge(cpvs).pid + + def append_repository(self, repo): + raise NotImplementedError('PkgCorePM does not support adding repositor= ies yet.') + + # XXX: vardb and stuff + # portage's get_userpriv_group() required by repoman