summaryrefslogtreecommitdiffstats
path: root/extras/init.d
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2016-08-17 20:19:59 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-08-31 20:18:42 -0700
commitee0d8ca53f685f8f27c93b3d7c808f2a78c1ae43 (patch)
tree32627cdffde0b55cff78d972529a456178655cc6 /extras/init.d
parent054b09eb5f040ccc0adbb86759da403b49544083 (diff)
io-stats: Add stats for upcall notificationsv3.10dev
With this patch, there will be additional entries seen in the profile info: UPCALL : Total number of upcall events that were sent from the brick(in brick profile), and number of upcall notifications recieved by client(in client profile) Cache invalidation events: ------------------------- CI_IATT : Number of upcalls that were cache invalidation and had one of the IATT_UPDATE_FLAGS set. This indicates that one of the iatt value was changed. CI_XATTR : Number of upcalls that were cache invalidation, and had one of the UP_XATTR or UP_XATTR_RM set. This indicates that an xattr was updated or deleted. CI_RENAME : Number of upcalls that were cache invalidation, resulted by the renaming of a file or directory CI_UNLINK : Number of upcalls that were cache invalidation, resulted by the unlink of a file. CI_FORGET : Number of upcalls that were cache invalidation, resulted by the forget of inode on the server side. Lease events: ------------ LEASE_RECALL : Number of lease recalls sent by the brick (in brick profile), and number of lease recalls recieved by client(in client profile) Note that the sum of CI_IATT, CI_XATTR, CI_RENAME, CI_UNLINK, CI_FORGET, LEASE_RECALL may not be equal to UPCALL. This is because, each cache invalidation can carry multiple flags. Eg: - Every CI_XATTR will have CI_IATT - Every CI_UNLINK will also increment CI_IATT as link count is an iatt attribute. Also UP_PARENT_DENTRY_FLAGS is currently not accounted for, as CI_RENAME and CI_UNLINK will always have the flag UP_PARENT_DENTRY_FLAGS Change-Id: Ieb8cd21dde2c4c7618f12d025a5e5156f9cc0fe9 BUG: 1371543 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/15193 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'extras/init.d')
0 files changed, 0 insertions, 0 deletions
='#n180'>180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080
#
# comps.py: header list and component set (package groups) management
#
# Erik Troan <ewt@redhat.com>
# Matt Wilson <msw@redhat.com>
# Jeremy Katzj <katzj@redhat.com>
# Michael Fulbright <msf@redhat.com>
#
# Copyright 1999-2002 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
#
# You should have received a copy of the GNU Library Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

import rpm
import os
from string import *
import types
import urllib2
import time
import language

from rhpl.log import log
from rhpl.translate import _, N_
import rhpl.comps

ExcludePackages = { 'XFree86-3DLabs' : None, 	'XFree86-8514' : None,
                    'XFree86-AGX' : None, 	'XFree86-I128' : None,
                    'XFree86-Mach32' : None, 	'XFree86-Mach64' : None,
                    'XFree86-Mach8' : None, 	'XFree86-Mono' : None,
                    'XFree86-P9000' : None, 	'XFree86-S3' : None,
                    'XFree86-S3V' : None, 	'XFree86-SVGA' : None,
                    'XFree86-VGA16' : None,	'XFree86-W32' : None,

                    'kernel' : None,		'kernel-BOOT' : None,
                    'kernel-smp' : None,	'kernel-bigmem' : None,
                    'kernel-vrdr' : None,	'kernel-tape' : None,
                    'kernel-BOOTtape' : None,	'kernel-BOOTvrdr' : None,
                    'kernel-summit' : None,

                    'kinput2-canna' : None,	'kinput-canna-wnn4' : None,
                    'kinput2-wnn4' : None,	'kinput2-wnn6' : None }

# Package selection is complicated. Here are the rules:
#
# Calling package.select() forces the package on. No other rules apply.
# Calling package.unselect() forces the package off. No other rules apply.
#
# Else:
#
# Each package contains a list of components that include it.  Each
# registered component is checked to see if it and all its parent
# components are on (this is done by recursive checking of 
# parent.isSelected()).  Some subcomps are keyed on the state of
# another toplevel component.  If a component, all of its ancestors,
# and conditional components are selected, the package is selected.
# Otherwise it is not.
#

CHECK_COMPS	= 0
FORCE_SELECT	= 1
FORCE_UNSELECT	= 2


PKGTYPE_MANDATORY = 0
PKGTYPE_DEFAULT = 1
PKGTYPE_OPTIONAL = 2

class Package:
    def __getitem__(self, item):
	return self.h[item]

    def __repr__(self):
	return "%s" % self.name

    def select(self):
	self.state = FORCE_SELECT
	self.selected = 1

    def unselect(self):
	self.state = FORCE_UNSELECT
	self.selected = 0

    def isSelected(self):
	return self.selected

    def wasForcedOff(self):
        if self.state == FORCE_UNSELECT and not self.selected:
            return 1
        else:
            return 0

    def updateSelectionCache(self):
	if self.state == FORCE_SELECT or self.state == FORCE_UNSELECT:
	    return

	self.selected = 0
	for comp in self.comps:
	    on = 1
            # if this component is selected for any reason at all,
            # the package is not selected.
            if not comp.isSelected(justManual = 0):
                on = 0
            else:
                # if the component is on, check to see if this package
                # was listed with an expression conditional in the comps
                # file.  If it did, we'll find a list of expressions
                # in the component's package dictionary.  If any of them
                # evaluates to be true, the package is selected.
                if comp.pkgDict[self] != None:
                    on = 0
                    for expr in comp.pkgDict[self]:
                        if comp.set.exprMatch (expr):
                                on = 1
                                # one is sufficient
                                break
            if on:
                self.selected = 1
                # one component is sufficient in the "package is selected"
                # case, stop looking to save time.
                break

    def getState(self):
	return (self.state, self.selected)

    def setState(self, state):
	(self.state, self.selected) = state

    def registerComponent(self, comp):
        if comp not in self.comps:
            self.comps.append(comp)

    def unregisterComponent(self, comp):
        try:
            self.comps.remove(comp)
        except:
            log("WARNING: Unable to unregister %s for pkg %s" % (comp, self.name))
            pass

    def __init__(self, header):
	self.h = header
	self.comps = []
	self.selected = 0
	self.state = CHECK_COMPS
	self.name = header[rpm.RPMTAG_NAME]
	self.size = header[rpm.RPMTAG_SIZE]

class HeaderList:
    def selected(self):
	l = []
 	keys = self.packages.keys()
	keys.sort()
	for name in keys:
	    if self.packages[name].selected: l.append(self.packages[name])
	return l

    def has_key(self, item):
	return self.packages.has_key(item)

    def keys(self):
        return self.packages.keys()

    def values(self):
        return self.packages.values()

    def __getitem__(self, item):
	return self.packages[item]

    def list(self):
	return self.packages.values()

    def mergeFullHeaders(self, file):
        if self.hasFullHeaders:
            return
        fd = os.open(file, os.O_RDONLY)
        rpm.mergeHeaderListFromFD(self.hdlist, fd, 1000004)
        os.close(fd)
        self.hasFullHeaders = 1

    def preordered(self):
        preordered = 1
	for h in self.selected():
            if h[1000003] == None:
                preordered = 0
        return preordered

    def __init__(self, hdlist, compatPackages = None, noscore = 0):
        self.hdlist = hdlist
	self.packages = {}
	newCompat = []
        self.hasFullHeaders = 0
	for h in hdlist:
	    name = h[rpm.RPMTAG_NAME]
            if noscore:
                self.packages[name] = Package(h)
                continue
	    score1 = rpm.archscore(h['arch'])
	    if (score1):
		if self.packages.has_key(name):
		    score2 = rpm.archscore(self.packages[name].h['arch'])
		    if (score1 < score2):
			newCompat.append(self.packages[name])
			self.packages[name] = Package(h)
		    else:
			newCompat.append(Package(h))
		else:
		    self.packages[name] = Package(h)
        if hdlist and not self.packages:
            raise RuntimeError, ("the header list was read, but no packages "
                                 "matching architecture '%s' were found."
                                 % os.uname()[4])

	if compatPackages != None:
            compatPackages.extend(newCompat)

class HeaderListFromFile (HeaderList):

    def __init__(self, path, compatPackages = None, noscore = 0):
	hdlist = rpm.readHeaderListFromFile(path)
	HeaderList.__init__(self, hdlist, compatPackages = compatPackages,
			    noscore = noscore)

class HeaderListFD (HeaderList):
    def __init__(self, fd):
	hdlist = rpm.readHeaderListFromFD (fd)
	HeaderList.__init__(self, hdlist)

# A component has a name, a selection state, a list of included components,
# and a list of packages whose selection depends in some way on this component 
# being selected. Selection and deselection recurses through included 
# components.
#
# When the component file is parsed, the comp lists that include each
# package are built up. Component selection is used by the packages to
# determine whether or not they are selected.
#
# The selection state consists of a manually selected flag and an included
# selection count. They are separate to make UI coding easier.

class Component:
    def __len__(self):
	return len(self.pkgDict.keys())

    def __repr__(self):
	return "comp %s" % (self.name)

    def packages(self):
	return self.pkgDict.keys()

    # return dictionary of packages in component with full info from xml comps
    def packagesFullInfo(self):
	return self.newpkgDict
    
    def metapackagesFullInfo(self):
	return self.metapkgs
    
    def includesPackage(self, pkg, includeDeps = 0):
        if not self.pkgDict.has_key(pkg):
            return 0
        if self.pkgDict[pkg] == None:
            return 1
        # if this package is the component with a condition,
        # check to see if the condition is met before saying that
        # the package is included in this component
        for expr in self.pkgDict[pkg]:
            if self.set.exprMatch (expr):
                return 1
        return 0

    def select(self, forInclude = 0, toplevel = 1):
	if forInclude:
            self.selectionCount = self.selectionCount + 1
	else:
	    self.manuallySelected = 1

	for name in self.includes:
            if not self.set.has_key(name):
                log ("warning, unknown toplevel component %s "
                     "included by component %s", name, self.name)
            self.set[name].select(forInclude = 1, toplevel = 0)

        for comp in self.metapkgs.keys():
            if self.metapkgs[comp][1] == 1:
                comp.select(forInclude = 1, toplevel = 0)

        if toplevel:
            self.set.updateSelections()

    def includeMembers(self):
        for name in self.includes:
            if not self.set.has_key(name):
                log ("warning, unknown toplevel component %s "
                     "included by component %s", name, self.name)
            self.set[name].select(forInclude = 0, toplevel = 0)

        self.set.updateSelections()

    def isSelected(self, justManual = 0):
        if self.conditionalKey:
            if not self.set.has_key(self.conditionalKey):
                log ("warning, unknown conditional trigger %s wanted by %s",
                     self.conditionalKey, self.name)
                return 0
            else:
                if (self.set[self.conditionalKey].isSelected()
                    and self.parent.isSelected()):
                    return 1
                return 0

	# don't admit to selection-by-inclusion
	if justManual:
	    return self.manuallySelected

	return self.manuallySelected or (self.selectionCount > 0)

    def unselect(self, forInclude = 0, toplevel = 1):
	if forInclude:
	    self.selectionCount = self.selectionCount - 1
	    if self.selectionCount < 0:
		self.selectionCount = 0
	else:
	    self.manuallySelected = 0

	for name in self.includes:
            if not self.set.has_key(name):
                log ("warning, unknown toplevel component %s "
                     "included by component %s", name, self.name)
            self.set[name].unselect(forInclude = 1, toplevel = 0)

        for comp in self.metapkgs.keys():
            if self.metapkgs[comp][1] == 1:
                comp.unselect(forInclude = 1, toplevel = 0)

        if toplevel:
            self.set.updateSelections()

    def addInclude(self, comp):
	self.includes.append(comp)

    def addMetaPkg(self, comp, isDefault = 0):
        self.metapkgs[comp] = (PKGTYPE_OPTIONAL, isDefault)

    def addPackage(self, p, pkgtype, handleDeps = 1):
        if pkgtype == PKGTYPE_MANDATORY:
            p.registerComponent(self)
            self.newpkgDict[p] = (pkgtype, 1)
            self.pkgDict[p] = None
            if handleDeps == 1:
                self.updateDependencyCountForAddition(p)            
        elif pkgtype == PKGTYPE_DEFAULT:
            p.registerComponent(self)
            self.newpkgDict[p] = (PKGTYPE_OPTIONAL, 1)
            self.pkgDict[p] = None
            if handleDeps == 1:            
                self.updateDependencyCountForAddition(p)            
        elif pkgtype == PKGTYPE_OPTIONAL:
            self.newpkgDict[p] = (PKGTYPE_OPTIONAL, 0)
        else:
            log("Unable to add package %s to component %s because it has an unknown pkgtype of %d" %(p.name, self.name, pkgtype))

    def addDependencyPackage(self, p):
        if not self.depsDict.has_key(p):
            self.depsDict[p.name] = 1
            # make sure it's registered in this component
            p.registerComponent(self)
            # and it also has to be in the pkgDict
            self.pkgDict[p] = None
        else:
            self.depsDict[p.name] = self.depsDict[p.name] + 1

    def selectOptionalPackage(self, p):
        if isinstance(p, Package):
            if p not in self.newpkgDict.keys():
                log("%s not in pkgDict for component %s" % (p.name, self.name))
            else:
                # dont ref count more than once
                if p in self.pkgDict.keys():
                    log("%s already enabled in pkgDict for component %s" % (p.name, self.name))
                    return

                self.newpkgDict[p] = (PKGTYPE_OPTIONAL, 1)
                p.registerComponent(self)
                self.pkgDict[p] = None
                # up the refcount since, otherwise, when you have things
                # which are deps as optional also, Bad Things Happen (tm)
                if p.name in self.depsDict.keys():
                    self.depsDict[p.name] = self.depsDict[p.name] + 1
                else:
                    self.depsDict[p.name] = 1
                
                self.updateDependencyCountForAddition(p)
        elif isinstance(p, Component):
            p.select(forInclude = 1, toplevel = 0)
            self.metapkgs[p] = (PKGTYPE_OPTIONAL, 1)
        else:
            log("don't know how to select %s" %(p,))
        self.set.updateSelections()

    def unselectOptionalPackage(self, p):
        if isinstance(p, Package):        
            if p not in self.pkgDict.keys():
                log("%s not in pkgDict for component %s" % (p.name, self.name))
            else:
                self.newpkgDict[p] = (PKGTYPE_OPTIONAL, 0)
                p.unregisterComponent(self)
                if self.pkgDict.has_key(p):
                    del self.pkgDict[p]
                # dec the refcount since, otherwise, when you have things
                # which are deps as optional also, Bad Things Happen (tm)
                if p.name in self.depsDict.keys():
                    self.depsDict[p.name] = self.depsDict[p.name] - 1
                    if self.depsDict[p.name] == 0:
                        del self.depsDict[p.name]
                self.updateDependencyCountForRemoval(p)
        elif isinstance(p, Component):
            p.unselect(forInclude = 1, toplevel = 0)
            self.metapkgs[p] = (PKGTYPE_OPTIONAL, 0)
        else:
            log("don't know how to unselect %s" %(p,))
        self.set.updateSelections()
        
    def updateDependencyCountForAddition(self, p):
        pkgs = [ p ]
        checked = []
        while len(pkgs) > 0:
            tocheck = pkgs
            pkgs = []
            for pkg in tocheck:
                pkg = pkg.name
                # make sure the package is in the package list
                if not self.set.compsxml.packages.has_key(pkg):
                    log("Component %s needs package %s which doesn't exist"
                        %(self.name, pkg))
                    continue
                deps = self.set.compsxml.packages[pkg].dependencies
                for dep in deps:
                    # really needs to be in the hdlist
                    if not self.set.packages.has_key(dep):
                        log("Package %s requires %s which we don't have"
                            %(tocheck, dep))
                        continue
                    # if we've already checked for this package, don't worry
                    if dep in checked:
                        continue
                    # up the refcount on the dependency
                    if dep in self.depsDict.keys():
                        self.depsDict[dep] = self.depsDict[dep] + 1
                    else:
                        self.depsDict[dep] = 1
                        # make sure it's registered in this component
                        self.set.packages[dep].registerComponent(self)
                        # and it also has to be in the pkgDict
                        self.pkgDict[self.set.packages[dep]] = None
                    pkgs.append(self.set.packages[dep])
                    checked.append(dep)

    def updateDependencyCountForRemoval(self, p):
        pkgs = [ p ]
        checked = []
        while len(pkgs) > 0:
            tocheck = pkgs
            pkgs = []
            for pkg in tocheck:
                pkg = pkg.name
                # make sure the package is in the package list
                if not self.set.compsxml.packages.has_key(pkg):
                    log("Component %s needs package %s which doesn't exist"
                        %(self.name, pkg))
                    continue
                deps = self.set.compsxml.packages[pkg].dependencies
                for dep in deps:
                    # really needs to be in the hdlist
                    if not self.set.packages.has_key(dep):
                        log("Package %s requires %s which we don't have"
                            %(tocheck, dep))
                        continue
                    # if we've already checked for this package, don't worry
                    if dep in checked:
                        continue
                    # up the refcount on the dependency
                    if dep in self.depsDict.keys():
                        self.depsDict[dep] = self.depsDict[dep] - 1
                        if self.depsDict[dep] == 0:
                            self.set.packages[dep].unregisterComponent(self)
                            # remove it from the pkgDict
                            if self.pkgDict.has_key(self.set.packages[dep]):
                                del self.pkgDict[self.set.packages[dep]]
                            else:
                                log("tried to remove %s and failed" %(self.set.packages[dep],))
                            del self.depsDict[dep]
                    else:
                        log("WARNING: trying to reduce refcount on dep %s in group %s without being in deps dict" % (dep, self.name))
                    pkgs.append(self.set.packages[dep])
                    checked.append(dep)

    def setDefault(self, default):
        self.default = default

    def setDefaultSelection(self):
	if self.default:
	    self.select()

    def getState(self):
	return (self.manuallySelected, self.selectionCount)

    def setState(self, state):
	(self.manuallySelected, self.selectionCount) = state

    def __init__(self, set, compgroup, packages,
                 conditionalKey = "", parent=None,
                 langs = [], doDeps = 1):

        self.set = set

        # set the name and description based on the language
        # we have to keep self.name as english, though, to avoid
        # confusion with kickstart and a lot of our referencing that
        # should be by groupid :/
        self.name = compgroup.name
        self.displayName = None
	self.description = None
        for lang in langs:
            if self.displayName is None and compgroup.translated_name.has_key(lang):
                self.displayName = compgroup.translated_name[lang]
            if (self.description is None and
                compgroup.translated_description.has_key(lang)):
                self.description = compgroup.translated_description[lang]
        # if we didn't find a translation, fall back to english
        if self.displayName is None:
            self.displayName = compgroup.name
        if self.description is None:
            self.description = compgroup.description

        self.hidden = not compgroup.user_visible
        self.default = compgroup.default
        self.comp = compgroup
        self.id = compgroup.id
	
        # do we use these anymore?
        self.conditionalKey = conditionalKey
        self.parent = parent

        self.pkgDict = {}
        self.newpkgDict = {}
        self.includes = []
        self.metapkgs = {}
        self.manuallySelected = 0
        self.selectionCount = 0
        self.depsDict = {}

        for pkg in compgroup.packages.keys():
            if not packages.has_key(pkg):
                log("%s references package %s which doesn't exist"
                    %(self.name, pkg))
                continue
            (type, name) = compgroup.packages[pkg]
            if type == u'mandatory':
                pkgtype = PKGTYPE_MANDATORY
            elif type == u'default':
                pkgtype = PKGTYPE_DEFAULT
            elif type == u'optional':
                pkgtype = PKGTYPE_OPTIONAL
            else:
                log("Invalid package type of %s for %s in %s; defaulting to optional" % (type, pkg, self.name))
                pkgtype = PKGTYPE_OPTIONAL
            self.addPackage(packages[pkg], pkgtype, doDeps)
                

class ComponentSet:
    def __len__(self):
	return len(self.comps)

    def __getitem__(self, key):
	if (type(key) == types.IntType):