osc.util package

Submodules

osc.util.ar module

class osc.util.ar.Ar(fn=None, fh=None)

Bases: object

Represents an ar archive (only GNU format is supported). Readonly access.

get_file(fn)
hdr_len = 60
hdr_pat = re.compile('^(.{16})(.{12})(.{6})(.{6})(.{8})(.{10})(.{2})', re.DOTALL)
read()

reads in the archive. It tries to use mmap due to performance reasons (in case of large files)

exception osc.util.ar.ArError(fn, msg)

Bases: Exception

Base class for all ar related errors

class osc.util.ar.ArFile(fn, uid, gid, mode, buf)

Bases: _io.StringIO

Represents 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: object

Represents an ar header entry

osc.util.archquery module

exception osc.util.archquery.ArchError(fname, msg)

Bases: osc.util.packagequery.PackageError

class osc.util.archquery.ArchQuery(fh)

Bases: osc.util.packagequery.PackageQuery, osc.util.packagequery.PackageQueryResult

arch()
canonname()
conflicts()
description()
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

release()
requires()
static rpmvercmp(ver1, ver2)

implementation of RPM’s version comparison algorithm (as described in lib/rpmvercmp.c)

vercmp(archq)
version()

osc.util.cpio module

exception osc.util.cpio.CpioError(fn, msg)

Bases: Exception

base 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='')

Bases: object

Represents a cpio header (“New” portable format and CRC format).

class osc.util.cpio.CpioRead(filename)

Bases: object

Represents 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': '070701'}
class osc.util.cpio.CpioWrite

Bases: object

cpio archive small files in memory, using new style portable header format

add(name=None, content=None, perms=420, type=32768)
add_padding()
get()

osc.util.debquery module

exception osc.util.debquery.DebError(fname, msg)

Bases: osc.util.packagequery.PackageError

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

default_tags = ('package', 'version', 'release', 'epoch', 'architecture', 'description', 'provides', 'depends', 'pre_depends', 'conflicts', 'breaks')
description()
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

release()
requires()
vercmp(debq)
version()

osc.util.packagequery module

exception osc.util.packagequery.PackageError(fname, msg)

Bases: Exception

base class for all package related errors

class osc.util.packagequery.PackageQueries(wanted_architecture)

Bases: dict

Dict 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.

@param a PackageQuery

architectureMap = {'amd64': ['x86_64'], 'armv6hl': ['armv6l'], 'armv7hl': ['armv7l'], 'i386': ['i586', 'i686'], 'ppc64el': ['ppc64le']}
class osc.util.packagequery.PackageQuery

Bases: object

abstract 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

class osc.util.packagequery.PackageQueryResult

Bases: object

abstract base class that represents the result of a package query

arch()
canonname()
conflicts()
description()
epoch()
evr()
gettag(tag)
name()
obsoletes()
path()
provides()
release()
requires()
vercmp(pkgquery)
version()

osc.util.repodata module

osc.util.rpmquery module

osc.util.safewriter module

class osc.util.safewriter.SafeWriter(writer, encoding='unicode_escape')

Bases: object

Safely write an (unicode) str. In case of an “UnicodeEncodeError” the the str is encoded with the “encoding” encoding. All getattr, setattr calls are passed through to the “writer” instance.

write(s)

Module contents