From 87f58a0fba5ffc2ca3d17cd98fc88bf450d427d4 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 21 Mar 2023 16:37:56 +0200 Subject: [PATCH] Updated for repo name --- configs/repositories.toml | 3 +++ configs/slpkg.toml | 10 +++++----- slpkg/check_updates.py | 6 +++--- slpkg/install_data.py | 5 ++--- slpkg/repositories.py | 6 ++++++ slpkg/update_repository.py | 11 ++++++----- slpkg/views/ascii.py | 4 ++-- 7 files changed, 27 insertions(+), 18 deletions(-) diff --git a/configs/repositories.toml b/configs/repositories.toml index aa449ad9..1f27a179 100644 --- a/configs/repositories.toml +++ b/configs/repositories.toml @@ -1,18 +1,21 @@ # Repositories configuration file. [REPOSITORIES] + SBO_REPO_NAME = "sbo" SBO_REPO_URL = "https://slackbuilds.org/slackbuilds/15.0/" SBO_REPO_TXT = "SLACKBUILDS.TXT" SBO_REPO_CHGLOG_TXT = "ChangeLog.txt" SBO_REPO_TAR_SUFFIX = ".tar.gz" SBO_REPO_TAG = "_SBo" + PONCE_REPO_NAME = "ponce" PONCE_REPO = false PONCE_REPO_URL = "https://cgit.ponce.cc/slackbuilds/plain/" PONCE_REPO_TXT = "SLACKBUILDS.TXT" PONCE_REPO_CHGLOG_TXT = "ChangeLog.txt" PONCE_REPO_TAG = "_SBo" + GNOME_REPO_NAME = "gnome" GNOME_REPO = true GNOME_REPO_URL = "https://reddoglinux.ddns.net/linux/gnome/43.x/x86_64/" GNOME_REPO_PKG_TXT = "PACKAGES.TXT" diff --git a/configs/slpkg.toml b/configs/slpkg.toml index f75be997..6ab3570b 100644 --- a/configs/slpkg.toml +++ b/configs/slpkg.toml @@ -7,14 +7,14 @@ # File suffix for list packages. # Change here if you are going to use '.sqf' files. FILE_LIST_SUFFIX = ".pkgs" - # Configs for displaying colorful menu. Default is true. [true/false]. + # Configs for displaying colorful menu. Default is true. [true/false] COLORS = true # Dialog is a program that will let you present a variety of questions or # display messages using dialog boxes from a shell script. - # Default is true. [true/false]. + # Default is true. [true/false] DIALOG = true # If silent mode is true, it does not print the commands as they are executed. - # Default is true. [true/false]. + # Default is true. [true/false] SILENT_MODE = true # Choose ascii printable characters. # If true, it uses the extended characters, otherwise the basic ones. @@ -23,7 +23,7 @@ # Set false to all the questions. If set false, option --yes will not work. # Default is true. [true/false]. ASK_QUESTION = true - # Download sources in parallel. Default is false. [true/false]. + # Download sources in parallel. Default is false. [true/false] PARALLEL_DOWNLOADS = false # Pass your file pattern here, instead, you can use '--file-pattern=' or '-F=' option. FILE_PATTERN = "" @@ -42,7 +42,7 @@ REMOVEPKG = "removepkg" # You can choose a downloader among wget, curl and lftp. - # Default is wget. [wget/curl/lftp]. + # Default is wget. [wget/curl/lftp] DOWNLOADER = "wget" # Wget downloader options. # -c, --continue: resume getting a partially-downloaded file. diff --git a/slpkg/check_updates.py b/slpkg/check_updates.py index 2b35634a..005a7b15 100644 --- a/slpkg/check_updates.py +++ b/slpkg/check_updates.py @@ -42,18 +42,18 @@ class CheckUpdates(Configs): if self.utils.is_option(self.flag_binary, self.flags): if self.repos.gnome_repo: - repo: str = 'gnome' + repo: str = self.repos.gnome_repo_name self.local_chg_txt: Path = Path(self.repos.gnome_repo_path, self.repos.gnome_repo_chglog_pkg_txt) self.repo_chg_txt: str = f'{self.repos.gnome_repo_url}{self.repos.gnome_repo_chglog_pkg_txt}' compare: bool = self.compare_dates() else: if self.repos.ponce_repo: - repo: str = 'ponce' + repo: str = self.repos.ponce_repo_name self.local_chg_txt: Path = Path(self.repos.ponce_repo_path, self.repos.ponce_repo_chglog_txt) self.repo_chg_txt: str = f'{self.repos.ponce_repo_url}{self.repos.ponce_repo_chglog_txt}' compare: bool = self.compare_dates() else: - repo: str = 'sbo' + repo: str = self.repos.sbo_repo_name self.local_chg_txt: Path = Path(self.repos.sbo_repo_path, self.repos.sbo_repo_chglog_txt) self.repo_chg_txt: str = f'{self.repos.sbo_repo_url}{self.repos.sbo_repo_chglog_txt}' compare: bool = self.compare_dates() diff --git a/slpkg/install_data.py b/slpkg/install_data.py index 0908e10c..fe479a6a 100644 --- a/slpkg/install_data.py +++ b/slpkg/install_data.py @@ -71,7 +71,6 @@ class CreateData(Configs): def install_gnome_data(self) -> None: """ Install the data for SBo repository. """ - repo: str = 'gnome' pkg_tag = [ 'PACKAGE NAME:', 'PACKAGE MIRROR:', @@ -80,7 +79,7 @@ class CreateData(Configs): 'PACKAGE SIZE (uncompressed):', 'PACKAGE DESCRIPTION:', ] - path = Path(self.lib_path, 'repositories', repo, self.repos.gnome_repo_pkg_txt) + path = Path(self.lib_path, 'repositories', self.repos.gnome_repo_name, self.repos.gnome_repo_pkg_txt) pkg_txt: list = self.utils.read_file(path) @@ -122,7 +121,7 @@ class CreateData(Configs): if len(cache) == 8: data: str = BinariesTable( - repo=repo, + repo=self.repos.gnome_repo_name, name=cache[0], version=cache[1], package=cache[2], diff --git a/slpkg/repositories.py b/slpkg/repositories.py index fda70942..bc35eba2 100644 --- a/slpkg/repositories.py +++ b/slpkg/repositories.py @@ -25,6 +25,7 @@ class Repositories(Configs): self.repos: dict = {} + self.sbo_repo_name: str = 'sbo' self.sbo_repo_path: Path = Path(self.lib_path, 'repositories', 'sbo') self.sbo_repo_url: str = "https://slackbuilds.org/slackbuilds/15.0/" self.sbo_repo_txt: str = "SLACKBUILDS.TXT" @@ -32,6 +33,7 @@ class Repositories(Configs): self.sbo_repo_tar_suffix: str = ".tar.gz" self.sbo_repo_tag: str = "_SBo" + self.ponce_repo_name: str = 'ponce' self.ponce_repo: bool = False self.ponce_repo_path: Path = Path(self.lib_path, 'repositories', 'ponce') self.ponce_repo_url: str = "https://cgit.ponce.cc/slackbuilds/plain/" @@ -39,6 +41,7 @@ class Repositories(Configs): self.ponce_repo_chglog_txt: str = "ChangeLog.txt" self.ponce_repo_tag: str = "_SBo" + self.gnome_repo_name: str = 'gnome' self.gnome_repo: bool = True self.gnome_repo_path: Path = Path(self.lib_path, 'repositories', 'gnome') self.gnome_repo_url: str = "https://reddoglinux.ddns.net/linux/gnome/43.x/x86_64/" @@ -55,18 +58,21 @@ class Repositories(Configs): with open(self.repositories_file_toml, 'rb') as repo: self.repos: dict = tomli.load(repo)['REPOSITORIES'] + self.sbo_repo_name: str = self.repos['SBO_REPO_NAME'] self.sbo_repo_url: str = self.repos['SBO_REPO_URL'] self.sbo_repo_txt: str = self.repos['SBO_REPO_TXT'] self.sbo_repo_chglog_txt: str = self.repos['SBO_REPO_CHGLOG_TXT'] self.sbo_repo_tar_suffix: str = self.repos['SBO_REPO_TAR_SUFFIX'] self.sbo_repo_tag: str = self.repos['SBO_REPO_TAG'] + self.ponce_repo_name: str = self.repos['PONCE_REPO_NAME'] self.ponce_repo: bool = self.repos['PONCE_REPO'] self.ponce_repo_url: str = self.repos['PONCE_REPO_URL'] self.ponce_repo_txt: str = self.repos['PONCE_REPO_TXT'] self.ponce_repo_chglog_txt: str = self.repos['PONCE_REPO_CHGLOG_TXT'] self.ponce_repo_tag: str = self.repos['PONCE_REPO_TAG'] + self.gnome_repo_name: str = self.repos['GNOME_REPO_NAME'] self.gnome_repo: bool = self.repos['GNOME_REPO'] self.gnome_repo_url: str = self.repos['GNOME_REPO_URL'] self.gnome_repo_pkg_txt: str = self.repos['GNOME_REPO_PKG_TXT'] diff --git a/slpkg/update_repository.py b/slpkg/update_repository.py index 2e515964..2458af43 100644 --- a/slpkg/update_repository.py +++ b/slpkg/update_repository.py @@ -61,7 +61,7 @@ class UpdateRepository(Configs): """ Update the binary repositories. """ if self.repos.gnome_repo: print('Updating the packages list...\n') - print(f"Downloading the '{self.green}gnome{self.endc}' repository, please wait...\n") + print(f"Downloading the '{self.green}{self.repos.gnome_repo_name}{self.endc}' repository, please wait...\n") repo: str = 'gnome' self.make_dirs(repo) @@ -81,10 +81,11 @@ class UpdateRepository(Configs): def slackbuild_repositories(self): """ Update the slackbuild repositories. """ if self.repos.ponce_repo: - self.make_dirs('gnome') + self.make_dirs(self.repos.gnome_repo_name) if not self.utils.is_option(self.flag_generate, self.flags): print('Updating the packages list...\n') - print(f"Downloading the '{self.green}ponce{self.endc}' repository, please wait...\n") + print(f"Downloading the '{self.green}{self.repos.gnome_repo_name}" + f"{self.endc}' repository, please wait...\n") self.delete_file(self.repos.ponce_repo_path, self.repos .ponce_repo_txt) lftp_command: str = (f'lftp {self.lftp_mirror_options} {self.repos.ponce_repo_url} ' f'{self.repos.ponce_repo_path}') @@ -103,13 +104,13 @@ class UpdateRepository(Configs): print('\n') else: - self.make_dirs('sbo') + self.make_dirs(self.repos.sbo_repo_name) print('Updating the packages list...\n') self.delete_file(self.repos.sbo_repo_path, self.repos.sbo_repo_txt) self.delete_file(self.repos.sbo_repo_path, self.repos.sbo_repo_chglog_txt) - print(f"Downloading the '{self.green}sbo{self.endc}' repository, please wait...\n") + print(f"Downloading the '{self.green}{self.repos.sbo_repo_name}{self.endc}' repository, please wait...\n") lftp_command: str = f'lftp {self.lftp_mirror_options} {self.repos.sbo_repo_url} {self.repos.sbo_repo_path}' self.utils.process(lftp_command) diff --git a/slpkg/views/ascii.py b/slpkg/views/ascii.py index 6c1a81d7..d6a0540f 100644 --- a/slpkg/views/ascii.py +++ b/slpkg/views/ascii.py @@ -51,9 +51,9 @@ class Ascii(Configs): self.bgreen: str = f'{self.bold}{self.green}' self.bred: str = f'{self.bold}{self.red}' - self.repo: str = 'sbo' + self.repo: str = self.repos.sbo_repo_name if self.repos.ponce_repo: - self.repo: str = 'ponce' + self.repo: str = self.repos.ponce_repo_name def draw_package_title_box(self, message: str, title: str) -> None: """ Drawing package title box. """