Example #1
0
    def getUnresolvedDependencies(self):
        """Get all unresolved dependencies.

        Return a HashList: RpmPackage =>
        [(name, RPMSENSE_* flags, EVR string)]."""

        unresolved = HashList()

        for p, d in self.iterUnresolvedDependencies():
            unresolved.setdefault(p, []).append(d)

        return unresolved
Example #2
0
    def getUnresolvedDependencies(self):
        """Get all unresolved dependencies.

        Return a HashList: RpmPackage =>
        [(name, RPMSENSE_* flags, EVR string)]."""

        unresolved = HashList()

        for p, d in self.iterUnresolvedDependencies():
            unresolved.setdefault(p, [ ]).append(d)

        return unresolved
Example #3
0
    def getResolvedDependencies(self):
        """Get resolved dependencies.

        Return a HashList: RpmPackage =>
        [((name, RPMSENSE_* flags, EVR string),
          [relevant resolving RpmPackage's])]."""

        all_resolved = HashList()
        for name in self.database.getNames():
            for r in self.database.getPkgsByName(name):
                log.debug1("Checking dependencies for %s", r.getNEVRA())
                (unresolved, resolved) = self.getPkgDependencies(r)
                if len(resolved) > 0:
                    all_resolved.setdefault(r, [ ]).extend(resolved)
        return all_resolved
Example #4
0
    def getResolvedDependencies(self):
        """Get resolved dependencies.

        Return a HashList: RpmPackage =>
        [((name, RPMSENSE_* flags, EVR string),
          [relevant resolving RpmPackage's])]."""

        all_resolved = HashList()
        for name in self.database.getNames():
            for r in self.database.getPkgsByName(name):
                log.debug1("Checking dependencies for %s", r.getNEVRA())
                (unresolved, resolved) = self.getPkgDependencies(r)
                if len(resolved) > 0:
                    all_resolved.setdefault(r, []).extend(resolved)
        return all_resolved
Example #5
0
    def getConflicts(self):
        """Check for conflicts in conflicts and obsoletes among currently
        installed packages.

        Return a HashList: RpmPackage =>
        [((name, RPMSENSE_* flags, EVR string), conflicting RpmPackage)]."""

        conflicts = HashList()

        if self.config.noconflicts:
            # conflicts turned off
            return conflicts

        if self.config.checkinstalled == 0:
            for r in self.installs:
                log.debug1("Checking for conflicts for %s", r.getNEVRA())
                self.getPkgConflicts(r, r["conflicts"] + r["obsoletes"],
                                     conflicts)
            return conflicts

        for name in self.database.getNames():
            for r in self.database.getPkgsByName(name):
                log.debug1("Checking for conflicts for %s", r.getNEVRA())
                self.getPkgConflicts(r, r["conflicts"] + r["obsoletes"],
                                     conflicts)
        return conflicts
Example #6
0
    def getObsoleteConflicts(self):
        """Check for conflicts from obsoletes of installed packages
        against newly installed packages.
        
        Return a HashList: RpmPackage =>
        [((name, RPMSENSE_* flags, EVR string), conflicting RpmPackage)]."""
        conflicts = HashList()
        if self.config.checkinstalled:
            # conflicts get caught by getConflicts()
            return conflicts

        for n, f, v, pkg in self.database.iterObsoletes():
            if pkg in self.installs:
                continue
            for p in self.database.searchDependency(n, f, v):
                if not p in self.installs:
                    continue
                # if p in self.updates:
                # XXX check old pkg has already same conflict 
                conflicts.setdefault(pkg, []).append(((n, f, v), p))
        return conflicts
Example #7
0
    def getObsoleteConflicts(self):
        """Check for conflicts from obsoletes of installed packages
        against newly installed packages.
        
        Return a HashList: RpmPackage =>
        [((name, RPMSENSE_* flags, EVR string), conflicting RpmPackage)]."""
        conflicts = HashList()
        if self.config.checkinstalled:
            # conflicts get caught by getConflicts()
            return conflicts

        for n, f, v, pkg in self.database.iterObsoletes():
            if pkg in self.installs:
                continue
            for p in self.database.searchDependency(n, f, v):
                if not p in self.installs:
                    continue
                # if p in self.updates:
                # XXX check old pkg has already same conflict
                conflicts.setdefault(pkg, []).append(((n, f, v), p))
        return conflicts
Example #8
0
    def getFileConflicts(self):
        """Find file conflicts among packages in self.database.names.

        Return a HashList:
        RpmPackage => [(filename, conflicting RpmPackage)]."""

        conflicts = HashList()

        db = self.database

        if self.config.nofileconflicts:
            # file conflicts turned off
            return conflicts
        if self.config.checkinstalled == 0:
            # no conflicts if there is no new package
            for pkg in self.installs:
                for name in pkg.iterFilenames():
                    dups = db.searchFilenames(name)
                    if len(dups) == 1: continue
                    log.debug1("Checking for file conflicts for '%s'", name)
                    for p in dups:
                        if p is pkg: continue
                        if self._hasFileConflict(pkg, p, name):
                            conflicts.setdefault(pkg, [ ]).append(
                                (name, p))
            return conflicts

        # duplicates: { name: [(pkg, idx),..], .. }
        duplicates = self.database.getFileDuplicates()
        for name in duplicates:
            dups = duplicates[name]
            log.debug1("Checking for file conflicts for '%s'", name)
            for j in xrange(len(dups)):
                for k in xrange(j+1, len(dups)):
                    if not self._hasFileConflict(dups[j], dups[k], name):
                        continue
                    conflicts.setdefault(dups[j], [ ]).append((name, dups[k]))
                    conflicts.setdefault(dups[k], [ ]).append((name, dups[j]))
        return conflicts
Example #9
0
def get_hashlist(opts):
    '''
    If the user asks to reduce memory use, return a disk-backed HashList
    object, which will obviously run much more slowly than the default
    memory-backed HashList object.
    '''

    if opts.use_less_memory:
        log.debug("get_hashlist(): Returning Sqlite-backed hashlist object")
        return SqliteHashList()
    else:
        log.debug("get_hashlist(): Returning memory-backed hashlist object")
        return HashList()
Example #10
0
    def getObsoletes(self):
        """Check for obsoletes among packages in self.database.names.

        Return a HashList: RpmPackage =>
        [((name, RPMSENSE_* flags, EVR string), obsoleted RpmPackage)]."""

        obsoletes = HashList()

        if self.config.noconflicts:
            # conflicts turned off, obsoletes are also conflicts, but in an
            # other level
            return obsoletes
        if self.config.checkinstalled == 0:
            for r in self.installs:
                log.debug1("Checking for obsoletes for %s", r.getNEVRA())
                self.getPkgConflicts(r, r["obsoletes"], obsoletes)
            return obsoletes

        for name in self.database.getNames():
            for r in self.database.getPkgsByName(name):
                log.debug1(1, "Checking for obsoletes for %s" % r.getNEVRA())
                self.getPkgConflicts(r, r["obsoletes"], obsoletes)
        return obsoletes
Example #11
0
    def getFileConflicts(self):
        """Find file conflicts among packages in self.database.names.

        Return a HashList:
        RpmPackage => [(filename, conflicting RpmPackage)]."""

        conflicts = HashList()

        db = self.database

        if self.config.nofileconflicts:
            # file conflicts turned off
            return conflicts
        if self.config.checkinstalled == 0:
            # no conflicts if there is no new package
            for pkg in self.installs:
                for name in pkg.iterFilenames():
                    dups = db.searchFilenames(name)
                    if len(dups) == 1: continue
                    log.debug1("Checking for file conflicts for '%s'", name)
                    for p in dups:
                        if p is pkg: continue
                        if self._hasFileConflict(pkg, p, name):
                            conflicts.setdefault(pkg, []).append((name, p))
            return conflicts

        # duplicates: { name: [(pkg, idx),..], .. }
        duplicates = self.database.getFileDuplicates()
        for name in duplicates:
            dups = duplicates[name]
            log.debug1("Checking for file conflicts for '%s'", name)
            for j in xrange(len(dups)):
                for k in xrange(j + 1, len(dups)):
                    if not self._hasFileConflict(dups[j], dups[k], name):
                        continue
                    conflicts.setdefault(dups[j], []).append((name, dups[k]))
                    conflicts.setdefault(dups[k], []).append((name, dups[j]))
        return conflicts