mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-11-16 07:47:35 +01:00
Update for ponce repo
This commit is contained in:
parent
28c90b4930
commit
dd3e6ec9f6
7 changed files with 82 additions and 15 deletions
|
@ -84,5 +84,9 @@
|
|||
# Slpkg it still going to use SLACKBUILDS.TXT and ChangeLog.txt from SBo repository. #
|
||||
# For blacklisted files, edit the /etc/slpkg/blacklist.toml file. #
|
||||
######################################################################################
|
||||
# PONCE_REPO_URL = "https://cgit.ponce.cc/slackbuilds/plain"
|
||||
PONCE_REPO_URL = ""
|
||||
# PONCE_REPO = true
|
||||
PONCE_REPO = false
|
||||
PONCE_REPO_URL = "https://cgit.ponce.cc/slackbuilds/plain"
|
||||
SLACK_CURRENT_MIRROR = "https://mirrors.slackware.com/slackware/slackware64-15.0"
|
||||
SLACK_CHGLOG_TXT = "ChangeLog.txt"
|
||||
SLACK_CHGLOG_PATH = "/var/lib/slpkg/repository/slack_current"
|
|
@ -55,8 +55,11 @@ class Configs:
|
|||
sbo_repo_tag: str = '_SBo'
|
||||
|
||||
# Ponce repo configs.
|
||||
# PONCE URL: https://cgit.ponce.cc/slackbuilds/plain
|
||||
ponce_repo_url: str = ''
|
||||
ponce_repo: bool = False
|
||||
ponce_repo_url: str = 'https://cgit.ponce.cc/slackbuilds/plain'
|
||||
slack_current_mirror: str = 'https://mirrors.slackware.com/slackware/slackware64-15.0'
|
||||
slack_chglog_txt: str = 'ChangeLog.txt'
|
||||
slack_chglog_path: str = Path('/var/lib/slpkg/repository/slack_current')
|
||||
|
||||
# Slackware commands.
|
||||
installpkg: str = 'upgradepkg --install-new'
|
||||
|
@ -112,7 +115,11 @@ class Configs:
|
|||
sbo_repo_tag: str = config['SBO_REPO_TAG']
|
||||
|
||||
# Ponce repo configs.
|
||||
ponce_repo: bool = config['PONCE_REPO']
|
||||
ponce_repo_url: str = config['PONCE_REPO_URL']
|
||||
slack_current_mirror: str = config['SLACK_CURRENT_MIRROR']
|
||||
slack_chglog_txt: str = config['SLACK_CHGLOG_TXT']
|
||||
slack_chglog_path: str = config['SLACK_CHGLOG_PATH']
|
||||
|
||||
# Slackware commands.
|
||||
installpkg: str = config['INSTALLPKG']
|
||||
|
@ -152,7 +159,8 @@ class Configs:
|
|||
sbo_repo_path,
|
||||
lib_path,
|
||||
etc_path,
|
||||
db_path]
|
||||
db_path,
|
||||
slack_chglog_path]
|
||||
|
||||
for path in paths:
|
||||
if not os.path.isdir(path):
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
|
||||
from slpkg.queries import SBoQueries
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.models.models import SBoTable
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.models.models import SBoTable, PonceTable
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
|
@ -15,6 +19,8 @@ class CreateData(Configs):
|
|||
def __init__(self):
|
||||
super(Configs, self).__init__()
|
||||
self.session = Session
|
||||
self.utils = Utilities()
|
||||
self.query = SBoQueries('')
|
||||
|
||||
def insert_sbo_table(self):
|
||||
""" Install the data. """
|
||||
|
@ -58,8 +64,42 @@ class CreateData(Configs):
|
|||
|
||||
self.session.commit()
|
||||
|
||||
def insert_ponce_blacklist_packages(self):
|
||||
sbos = self.query.sbos()
|
||||
|
||||
with open('../ChangeLog.slack', 'r', encoding='utf-8') as f:
|
||||
log = f.readlines()
|
||||
|
||||
for line in log:
|
||||
|
||||
# Clean the line from white spaces.
|
||||
line = line.strip()
|
||||
|
||||
if re.findall('Added[.]', line):
|
||||
|
||||
# Clean the line.
|
||||
line = re.sub(r'Added.|.txz:', '', line)
|
||||
pkg = line.split('/')[-1]
|
||||
|
||||
# Split and get the name only.
|
||||
name = self.utils.split_installed_pkg(pkg)[0]
|
||||
|
||||
if name in sbos:
|
||||
data = PonceTable(name=name)
|
||||
self.session.add(data)
|
||||
|
||||
# Stop the date when the Slackware 15.0 released.
|
||||
if line == 'Wed Feb 2 22:22:22 UTC 2022':
|
||||
break
|
||||
|
||||
self.session.commit()
|
||||
|
||||
@staticmethod
|
||||
def read_file(file: Union[str, Path]) -> list:
|
||||
""" Reads the text file. """
|
||||
with open(file, 'r', encoding='utf-8') as f:
|
||||
return f.readlines()
|
||||
|
||||
|
||||
# create = CreateData()
|
||||
# create.insert_ponce_blacklist_packages()
|
||||
|
|
|
@ -73,7 +73,7 @@ class Downloader(Configs, Utilities):
|
|||
|
||||
def check_if_downloaded(self):
|
||||
""" Checks if the file downloaded. """
|
||||
if 'ponce' not in self.url:
|
||||
if not self.ponce_repo and 'ponce' not in self.url:
|
||||
url = unquote(self.url)
|
||||
file = url.split('/')[-1]
|
||||
path_file = Path(self.path, file)
|
||||
|
@ -92,7 +92,7 @@ class Downloader(Configs, Utilities):
|
|||
message = f'[{self.green}Downloading{self.endc}]'
|
||||
|
||||
# Starting multiprocessing
|
||||
if 'ponce' in self.url:
|
||||
if self.ponce_repo and 'ponce' in self.url:
|
||||
p1 = Process(target=self.lftp)
|
||||
else:
|
||||
p1 = Process(target=self.transfer_tools)
|
||||
|
@ -121,7 +121,7 @@ class Downloader(Configs, Utilities):
|
|||
# Restore the terminal cursor
|
||||
print('\x1b[?25h', self.endc)
|
||||
else:
|
||||
if 'ponce' in self.url:
|
||||
if self.ponce_repo and 'ponce' in self.url:
|
||||
self.lftp()
|
||||
else:
|
||||
self.transfer_tools()
|
||||
|
|
|
@ -38,6 +38,14 @@ class SBoTable(Base):
|
|||
short_description: str = Column(Text)
|
||||
|
||||
|
||||
class PonceTable(Base):
|
||||
|
||||
__tablename__ = 'poncetable'
|
||||
|
||||
id: int = Column(Integer, primary_key=True)
|
||||
name: str = Column(Text)
|
||||
|
||||
|
||||
@dataclass
|
||||
class LogsDependencies(Base):
|
||||
""" The table that stores the dependencies after installing a package. """
|
||||
|
|
|
@ -138,15 +138,15 @@ class Slackbuilds(Configs):
|
|||
self.utils.remove_folder_if_exists(self.build_path, sbo)
|
||||
|
||||
location = SBoQueries(sbo).location()
|
||||
url = f'{self.sbo_repo_url}/{location}/{file}'
|
||||
sbo_url = f'{self.sbo_repo_url}/{location}/{file}'
|
||||
ponce_url = f'{self.ponce_repo_url}/{location}/{sbo}'
|
||||
|
||||
if self.ponce_repo_url:
|
||||
if self.ponce_repo and self.ponce_repo_url:
|
||||
path = Path(self.build_path, sbo)
|
||||
lftp = Downloader(path, ponce_url, self.flags)
|
||||
lftp.download()
|
||||
else:
|
||||
down_sbo = Downloader(self.tmp_slpkg, url, self.flags)
|
||||
down_sbo = Downloader(self.tmp_slpkg, sbo_url, self.flags)
|
||||
down_sbo.download()
|
||||
|
||||
self.utils.untar_archive(self.tmp_slpkg, file, self.build_path)
|
||||
|
|
|
@ -7,7 +7,7 @@ from multiprocessing import Process
|
|||
from slpkg.configs import Configs
|
||||
from slpkg.downloader import Downloader
|
||||
from slpkg.create_data import CreateData
|
||||
from slpkg.models.models import SBoTable
|
||||
from slpkg.models.models import SBoTable, PonceTable
|
||||
from slpkg.views.views import ViewMessage
|
||||
from slpkg.progress_bar import ProgressBar
|
||||
from slpkg.check_updates import CheckUpdates
|
||||
|
@ -38,15 +38,21 @@ class UpdateRepository(Configs):
|
|||
|
||||
slackbuilds_txt = f'{self.sbo_repo_url}/{self.sbo_txt}'
|
||||
changelog_txt = f'{self.sbo_repo_url}/{self.sbo_chglog_txt}'
|
||||
slack_changelog_txt = f'{self.slack_current_mirror}/{self.slack_chglog_txt}'
|
||||
|
||||
down_slackbuilds = Downloader(self.sbo_repo_path, slackbuilds_txt, self.flags)
|
||||
down_slackbuilds.download()
|
||||
|
||||
down_changelog = Downloader(self.sbo_repo_path, changelog_txt, self.flags)
|
||||
down_changelog.download()
|
||||
if self.ponce_repo:
|
||||
down_sbo_changelog = Downloader(self.sbo_repo_path, changelog_txt, self.flags)
|
||||
down_sbo_changelog.download()
|
||||
|
||||
down_slack_current_changelog = Downloader(self.slack_chglog_path, slack_changelog_txt, self.flags)
|
||||
down_slack_current_changelog.download()
|
||||
|
||||
data = CreateData()
|
||||
data.insert_sbo_table()
|
||||
data.insert_ponce_blacklist_packages()
|
||||
|
||||
def check(self):
|
||||
check_updates = CheckUpdates()
|
||||
|
@ -91,4 +97,5 @@ class UpdateRepository(Configs):
|
|||
def delete_sbo_data(self):
|
||||
""" Delete the table from the database. """
|
||||
self.session.query(SBoTable).delete()
|
||||
self.session.query(PonceTable).delete()
|
||||
self.session.commit()
|
||||
|
|
Loading…
Reference in a new issue