yum.packages

Classes and functions dealing with rpm package representations.

yum.packages.comparePoEVR(po1, po2)

Compare two Package or PackageEVR objects.

yum.packages.comparePoEVREQ(po1, po2)

Compare two Package or PackageEVR objects for equality.

yum.packages.buildPkgRefDict(pkgs, casematch=True)

take a list of pkg objects and return a dict the contains all the possible naming conventions for them eg: for (name,i386,0,1,1) dict[name] = (name, i386, 0, 1, 1) dict[name.i386] = (name, i386, 0, 1, 1) dict[name-1-1.i386] = (name, i386, 0, 1, 1) dict[name-1] = (name, i386, 0, 1, 1) dict[name-1-1] = (name, i386, 0, 1, 1) dict[0:name-1-1.i386] = (name, i386, 0, 1, 1) dict[name-0:1-1.i386] = (name, i386, 0, 1, 1)

yum.packages.parsePackages(pkgs, usercommands, casematch=0, unique='repo-epoch-name-version-release-arch')

matches up the user request versus a pkg list: for installs/updates available pkgs should be the ‘others list’ for removes it should be the installed list of pkgs takes an optional casematch option to determine if case should be matched exactly. Defaults to not matching.

FakeSack

class yum.packages.FakeSack

Fake PackageSack to use with FakeRepository

delPackage(obj)

delete a pkgobject, do nothing, but make localpackages work with –skip-broken

have_fastReturnFileEntries()

Is calling pkg.returnFileEntries(primary_only=True) faster than using searchFiles().

FakeRepository

class yum.packages.FakeRepository(repoid)

Fake repository class for use in rpmsack package objects

PackageObject

class yum.packages.PackageObject

Bases: object

Base Package Object - sets up the default storage dicts and the most common returns

printVer()

returns a printable version string - including epoch, if it’s set

verCMP(other)

Compare package to another one, only rpm-version ordering.

verEQ(other)

Compare package to another one, only rpm-version equality.

verGE(other)

Uses verCMP, tests if the other _rpm-version_ is >= ours.

verGT(other)

Uses verCMP, tests if the other _rpm-version_ is > ours.

verLE(other)

Uses verCMP, tests if the other _rpm-version_ is <= ours.

verLT(other)

Uses verCMP, tests if the other _rpm-version_ is < ours.

verNE(other)

Compare package to another one, only rpm-version inequality.

YumNotFoundPackage

class yum.packages.YumNotFoundPackage(pkgtup)

Bases: yum.packages.PackageObject

verifyLocalPkg()

check the package checksum vs the localPkg return True if pkg is good, False if not

RpmBase

class yum.packages.RpmBase

Bases: object

return functions and storage for rpm-specific data

checkPrco(prcotype, prcotuple)

returns 1 or 0 if the pkg contains the requested tuple/tuple range

have_fastReturnFileEntries()

Is calling pkg.returnFileEntries(primary_only=True) faster than using searchFiles().

inPrcoRange(prcotype, reqtuple)

returns true if the package has a the prco that satisfies the reqtuple range, assume false. Takes: prcotype, requested prco tuple

obsoletedBy(obsoleters, limit=0)

Returns list of obsoleters that obsolete this package. Note that we don’t do obsoleting loops. If limit is != 0, then we stop after finding that many.

provides_for(reqtuple)

check to see if the package object provides for the requirement passed, including searching filelists if the requirement is a file dep

returnChangelog()

return changelog entries

returnFileEntries(ftype='file', primary_only=False)

return list of files based on type, you can pass primary_only=True to limit to those files in the primary repodata

returnFileTypes(primary_only=False)

return list of types of files in the package, you can pass primary_only=True to limit to those files in the primary repodata

returnPrco(prcotype, printable=False)

return list of provides, requires, conflicts or obsoletes

PackageEVR

class yum.packages.PackageEVR(e, v, r)

A comparable epoch, version, and release representation. Note that you almost certainly want to use pkg.verEQ() or pkg.verGT() etc. instead.

YumAvailablePackage

class yum.packages.YumAvailablePackage(repo, pkgdict=None)

Bases: yum.packages.PackageObject, yum.packages.RpmBase

derived class for the packageobject and RpmBase packageobject yum uses this for dealing with packages in a repository

checksum

Returns the ‘default’ checksum

committer

Returns the name of the last person to do a commit to the changelog.

committime

Returns the time of the last commit to the changelog.

exclude()

remove self from package sack

importFromDict(pkgdict)

handles an mdCache package dictionary item to populate out the package information

localHdr()

return path to local cached Header file downloaded from package byte ranges

localPkg()

return path to local package (whether it is present there, or not)

prcoPrintable(prcoTuple)

convert the prco tuples into a nicer human string

printVer()

returns a printable version string - including epoch, if it’s set

remote_url

returns a URL that can be used for downloading the package. Note that if you’re going to download the package in your tool, you should use self.repo.getPackage.

requiresList()

return a list of requires in normal rpm format

returnLocalHeader()

returns an rpm header object from the package object’s local header cache

verifyLocalPkg()

check the package checksum vs the localPkg return True if pkg is good, False if not

YumHeaderPackage

class yum.packages.YumHeaderPackage(repo, hdr)

Bases: yum.packages.YumAvailablePackage

Package object built from an rpm header

returnFileEntries(ftype='file', primary_only=False)

return list of files based on type

_CountedReadFile

class yum.packages._CountedReadFile(fp)

Has just a read() method, and keeps a count so we can find out how much has been read. Implemented so we can get the real size of the file from prelink.

_PkgVerifyProb

class yum.packages._PkgVerifyProb(type, msg, ftypes, fake=False)

Holder for each “problem” we find with a pkg.verify().

YUMVerifyPackageFile

class yum.packages.YUMVerifyPackageFile(filename)

Bases: object

_RPMVerifyPackageFile

class yum.packages._RPMVerifyPackageFile(fi, filetuple, csum_type, override_vflags=False)

Bases: yum.packages.YUMVerifyPackageFile

YUMVerifyPackage

class yum.packages.YUMVerifyPackage(po)

A holder for YUMVerifyPackageFile objects.

_RPMVerifyPackage

class yum.packages._RPMVerifyPackage(po, fi, def_csum_type, patterns, all)

Bases: yum.packages.YUMVerifyPackage

YumInstalledPackage

class yum.packages.YumInstalledPackage(hdr, yumdb=None)

Bases: yum.packages.YumHeaderPackage

super class for dealing with packages in the rpmdb

verify(patterns=[], deps=False, script=False, fake_problems=True, all=False, fast=False, callback=None)

verify that the installed files match the packaged checksum optionally verify they match only if they are in the ‘pattern’ list returns a tuple

YumLocalPackage

class yum.packages.YumLocalPackage(ts=None, filename=None)

Bases: yum.packages.YumHeaderPackage

Class to handle an arbitrary package from a file path this inherits most things from YumInstalledPackage because installed packages and an arbitrary package on disk act very much alike. init takes a ts instance and a filename/path to the package.

verifyLocalPkg()

don’t bother “checking” the package matches itself.

YumUrlPackage

class yum.packages.YumUrlPackage(yb=None, ts=None, url=None, ua=None)

Bases: yum.packages.YumLocalPackage

Class to handle an arbitrary package from a URL this inherits most things from YumLocalPackage, but will download a remote package to make it local. init takes a YumBase, a ts instance and a url to the package.