mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
Added --reinstall option
This commit is contained in:
parent
685741efe0
commit
edaf3820b5
5 changed files with 22 additions and 6 deletions
|
@ -56,6 +56,11 @@ Answer Yes to all questions.
|
|||
.RS
|
||||
Turns off dependency resolving.
|
||||
.RE
|
||||
.P
|
||||
--reinstall
|
||||
.RS
|
||||
Use this option if you want to upgrade all packages even if the same version is already installed. Do not skip installed packages.
|
||||
.RE
|
||||
.SH CONFIGURATION FILE
|
||||
.P
|
||||
Configuration file in the /etc/slpkg/slpkg.json file.
|
||||
|
|
|
@ -5,7 +5,7 @@ from metadata import Metadata
|
|||
|
||||
|
||||
def usage(status):
|
||||
args = [f'Usage: {Metadata.proj_name} [OPTIONS] [packages]\n',
|
||||
args = [f'Usage: {Metadata.prog_name} [OPTIONS] [packages]\n',
|
||||
' Tool that interact with the SBo repository.\n',
|
||||
'Options:',
|
||||
' update Update the data packages.',
|
||||
|
@ -15,6 +15,7 @@ def usage(status):
|
|||
' clean-logs Purge logs of dependencies.',
|
||||
' --yes Answer Yes to all questions.',
|
||||
' --resolve-off Turns off dependency resolving.',
|
||||
' --reinstall Use this option if you want to upgrade.',
|
||||
' -h, --help Show this message and exit.',
|
||||
' -v, --version Print version and exit.\n',
|
||||
'If you need more information try to use slpkg manpage.']
|
||||
|
|
|
@ -51,16 +51,21 @@ class Argparse:
|
|||
|
||||
def flags(self):
|
||||
self.flags = []
|
||||
resolve_off = '--resolve-off'
|
||||
yes = '--yes'
|
||||
resolve_off = '--resolve-off'
|
||||
reinstall = '--reinstall'
|
||||
|
||||
if yes in self.args:
|
||||
self.args.remove(yes)
|
||||
self.flags.append(yes)
|
||||
|
||||
if resolve_off in self.args:
|
||||
self.args.remove(resolve_off)
|
||||
self.flags.append(resolve_off)
|
||||
|
||||
if yes in self.args:
|
||||
self.args.remove(yes)
|
||||
self.flags.append(yes)
|
||||
if reinstall in self.args:
|
||||
self.args.remove(reinstall)
|
||||
self.flags.append(reinstall)
|
||||
|
||||
def command(self):
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ class Metadata:
|
|||
repo_tag: str = '_SBo'
|
||||
# Slackware commands
|
||||
installpkg: str = 'upgradepkg --install-new'
|
||||
reinstall: str = 'upgradepkg --reinstall'
|
||||
removepkg: str = 'removepkg'
|
||||
# Other configs
|
||||
colors: str = 'on'
|
||||
|
|
|
@ -34,6 +34,7 @@ class Slackbuilds:
|
|||
repo_tag: str = Metadata.repo_tag
|
||||
pkg_suffix: str = Metadata.pkg_suffix
|
||||
installpkg: str = Metadata.installpkg
|
||||
reinstall: str = Metadata.reinstall
|
||||
|
||||
def execute(self):
|
||||
''' Starting build or install the slackbuilds. '''
|
||||
|
@ -129,7 +130,10 @@ class Slackbuilds:
|
|||
|
||||
def install_package(self, package):
|
||||
''' Install the packages that before created in the tmp directory. '''
|
||||
command = f'{self.installpkg} {self.tmp_path}/{package}'
|
||||
execute = self.installpkg
|
||||
if '--reinstall' in self.flags:
|
||||
execute = self.reinstall
|
||||
command = f'{execute} {self.tmp_path}/{package}'
|
||||
subprocess.call(command, shell=True)
|
||||
|
||||
def creating_package_for_install(self, name: str):
|
||||
|
|
Loading…
Reference in a new issue