Merge branch 'develop'

This commit is contained in:
Dimitris Zlatanidis 2022-04-02 21:34:10 +03:00
commit ecfaed109b
12 changed files with 44 additions and 41 deletions

View file

@ -1,3 +1,7 @@
3.9.5 - 02/04/2022
BugFix:
- Config variable ONLY_INSTALLED when is set on
3.9.4 - 26/03/2022 3.9.4 - 26/03/2022
BugFix: BugFix:
- Check if a virtual environment exists before run - Check if a virtual environment exists before run

View file

@ -1399,7 +1399,7 @@ Check for the installed packages:
>>> GetFromInstalled(package="ffmpeg").name() >>> GetFromInstalled(package="ffmpeg").name()
'ffmpeg' 'ffmpeg'
>>> GetFromInstalled(package="ffmpeg").version() >>> GetFromInstalled(package="ffmpeg").version()
'-3.2.4' '3.2.4'
``` ```
##### Copyright ##### Copyright

View file

@ -60,7 +60,7 @@ DEL_ALL=on
DEL_BUILD=off DEL_BUILD=off
# Keep build log file if SBO_BUILD_LOG is "on". Default is "on". # Keep build log file if SBO_BUILD_LOG is "on". Default is "on".
SBO_BUILD_LOG=on SBO_BUILD_LOG=off
# Speed up SlackBuild scripts. If "on" slpkg auto detect the numbers of # Speed up SlackBuild scripts. If "on" slpkg auto detect the numbers of
# processor and apply into MAKEFLAGS variable. Some SlackBuilds fail if # processor and apply into MAKEFLAGS variable. Some SlackBuilds fail if

View file

@ -1,20 +0,0 @@
#!/bin/sh
#
# The Python2 source is the definitive source.
# This script uses 2to3-3.2 to create a new python3/slpkg
# source tree that works under Python 3.
# (Thanks beautifulsoup4 for the script).
#
# ******************************** WARNING ***********************************
# There are some issues here, please do not use before Slackware 15.0 release.
# ****************************************************************************
echo "About to destroy and rebuild the py3k/slpkg directory."
rm -rf py3k/slpkg
mkdir -p py3k/slpkg
cp -rf * py3k/slpkg
2to3 -w py3k/slpkg
echo ""
echo "OK, conversion is done."
echo "Now running the unit tests."
(cd py3k && python3 -m unittest discover -s slpkg)

View file

@ -76,7 +76,7 @@ class MetaData:
__all__ = "slpkg" __all__ = "slpkg"
__author__ = "dslackw" __author__ = "dslackw"
__version_info__ = (3, 9, 4) __version_info__ = (3, 9, 5)
__version__ = "{0}.{1}.{2}".format(*__version_info__) __version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)" __license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com" __email__ = "d.zlatanidis@gmail.com"

View file

@ -244,7 +244,7 @@ class BinaryInstall(BlackList, Utils):
installed""" installed"""
name = split_package(package)[0] name = split_package(package)[0]
rep_ver = split_package(package)[1] rep_ver = split_package(package)[1]
ins_ver = GetFromInstalled(name).version()[1:] ins_ver = GetFromInstalled(name).version()
if not ins_ver: if not ins_ver:
ins_ver = "0" ins_ver = "0"
if parse_version(rep_ver) < parse_version(ins_ver): if parse_version(rep_ver) < parse_version(ins_ver):
@ -301,6 +301,8 @@ class BinaryInstall(BlackList, Utils):
COLOR = self.meta.color["RED"] COLOR = self.meta.color["RED"]
uni_sum += 1 uni_sum += 1
ver = GetFromInstalled(pkg_repo[0]).version() ver = GetFromInstalled(pkg_repo[0]).version()
if ver:
ver = f"-{ver}"
print(f" {COLOR}{pkg_repo[0] + ver}{self.endc}" print(f" {COLOR}{pkg_repo[0] + ver}{self.endc}"
f"{' ' * (23-len(pkg_repo[0] + ver))} {pkg_repo[1]}" f"{' ' * (23-len(pkg_repo[0] + ver))} {pkg_repo[1]}"
f"{' ' * (18-len(pkg_repo[1]))} {pkg_repo[2]}" f"{' ' * (18-len(pkg_repo[1]))} {pkg_repo[2]}"

View file

@ -312,7 +312,7 @@ class ArgParse(BlackList):
# Remove --checklist flag from args so that works with # Remove --checklist flag from args so that works with
# both conditions # both conditions
#if flags[3] in self.args: # if flags[3] in self.args:
# self.args.remove(flags[3]) # self.args.remove(flags[3])
if (len(self.args) >= 3 and self.args[0] in options and if (len(self.args) >= 3 and self.args[0] in options and
@ -322,10 +322,6 @@ class ArgParse(BlackList):
BinaryInstall(pkg_upgrade(self.args[1], skip, flag), BinaryInstall(pkg_upgrade(self.args[1], skip, flag),
self.args[1], flag).start(is_upgrade=True) self.args[1], flag).start(is_upgrade=True)
elif self.args[1] == "slack": elif self.args[1] == "slack":
if self.meta.only_installed in ["on", "ON"]:
BinaryInstall(pkg_upgrade("slack", skip, flag),
"slack", flag).start(is_upgrade=True)
else:
Patches(skip, flag).start() Patches(skip, flag).start()
elif self.args[1] == "sbo": elif self.args[1] == "sbo":
SBoInstall(sbo_upgrade(skip, flag), flag).start( SBoInstall(sbo_upgrade(skip, flag), flag).start(

View file

@ -46,7 +46,7 @@ class GetFromInstalled:
"""Return version from installed packages """Return version from installed packages
""" """
if self.find: if self.find:
return self.meta.sp + split_package(self.find)[1] return split_package(self.find)[1]
return "" return ""
def name(self): def name(self):

View file

@ -187,7 +187,8 @@ class PackageManager(Utils):
for pkg in self.binary: for pkg in self.binary:
name = GetFromInstalled(pkg).name() name = GetFromInstalled(pkg).name()
ver = GetFromInstalled(pkg).version() ver = GetFromInstalled(pkg).version()
package = find_package(f"{name}{ver}{self.meta.sp}", self.meta.pkg_path) package = find_package(f"{name}-{ver}{self.meta.sp}",
self.meta.pkg_path)
if pkg and name == pkg: if pkg and name == pkg:
removed.append(pkg) removed.append(pkg)
packages.append(package[0]) packages.append(package[0])
@ -257,7 +258,7 @@ class PackageManager(Utils):
for dep in dependencies: for dep in dependencies:
if GetFromInstalled(dep).name(): if GetFromInstalled(dep).name():
ver = GetFromInstalled(dep).version() ver = GetFromInstalled(dep).version()
packages.append(dep + ver) packages.append(f"{dep}-{ver}")
else: else:
dependencies.remove(dep) dependencies.remove(dep)
if packages: if packages:
@ -307,7 +308,7 @@ class PackageManager(Utils):
for dep in dependencies: for dep in dependencies:
if dep not in self.skip and GetFromInstalled(dep).name(): if dep not in self.skip and GetFromInstalled(dep).name():
ver = GetFromInstalled(dep).version() ver = GetFromInstalled(dep).version()
removes.append(dep + ver) removes.append(f"{dep}-{ver}")
self._removepkg(dep) self._removepkg(dep)
return removes return removes
@ -317,7 +318,7 @@ class PackageManager(Utils):
removes = [] removes = []
if GetFromInstalled(package).name() and package not in self.skip: if GetFromInstalled(package).name() and package not in self.skip:
ver = GetFromInstalled(package).version() ver = GetFromInstalled(package).version()
removes.append(package + ver) removes.append(f"{package}-{ver}")
self._removepkg(package) self._removepkg(package)
return removes return removes
@ -453,7 +454,7 @@ class PackageManager(Utils):
for pkg in self.binary: for pkg in self.binary:
name = GetFromInstalled(pkg).name() name = GetFromInstalled(pkg).name()
ver = GetFromInstalled(pkg).version() ver = GetFromInstalled(pkg).version()
find = find_package(f"{name}{ver}{self.meta.sp}", find = find_package(f"{name}-{ver}{self.meta.sp}",
self.meta.pkg_path) self.meta.pkg_path)
if find: if find:
package = self.read_file( package = self.read_file(

View file

@ -269,6 +269,8 @@ class SBoInstall(BlackList, Utils):
args[3] arch args[3] arch
""" """
ver = GetFromInstalled(args[1]).version() ver = GetFromInstalled(args[1]).version()
if ver:
ver = f"-{ver}"
print(f" {args[0]}{args[1] + ver} {self.endc}" print(f" {args[0]}{args[1] + ver} {self.endc}"
f"{' ' * (24-len(args[1] + ver))}{args[2]}" f"{' ' * (24-len(args[1] + ver))}{args[2]}"
f"{' ' * (18-len(args[2]))} {args[3]}" f"{' ' * (18-len(args[2]))} {args[3]}"
@ -372,7 +374,7 @@ class SBoInstall(BlackList, Utils):
installed""" installed"""
name = "-".join(prgnam.split("-")[:-1]) name = "-".join(prgnam.split("-")[:-1])
sbo_ver = prgnam.split("-")[-1] sbo_ver = prgnam.split("-")[-1]
ins_ver = GetFromInstalled(name).version()[1:] ins_ver = GetFromInstalled(name).version()
if not ins_ver: if not ins_ver:
ins_ver = "0" ins_ver = "0"
if parse_version(sbo_ver) < parse_version(ins_ver): if parse_version(sbo_ver) < parse_version(ins_ver):

View file

@ -104,8 +104,8 @@ class Patches(BlackList, Utils):
f"{self.msg.pkg(len(self.upgrade_all))} will be upgraded and" f"{self.msg.pkg(len(self.upgrade_all))} will be upgraded and"
f" {self.count_added} will be installed.") f" {self.count_added} will be installed.")
print(f"Need to get {size[0]} {unit[0]} of archives.") print(f"Need to get {size[0]} {unit[0]} of archives.")
print(f"After this process, {size[1]} {unit[1]} of additional disk space " print(f"After this process, {size[1]} {unit[1]} of additional disk"
f"will be used.{self.endc}") f" space will be used.{self.endc}")
print() print()
if self.msg.answer() in ["y", "Y"]: if self.msg.answer() in ["y", "Y"]:
Download(self.patch_path, self.dwn_links, Download(self.patch_path, self.dwn_links,
@ -136,7 +136,23 @@ class Patches(BlackList, Utils):
black = list(self.get_black()) black = list(self.get_black())
for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]): for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]):
repo_pkg_name = split_package(name)[0] repo_pkg_name = split_package(name)[0]
if (not os.path.isfile(self.meta.pkg_path + name[:-4]) and if self.meta.only_installed in ["on", "ON"]:
pkg_name = split_package(name)[0]
pkg_ver = split_package(name)[1]
if (GetFromInstalled(pkg_name).name() and
repo_pkg_name not in black and
repo_pkg_name not in self.skip and
pkg_ver > GetFromInstalled(pkg_name).version()):
self.dwn_links.append(f"{mirrors('', '')}{loc}/{name}")
self.comp_sum.append(comp)
self.uncomp_sum.append(uncomp)
self.upgrade_all.append(name)
self.count_upg += 1
if not find_package(repo_pkg_name + self.meta.sp,
self.meta.pkg_path):
self.count_added += 1
self.count_upg -= 1
elif (not os.path.isfile(self.meta.pkg_path + name[:-4]) and
repo_pkg_name not in black and repo_pkg_name not in black and
repo_pkg_name not in self.skip): repo_pkg_name not in self.skip):
self.dwn_links.append(f"{mirrors('', '')}{loc}/{name}") self.dwn_links.append(f"{mirrors('', '')}{loc}/{name}")
@ -187,6 +203,8 @@ class Patches(BlackList, Utils):
if pkg_repo[0] == pkg_inst: if pkg_repo[0] == pkg_inst:
color = self.yellow color = self.yellow
ver = GetFromInstalled(pkg_repo[0]).version() ver = GetFromInstalled(pkg_repo[0]).version()
if ver:
ver = f"-{ver}"
print(f" {color}{pkg_repo[0] + ver}{self.endc}" print(f" {color}{pkg_repo[0] + ver}{self.endc}"
f"{' ' * (23-len(pkg_repo[0] + ver))} {pkg_repo[1]}" f"{' ' * (23-len(pkg_repo[0] + ver))} {pkg_repo[1]}"
f"{' ' * (18-len(pkg_repo[1]))} {pkg_repo[2]}" f"{' ' * (18-len(pkg_repo[1]))} {pkg_repo[2]}"

View file

@ -38,7 +38,7 @@ def choose_upg(packages):
for pkg in packages: for pkg in packages:
name = GetFromInstalled(pkg).name() name = GetFromInstalled(pkg).name()
ver = GetFromInstalled(pkg).version() ver = GetFromInstalled(pkg).version()
binary = f"{name}{ver}" binary = f"{name}-{ver}"
installed = find_package(binary + _meta_.sp, _meta_.pkg_path)[0] installed = find_package(binary + _meta_.sp, _meta_.pkg_path)[0]
data.append(installed) data.append(installed)
text = "Press 'spacebar' to unchoose packages from upgrade" text = "Press 'spacebar' to unchoose packages from upgrade"