summaryrefslogtreecommitdiffstats
path: root/pym/portage/sets/profiles.py
blob: 35cf4d87db2fb4dc114cc91ab0a90381d2895824 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright 2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

import os
from portage.util import grabfile_package, stack_lists
from portage.sets.base import PackageSet

__all__ = ["PackagesSystemSet"]

class PackagesSystemSet(PackageSet):
	_operations = ["merge"]

	def __init__(self, profile_paths):
		super(PackagesSystemSet, self).__init__()
		self._profile_paths = profile_paths
		self.description = "System packages for profile %s" % self._profile_paths[-1]
	
	def load(self):
		mylist = [grabfile_package(os.path.join(x, "packages")) for x in self._profile_paths]
		mylist = stack_lists(mylist, incremental=1)
		self._setAtoms([x[1:] for x in mylist if x[0] == "*"])

	def singleBuilder(self, options, settings, trees):
		return PackagesSystemSet(settings.profiles)
	singleBuilder = classmethod(singleBuilder)