From 6d03b1d41c773b08d68939257c9f9421d2662f10 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 12 Jun 2015 08:17:09 +0300 Subject: [PATCH] Feature added print installed version --- slpkg/binary/install.py | 13 +++++++++++-- slpkg/sbo/slackbuild.py | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/slpkg/binary/install.py b/slpkg/binary/install.py index 865e5e3f..b1bde6b3 100644 --- a/slpkg/binary/install.py +++ b/slpkg/binary/install.py @@ -233,15 +233,24 @@ class BinaryInstall(object): else: COLOR = self.meta.color["RED"] uni_sum += 1 + ver = self.get_installed_version(pkg_split[0]) print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>11}{12}".format( - COLOR, pkg_split[0], self.meta.color["ENDC"], - " " * (24-len(pkg_split[0])), pkg_split[1], + COLOR, pkg_split[0] + ver, self.meta.color["ENDC"], + " " * (24-len(pkg_split[0] + ver)), pkg_split[1], " " * (18-len(pkg_split[1])), pkg_split[2], " " * (8-len(pkg_split[2])), pkg_split[3], " " * (7-len(pkg_split[3])), repo, comp, " K")).rstrip() return [pkg_sum, upg_sum, uni_sum] + def get_installed_version(self, package): + """Get installed package version + """ + find = find_package(package + self.meta.sp, self.meta.pkg_path) + if find: + return self.meta.sp + split_package(find[0])[1] + return "" + def top_view(self): Msg().template(78) print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format( diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index 634bef37..aaaa85b4 100644 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -228,13 +228,22 @@ class SBoInstall(object): args[2] version args[3] arch """ + ver = self.get_installed_version(args[1]) print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>11}{12}".format( - args[0], args[1], self.meta.color["ENDC"], - " " * (24-len(args[1])), args[2], + args[0], args[1] + ver, self.meta.color["ENDC"], + " " * (24-len(args[1] + ver)), args[2], " " * (18-len(args[2])), args[3], " " * (15-len(args[3])), "", "", "SBo", "", "")).rstrip() + def get_installed_version(self, package): + """Get installed package version + """ + find = find_package(package + self.meta.sp, self.meta.pkg_path) + if find: + return self.meta.sp + split_package(find[0])[1] + return "" + def tag(self, sbo, count_ins, count_upg, count_uni): """ Tag with color green if package already installed,