REDROOM
PHP 7.4.33
Path:
Logout
Edit File
Size: 4.00 KB
Close
/lib/python3.6/site-packages/dnf-plugins/repograph.py
Text
Base64
# repograph.py # DNF plugin adding a command to Output a full package dependency graph in dot # format. # # Copyright (C) 2015 Igor Gnatenko # # 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. Any Red Hat trademarks that are incorporated in the # source code or documentation are not subject to the GNU General Public # License and may only be used or replicated with the express permission of # Red Hat, Inc. # from __future__ import absolute_import from __future__ import unicode_literals from dnfpluginscore import _, logger import dnf.cli DOT_HEADER = """ size="20.69,25.52"; ratio="fill"; rankdir="TB"; orientation=port; node[style="filled"]; """ class RepoGraph(dnf.Plugin): name = "repograph" def __init__(self, base, cli): super(RepoGraph, self).__init__(base, cli) if cli is None: return cli.register_command(RepoGraphCommand) class RepoGraphCommand(dnf.cli.Command): aliases = ("repograph", "repo-graph",) summary = _("Output a full package dependency graph in dot format") def configure(self): demands = self.cli.demands demands.sack_activation = True demands.available_repos = True if self.opts.repo: for repo in self.base.repos.all(): if repo.id not in self.opts.repo: repo.disable() else: repo.enable() def run(self): self.do_dot(DOT_HEADER) def do_dot(self, header): maxdeps = 0 deps = self._get_deps(self.base.sack) print("digraph packages {") print("{}".format(header)) for pkg in deps.keys(): if len(deps[pkg]) > maxdeps: maxdeps = len(deps[pkg]) # color calculations lifted from rpmgraph h = 0.5 + (0.6 / 23 * len(deps[pkg])) s = h + 0.1 b = 1.0 print('"{}" [color="{:.12g} {:.12g} {}"];'.format(pkg, h, s, b)) print('"{}" -> {{'.format(pkg)) for req in deps[pkg]: print('"{}"'.format(req)) print('}} [color="{:.12g} {:.12g} {}"];\n'.format(h, s, b)) print("}") @staticmethod def _get_deps(sack): requires = {} prov = {} skip = [] available = sack.query().available() for pkg in available: xx = {} for req in pkg.requires: reqname = str(req) if reqname in skip: continue # XXX: https://bugzilla.redhat.com/show_bug.cgi?id=1186721 if reqname.startswith("solvable:"): continue if reqname in prov: provider = prov[reqname] else: provider = available.filter(provides=reqname) if not provider: logger.debug(_("Nothing provides: '%s'"), reqname) skip.append(reqname) continue else: provider = provider[0].name prov[reqname] = provider if provider == pkg.name: xx[provider] = None if provider in xx or provider in skip: continue else: xx[provider] = None requires[pkg.name] = xx.keys() return requires
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 17
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
__pycache__
DIR
-
drwxr-xr-x
2025-05-15 05:08:56
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
builddep.py
9.13 KB
lrw-r--r--
2024-04-08 10:02:45
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
changelog.py
4.85 KB
lrw-r--r--
2021-04-12 15:30:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
config_manager.py
10.63 KB
lrw-r--r--
2021-04-12 15:30:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
copr.py
29.59 KB
lrw-r--r--
2024-04-08 10:02:45
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
debug.py
12.27 KB
lrw-r--r--
2021-04-12 15:30:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
debuginfo-install.py
10.82 KB
lrw-r--r--
2021-04-12 15:30:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
download.py
12.04 KB
lrw-r--r--
2021-04-12 15:30:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
generate_completion_cache.py
3.86 KB
lrw-r--r--
2021-04-12 15:30:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
groups_manager.py
13.21 KB
lrw-r--r--
2024-04-08 10:02:45
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
needs_restarting.py
11.59 KB
lrw-r--r--
2024-04-08 10:02:46
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
repoclosure.py
6.65 KB
lrw-r--r--
2021-04-12 15:30:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
repodiff.py
11.21 KB
lrw-r--r--
2021-04-12 15:30:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
repograph.py
4.00 KB
lrw-r--r--
2021-04-12 15:30:34
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
repomanage.py
10.32 KB
lrw-r--r--
2024-04-08 10:02:45
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
reposync.py
14.30 KB
lrw-r--r--
2024-04-08 10:02:45
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
system_upgrade.py
26.17 KB
lrw-r--r--
2024-04-08 10:02:45
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
universal_hooks.py
5.78 KB
lrwxr-xr-x
2025-05-06 19:22:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).