diff --git a/ChangeLog.txt b/ChangeLog.txt index e3fd9444..a2ce54ad 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -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 BugFix: - Check if a virtual environment exists before run diff --git a/EXAMPLES.md b/EXAMPLES.md index 5fc1ab78..8b3f3096 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -1399,7 +1399,7 @@ Check for the installed packages: >>> GetFromInstalled(package="ffmpeg").name() 'ffmpeg' >>> GetFromInstalled(package="ffmpeg").version() -'-3.2.4' +'3.2.4' ``` ##### Copyright diff --git a/conf/slpkg.conf b/conf/slpkg.conf index c457ad5c..4cec339a 100644 --- a/conf/slpkg.conf +++ b/conf/slpkg.conf @@ -60,7 +60,7 @@ DEL_ALL=on DEL_BUILD=off # 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 # processor and apply into MAKEFLAGS variable. Some SlackBuilds fail if diff --git a/convert-py3k b/convert-py3k deleted file mode 100755 index 21dbac97..00000000 --- a/convert-py3k +++ /dev/null @@ -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) diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index fa7c3767..dab81edc 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -76,7 +76,7 @@ class MetaData: __all__ = "slpkg" __author__ = "dslackw" - __version_info__ = (3, 9, 4) + __version_info__ = (3, 9, 5) __version__ = "{0}.{1}.{2}".format(*__version_info__) __license__ = "GNU General Public License v3 (GPLv3)" __email__ = "d.zlatanidis@gmail.com" diff --git a/slpkg/binary/install.py b/slpkg/binary/install.py index f0030c5a..9ffd79f8 100644 --- a/slpkg/binary/install.py +++ b/slpkg/binary/install.py @@ -244,7 +244,7 @@ class BinaryInstall(BlackList, Utils): installed""" name = split_package(package)[0] rep_ver = split_package(package)[1] - ins_ver = GetFromInstalled(name).version()[1:] + ins_ver = GetFromInstalled(name).version() if not ins_ver: ins_ver = "0" if parse_version(rep_ver) < parse_version(ins_ver): @@ -301,6 +301,8 @@ class BinaryInstall(BlackList, Utils): COLOR = self.meta.color["RED"] uni_sum += 1 ver = GetFromInstalled(pkg_repo[0]).version() + if ver: + ver = f"-{ver}" print(f" {COLOR}{pkg_repo[0] + ver}{self.endc}" f"{' ' * (23-len(pkg_repo[0] + ver))} {pkg_repo[1]}" f"{' ' * (18-len(pkg_repo[1]))} {pkg_repo[2]}" diff --git a/slpkg/main.py b/slpkg/main.py index cb268327..bce8cd12 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -312,7 +312,7 @@ class ArgParse(BlackList): # Remove --checklist flag from args so that works with # both conditions - #if flags[3] in self.args: + # if flags[3] in self.args: # self.args.remove(flags[3]) if (len(self.args) >= 3 and self.args[0] in options and @@ -322,11 +322,7 @@ class ArgParse(BlackList): BinaryInstall(pkg_upgrade(self.args[1], skip, flag), self.args[1], flag).start(is_upgrade=True) 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": SBoInstall(sbo_upgrade(skip, flag), flag).start( is_upgrade=True) diff --git a/slpkg/pkg/installed.py b/slpkg/pkg/installed.py index 591cdb60..d857dd5e 100644 --- a/slpkg/pkg/installed.py +++ b/slpkg/pkg/installed.py @@ -46,7 +46,7 @@ class GetFromInstalled: """Return version from installed packages """ if self.find: - return self.meta.sp + split_package(self.find)[1] + return split_package(self.find)[1] return "" def name(self): diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py index 60e02e73..316b6ed8 100644 --- a/slpkg/pkg/manager.py +++ b/slpkg/pkg/manager.py @@ -187,7 +187,8 @@ class PackageManager(Utils): for pkg in self.binary: name = GetFromInstalled(pkg).name() 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: removed.append(pkg) packages.append(package[0]) @@ -257,7 +258,7 @@ class PackageManager(Utils): for dep in dependencies: if GetFromInstalled(dep).name(): ver = GetFromInstalled(dep).version() - packages.append(dep + ver) + packages.append(f"{dep}-{ver}") else: dependencies.remove(dep) if packages: @@ -307,7 +308,7 @@ class PackageManager(Utils): for dep in dependencies: if dep not in self.skip and GetFromInstalled(dep).name(): ver = GetFromInstalled(dep).version() - removes.append(dep + ver) + removes.append(f"{dep}-{ver}") self._removepkg(dep) return removes @@ -317,7 +318,7 @@ class PackageManager(Utils): removes = [] if GetFromInstalled(package).name() and package not in self.skip: ver = GetFromInstalled(package).version() - removes.append(package + ver) + removes.append(f"{package}-{ver}") self._removepkg(package) return removes @@ -453,7 +454,7 @@ class PackageManager(Utils): for pkg in self.binary: name = GetFromInstalled(pkg).name() 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) if find: package = self.read_file( diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index b0af0164..6b38314a 100644 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -269,6 +269,8 @@ class SBoInstall(BlackList, Utils): args[3] arch """ ver = GetFromInstalled(args[1]).version() + if ver: + ver = f"-{ver}" print(f" {args[0]}{args[1] + ver} {self.endc}" f"{' ' * (24-len(args[1] + ver))}{args[2]}" f"{' ' * (18-len(args[2]))} {args[3]}" @@ -372,7 +374,7 @@ class SBoInstall(BlackList, Utils): installed""" name = "-".join(prgnam.split("-")[:-1]) sbo_ver = prgnam.split("-")[-1] - ins_ver = GetFromInstalled(name).version()[1:] + ins_ver = GetFromInstalled(name).version() if not ins_ver: ins_ver = "0" if parse_version(sbo_ver) < parse_version(ins_ver): diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py index 67da7571..4c6ed50e 100644 --- a/slpkg/slack/patches.py +++ b/slpkg/slack/patches.py @@ -104,8 +104,8 @@ class Patches(BlackList, Utils): f"{self.msg.pkg(len(self.upgrade_all))} will be upgraded and" f" {self.count_added} will be installed.") print(f"Need to get {size[0]} {unit[0]} of archives.") - print(f"After this process, {size[1]} {unit[1]} of additional disk space " - f"will be used.{self.endc}") + print(f"After this process, {size[1]} {unit[1]} of additional disk" + f" space will be used.{self.endc}") print() if self.msg.answer() in ["y", "Y"]: Download(self.patch_path, self.dwn_links, @@ -136,7 +136,23 @@ class Patches(BlackList, Utils): black = list(self.get_black()) for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]): 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 self.skip): self.dwn_links.append(f"{mirrors('', '')}{loc}/{name}") @@ -187,6 +203,8 @@ class Patches(BlackList, Utils): if pkg_repo[0] == pkg_inst: color = self.yellow ver = GetFromInstalled(pkg_repo[0]).version() + if ver: + ver = f"-{ver}" print(f" {color}{pkg_repo[0] + ver}{self.endc}" f"{' ' * (23-len(pkg_repo[0] + ver))} {pkg_repo[1]}" f"{' ' * (18-len(pkg_repo[1]))} {pkg_repo[2]}" diff --git a/slpkg/upgrade_checklist.py b/slpkg/upgrade_checklist.py index ab9b15e5..9127418b 100644 --- a/slpkg/upgrade_checklist.py +++ b/slpkg/upgrade_checklist.py @@ -38,7 +38,7 @@ def choose_upg(packages): for pkg in packages: name = GetFromInstalled(pkg).name() ver = GetFromInstalled(pkg).version() - binary = f"{name}{ver}" + binary = f"{name}-{ver}" installed = find_package(binary + _meta_.sp, _meta_.pkg_path)[0] data.append(installed) text = "Press 'spacebar' to unchoose packages from upgrade"