GRAYBYTE WORDPRESS FILE MANAGER6123

Server IP : 198.54.121.189 / Your IP : 216.73.216.34
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /lib/python3.6/site-packages/up2date_client/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /lib/python3.6/site-packages/up2date_client//rpmUtils.py
# some high level utility stuff for rpm handling

# Client code for Update Agent
# Copyright (c) 1999--2016 Red Hat, Inc.  Distributed under GPLv2.
#
# Author: Preston Brown <pbrown@redhat.com>
#         Adrian Likins <alikins@redhat.com>
#


#
#  FIXME: Some exceptions in here are currently in up2date.py
#         fix by moving to up2dateErrors.py and importing from there
#
#

import os
import rpm
from rhn.i18n import sstr
from up2date_client import transaction

import gettext
t = gettext.translation('rhn-client-tools', fallback=True)
# Python 3 translations don't have a ugettext method
if not hasattr(t, 'ugettext'):
    t.ugettext = t.gettext
_ = t.ugettext

def installedHeaderByKeyword(**kwargs):
    """ just cause this is such a potentially useful looking method... """
    _ts = transaction.initReadOnlyTransaction()
    mi = _ts.dbMatch()
    for keyword in kwargs.keys():
        mi.pattern(keyword, rpm.RPMMIRE_GLOB, kwargs[keyword])
        # we really shouldnt be getting multiples here, but what the heck
    headerList = []
    for h in mi:
        headerList.append(h)

    return headerList

def verifyPackages(packages):
    """ given a list of package labels, run rpm -V on them
        and return a dict keyed off that data
    """
    data = {}
    missing_packages = []
    # data structure is keyed off package
    # label, with value being an array of each
    # line of the output from -V


    retlist = []
    for package in packages:
        # we have to have at least name...

        # Note: we cant reliable match on epoch, so just
        # skip it... two packages that only diff by epoch is
        # way broken anyway
        keywords = {'name': package[0],
                    'version': package[1],
                    'release': package[2],
                    # we left our epoch
                    'arch': package[4]
                    }
        for key in (keywords.keys()):
            if (keywords[key] == None) or (keywords[key] == ""):
                del(keywords[key])

        headers = installedHeaderByKeyword(**keywords)
        if len(headers) == 0:
            missing_packages.append(package)

        for header in headers:
            epoch = header['epoch']
            if epoch == None:
                epoch = ""
            # gpg-pubkey "packages" can have an arch of None, see bz #162701
            arch = header["arch"]
            if arch == None:
                arch = ""

            pkg = (header['name'], header['version'],
                   header['release'], epoch,
                   arch)

            # dont include arch in the label if it's a None arch, #162701
            if header["arch"] == "":
                packageLabel = "%s-%s-%s" % (pkg[0], pkg[1], pkg[2])
            else:
                packageLabel = "%s-%s-%s.%s" % (pkg[0], pkg[1], pkg[2], pkg[4])

            verifystring = "/usr/bin/rpmverify -V %s" % packageLabel

            fd = os.popen(verifystring)
            res = fd.readlines()
            fd.close()

            reslist = []
            for line in res:
                reslist.append(line.strip())
            retlist.append([pkg, reslist])

    return retlist, missing_packages

#FIXME: this looks like a good candidate for caching, since it takes a second
# or two to run, and I can call it a couple of times
def getInstalledPackageList(msgCallback = None, progressCallback = None,
                            getArch=None, getInfo = None):
    """ Return list of packages. Package is hash with keys name, epoch,
        version, release and optionaly arch and cookie
    """
    pkg_list = []

    if msgCallback != None:
        msgCallback(_("Getting list of packages installed on the system"))

    _ts = transaction.initReadOnlyTransaction()
    count = 0
    total = 0

    for h in _ts.dbMatch():
        if h == None:
            break
        count = count + 1

    total = count

    count = 0
    for h in _ts.dbMatch():
        if h == None:
            break
        package = {
            'name': sstr(h['name']),
            'epoch': h['epoch'],
            'version': sstr(h['version']),
            'release': sstr(h['release']),
            'installtime': h['installtime']
        }
        if package['epoch'] == None:
            package['epoch'] = ""
        else: # convert it to string
            package['epoch'] = "%s" % package['epoch']
        if getArch:
            package['arch'] = h['arch']
            # the arch on gpg-pubkeys is "None"...
            if package['arch']:
                package['arch'] = sstr(package['arch'])
                pkg_list.append(package)
        elif getInfo:
            if h['arch']:
                package['arch'] = sstr(h['arch'])
            if h['cookie']:
                package['cookie'] = sstr(h['cookie'])
            pkg_list.append(package)
        else:
            pkg_list.append(package)

        if progressCallback != None:
            progressCallback(count, total)
        count = count + 1

    pkg_list.sort(key=lambda x:(x['name'], x['epoch'], x['version'], x['release']))
    return pkg_list

def setDebugVerbosity():
    """Set rpm's verbosity mode
    """
    try:
        rpm.setVerbosity(rpm.RPMLOG_DEBUG)
    except AttributeError:
        print("extra verbosity not supported in this version of rpm")

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 01 2025 22:14:40
root / root
0755
__pycache__
--
March 19 2025 08:31:13
root / root
0755
__init__.py
0 KB
February 26 2025 11:13:36
root / root
0644
capabilities.py
7.277 KB
February 26 2025 11:13:36
root / root
0644
clientCaps.py
2.156 KB
February 26 2025 11:13:36
root / root
0644
clpwd.py
3.558 KB
February 26 2025 11:13:36
root / root
0644
config.py
12.505 KB
February 26 2025 11:13:36
root / root
0644
debUtils.py
2.764 KB
February 26 2025 11:13:36
root / root
0644
getMethod.py
4.201 KB
February 26 2025 11:13:36
root / root
0644
haltree.py
4.533 KB
February 26 2025 11:13:36
root / root
0644
hardware.py
31.91 KB
February 26 2025 11:13:36
root / root
0644
hardware_gudev.py
12.906 KB
February 26 2025 11:13:36
root / root
0644
hardware_hal.py
11.332 KB
February 26 2025 11:13:36
root / root
0644
hardware_udev.py
12.988 KB
February 26 2025 11:13:36
root / root
0644
pkgUtils.py
0.288 KB
February 26 2025 11:13:36
root / root
0644
pkgplatform.py
0.302 KB
February 26 2025 11:36:16
root / root
0644
pmPlugin.py
2.792 KB
February 26 2025 11:13:36
root / root
0644
rhnChannel.py
4.913 KB
February 26 2025 11:13:36
root / root
0644
rhnHardware.py
0.32 KB
February 26 2025 11:13:36
root / root
0644
rhnPackageInfo.py
2.34 KB
February 26 2025 11:13:36
root / root
0644
rhncli.py
9.116 KB
February 26 2025 11:13:36
root / root
0644
rhnreg.py
31.219 KB
February 26 2025 11:13:36
root / root
0644
rhnreg_constants.py
18.134 KB
February 26 2025 11:13:36
root / root
0644
rhnserver.py
8.655 KB
February 26 2025 11:13:36
root / root
0644
rpcServer.py
10.959 KB
February 26 2025 11:13:36
root / root
0644
rpmUtils.py
5.196 KB
February 26 2025 11:13:36
root / root
0644
transaction.py
4.095 KB
February 26 2025 11:13:36
root / root
0644
tui.py
43.702 KB
February 26 2025 11:13:36
root / root
0644
up2dateAuth.py
9.472 KB
February 26 2025 11:13:36
root / root
0644
up2dateErrors.py
10.256 KB
February 26 2025 11:13:36
root / root
0644
up2dateLog.py
2.059 KB
February 26 2025 11:13:36
root / root
0644
up2dateUtils.py
5.059 KB
February 26 2025 11:36:16
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF