$34 GRAYBYTE WORDPRESS FILE MANAGER $21

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/lib/python3.6/site-packages/up2date_client/

HOME
Current File : /lib/python3.6/site-packages/up2date_client//debUtils.py
# Client code for Update Agent
# Copyright (c) 2011--2016 Red Hat, Inc.  Distributed under GPLv2.
#
# Author: Simon Lukasik
#         Lukas Durfina
#

import os
import apt
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


# FIXME: After Debian bug 187019 is resolved
def verifyPackages(packages):
    cache = apt.Cache()
    missing_packages = []
    for package in packages:
        pkg = cache[package[0]]
        if pkg == None or not pkg.is_installed:
            missing_packages.append(package)

    return [], missing_packages

def parseVRE(version):
    epoch = ''
    release = 'X'
    if version.find(':') != -1:
        epoch, version = version.split(':')
    if version.find('-') != -1:
        tmp = version.split('-')
        version = '-'.join(tmp[:-1])
        release = tmp[-1]
    return version, release, epoch

def installTime(pkg_name, pkg_arch):
    dir = '/var/lib/dpkg/info'
    files = [ '%s.list' % pkg_name,
              '%s:%s.list' % (pkg_name, pkg_arch) ]
    # In edge cases, pkg_name can include the arch but the .list file does not
    if ':' in pkg_name:
        files.append('%s.list' % (pkg_name[:pkg_name.index(':')]))
    for f in files:
        path = os.path.join(dir,f)
        if os.path.isfile(path):
            return os.path.getmtime(path)
    return 0

#FIXME: Using Apt cache might not be an ultimate solution.
# It could be better to parse /var/lib/dpkg/status manually.
# Apt cache might not contain all the packages.
def getInstalledPackageList(msgCallback = None, progressCallback = None,
                            getArch=None, getInfo = None):
    """ Return list of packages. Package is dict with following keys:
        name, epoch, version, release and optionaly arch.
    """
    if msgCallback != None:
        msgCallback(_("Getting list of packages installed on the system"))
    cache = apt.Cache()

    total = 0
    for pkg in cache:
        if pkg.installed != None:
            total += 1

    count = 0
    pkg_list = []
    for pkg in cache:
        if pkg.installed == None:
            continue
        version, release, epoch = parseVRE(pkg.installed.version)
        package = {
            'name': pkg.name,
            'epoch': epoch,
            'version': version,
            'release': release,
            'arch': pkg.installed.architecture + '-deb',
            'installtime': installTime(pkg.name, pkg.installed.architecture)
            }
        pkg_list.append(package)

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

    pkg_list.sort(key=lambda package: package['version'])
    return pkg_list

def setDebugVerbosity():
    pass

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
16 Dec 2025 9.25 PM
root / root
0755
__pycache__
--
14 Aug 2025 9.29 PM
root / root
0755
__init__.py
0 KB
29 May 2025 8.37 PM
root / root
0644
capabilities.py
7.277 KB
29 May 2025 8.37 PM
root / root
0644
clientCaps.py
2.156 KB
29 May 2025 8.37 PM
root / root
0644
clpwd.py
3.558 KB
29 May 2025 8.37 PM
root / root
0644
config.py
14.456 KB
29 May 2025 8.37 PM
root / root
0644
debUtils.py
2.764 KB
29 May 2025 8.37 PM
root / root
0644
getMethod.py
4.201 KB
29 May 2025 8.37 PM
root / root
0644
haltree.py
4.533 KB
29 May 2025 8.37 PM
root / root
0644
hardware.py
31.909 KB
29 May 2025 8.37 PM
root / root
0644
hardware_gudev.py
12.906 KB
29 May 2025 8.37 PM
root / root
0644
hardware_hal.py
11.332 KB
29 May 2025 8.37 PM
root / root
0644
hardware_udev.py
12.988 KB
29 May 2025 8.37 PM
root / root
0644
pkgUtils.py
0.288 KB
29 May 2025 8.37 PM
root / root
0644
pkgplatform.py
0.302 KB
29 May 2025 8.47 PM
root / root
0644
pmPlugin.py
2.792 KB
29 May 2025 8.37 PM
root / root
0644
rhnChannel.py
4.913 KB
29 May 2025 8.37 PM
root / root
0644
rhnHardware.py
0.32 KB
29 May 2025 8.37 PM
root / root
0644
rhnPackageInfo.py
2.34 KB
29 May 2025 8.37 PM
root / root
0644
rhncli.py
9.116 KB
29 May 2025 8.37 PM
root / root
0644
rhnreg.py
31.349 KB
29 May 2025 8.37 PM
root / root
0644
rhnreg_constants.py
18.134 KB
29 May 2025 8.37 PM
root / root
0644
rhnserver.py
9.308 KB
29 May 2025 8.37 PM
root / root
0644
rpcServer.py
11.718 KB
29 May 2025 8.37 PM
root / root
0644
rpmUtils.py
5.196 KB
29 May 2025 8.37 PM
root / root
0644
transaction.py
4.095 KB
29 May 2025 8.37 PM
root / root
0644
tui.py
43.7 KB
29 May 2025 8.37 PM
root / root
0644
up2dateAuth.py
10.688 KB
29 May 2025 8.37 PM
root / root
0644
up2dateErrors.py
10.256 KB
29 May 2025 8.37 PM
root / root
0644
up2dateLog.py
2.059 KB
29 May 2025 8.37 PM
root / root
0644
up2dateUtils.py
5.059 KB
29 May 2025 8.47 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF