mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-30 20:34:38 +01:00
add repos in tracking
This commit is contained in:
parent
d1897ba1d5
commit
533e5668b2
9 changed files with 136 additions and 95 deletions
|
@ -45,11 +45,10 @@ def options():
|
|||
" -c, <repository> --upgrade check for updated " +
|
||||
"packages",
|
||||
" -s, <repository> <package> download, build & install",
|
||||
" -t, <repository> <package> tracking dependencies",
|
||||
" -p, <repository> <package> --color= print package description",
|
||||
" red, green, yellow, cyan, grey colors support",
|
||||
" -f, <package> find installed packages",
|
||||
" -t, <package> tracking dependencies " +
|
||||
"from SBo",
|
||||
" -n, <package> view packages from SBo",
|
||||
" -i, [package...] install binary packages",
|
||||
" -u, [package...] upgrade binary packages",
|
||||
|
@ -74,12 +73,14 @@ def usage():
|
|||
"Usage: slpkg [-h] [-v] [-a script.tar.gz [sources...]]",
|
||||
" [-b --list, [...] --add, --remove]",
|
||||
" [-q --list, [...] --add, --remove]",
|
||||
" [-q --build, --install, --build-install]",
|
||||
" [ --build, --install, --build-install]",
|
||||
" [-l <repository>, all, noarch]",
|
||||
" [-c <repository> --upgrade]",
|
||||
" [-s <repository> <package>]",
|
||||
" [-p <repository> <package>]",
|
||||
" [-f] [-t] [-n] [-i [...]] [-u [...]]",
|
||||
" [-t <repository> <package>]",
|
||||
" [-p <repository> <package> --color=]",
|
||||
" [ red, green, yellow, cyan, grey]",
|
||||
" [-f] [-n] [-i [...]] [-u [...]]",
|
||||
" [-o [...]] [-r [...]] [-d [...]]\n",
|
||||
"For more information try 'slpkg --help'\n"
|
||||
]
|
||||
|
|
|
@ -27,6 +27,7 @@ import getpass
|
|||
from desc import PkgDesc
|
||||
from queue import QueuePkgs
|
||||
from messages import s_user
|
||||
from tracking import track_dep
|
||||
from blacklist import BlackList
|
||||
from version import prog_version
|
||||
from arguments import options, usage
|
||||
|
@ -38,7 +39,6 @@ from pkg.manager import PackageManager
|
|||
|
||||
from sbo.check import SBoCheck
|
||||
from sbo.views import SBoNetwork
|
||||
from sbo.tracking import track_dep
|
||||
from sbo.slackbuild import SBoInstall
|
||||
|
||||
from slack.install import Slack
|
||||
|
@ -134,8 +134,9 @@ def main():
|
|||
install[args[1]]()
|
||||
else:
|
||||
usage()
|
||||
elif len(args) == 2 and args[0] == "-t":
|
||||
track_dep(args[1])
|
||||
elif len(args) == 3 and args[0] == "-t" and args[1] in ["sbo", "alien",
|
||||
"rlw", "slacky"]:
|
||||
track_dep(args[2], args[1])
|
||||
elif len(args) == 2 and args[0] == "-n":
|
||||
SBoNetwork(args[1]).view()
|
||||
elif len(args) == 2 and args[0] == "-b" and args[1] == "--list":
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
import sys
|
||||
|
||||
from colors import GREY, ENDC
|
||||
from toolbar import status
|
||||
|
||||
from greps import repo_requires
|
||||
|
||||
|
@ -37,17 +37,18 @@ def dependencies_pkg(name, repo):
|
|||
try:
|
||||
dependencies = []
|
||||
requires = repo_requires(name, repo)
|
||||
toolbar_width, index = 2, 0
|
||||
if requires:
|
||||
for req in requires:
|
||||
index += 1
|
||||
toolbar_width = status(index, toolbar_width, 1)
|
||||
if req:
|
||||
dependencies.append(req)
|
||||
if dependencies:
|
||||
dep_results.append(dependencies)
|
||||
for dep in dependencies:
|
||||
sys.stdout.write("{0}.{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
dependencies_pkg(dep, repo)
|
||||
return dep_results
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
|
|
|
@ -107,17 +107,41 @@ def repo_requires(name, repo):
|
|||
'''
|
||||
Grap package requirements from alien repository
|
||||
'''
|
||||
lib = {
|
||||
'alien': lib_path + "alien_repo/PACKAGES.TXT",
|
||||
'slacky': lib_path + "slacky_repo/PACKAGES.TXT"
|
||||
}
|
||||
f = open(lib[repo], "r")
|
||||
PACKAGES_TXT = f.read()
|
||||
f.close()
|
||||
for line in PACKAGES_TXT.splitlines():
|
||||
if line.startswith("PACKAGE NAME: "):
|
||||
pkg = line[14:].strip()
|
||||
pkg_name = split_package(pkg)[0]
|
||||
if line.startswith("PACKAGE REQUIRED: "):
|
||||
if pkg_name == name:
|
||||
return line[18:].strip().split(",")
|
||||
slacky_deps = []
|
||||
if repo in ["alien", "slacky"]:
|
||||
lib = {
|
||||
'alien': lib_path + "alien_repo/PACKAGES.TXT",
|
||||
'slacky': lib_path + "slacky_repo/PACKAGES.TXT"
|
||||
}
|
||||
f = open(lib[repo], "r")
|
||||
PACKAGES_TXT = f.read()
|
||||
f.close()
|
||||
for line in PACKAGES_TXT.splitlines():
|
||||
if line.startswith("PACKAGE NAME: "):
|
||||
pkg = line[14:].strip()
|
||||
pkg_name = split_package(pkg)[0]
|
||||
if line.startswith("PACKAGE REQUIRED: "):
|
||||
if pkg_name == name:
|
||||
if repo == "slacky":
|
||||
for dep in line[18:].strip().split(","):
|
||||
slacky_deps.append(dep.split()[0])
|
||||
return slacky_deps
|
||||
else:
|
||||
return line[18:].strip().split(",")
|
||||
elif repo == "rlw":
|
||||
'''
|
||||
Robby's repository dependencies as shown in the central page
|
||||
http://rlworkman.net/pkgs/
|
||||
'''
|
||||
dependencies = {
|
||||
"abiword": "wv",
|
||||
"claws-mail": "libetpan bogofilter html2ps",
|
||||
"inkscape": "gtkmm atkmm pangomm cairomm mm-common libsigc++ "
|
||||
"libwpg lxml gsl numpy BeautifulSoup",
|
||||
"texlive": "libsigsegv texi2html",
|
||||
"xfburn": "libburn libisofs"
|
||||
}
|
||||
if name in dependencies.keys():
|
||||
return dependencies[name].split()
|
||||
else:
|
||||
return ""
|
||||
|
|
|
@ -172,7 +172,7 @@ class OthersInstall(object):
|
|||
for pkg in deps:
|
||||
for name, loc, comp, uncomp in zip(data[0], data[1], data[2],
|
||||
data[3]):
|
||||
if name.startswith(pkg) and pkg not in black:
|
||||
if name.startswith(pkg + "-") and pkg not in black:
|
||||
# store downloads packages by repo
|
||||
dwn.append("{0}{1}/{2}".format(self.mirror, loc, name))
|
||||
install.append(name)
|
||||
|
@ -182,7 +182,7 @@ class OthersInstall(object):
|
|||
for name, loc, comp, uncomp in zip(data[0], data[1], data[2],
|
||||
data[3]):
|
||||
package = "".join(deps)
|
||||
if package in name and package not in BlackList().packages():
|
||||
if package in name and package not in black:
|
||||
# store downloads packages by repo
|
||||
dwn.append("{0}{1}/{2}".format(self.mirror, loc, name))
|
||||
install.append(name)
|
||||
|
@ -263,18 +263,18 @@ def install(tmp_path, install_all):
|
|||
PackageManager(package).upgrade()
|
||||
|
||||
|
||||
def repo_deps(name, repo):
|
||||
def resolving_deps(name, repo):
|
||||
'''
|
||||
Return package dependencies
|
||||
'''
|
||||
deps = dependencies_pkg(name, repo)
|
||||
requires, dependencies = [], []
|
||||
sys.stdout.write("{0}Resolving dependencies ...{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
deps = dependencies_pkg(name, repo)
|
||||
requires.append(name)
|
||||
# Create one list for all packages
|
||||
for pkg in deps:
|
||||
requires += pkg
|
||||
if repo == "slacky":
|
||||
requires = slacky_req_check(name, requires)
|
||||
requires.reverse()
|
||||
# Remove double dependencies
|
||||
for duplicate in requires:
|
||||
|
@ -283,59 +283,6 @@ def repo_deps(name, repo):
|
|||
return dependencies
|
||||
|
||||
|
||||
def rlw_deps(name):
|
||||
'''
|
||||
Robby's repository dependencies as shown in the central page
|
||||
http://rlworkman.net/pkgs/
|
||||
'''
|
||||
dependencies = {
|
||||
"abiword": "wv",
|
||||
"claws-mail": "libetpan bogofilter html2ps",
|
||||
"inkscape": "gtkmm atkmm pangomm cairomm mm-common libsigc++ libwpg" +
|
||||
"lxml gsl numpy BeautifulSoup",
|
||||
"texlive": "libsigsegv texi2html",
|
||||
"xfburn": "libburn libisofs"
|
||||
}
|
||||
if name in dependencies.keys():
|
||||
return dependencies[name]
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def resolving_deps(name, repo):
|
||||
'''
|
||||
Return dependencies for one package from
|
||||
alien repository
|
||||
'''
|
||||
dependencies = []
|
||||
sys.stdout.write("{0}Resolving dependencies ...{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
if repo == "alien" or repo == "slacky":
|
||||
dependencies = repo_deps(name, repo)
|
||||
elif repo == "rlw":
|
||||
dependencies = rlw_deps(name).split()
|
||||
dependencies.append(name)
|
||||
return dependencies
|
||||
|
||||
|
||||
def slacky_req_check(name, requires):
|
||||
'''
|
||||
Checks if the requirement is installed or if it is
|
||||
smaller version
|
||||
'''
|
||||
new = []
|
||||
for req in requires[1:]:
|
||||
split_req = req.split() # split requirements
|
||||
req_name = split_req[0] # store name
|
||||
installed = find_package(req_name + "-", pkg_path)
|
||||
if not installed:
|
||||
new.append(req_name)
|
||||
requires = []
|
||||
requires.append(name)
|
||||
requires += new
|
||||
return requires
|
||||
|
||||
|
||||
def write_deps(dependencies):
|
||||
'''
|
||||
Write dependencies in a log file
|
||||
|
|
52
slpkg/others/search.py
Executable file
52
slpkg/others/search.py
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# search.py file is part of slpkg.
|
||||
|
||||
# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
||||
# All rights reserved.
|
||||
|
||||
# Utility for easy management packages in Slackware
|
||||
|
||||
# https://github.com/dslackw/slpkg
|
||||
|
||||
# Slpkg 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.
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty 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, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
|
||||
from blacklist import BlackList
|
||||
from __metadata__ import lib_path
|
||||
from splitting import split_package
|
||||
|
||||
|
||||
def search_pkg(name, repo):
|
||||
'''
|
||||
Search if package exists in PACKAGES.TXT file
|
||||
and return the name.
|
||||
'''
|
||||
try:
|
||||
blacklist = BlackList().packages()
|
||||
repo_dir = {
|
||||
"rlw": "rlw_repo/PACKAGES.TXT",
|
||||
"alien": "alien_repo/PACKAGES.TXT",
|
||||
"slacky": "slacky_repo/PACKAGES.TXT"
|
||||
}
|
||||
with open(lib_path + repo_dir[repo], "r") as PACKAGES_TXT:
|
||||
for line in PACKAGES_TXT:
|
||||
if line.startswith("PACKAGE NAME: "):
|
||||
pkg_name = split_package(line[15:])[0].strip()
|
||||
if name == pkg_name and name not in blacklist:
|
||||
PACKAGES_TXT.close()
|
||||
return pkg_name
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
sys.exit()
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
import sys
|
||||
|
||||
from colors import GREY, ENDC
|
||||
from toolbar import status
|
||||
from blacklist import BlackList
|
||||
|
||||
from greps import SBoGrep
|
||||
|
@ -39,8 +39,11 @@ def sbo_dependencies_pkg(name):
|
|||
dependencies = []
|
||||
blacklist = BlackList().packages()
|
||||
requires = SBoGrep(name).requires()
|
||||
toolbar_width, index = 2, 0
|
||||
if requires:
|
||||
for req in requires:
|
||||
index += 1
|
||||
toolbar_width = status(index, toolbar_width, 1)
|
||||
# avoid to add %README% as dependency and
|
||||
# if require in blacklist
|
||||
if "%README%" not in req and req not in blacklist:
|
||||
|
@ -48,10 +51,8 @@ def sbo_dependencies_pkg(name):
|
|||
if dependencies:
|
||||
dep_results.append(dependencies)
|
||||
for dep in dependencies:
|
||||
sys.stdout.write("{0}.{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
sbo_dependencies_pkg(dep)
|
||||
return dep_results
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
|
|
|
@ -64,12 +64,12 @@ class SBoInstall(object):
|
|||
try:
|
||||
if self.dependencies_list or sbo_search_pkg(self.name) is not None:
|
||||
dependencies = self.remove_dbs()
|
||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
||||
# sbo versions = idata[0]
|
||||
# package arch = idata[1]
|
||||
# package sum = idata[2]
|
||||
# sources = idata[3]
|
||||
idata = installing_data(dependencies, self.UNST)
|
||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
||||
# count upgraded = cnt[0]
|
||||
# count installed = cnt[1]
|
||||
(PKG_COLOR, count) = pkg_colors_tag(self.name, idata[0], 0, 0)
|
||||
|
@ -176,7 +176,12 @@ def installing_data(dependencies, support):
|
|||
'''
|
||||
package_sum = 0
|
||||
sbo_versions, package_arch = [], []
|
||||
sys.stdout.write("{0}Resolving dependencies ...{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
toolbar_width, index = 2, 0
|
||||
for pkg in dependencies:
|
||||
index += 1
|
||||
toolbar_width = status(index, toolbar_width, 1)
|
||||
version = SBoGrep(pkg).version()
|
||||
sbo_versions.append(version)
|
||||
sources = SBoGrep(pkg).source()
|
||||
|
@ -184,6 +189,7 @@ def installing_data(dependencies, support):
|
|||
sbo_package = ("{0}-{1}".format(pkg, version))
|
||||
if find_package(sbo_package, pkg_path):
|
||||
package_sum += 1
|
||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
||||
return [sbo_versions, package_arch, package_sum, sources]
|
||||
|
||||
|
||||
|
|
|
@ -30,11 +30,14 @@ from colors import RED, GREEN, GREY, YELLOW, CYAN, ENDC
|
|||
|
||||
from pkg.find import find_package
|
||||
|
||||
from search import sbo_search_pkg
|
||||
from dependency import sbo_dependencies_pkg
|
||||
from sbo.search import sbo_search_pkg
|
||||
from sbo.dependency import sbo_dependencies_pkg
|
||||
|
||||
from others.dependency import dependencies_pkg
|
||||
from others.search import search_pkg
|
||||
|
||||
|
||||
def track_dep(name):
|
||||
def track_dep(name, repo):
|
||||
'''
|
||||
View tree of dependencies and also
|
||||
highlight packages with color green
|
||||
|
@ -44,9 +47,14 @@ def track_dep(name):
|
|||
Initialization().sbo()
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
dependencies_list = sbo_dependencies_pkg(name)
|
||||
if repo == "sbo":
|
||||
dependencies_list = sbo_dependencies_pkg(name)
|
||||
find_pkg = sbo_search_pkg(name)
|
||||
else:
|
||||
find_pkg = search_pkg(name, repo)
|
||||
dependencies_list = dependencies_pkg(name, repo)
|
||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
||||
if sbo_search_pkg(name):
|
||||
if find_pkg:
|
||||
requires, dependencies = [], []
|
||||
# Create one list for all packages
|
||||
for pkg in dependencies_list:
|
Loading…
Add table
Reference in a new issue