mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
update messages, fix create build_path
This commit is contained in:
parent
776be404d0
commit
47278d792d
8 changed files with 88 additions and 44 deletions
|
@ -27,12 +27,17 @@ import sys
|
||||||
from slpkg.sizes import units
|
from slpkg.sizes import units
|
||||||
from slpkg.remove import delete
|
from slpkg.remove import delete
|
||||||
from slpkg.log_deps import write_deps
|
from slpkg.log_deps import write_deps
|
||||||
from slpkg.messages import template
|
|
||||||
from slpkg.checksum import check_md5
|
from slpkg.checksum import check_md5
|
||||||
from slpkg.blacklist import BlackList
|
from slpkg.blacklist import BlackList
|
||||||
from slpkg.downloader import Download
|
from slpkg.downloader import Download
|
||||||
from slpkg.grep_md5 import pkg_checksum
|
from slpkg.grep_md5 import pkg_checksum
|
||||||
from slpkg.splitting import split_package
|
from slpkg.splitting import split_package
|
||||||
|
from slpkg.messages import (
|
||||||
|
template,
|
||||||
|
msg_done,
|
||||||
|
msg_reading,
|
||||||
|
msg_resolving
|
||||||
|
)
|
||||||
from slpkg.utils import (
|
from slpkg.utils import (
|
||||||
remove_dbs,
|
remove_dbs,
|
||||||
dimensional_list
|
dimensional_list
|
||||||
|
@ -69,9 +74,7 @@ class BinaryInstall(object):
|
||||||
self.dependencies = []
|
self.dependencies = []
|
||||||
self.deps_dict = {}
|
self.deps_dict = {}
|
||||||
self.answer = ''
|
self.answer = ''
|
||||||
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
msg_reading()
|
||||||
color['GREY'], color['ENDC']))
|
|
||||||
sys.stdout.flush()
|
|
||||||
self.PACKAGES_TXT, self.mirror = RepoInit(self.repo).fetch()
|
self.PACKAGES_TXT, self.mirror = RepoInit(self.repo).fetch()
|
||||||
num_lines = sum(1 for line in self.PACKAGES_TXT)
|
num_lines = sum(1 for line in self.PACKAGES_TXT)
|
||||||
self.step = (num_lines / 700)
|
self.step = (num_lines / 700)
|
||||||
|
@ -87,16 +90,14 @@ class BinaryInstall(object):
|
||||||
self.packages, self.pkg_ver = self.packages[0], self.packages[1]
|
self.packages, self.pkg_ver = self.packages[0], self.packages[1]
|
||||||
mas_sum = dep_sum = sums = [0, 0, 0]
|
mas_sum = dep_sum = sums = [0, 0, 0]
|
||||||
self.pkg_exist()
|
self.pkg_exist()
|
||||||
sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
|
msg_done()
|
||||||
color['ENDC']))
|
|
||||||
self.dependencies = self.resolving_deps()
|
self.dependencies = self.resolving_deps()
|
||||||
(self.dep_dwn, self.dep_install, self.dep_comp_sum,
|
(self.dep_dwn, self.dep_install, self.dep_comp_sum,
|
||||||
self.dep_uncomp_sum) = self.store(self.dependencies)
|
self.dep_uncomp_sum) = self.store(self.dependencies)
|
||||||
self.packages = self.clear_masters()
|
self.packages = self.clear_masters()
|
||||||
(self.dwn, self.install, self.comp_sum,
|
(self.dwn, self.install, self.comp_sum,
|
||||||
self.uncomp_sum) = self.store(self.packages)
|
self.uncomp_sum) = self.store(self.packages)
|
||||||
sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
|
msg_done()
|
||||||
color['ENDC']))
|
|
||||||
print("") # new line at start
|
print("") # new line at start
|
||||||
if self.install:
|
if self.install:
|
||||||
self.top_view()
|
self.top_view()
|
||||||
|
@ -221,9 +222,7 @@ class BinaryInstall(object):
|
||||||
Return package dependencies
|
Return package dependencies
|
||||||
'''
|
'''
|
||||||
requires = []
|
requires = []
|
||||||
sys.stdout.write("{0}Resolving dependencies ...{1}".format(
|
msg_resolving()
|
||||||
color['GREY'], color['ENDC']))
|
|
||||||
sys.stdout.flush()
|
|
||||||
for dep in self.packages:
|
for dep in self.packages:
|
||||||
dependencies = []
|
dependencies = []
|
||||||
dependencies = dimensional_list(Dependencies(self.PACKAGES_TXT,
|
dependencies = dimensional_list(Dependencies(self.PACKAGES_TXT,
|
||||||
|
|
|
@ -66,13 +66,13 @@ class Case(object):
|
||||||
self.release = slack_rel
|
self.release = slack_rel
|
||||||
|
|
||||||
def sbo_install(self):
|
def sbo_install(self):
|
||||||
SBoInstall(self.package).start()
|
SBoInstall(self.package).start(False)
|
||||||
|
|
||||||
def binary_install(self, repo):
|
def binary_install(self, repo):
|
||||||
BinaryInstall(self.package, repo, self.release).start(False)
|
BinaryInstall(self.package, repo, self.release).start(False)
|
||||||
|
|
||||||
def sbo_upgrade(self):
|
def sbo_upgrade(self):
|
||||||
SBoInstall(sbo_upgrade()).start()
|
SBoInstall(sbo_upgrade()).start(True)
|
||||||
|
|
||||||
def slack_upgrade(self):
|
def slack_upgrade(self):
|
||||||
Patches(self.release).start()
|
Patches(self.release).start()
|
||||||
|
|
|
@ -76,3 +76,19 @@ def template(max_len):
|
||||||
Print template
|
Print template
|
||||||
'''
|
'''
|
||||||
print("+" + "=" * max_len)
|
print("+" + "=" * max_len)
|
||||||
|
|
||||||
|
|
||||||
|
def msg_reading():
|
||||||
|
sys.stdout.write("{0}Reading package lists ...{1}".format(color['GREY'],
|
||||||
|
color['ENDC']))
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
||||||
|
def msg_resolving():
|
||||||
|
sys.stdout.write("{0}Resolving dependencies ...{1}".format(color['GREY'],
|
||||||
|
color['ENDC']))
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
||||||
|
def msg_done():
|
||||||
|
sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
|
||||||
|
|
|
@ -43,19 +43,21 @@ def sbo_upgrade():
|
||||||
try:
|
try:
|
||||||
sys.stdout.write("{0}Checking ...{1}".format(color['GREY'],
|
sys.stdout.write("{0}Checking ...{1}".format(color['GREY'],
|
||||||
color['ENDC']))
|
color['ENDC']))
|
||||||
upgrade_names = []
|
upgrade_names, pkg_ver = [], []
|
||||||
index, toolbar_width = 0, 3
|
index, toolbar_width = 0, 3
|
||||||
for pkg in sbo_list():
|
for pkg in sbo_list():
|
||||||
index += 1
|
index += 1
|
||||||
toolbar_width = status(index, toolbar_width, 4)
|
toolbar_width = status(index, toolbar_width, 4)
|
||||||
name = split_package(pkg)[0]
|
name = split_package(pkg)[0]
|
||||||
|
ver = split_package(pkg)[1]
|
||||||
if sbo_search_pkg(name):
|
if sbo_search_pkg(name):
|
||||||
sbo_package = ("{0}-{1}".format(name, SBoGrep(name).version()))
|
sbo_package = ("{0}-{1}".format(name, SBoGrep(name).version()))
|
||||||
package = ("{0}-{1}".format(name, split_package(pkg)[1]))
|
package = ("{0}-{1}".format(name, ver))
|
||||||
if sbo_package > package:
|
if sbo_package > package:
|
||||||
upgrade_names.append(name)
|
upgrade_names.append(name)
|
||||||
|
pkg_ver.append(ver)
|
||||||
sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
|
sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
|
||||||
return upgrade_names
|
return upgrade_names, pkg_ver
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("") # new line at exit
|
print("") # new line at exit
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
|
@ -34,8 +34,11 @@ from slpkg.utils import (
|
||||||
)
|
)
|
||||||
from slpkg.messages import (
|
from slpkg.messages import (
|
||||||
template,
|
template,
|
||||||
|
msg_done,
|
||||||
pkg_found,
|
pkg_found,
|
||||||
build_FAILED
|
msg_reading,
|
||||||
|
build_FAILED,
|
||||||
|
msg_resolving
|
||||||
)
|
)
|
||||||
from slpkg.__metadata__ import (
|
from slpkg.__metadata__ import (
|
||||||
tmp,
|
tmp,
|
||||||
|
@ -71,12 +74,15 @@ class SBoInstall(object):
|
||||||
self.deps_dict = {}
|
self.deps_dict = {}
|
||||||
self.toolbar_width, self.index = 2, 0
|
self.toolbar_width, self.index = 2, 0
|
||||||
self.answer = ''
|
self.answer = ''
|
||||||
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
msg_reading()
|
||||||
color['GREY'], color['ENDC']))
|
|
||||||
sys.stdout.flush()
|
|
||||||
|
|
||||||
def start(self):
|
def start(self, if_upgrade):
|
||||||
try:
|
try:
|
||||||
|
self.if_upgrade, self.pkg_ver = if_upgrade, []
|
||||||
|
self.view_version()
|
||||||
|
if self.if_upgrade:
|
||||||
|
self.slackbuilds, self.pkg_ver = (self.slackbuilds[0],
|
||||||
|
self.slackbuilds[1])
|
||||||
tagc, match = '', False
|
tagc, match = '', False
|
||||||
count_ins = count_upg = count_uni = 0
|
count_ins = count_upg = count_uni = 0
|
||||||
for sbo in self.slackbuilds:
|
for sbo in self.slackbuilds:
|
||||||
|
@ -93,30 +99,38 @@ class SBoInstall(object):
|
||||||
if not self.package_found:
|
if not self.package_found:
|
||||||
match = True
|
match = True
|
||||||
self.package_found = self.matching(self.package_not_found)
|
self.package_found = self.matching(self.package_not_found)
|
||||||
self.dependencies, dep_src = self.sbo_version_source(
|
|
||||||
self.one_for_all(self.deps))
|
|
||||||
self.master_packages, mas_src = self.sbo_version_source(
|
self.master_packages, mas_src = self.sbo_version_source(
|
||||||
self.package_found)
|
self.package_found)
|
||||||
sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
|
msg_done()
|
||||||
color['ENDC']))
|
msg_resolving()
|
||||||
|
self.dependencies, dep_src = self.sbo_version_source(
|
||||||
|
self.one_for_all(self.deps))
|
||||||
|
msg_done()
|
||||||
self.master_packages = self.clear_masters()
|
self.master_packages = self.clear_masters()
|
||||||
if self.package_found:
|
if self.package_found:
|
||||||
print("\nThe following packages will be automatically "
|
print("\nThe following packages will be automatically "
|
||||||
"installed or upgraded \nwith new version:\n")
|
"installed or upgraded \nwith new version:\n")
|
||||||
self.top_view()
|
self.top_view()
|
||||||
for sbo, ar in zip(self.master_packages, mas_src):
|
# view master packages
|
||||||
|
for sbo, ver, ar in zip(self.master_packages, self.pkg_ver,
|
||||||
|
mas_src):
|
||||||
tagc, count_ins, count_upg, count_uni = self.tag(
|
tagc, count_ins, count_upg, count_uni = self.tag(
|
||||||
sbo, count_ins, count_upg, count_uni)
|
sbo, count_ins, count_upg, count_uni)
|
||||||
self.view_packages(tagc, '-'.join(sbo.split('-')[:-1]),
|
name = '-'.join(sbo.split('-')[:-1]) + '-' + ver
|
||||||
sbo.split('-')[-1], self.select_arch(ar))
|
if not if_upgrade:
|
||||||
|
name = '-'.join(sbo.split('-')[:-1])
|
||||||
|
self.view_packages(tagc, name, sbo.split('-')[-1],
|
||||||
|
self.select_arch(ar))
|
||||||
if not match and self.dependencies:
|
if not match and self.dependencies:
|
||||||
print("Installing for dependencies:")
|
print("Installing for dependencies:")
|
||||||
|
# view dependencies
|
||||||
for dep, ar in zip(self.dependencies, dep_src):
|
for dep, ar in zip(self.dependencies, dep_src):
|
||||||
tagc, count_ins, count_upg, count_uni = self.tag(
|
tagc, count_ins, count_upg, count_uni = self.tag(
|
||||||
dep, count_ins, count_upg, count_uni)
|
dep, count_ins, count_upg, count_uni)
|
||||||
self.view_packages(tagc, '-'.join(dep.split('-')[:-1]),
|
name = '-'.join(dep.split('-')[:-1])
|
||||||
dep.split('-')[-1], self.select_arch(ar))
|
self.view_packages(tagc, name, dep.split('-')[-1],
|
||||||
|
self.select_arch(ar))
|
||||||
count_total = (count_ins + count_upg + count_uni)
|
count_total = (count_ins + count_upg + count_uni)
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
|
@ -211,6 +225,15 @@ class SBoInstall(object):
|
||||||
"Size"))
|
"Size"))
|
||||||
template(78)
|
template(78)
|
||||||
|
|
||||||
|
def view_version(self):
|
||||||
|
'''
|
||||||
|
Create empty seats if not upgrade
|
||||||
|
'''
|
||||||
|
if not self.if_upgrade:
|
||||||
|
i = 0
|
||||||
|
for i in range(len(self.slackbuilds)):
|
||||||
|
self.pkg_ver.append('')
|
||||||
|
|
||||||
def view_packages(self, *args):
|
def view_packages(self, *args):
|
||||||
'''
|
'''
|
||||||
View slackbuild packages with version and arch
|
View slackbuild packages with version and arch
|
||||||
|
@ -303,6 +326,8 @@ class SBoInstall(object):
|
||||||
'''
|
'''
|
||||||
slackbuilds = self.dependencies + self.master_packages
|
slackbuilds = self.dependencies + self.master_packages
|
||||||
installs, upgraded, versions = [], [], []
|
installs, upgraded, versions = [], [], []
|
||||||
|
if not os.path.exists(build_path):
|
||||||
|
os.makedirs(build_path)
|
||||||
os.chdir(build_path)
|
os.chdir(build_path)
|
||||||
for sbo in slackbuilds:
|
for sbo in slackbuilds:
|
||||||
pkg = '-'.join(sbo.split('-')[:-1])
|
pkg = '-'.join(sbo.split('-')[:-1])
|
||||||
|
|
|
@ -203,6 +203,8 @@ class SBoNetwork(object):
|
||||||
color['ENDC']))
|
color['ENDC']))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
sources = []
|
sources = []
|
||||||
|
if not os.path.exists(build_path):
|
||||||
|
os.makedirs(build_path)
|
||||||
os.chdir(build_path)
|
os.chdir(build_path)
|
||||||
Download(build_path, self.dwn_srcs).start()
|
Download(build_path, self.dwn_srcs).start()
|
||||||
script = self.sbo_dwn.split("/")[-1]
|
script = self.sbo_dwn.split("/")[-1]
|
||||||
|
|
|
@ -28,12 +28,16 @@ import subprocess
|
||||||
from slpkg.sizes import units
|
from slpkg.sizes import units
|
||||||
from slpkg.url_read import URL
|
from slpkg.url_read import URL
|
||||||
from slpkg.remove import delete
|
from slpkg.remove import delete
|
||||||
from slpkg.messages import template
|
|
||||||
from slpkg.checksum import check_md5
|
from slpkg.checksum import check_md5
|
||||||
from slpkg.blacklist import BlackList
|
from slpkg.blacklist import BlackList
|
||||||
from slpkg.downloader import Download
|
from slpkg.downloader import Download
|
||||||
from slpkg.grep_md5 import pkg_checksum
|
from slpkg.grep_md5 import pkg_checksum
|
||||||
from slpkg.splitting import split_package
|
from slpkg.splitting import split_package
|
||||||
|
from slpkg.messages import (
|
||||||
|
template,
|
||||||
|
msg_done,
|
||||||
|
msg_reading
|
||||||
|
)
|
||||||
from slpkg.__metadata__ import (
|
from slpkg.__metadata__ import (
|
||||||
pkg_path,
|
pkg_path,
|
||||||
slpkg_tmp_patches,
|
slpkg_tmp_patches,
|
||||||
|
@ -55,13 +59,11 @@ class Patches(object):
|
||||||
def __init__(self, version):
|
def __init__(self, version):
|
||||||
self.version = version
|
self.version = version
|
||||||
self.patch_path = slpkg_tmp_patches
|
self.patch_path = slpkg_tmp_patches
|
||||||
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
msg_reading()
|
||||||
color['GREY'], color['ENDC']))
|
|
||||||
sys.stdout.flush()
|
|
||||||
if self.version == "stable":
|
if self.version == "stable":
|
||||||
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT",
|
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT",
|
||||||
"patches/")).reading()
|
"patches/")).reading()
|
||||||
self.step = 10
|
self.step = 20
|
||||||
else:
|
else:
|
||||||
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "")).reading()
|
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "")).reading()
|
||||||
self.step = 700
|
self.step = 700
|
||||||
|
@ -73,8 +75,7 @@ class Patches(object):
|
||||||
try:
|
try:
|
||||||
(pkg_for_upgrade, dwn_links, upgrade_all, comp_sum,
|
(pkg_for_upgrade, dwn_links, upgrade_all, comp_sum,
|
||||||
uncomp_sum) = self.store()
|
uncomp_sum) = self.store()
|
||||||
sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
|
msg_done()
|
||||||
color['ENDC']))
|
|
||||||
if upgrade_all:
|
if upgrade_all:
|
||||||
print("\nThese packages need upgrading:\n")
|
print("\nThese packages need upgrading:\n")
|
||||||
template(78)
|
template(78)
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from utils import (
|
from utils import (
|
||||||
read_file,
|
read_file,
|
||||||
|
@ -29,7 +28,9 @@ from utils import (
|
||||||
dimensional_list
|
dimensional_list
|
||||||
)
|
)
|
||||||
from messages import (
|
from messages import (
|
||||||
template
|
template,
|
||||||
|
msg_done,
|
||||||
|
msg_resolving
|
||||||
)
|
)
|
||||||
from __metadata__ import (
|
from __metadata__ import (
|
||||||
lib_path,
|
lib_path,
|
||||||
|
@ -54,9 +55,7 @@ def track_dep(name, repo):
|
||||||
if allready installed and color red
|
if allready installed and color red
|
||||||
if not installed.
|
if not installed.
|
||||||
'''
|
'''
|
||||||
sys.stdout.write("{0}Reading package lists ...{1}".format(color['GREY'],
|
msg_resolving()
|
||||||
color['ENDC']))
|
|
||||||
sys.stdout.flush()
|
|
||||||
if repo == "sbo":
|
if repo == "sbo":
|
||||||
dependencies_list = Requires().sbo(name)
|
dependencies_list = Requires().sbo(name)
|
||||||
find_pkg = sbo_search_pkg(name)
|
find_pkg = sbo_search_pkg(name)
|
||||||
|
@ -65,7 +64,7 @@ def track_dep(name, repo):
|
||||||
repo))
|
repo))
|
||||||
dependencies_list = Dependencies(PACKAGES_TXT, repo).binary(name)
|
dependencies_list = Dependencies(PACKAGES_TXT, repo).binary(name)
|
||||||
find_pkg = search_pkg(name, repo)
|
find_pkg = search_pkg(name, repo)
|
||||||
sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
|
msg_done()
|
||||||
if find_pkg:
|
if find_pkg:
|
||||||
requires, dependencies = [], []
|
requires, dependencies = [], []
|
||||||
requires = dimensional_list(dependencies_list)
|
requires = dimensional_list(dependencies_list)
|
||||||
|
|
Loading…
Reference in a new issue