mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-02-06 08:46:21 +01:00
Added for binary install
This commit is contained in:
parent
0f84247227
commit
f23e9a0bcb
1 changed files with 37 additions and 4 deletions
|
@ -2,24 +2,57 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from slpkg.configs import Configs
|
from slpkg.configs import Configs
|
||||||
|
from slpkg.utilities import Utilities
|
||||||
|
from slpkg.downloader import Downloader
|
||||||
from slpkg.views.views import ViewMessage
|
from slpkg.views.views import ViewMessage
|
||||||
|
from slpkg.repositories import Repositories
|
||||||
|
from slpkg.binaries.queries import BinsQueries
|
||||||
|
|
||||||
|
|
||||||
class Packages(Configs):
|
class Packages(Configs):
|
||||||
""" Download build and install the SlackBuilds. """
|
|
||||||
|
|
||||||
def __init__(self, packages: list, flags: list, file_pattern, mode: str):
|
def __init__(self, packages: list, flags: list, file_pattern: str, repo: str, mode: str):
|
||||||
super(Configs, self).__init__()
|
super(Configs, self).__init__()
|
||||||
self.packages: list = packages
|
self.packages: list = packages
|
||||||
self.flags: list = flags
|
self.flags: list = flags
|
||||||
self.file_pattern: str = file_pattern
|
self.file_pattern: str = file_pattern
|
||||||
|
self.repo: str = repo
|
||||||
self.mode: str = mode
|
self.mode: str = mode
|
||||||
|
|
||||||
|
self.utils = Utilities()
|
||||||
|
self.repos = Repositories()
|
||||||
self.view_message = ViewMessage(self.flags)
|
self.view_message = ViewMessage(self.flags)
|
||||||
|
|
||||||
|
self.binary_packages: list = []
|
||||||
self.flag_binary: list = ['-B', '--binary']
|
self.flag_binary: list = ['-B', '--binary']
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
self.view_message.install_packages(self.packages, [], self.mode)
|
self.view_message.install_packages(self.packages, self.mode)
|
||||||
|
|
||||||
self.view_message.question()
|
self.view_message.question()
|
||||||
|
self.download()
|
||||||
|
self.install_packages()
|
||||||
|
|
||||||
|
def download(self):
|
||||||
|
""" Download packages from the repositories. """
|
||||||
|
pkg_urls: list = []
|
||||||
|
for pkg in self.packages:
|
||||||
|
|
||||||
|
mirror: str = BinsQueries(pkg).mirror()
|
||||||
|
location: str = BinsQueries(pkg).location()
|
||||||
|
package: str = BinsQueries(pkg).package_bin()
|
||||||
|
|
||||||
|
pkg_urls.append(f'{mirror}{location}/{package}')
|
||||||
|
self.binary_packages.append(package)
|
||||||
|
|
||||||
|
self.utils.remove_file_if_exists(self.tmp_slpkg, package)
|
||||||
|
|
||||||
|
down = Downloader(self.tmp_slpkg, pkg_urls, self.flags)
|
||||||
|
down.download()
|
||||||
|
|
||||||
|
self.install_packages()
|
||||||
|
|
||||||
|
def install_packages(self):
|
||||||
|
""" Install the packages. """
|
||||||
|
for package in self.binary_packages:
|
||||||
|
command: str = f'{self.installpkg} {self.tmp_slpkg}/{package}'
|
||||||
|
self.utils.process(command)
|
||||||
|
|
Loading…
Add table
Reference in a new issue