GRAYBYTE WORDPRESS FILE MANAGER4058

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/dnf-plugins/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /lib/python3.6/site-packages/dnf-plugins//generate_completion_cache.py
# coding=utf-8
# generate_completion_cache.py - generate cache for dnf bash completion
# Copyright © 2013 Elad Alfassa <elad@fedoraproject.org>
# Copyright (C) 2014-2015 Igor Gnatenko <i.gnatenko.brain@gmail.com>
# Copyright (C) 2015  Red Hat, Inc.

# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.

from __future__ import absolute_import
from __future__ import unicode_literals
from dnf.i18n import ucd
from dnfpluginscore import logger

import dnf
import os.path
import sqlite3


class BashCompletionCache(dnf.Plugin):
    name = 'generate_completion_cache'

    def __init__(self, base, cli):
        super(BashCompletionCache, self).__init__(base, cli)
        self.base = base
        self.cache_file = "/var/cache/dnf/packages.db"

    @staticmethod
    def _out(msg):
        logger.debug('Completion plugin: %s', msg)

    def sack(self):
        ''' Generate cache of available packages '''
        # We generate this cache only if the repos were just freshed or if the
        # cache file doesn't exist

        fresh = False
        for repo in self.base.repos.iter_enabled():
            if repo.metadata is not None and repo.metadata.fresh:
                # One fresh repo is enough to cause a regen of the cache
                fresh = True
                break

        if not os.path.exists(self.cache_file) or fresh:
            try:
                with sqlite3.connect(self.cache_file) as conn:
                    self._out('Generating completion cache...')
                    cur = conn.cursor()
                    cur.execute(
                        "create table if not exists available (pkg TEXT)")
                    cur.execute(
                        "create unique index if not exists "
                        "pkg_available ON available(pkg)")
                    cur.execute("delete from available")
                    avail_pkgs = self.base.sack.query().available()
                    avail_pkgs_insert = [[str(x)] for x in avail_pkgs if x.arch != "src"]
                    cur.executemany("insert or ignore into available values (?)",
                                    avail_pkgs_insert)
                    conn.commit()
            except sqlite3.OperationalError as e:
                self._out("Can't write completion cache: %s" % ucd(e))

    def transaction(self):
        ''' Generate cache of installed packages '''
        if not self.transaction:
            return

        try:
            with sqlite3.connect(self.cache_file) as conn:
                self._out('Generating completion cache...')
                cur = conn.cursor()
                cur.execute("create table if not exists installed (pkg TEXT)")
                cur.execute(
                    "create unique index if not exists "
                    "pkg_installed ON installed(pkg)")
                cur.execute("delete from installed")
                inst_pkgs = dnf.sack._rpmdb_sack(self.base).query().installed()
                inst_pkgs_insert = [[str(x)] for x in inst_pkgs if x.arch != "src"]
                cur.executemany("insert or ignore into installed values (?)",
                                inst_pkgs_insert)
                conn.commit()
        except sqlite3.OperationalError as e:
            self._out("Can't write completion cache: %s" % ucd(e))

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 01 2025 22:14:40
root / root
0755
__pycache__
--
April 05 2025 06:23:03
root / root
0755
builddep.py
9.127 KB
April 08 2024 10:02:45
root / root
0644
changelog.py
4.851 KB
April 12 2021 15:30:34
root / root
0644
config_manager.py
10.63 KB
April 12 2021 15:30:34
root / root
0644
copr.py
29.588 KB
April 08 2024 10:02:45
root / root
0644
debug.py
12.271 KB
April 12 2021 15:30:34
root / root
0644
debuginfo-install.py
10.824 KB
April 12 2021 15:30:34
root / root
0644
download.py
12.041 KB
April 12 2021 15:30:34
root / root
0644
etckeeper.py
1.256 KB
January 28 2023 09:34:10
root / root
0644
generate_completion_cache.py
3.855 KB
April 12 2021 15:30:34
root / root
0644
groups_manager.py
13.215 KB
April 08 2024 10:02:45
root / root
0644
needs_restarting.py
11.594 KB
April 08 2024 10:02:46
root / root
0644
repoclosure.py
6.651 KB
April 12 2021 15:30:34
root / root
0644
repodiff.py
11.206 KB
April 12 2021 15:30:34
root / root
0644
repograph.py
3.996 KB
April 12 2021 15:30:34
root / root
0644
repomanage.py
10.322 KB
April 08 2024 10:02:45
root / root
0644
reposync.py
14.305 KB
April 08 2024 10:02:45
root / root
0644
spacewalk.py
13.876 KB
February 26 2025 09:26:06
root / root
0644
system_upgrade.py
26.165 KB
April 08 2024 10:02:45
root / root
0644
universal_hooks.py
5.78 KB
October 11 2020 23:57:51
root / root
0755
versionlock.py
12.028 KB
April 08 2024 10:02:45
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF