osc.util package¶
Submodules¶
osc.util.ar module¶
-
class
osc.util.ar.Ar(fn=None, fh=None)¶ Bases:
objectRepresents an ar archive (only GNU format is supported). Readonly access.
-
get_file(fn)¶
-
hdr_len= 60¶
-
hdr_pat= re.compile(b'^(.{16})(.{12})(.{6})(.{6})(.{8})(.{10})(.{2})', re.DOTALL)¶
-
read()¶ reads in the archive.
-
-
exception
osc.util.ar.ArError(fn, msg)¶ Bases:
ExceptionBase class for all ar related errors
-
class
osc.util.ar.ArFile(fn, uid, gid, mode, buf)¶ Bases:
_io.BytesIORepresents a file which resides in the archive
-
saveTo(dir=None)¶ writes file to dir/filename if dir isn’t specified the current working dir is used. Additionally it tries to set the owner/group and permissions.
-
-
class
osc.util.ar.ArHdr(fn, date, uid, gid, mode, size, fmag, off)¶ Bases:
objectRepresents an ar header entry
osc.util.archquery module¶
-
exception
osc.util.archquery.ArchError(fname, msg)¶
-
class
osc.util.archquery.ArchQuery(fh)¶ Bases:
osc.util.packagequery.PackageQuery,osc.util.packagequery.PackageQueryResult-
arch()¶
-
canonname()¶
-
conflicts()¶
-
description()¶
-
enhances()¶
-
epoch()¶
-
static
filename(name, epoch, version, release, arch)¶
-
gettag(tag)¶
-
name()¶
-
obsoletes()¶
-
path()¶
-
provides()¶
-
static
query(filename, all_tags=False, *extra_tags)¶
-
read(all_tags=True, self_provides=True, *extra_tags)¶ Returns a PackageQueryResult instance
-
recommends()¶
-
release()¶
-
requires()¶
-
static
rpmvercmp(ver1, ver2)¶ implementation of RPM’s version comparison algorithm (as described in lib/rpmvercmp.c)
-
suggests()¶
-
supplements()¶
-
vercmp(archq)¶
-
version()¶
-
osc.util.cpio module¶
-
exception
osc.util.cpio.CpioError(fn, msg)¶ Bases:
Exceptionbase class for all cpio related errors
-
class
osc.util.cpio.CpioHdr(mgc, ino, mode, uid, gid, nlink, mtime, filesize, dev_maj, dev_min, rdev_maj, rdev_min, namesize, checksum, off=-1, filename=b'')¶ Bases:
objectRepresents a cpio header (“New” portable format and CRC format).
-
class
osc.util.cpio.CpioRead(filename)¶ Bases:
objectRepresents a cpio archive. Supported formats: * ascii SVR4 no CRC also called “new_ascii”
-
copyin(dest=None)¶ extracts the cpio archive to dest. If dest is None $PWD will be used.
-
copyin_file(filename, dest=None, new_fn=None)¶ copies filename to dest. If dest is None the file will be stored in $PWD/filename. If dest points to a dir the file will be stored in dest/filename. In case new_fn is specified the file will be stored as new_fn.
-
hdr_fmt= '6s8s8s8s8s8s8s8s8s8s8s8s8s8s'¶
-
hdr_len= 110¶
-
read()¶
-
sfmt= {'newascii': b'070701'}¶
-
osc.util.debquery module¶
-
exception
osc.util.debquery.DebError(fname, msg)¶
-
class
osc.util.debquery.DebQuery(fh)¶ Bases:
osc.util.packagequery.PackageQuery,osc.util.packagequery.PackageQueryResult-
arch()¶
-
canonname()¶
-
conflicts()¶
-
static
debvercmp(ver1, ver2)¶ implementation of dpkg’s version comparison algorithm
-
description()¶
-
enhances()¶
-
epoch()¶
-
static
filename(name, epoch, version, release, arch)¶
-
gettag(num)¶
-
name()¶
-
obsoletes()¶
-
path()¶
-
provides()¶
-
static
query(filename, all_tags=False, *extra_tags)¶
-
read(all_tags=False, self_provides=True, *extra_tags)¶ Returns a PackageQueryResult instance
-
recommends()¶
-
release()¶
-
requires()¶
-
suggests()¶
-
supplements()¶
-
vercmp(debq)¶
-
version()¶
-
osc.util.packagequery module¶
-
exception
osc.util.packagequery.PackageError(fname, msg)¶ Bases:
Exceptionbase class for all package related errors
-
class
osc.util.packagequery.PackageQueries(wanted_architecture)¶ Bases:
dictDict of package name keys and package query values. When assigning a package query, to a name, the package is evaluated to see if it matches the wanted architecture and if it has a greater version than the current value.
-
add(query)¶ Adds package query to dict if it is of the correct architecture and is newer (has a greater version) than the currently assigned package.
Parameters: query – a PackageQuery
-
architectureMap= {'amd64': ['x86_64'], 'armv6hl': ['armv6l'], 'armv7hl': ['armv7l'], 'i386': ['i586', 'i686'], 'ppc64el': ['ppc64le']}¶
-
-
class
osc.util.packagequery.PackageQuery¶ Bases:
objectabstract base class for all package types
-
static
query(filename, all_tags=False, extra_rpmtags=(), extra_debtags=(), self_provides=True)¶
-
static
queryhdrmd5(filename)¶
-
read(all_tags=False, *extra_tags)¶ Returns a PackageQueryResult instance
-
static
-
class
osc.util.packagequery.PackageQueryResult¶ Bases:
objectabstract base class that represents the result of a package query
-
arch()¶
-
canonname()¶
-
conflicts()¶
-
description()¶
-
enhances()¶
-
epoch()¶
-
evr()¶
-
gettag(tag)¶
-
name()¶
-
obsoletes()¶
-
path()¶
-
provides()¶
-
recommends()¶
-
release()¶
-
requires()¶
-
suggests()¶
-
supplements()¶
-
vercmp(pkgquery)¶
-
version()¶
-
-
osc.util.packagequery.cmp(a, b)¶
osc.util.repodata module¶
Module for reading repodata directory (created with createrepo) for package information instead of scanning individual rpms.
-
class
osc.util.repodata.RepoDataQueryResult(directory, element)¶ Bases:
osc.util.packagequery.PackageQueryResultPackageQueryResult that reads in data from the repodata directory files.
-
arch(*args, **kwargs)¶
-
canonname()¶
-
conflicts(*args, **kwargs)¶
-
description(*args, **kwargs)¶
-
distribution()¶
-
enhances(*args, **kwargs)¶
-
epoch(*args, **kwargs)¶
-
gettag(tag)¶
-
name(*args, **kwargs)¶
-
obsoletes(*args, **kwargs)¶
-
path()¶
-
provides(*args, **kwargs)¶
-
recommends(*args, **kwargs)¶
-
release(*args, **kwargs)¶
-
requires(*args, **kwargs)¶
-
suggests(*args, **kwargs)¶
-
supplements(*args, **kwargs)¶
-
vercmp(other)¶
-
version(*args, **kwargs)¶
-
-
osc.util.repodata.namespace(name)¶
-
osc.util.repodata.primaryPath(directory)¶ Returns path to the primary repository data file.
Parameters: directory – repository directory that contains the repodata subdirectory Returns: path to primary repository data file Return type: str Raises: IOError – if repomd.xml contains no primary location
-
osc.util.repodata.queries(directory)¶ Returns a list of RepoDataQueries constructed from the repodata under the directory.
Parameters: directory – path to a repository directory (parent directory of repodata directory) Returns: list of RepoDataQueryResult instances Raises: IOError – if repomd.xml contains no primary location
osc.util.rpmquery module¶
-
exception
osc.util.rpmquery.RpmError(fname, msg)¶
-
class
osc.util.rpmquery.RpmHeader(offset, length)¶ Bases:
objectcorresponds more or less to the indexEntry_s struct
-
append(entry)¶
-
gettag(tag)¶
-
-
class
osc.util.rpmquery.RpmHeaderEntry(tag, type, offset, count)¶ Bases:
objectcorresponds to the entryInfo_s struct (except the data attribute)
-
ENTRY_SIZE= 16¶
-
-
exception
osc.util.rpmquery.RpmHeaderError(fname, msg)¶ Bases:
osc.util.rpmquery.RpmError
-
class
osc.util.rpmquery.RpmQuery(fh)¶ Bases:
osc.util.packagequery.PackageQuery,osc.util.packagequery.PackageQueryResult-
EQUAL= 8¶
-
GREATER= 4¶
-
HEADERSIG_TYPE= 5¶
-
HEADER_MAGIC= 2393761793¶
-
LEAD_MAGIC= 3987467995¶
-
LEAD_SIZE= 96¶
-
LESS= 2¶
-
SENSE_STRONG= 134217728¶
-
arch()¶
-
canonname()¶
-
conflicts()¶
-
description()¶
-
enhances()¶
-
epoch()¶
-
static
filename(name, epoch, version, release, arch)¶
-
gettag(num)¶
-
is_nosrc()¶
-
is_src()¶
-
name()¶
-
obsoletes()¶
-
path()¶
-
provides()¶
-
static
query(filename)¶
-
static
queryhdrmd5(filename)¶
-
read(all_tags=False, self_provides=True, *extra_tags, **extra_kw)¶ Returns a PackageQueryResult instance
-
recommends()¶
-
release()¶
-
requires()¶
-
static
rpmvercmp(ver1, ver2)¶ implementation of RPM’s version comparison algorithm (as described in lib/rpmvercmp.c)
-
suggests()¶
-
summary()¶
-
supplements()¶
-
url()¶
-
vercmp(rpmq)¶
-
version()¶
-
-
osc.util.rpmquery.cmp(a, b)¶
-
osc.util.rpmquery.unpack_string(data, encoding=None)¶ unpack a ‘0’ terminated string from data
osc.util.safewriter module¶
osc.util.helper module¶
-
osc.util.helper.decode_it(obj)¶ Decode the given object unless it is a str.
If the given object is a str or has no decode method, the object itself is returned. Otherwise, try to decode the object using utf-8. If this fails due to a UnicodeDecodeError, try to decode the object using latin-1.
-
osc.util.helper.decode_list(ilist)¶ Decodes the elements of a list if needed
-
osc.util.helper.format_table(rows, headers)¶ Format list of tuples into equal width table with headers
-
osc.util.helper.raw_input(*args)¶