Merge branch 'develop'

This commit is contained in:
Dimitris Zlatanidis 2022-04-04 19:07:37 +03:00
commit 81fef8d38c
8 changed files with 52 additions and 34 deletions

View file

@ -1,3 +1,7 @@
3.9.5 - 02/04/2022
Updated:
- Compared packages version when distribution upgrade
3.9.5 - 02/04/2022
BugFix:
- Config variable ONLY_INSTALLED when is set on

View file

@ -1,4 +1,4 @@
# slpkg 3.9.5
# slpkg 3.9.6
Slpkg is a powerful software package manager that installs, updates, and removes packages on
[Slackware](http://www.slackware.com/) based systems. It automatically computes dependencies and

View file

@ -28,10 +28,13 @@ cat ../slpkg/__metadata__.py | grep "__version_info__ = (" \
| tr -d [[:space:]] | cut -c19-23 | tr , .
}
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=slpkg
VERSION=${VERSION:-$(__version)}
BUILD=${BUILD:-1}
TAG=${TAG:-_dsw}
PKGTYPE=${PKGTYPE:-txz}
INSTALL="upgradepkg --install-new"
if [ -z "$ARCH" ]; then
@ -42,7 +45,14 @@ if [ -z "$ARCH" ]; then
esac
fi
CWD=$(pwd)
# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
@ -107,6 +117,6 @@ cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
$INSTALL $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz

View file

@ -76,7 +76,7 @@ class MetaData:
__all__ = "slpkg"
__author__ = "dslackw"
__version_info__ = (3, 9, 5)
__version_info__ = (3, 9, 6)
__version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"
@ -218,9 +218,6 @@ class MetaData:
CHECKSUMS_link = (f"https://gitlab.com/{__author__}/{__all__}/raw/"
"master/CHECKSUMS.md5")
# file spacer
sp = "-"
# current path
try:
path = os.getcwd() + "/"

View file

@ -35,12 +35,11 @@ class GetFromInstalled:
def __init__(self, package):
self.package = package
self.meta = _meta_
self.files = find_package(self.package + self.meta.sp,
self.meta.pkg_path)
self.files = find_package(f"{self.package}-", self.meta.pkg_path)
self.find = ""
for f in self.files:
if split_package(f)[0] == self.package:
self.find = f
for file in self.files:
if split_package(file)[0] == self.package:
self.find = file
def version(self):
"""Return version from installed packages

View file

@ -187,8 +187,7 @@ 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.pkg_path)
if pkg and name == pkg:
removed.append(pkg)
packages.append(package[0])
@ -217,7 +216,8 @@ class PackageManager(Utils):
else:
for rmv, pkg in zip(removed, packages):
self._sizes(pkg)
print(f"[ {self.red}delete{self.endc} ] --> [ {self.file_size} ] - {pkg}")
print(f"[ {self.red}delete{self.endc} ] --> "
f"[ {self.file_size} ] - {pkg}")
self._calc_sizes()
self._remove_summary()
if "--third-party" in self.extra:
@ -278,7 +278,7 @@ class PackageManager(Utils):
print(f"| Found dependencies for the package {package}:")
self.msg.template(78)
for pkg in packages:
find = find_package(pkg + self.meta.sp, self.meta.pkg_path)
find = find_package(f"{pkg}-", self.meta.pkg_path)
self._sizes(find[0])
print(f"| {self.red}{pkg}{self.endc}")
self.msg.template(78)
@ -347,7 +347,8 @@ class PackageManager(Utils):
deps = self.read_file(self.dep_path + pkg)
for rmv in removes:
if GetFromInstalled(rmv).name() and rmv in deps.split():
pkg_dep.append(f"{rmv} is dependency of the package --> {pkg}")
pkg_dep.append(f"{rmv} is dependency of the "
f"package --> {pkg}")
package.append(pkg)
dependency.append(rmv)
if package:
@ -366,8 +367,8 @@ class PackageManager(Utils):
self.red, " " * 30 + "!!! WARNING !!!", self.endc))
self.msg.template(78)
for p, d in zip(package, dependency):
print(f"| {self.yellow}{d}{self.endc} is dependency of the package --> "
f"{self.green}{p}{self.endc}")
print(f"| {self.yellow}{d}{self.endc} is dependency "
f"of the package --> {self.green}{p}{self.endc}")
self.msg.template(78)
self._skip_remove()
@ -419,7 +420,8 @@ class PackageManager(Utils):
for pkgs in packages:
matching += 1
self._sizes(pkgs)
print(f"[ {self.green}installed{self.endc} ] [ {self.file_size} ] - {pkgs}")
print(f"[ {self.green}installed{self.endc} ] "
f"[ {self.file_size} ] - {pkgs}")
if matching == 0:
message = "Can't find"
self.msg.pkg_not_found("", ", ".join(self.binary), message, "\n")
@ -454,8 +456,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}",
self.meta.pkg_path)
find = find_package(f"{name}-{ver}-", self.meta.pkg_path)
if find:
package = self.read_file(
self.meta.pkg_path + "".join(find))
@ -492,7 +493,8 @@ class PackageManager(Utils):
pkg = self.list_color_tag(pkg)
print(f"{self.grey}{index}:{self.endc} {pkg}")
if index == page:
read = input(f"\nPress {self.cyan}Enter{self.endc} to continue... ")
read = input(f"\nPress {self.cyan}Enter{self.endc} to "
f"continue... ")
if read in ["Q", "q"]:
break
print() # new line after page
@ -551,7 +553,7 @@ class PackageManager(Utils):
"""Tag with color installed packages
"""
name = GetFromInstalled(pkg).name()
find = name + self.meta.sp
find = f"{name}-"
if pkg.endswith(".txz") or pkg.endswith(".tgz"):
find = pkg[:-4]
if find_package(find, self.meta.pkg_path):

View file

@ -25,6 +25,8 @@
import os
import shutil
import subprocess
from pkg_resources import parse_version
from slpkg.init import Update
from slpkg.utils import Utils
@ -142,13 +144,14 @@ class Patches(BlackList, Utils):
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()):
parse_version(pkg_ver) > parse_version(
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,
if not find_package(f"{repo_pkg_name}-",
self.meta.pkg_path):
self.count_added += 1
self.count_upg -= 1
@ -160,8 +163,7 @@ class Patches(BlackList, Utils):
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):
if not find_package(f"{repo_pkg_name}-", self.meta.pkg_path):
self.count_added += 1
self.count_upg -= 1
return self.count_upg
@ -218,7 +220,7 @@ class Patches(BlackList, Utils):
check_md5(pkg_checksum(pkg, "slack_patches"),
self.patch_path + pkg)
pkg_ver = f"{split_package(pkg)[0]}-{split_package(pkg)[1]}"
if find_package(split_package(pkg)[0] + self.meta.sp,
if find_package(f"{split_package(pkg)[0]}-",
self.meta.pkg_path):
print(f"[ {self.yellow}upgrading{self.endc} ] --> {pkg[:-4]}")
PackageManager((self.patch_path + pkg).split()).upgrade(

View file

@ -87,7 +87,8 @@ class TrackingDeps(BlackList, Utils):
pkg_len = len(self.name) + 24
print() # new line at start
self.msg.template(pkg_len)
print(f"| Package {self.cyan}{self.name}{self.endc} dependencies :")
print(f"| Package {self.cyan}{self.name}{self.endc} "
f"dependencies :")
self.msg.template(pkg_len)
print("\\")
print(f" +---{self.yellow}[ Tree of dependencies ]{self.endc}")
@ -96,19 +97,22 @@ class TrackingDeps(BlackList, Utils):
if "--check-deps" in self.flag:
used = self.check_used(pkg)
self.deps_used(pkg, used)
used = f"is dependence on --> {self.cyan}{', '.join(used)}{self.endc}"
used = (f"is dependence on --> "
f"{self.cyan}{', '.join(used)}{self.endc}")
else:
used = ""
index += 1
installed = ""
if find_package(pkg + self.meta.sp, self.meta.pkg_path):
if find_package(f"{pkg}-", self.meta.pkg_path):
if self.meta.use_colors in ["off", "OFF"]:
installed = "* "
print(" |")
print(f" +--{index}: {self.green}{pkg}{self.endc} {installed}{used}")
print(f" +--{index}: {self.green}{pkg}{self.endc} "
f"{installed}{used}")
else:
print(" |")
print(f" +--{index}: {self.red}{pkg}{self.endc} {installed}")
print(f" +--{index}: {self.red}{pkg}{self.endc} "
f"{installed}")
if self.meta.use_colors in ["off", "OFF"]:
print("\n * = Installed\n")
else: