Пример #1
0
    def addErase(self, item):
        hdrs = []
        if isinstance(item, rpm.hdr):
            hdrs = [item]
        elif isinstance(item, rpm.mi):
            hdrs = item
        elif isinstance(item, int):
            hdrs = self.dbMatch(rpm.RPMDBI_PACKAGES, item)
        elif isinstance(item, str):
            hdrs = self.dbMatch(rpm.RPMDBI_LABEL, item)
        else:
            raise TypeError("invalid type %s" % type(item))

        for h in hdrs:
            if not _rpmts.addErase(self, h):
                raise rpm.error("package not installed")

        # garbage collection should take care but just in case...
        if isinstance(hdrs, rpm.mi):
            del hdrs
Пример #2
0
    def addErase(self, item):
        hdrs = []
        if isinstance(item, rpm.hdr):
            hdrs = [item]
        elif isinstance(item, rpm.mi):
            hdrs = item
        elif isinstance(item, int):
            hdrs = self.dbMatch(rpm.RPMDBI_PACKAGES, item)
        elif isinstance(item, _string_types):
            hdrs = self.dbMatch(rpm.RPMDBI_LABEL, item)
        else:
            raise TypeError("invalid type %s" % type(item))

        for h in hdrs:
            if not TransactionSetCore.addErase(self, h):
                raise rpm.error("package not installed")

        # garbage collection should take care but just in case...
        if isinstance(hdrs, rpm.mi):
            del hdrs
Пример #3
0
    def addErase(self, item):
        hdrs = []
        # match iterators are passed on as-is
        if isinstance(item, rpm.mi):
            hdrs = item
        elif isinstance(item, rpm.hdr):
            hdrs.append(item)
        elif isinstance(item, (int, str)):
            if isinstance(item, int):
                dbi = rpm.RPMDBI_PACKAGES
            else:
                dbi = rpm.RPMDBI_LABEL

            for h in self.dbMatch(dbi, item):
                hdrs.append(h)

            if not hdrs:
                raise rpm.error("package not installed")
        else:
            raise TypeError("invalid type %s" % type(item))

        for h in hdrs:
            if not TransactionSetCore.addErase(self, h):
                raise rpm.error("adding erasure to transaction failed")
Пример #4
0
    def addRestore(self, item):
        hdrs = self._i2hdrs(item)

        for h in hdrs:
            if not TransactionSetCore.addErase(self, h):
                raise rpm.error("adding restore to transaction failed")