コード例 #1
0
ファイル: log_deps.py プロジェクト: fatman2021/slpkg
def write_deps(deps_dict):
    """
    Write dependencies in a log file
    into directory `/var/log/slpkg/dep/`
    """
    for name, dependencies in deps_dict.iteritems():
        if find_package(name + "-", _meta_.pkg_path):
            dep_path = _meta_.log_path + "dep/"
            if not os.path.exists(dep_path):
                os.mkdir(dep_path)
            if os.path.isfile(dep_path + name):
                os.remove(dep_path + name)
            if len(dependencies) > 0:
                with open(dep_path + name, "w") as f:
                    for dep in dependencies:
                        f.write(dep + "\n")
                    f.close()
コード例 #2
0
ファイル: queue.py プロジェクト: unixbhaskar/slpkg
 def install(self):
     '''
     Install packages from queue
     '''
     packages = self.packages()
     if packages:
         print   # new line at start
         for pkg in packages:
             # check if package exist in repository
             find = find_package(pkg, tmp)
             try:
                 find = max(find)
             except ValueError:
                 print("Package '{0}' not found in /tmp\n".format(pkg))
             if pkg in find:
                 binary = "{0}{1}".format(tmp, find)
                 PackageManager(binary.split()).install()
     else:
         print("\nPackages not found in the queue for installation\n")
コード例 #3
0
 def install(self):
     '''
     Install packages from queue
     '''
     packages = self.packages()
     if packages:
         print  # new line at start
         for pkg in packages:
             # check if package exist in repository
             find = find_package(pkg, tmp)
             try:
                 find = max(find)
             except ValueError:
                 print("Package '{0}' not found in /tmp\n".format(pkg))
             if pkg in find:
                 binary = "{0}{1}".format(tmp, find)
                 PackageManager(binary.split()).install()
     else:
         print("\nPackages not found in the queue for installation\n")
コード例 #4
0
ファイル: load.py プロジェクト: fatman2021/slpkg
def library(repo):
    """Load packages from slpkg library and from local
    """
    pkg_list, packages = [], ""
    if repo == "sbo":
        if (os.path.isfile(
                _meta_.lib_path + "{0}_repo/SLACKBUILDS.TXT".format(repo))):
            packages = Utils().read_file(_meta_.lib_path + "{0}_repo/"
                                         "SLACKBUILDS.TXT".format(repo))
    else:
        if (os.path.isfile(
                _meta_.lib_path + "{0}_repo/PACKAGES.TXT".format(repo))):
            packages = Utils().read_file(_meta_.lib_path + "{0}_repo/"
                                         "PACKAGES.TXT".format(repo))
    for line in packages.splitlines():
        if repo == "sbo":
            if line.startswith("SLACKBUILD NAME: "):
                pkg_list.append(line[17:].strip())
        elif "local" not in repo:
            if line.startswith("PACKAGE NAME: "):
                pkg_list.append(line[15:].strip())
    if repo == "local":
        pkg_list = find_package("", _meta_.pkg_path)
    return pkg_list
コード例 #5
0
ファイル: tracking.py プロジェクト: fatman2021/slpkg
def track_dep(name, repo):
    """
    View tree of dependencies and also
    highlight packages with color green
    if allready installed and color red
    if not installed.
    """
    Msg().resolving()
    if repo == "sbo":
        dependencies_list = Requires(flag="").sbo(name)
        find_pkg = sbo_search_pkg(name)
    else:
        PACKAGES_TXT = Utils().read_file(_meta_.lib_path + "{0}_repo/"
                                         "PACKAGES.TXT".format(repo))
        names = Utils().package_name(PACKAGES_TXT)
        black = BlackList().packages(names, repo)
        dependencies_list = Dependencies(names, repo, black).binary(
            name, flag="")
        find_pkg = search_pkg(name, repo)
    Msg().done()
    if find_pkg:
        requires, dependencies = [], []
        requires = Utils().dimensional_list(dependencies_list)
        requires.reverse()
        dependencies = Utils().remove_dbs(requires)
        if dependencies == []:
            dependencies = ["No dependencies"]
        pkg_len = len(name) + 24
        print("")    # new line at start
        Msg().template(pkg_len)
        print("| Package {0}{1}{2} dependencies :".format(_meta_.color["CYAN"],
                                                          name,
                                                          _meta_.color["ENDC"]))
        Msg().template(pkg_len)
        print("\\")
        print(" +---{0}[ Tree of dependencies ]{1}".format(
            _meta_.color["YELLOW"], _meta_.color["ENDC"]))
        index = 0
        for pkg in dependencies:
            index += 1
            installed = ""
            if find_package(pkg + _meta_.sp, _meta_.pkg_path):
                if _meta_.use_colors in ["off", "OFF"]:
                    installed = "*"
                print(" |")
                print(" {0}{1}: {2}{3}{4} {5}".format("+--", index,
                                                      _meta_.color["GREEN"],
                                                      pkg, _meta_.color["ENDC"],
                                                      installed))
            else:
                print(" |")
                print(" {0}{1}: {2}{3}{4} {5}".format("+--", index,
                                                      _meta_.color["RED"], pkg,
                                                      _meta_.color["ENDC"],
                                                      installed))
        if _meta_.use_colors in ["off", "OFF"]:
            print("\n *: Installed\n")
        else:
            print("")    # new line at end
    else:
        print("\nNo package was found to match\n")