From 40eefb36802e961cf46f30aaab4d6bd94305a3a2 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 25 Dec 2022 20:02:55 +0200 Subject: [PATCH] Added full reverse flag --- ChangeLog.txt | 5 +++-- man/slpkg.1 | 8 ++++++-- slpkg/dependees.py | 6 ++++-- slpkg/main.py | 10 +++++++--- slpkg/views/cli_menu.py | 5 +++-- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index b6791729..ddf1bced 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,8 +1,9 @@ 4.4.0 - 23/12/2022 Added: - New command to tracking the dependencies -- Added pythondialog as dependency -- Added dialog for upgrade, remove and dependencies +- pythondialog as dependency +- dialog for upgrade, remove and dependencies +- --full-reverse flag to work with dependees 4.3.9 - 22/12/2022 Added: diff --git a/man/slpkg.1 b/man/slpkg.1 index 39937fc3..942bc56e 100644 --- a/man/slpkg.1 +++ b/man/slpkg.1 @@ -1,10 +1,10 @@ -.TH slpkg 1 "Orestiada, Greece" "slpkg 4.3.9" dslackw +.TH slpkg 1 "Orestiada, Greece" "slpkg 4.4.0" dslackw .SH NAME .P slpkg - [OPTIONS] [COMMAND] .SH SYNAPSES .P -slpkg [-h|-v] [update] [upgrade] [check-updates] [clean-logs] [clean-tmp] [-b, build] [-i, install] [-d, download] [-r, remove] [-f, find] [-w, view] [-s, search] [-e, dependees] [-t, tracking] --yes --jobs --resolve-off --reinstall --skip-installed +slpkg [-h|-v] [update] [upgrade] [check-updates] [clean-logs] [clean-tmp] [-b, build] [-i, install] [-d, download] [-r, remove] [-f, find] [-w, view] [-s, search] [-e, dependees] [-t, tracking] --yes, --jobs, --resolve-off, --reinstall, --skip-installed, --full-reverse .SH DESCRIPTION .P Slpkg is a software package manager that installs, updates, and removes packages on Slackware based systems. It automatically computes dependencies and figures out what things should occur to install packages. Slpkg makes it easier to maintain groups of machines without having to manually update. @@ -108,6 +108,10 @@ Use this option if you want to upgrade all packages even if the same version is This a helpful option if you want to avoid building and reinstalling packages. Note: This option affects only the dependencies. .RE +.P +--full-reverse +.RS +Full reverse dependency. Works only with -e, dependees command and show the requires too. .RE .P -h | --help diff --git a/slpkg/dependees.py b/slpkg/dependees.py index 9d2d2335..a387eab7 100644 --- a/slpkg/dependees.py +++ b/slpkg/dependees.py @@ -9,8 +9,9 @@ from slpkg.queries import SBoQueries class Dependees: """ Show which packages depend. """ - def __init__(self, packages: list): + def __init__(self, packages: list, flags: list): self.packages = packages + self.flags = flags self.configs = Configs self.colors = self.configs.colour @@ -56,7 +57,8 @@ class Dependees: else: print(f'{" " * 3}{cyan}{v}{endc}') - print(f'{" " * 4}{char} {" ".join([req for req in SBoQueries(v).requires()])}') + if '--full-reverse' in self.flags: + print(f'{" " * 4}{char} {" ".join([req for req in SBoQueries(v).requires()])}') print(f'\n{grey}{len(value)} dependees for {key}{endc}\n') else: diff --git a/slpkg/main.py b/slpkg/main.py index 84161e73..d230c87a 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -41,7 +41,8 @@ class Argparse: '--jobs', '--resolve-off', '--reinstall', - '--skip-installed'] + '--skip-installed', + '--full-reverse'] # Check for correct flag for opt in self.args: @@ -198,13 +199,16 @@ class Argparse: self.usage.help(1) def dependees(self): - if len(self.args) >= 2 and not self.flags: + if [f for f in self.flags if f in self.options[:-1]]: + self.usage.help(1) + + if len(self.args) >= 2: packages = list(set(self.args[1:])) self.check.database() self.check.exists(packages) - dependees = Dependees(packages) + dependees = Dependees(packages, self.flags) dependees.slackbuilds() raise SystemExit() self.usage.help(1) diff --git a/slpkg/views/cli_menu.py b/slpkg/views/cli_menu.py index 326a3cf3..b5c5cffa 100644 --- a/slpkg/views/cli_menu.py +++ b/slpkg/views/cli_menu.py @@ -21,8 +21,8 @@ class Usage: """ Prints the short menu. """ args = ( f'Usage: {Configs.prog_name} [{self.yellow}OPTIONS{self.endc}] [{self.cyan}COMMAND{self.endc}] \n' - f'\n slpkg [{self.yellow}OPTIONS{self.endc}] [--yes, --jobs, --resolve-off, --reinstall, ' - f'--skip-installed]\n' + f'\n slpkg [{self.yellow}OPTIONS{self.endc}] [--yes, --jobs, --resolve-off, --reinstall]\n' + f' slpkg [{self.yellow}OPTIONS{self.endc}] [--skip-installed, --full-reverse]\n' f' slpkg [{self.cyan}COMMAND{self.endc}] [update, upgrade, check-updates, clean-logs, clean-tmp]\n' f' slpkg [{self.cyan}COMMAND{self.endc}] [-b, build, -i, install, -d, download, -r, remove] \n' f' slpkg [{self.cyan}COMMAND{self.endc}] [-f, find, -w, view, -s, search, -e, dependees] \n' @@ -59,6 +59,7 @@ class Usage: f' {self.yellow}--resolve-off{self.endc} Turns off dependency resolving.\n' f' {self.yellow}--reinstall{self.endc} Upgrade packages of the same version.\n' f' {self.yellow}--skip-installed{self.endc} Skip installed packages.\n' + f' {self.yellow}--full-reverse{self.endc} Full reverse dependency.\n' '\n -h, --help Show this message and exit.\n' ' -v, --version Print version and exit.\n' '\nEdit the configuration file in the /etc/slpkg/slpkg.toml.\n'