File Explorer

/proc/self/root/proc/thread-self/root/lib64/python3.9/site-packages/rpm

This explorer reads the filesystem of the server it runs on, so /workspace/user isn't present here. Browsing and the terminal still work against this server's own disk from /.

__init__.py3.0 KB · 117 lines
r"""RPM Module This module enables you to manipulate rpms and the rpm database. The rpm base module provides the main starting point foraccessing RPM from Python. For most usage, callthe TransactionSet method to get a transaction set (rpmts). For example:	import rpm	ts = rpm.TransactionSet() The transaction set will open the RPM database as needed, soin most cases, you do not need to explicitly open thedatabase. The transaction set is the workhorse of RPM. You can open another RPM database, such as one that holdsall packages for a given Linux distribution, to providepackages used to solve dependencies. To do this, usethe following code: rpm.addMacro('_dbpath', '/path/to/alternate/database')solvets = rpm.TransactionSet()solvets.openDB()rpm.delMacro('_dbpath') # Open default databasets = rpm.TransactionSet() This code gives you access to two RPM databases throughtwo transaction sets (rpmts): ts is a transaction setassociated with the default RPM database and solvetsis a transaction set tied to an alternate database, whichis very useful for resolving dependencies.""" import warningsfrom rpm._rpm import *from rpm.transaction import *import rpm._rpm as _rpm_RPMVSF_NODIGESTS = _rpm._RPMVSF_NODIGESTS_RPMVSF_NOHEADER = _rpm._RPMVSF_NOHEADER_RPMVSF_NOPAYLOAD = _rpm._RPMVSF_NOPAYLOAD_RPMVSF_NOSIGNATURES = _rpm._RPMVSF_NOSIGNATURES __version__ = _rpm.__version____version_info__ = tuple(__version__.split('.')) # backwards compatibility + give the same class both waysts = TransactionSet  def headerLoad(*args, **kwds):    """DEPRECATED! Use rpm.hdr() instead."""    warnings.warn("Use rpm.hdr() instead.", DeprecationWarning, stacklevel=2)    return hdr(*args, **kwds)  def _doHeaderListFromFD(rpm_fd, retrofit):    hlist = []    while 1:        try:            h = hdr(rpm_fd)            if retrofit:                h.convert(HEADERCONV_RETROFIT_V3)            hlist.append(h)        except _rpm.error:            break     return hlist  def readHeaderListFromFD(file_desc, retrofit=True):    if not isinstance(file_desc, fd):        file_desc = fd(file_desc)    return _doHeaderListFromFD(file_desc, retrofit)  def readHeaderListFromFile(path, retrofit=True):    f = fd(path)    hlist = _doHeaderListFromFD(f, retrofit)    f.close()    return hlist  def readHeaderFromFD(file_desc):    """Return (header, pos_before_hdr)"""    if not isinstance(file_desc, fd):        file_desc = fd(file_desc)    try:        offset = file_desc.tell()        h = hdr(file_desc)    except (_rpm.error, IOError):        offset = None        h = None     return (h, offset)  def signalsCaught(siglist):    """Returns list of signals that were caught."""    caught = []    for sig in siglist:        if signalCaught(sig):            caught.append(sig)     return caught  def dsSingle(TagN, N, EVR="", Flags=RPMSENSE_ANY):    """    Creates a single entry dependency set (ds)     dsSingle(RPMTAG_CONFLICTNAME, "rpm") corresponds to "Conflicts: rpm"    """    return ds((N, Flags, EVR), TagN)