mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-26 09:58:31 +01:00
Remove models
This commit is contained in:
parent
3626ee14d0
commit
33f1876729
11 changed files with 0 additions and 211 deletions
|
@ -1,41 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.models.models import BinariesTable
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
class BinQueries:
|
||||
""" Queries class for the binary repositories. """
|
||||
|
||||
def __init__(self, repository: str):
|
||||
self.repository: str = repository
|
||||
self.session = Session
|
||||
|
||||
self.utils = Utilities()
|
||||
|
||||
def repository_data(self) -> dict:
|
||||
""" Returns a dictionary with the repository data. """
|
||||
repository_data: tuple = self.session.query(
|
||||
BinariesTable).where(
|
||||
BinariesTable.repo == self.repository).all()
|
||||
|
||||
repos_dict: dict = {
|
||||
data.name: {'version': data.version,
|
||||
'package': data.package,
|
||||
'mirror': data.mirror,
|
||||
'location': data.location,
|
||||
'size_comp': data.size_comp,
|
||||
'size_uncomp': data.size_uncomp,
|
||||
'requires': data.required,
|
||||
'conflicts': data.conflicts,
|
||||
'suggests': data.suggests,
|
||||
'description': data.description,
|
||||
'checksum': data.checksum,
|
||||
'repository': data.repo}
|
||||
for data in repository_data
|
||||
if not self.utils.blacklist_pattern(data.name)
|
||||
}
|
||||
|
||||
return repos_dict
|
|
@ -5,7 +5,6 @@ from slpkg.configs import Configs
|
|||
from slpkg.utilities import Utilities
|
||||
from slpkg.error_messages import Errors
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
# from slpkg.models.models import SBoTable, PonceTable, BinariesTable
|
||||
|
||||
|
@ -21,7 +20,6 @@ class Check(Configs):
|
|||
self.utils = Utilities()
|
||||
self.repos = Repositories()
|
||||
|
||||
self.session = Session
|
||||
self.count_rows: int = 0
|
||||
self.is_binary: bool = self.utils.is_binary_repo(repository)
|
||||
|
||||
|
|
|
@ -8,10 +8,6 @@ from slpkg.configs import Configs
|
|||
from slpkg.utilities import Utilities
|
||||
from slpkg.views.views import View
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.models.models import session as Session
|
||||
from slpkg.models.models import (Base, engine, LogsDependencies,
|
||||
SBoTable, PonceTable, BinariesTable,
|
||||
LastRepoUpdated)
|
||||
|
||||
|
||||
class Cleanings(Configs):
|
||||
|
|
|
@ -10,7 +10,6 @@ from slpkg.utilities import Utilities
|
|||
from slpkg.downloader import Downloader
|
||||
from slpkg.views.views import View
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
class DownloadOnly(Configs):
|
||||
|
@ -29,7 +28,6 @@ class DownloadOnly(Configs):
|
|||
self.download = Downloader(flags)
|
||||
self.repos = Repositories()
|
||||
self.utils = Utilities()
|
||||
self.session = Session
|
||||
self.urls: dict = {}
|
||||
self.download_path: Path = Path()
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
from slpkg.utilities import Utilities
|
||||
from slpkg.binaries.required import Required
|
||||
from slpkg.sbos.dependencies import Requires
|
||||
from slpkg.models.models import LogsDependencies
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
class LoggingDeps:
|
||||
|
@ -15,7 +13,6 @@ class LoggingDeps:
|
|||
self.data: dict = data
|
||||
|
||||
self.utils = Utilities()
|
||||
self.session = Session
|
||||
|
||||
self.is_binary: bool = self.utils.is_binary_repo(repository)
|
||||
|
||||
|
|
|
@ -1,102 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
|
||||
from dataclasses import dataclass
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy import create_engine, Column, Integer, Text
|
||||
|
||||
from slpkg.configs import Configs
|
||||
|
||||
|
||||
DATABASE_URI: str = os.path.join(f'sqlite:///{Configs.db_path}', Configs.database_name)
|
||||
engine = create_engine(DATABASE_URI)
|
||||
session = sessionmaker(engine)()
|
||||
Base = declarative_base()
|
||||
|
||||
|
||||
@dataclass
|
||||
class SBoTable(Base):
|
||||
""" The main table for the SBo repository. """
|
||||
|
||||
__tablename__ = 'sbotable'
|
||||
|
||||
id: int = Column(Integer, primary_key=True)
|
||||
name: str = Column(Text)
|
||||
location: str = Column(Text)
|
||||
files: str = Column(Text)
|
||||
version: str = Column(Text)
|
||||
download: str = Column(Text)
|
||||
download64: str = Column(Text)
|
||||
md5sum: str = Column(Text)
|
||||
md5sum64: str = Column(Text)
|
||||
requires: str = Column(Text)
|
||||
short_description: str = Column(Text)
|
||||
|
||||
|
||||
@dataclass
|
||||
class PonceTable(Base):
|
||||
""" The main table for the ponce repository. """
|
||||
|
||||
__tablename__: str = 'poncetable'
|
||||
|
||||
id: int = Column(Integer, primary_key=True)
|
||||
name: str = Column(Text)
|
||||
location: str = Column(Text)
|
||||
files: str = Column(Text)
|
||||
version: str = Column(Text)
|
||||
download: str = Column(Text)
|
||||
download64: str = Column(Text)
|
||||
md5sum: str = Column(Text)
|
||||
md5sum64: str = Column(Text)
|
||||
requires: str = Column(Text)
|
||||
short_description: str = Column(Text)
|
||||
|
||||
|
||||
@dataclass
|
||||
class BinariesTable(Base):
|
||||
""" The main table for the binary repositories. """
|
||||
|
||||
__tablename__: str = 'binariestable'
|
||||
|
||||
id: int = Column(Integer, primary_key=True)
|
||||
repo: str = Column(Text)
|
||||
name: str = Column(Text)
|
||||
version: str = Column(Text)
|
||||
package: str = Column(Text)
|
||||
mirror: str = Column(Text)
|
||||
location: str = Column(Text)
|
||||
size_comp: str = Column(Text)
|
||||
size_uncomp: str = Column(Text)
|
||||
required: str = Column(Text)
|
||||
conflicts: str = Column(Text)
|
||||
suggests: str = Column(Text)
|
||||
description: str = Column(Text)
|
||||
checksum: str = Column(Text)
|
||||
|
||||
|
||||
@dataclass
|
||||
class LogsDependencies(Base):
|
||||
""" The table that stores the dependencies after installing a package. """
|
||||
|
||||
__tablename__: str = 'logsdependencies'
|
||||
|
||||
id: int = Column(Integer, primary_key=True)
|
||||
name: str = Column(Text)
|
||||
requires: str = Column(Text)
|
||||
|
||||
|
||||
@dataclass
|
||||
class LastRepoUpdated(Base):
|
||||
""" The table that saves the last updated date. """
|
||||
|
||||
__tablename__: str = 'lastupdated'
|
||||
|
||||
id: int = Column(Integer, primary_key=True)
|
||||
repo: str = Column(Text)
|
||||
date: str = Column(Text)
|
||||
|
||||
|
||||
Base.metadata.create_all(engine)
|
|
@ -10,8 +10,6 @@ from slpkg.dialog_box import DialogBox
|
|||
from slpkg.views.views import View
|
||||
from slpkg.views.asciibox import AsciiBox
|
||||
from slpkg.multi_process import MultiProcess
|
||||
from slpkg.models.models import LogsDependencies
|
||||
from slpkg.models.models import session as Session
|
||||
|
||||
|
||||
class RemovePackages(Configs):
|
||||
|
@ -23,7 +21,6 @@ class RemovePackages(Configs):
|
|||
super(Configs, self).__init__()
|
||||
self.packages: list = packages
|
||||
|
||||
self.session = Session
|
||||
self.dialogbox = DialogBox()
|
||||
self.utils = Utilities()
|
||||
self.ascii = AsciiBox()
|
||||
|
|
|
@ -6,9 +6,6 @@ import shutil
|
|||
from slpkg.configs import Configs
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.models.models import session as Session
|
||||
from slpkg.models.models import (LastRepoUpdated, SBoTable,
|
||||
PonceTable, BinariesTable)
|
||||
|
||||
|
||||
class RepoInfo(Configs):
|
||||
|
@ -18,7 +15,6 @@ class RepoInfo(Configs):
|
|||
self.flags: list = flags
|
||||
self.repository: str = repository
|
||||
|
||||
self.session = Session
|
||||
self.utils = Utilities()
|
||||
self.repos = Repositories()
|
||||
self.columns, self.rows = shutil.get_terminal_size()
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.models.models import session as Session
|
||||
from slpkg.models.models import SBoTable, PonceTable
|
||||
|
||||
|
||||
class SBoQueries(Configs):
|
||||
""" Queries class for the sbo repository. """
|
||||
|
||||
def __init__(self, repository: str):
|
||||
super(Configs, self).__init__()
|
||||
self.session = Session
|
||||
|
||||
self.repos = Repositories()
|
||||
self.utils = Utilities()
|
||||
|
||||
table: dict = {
|
||||
self.repos.sbo_repo_name: SBoTable,
|
||||
self.repos.ponce_repo_name: PonceTable
|
||||
}
|
||||
|
||||
if repository == '*':
|
||||
repository = self.repos.default_repository
|
||||
|
||||
self.sbo_table: str = table[repository]
|
||||
|
||||
def repository_data(self) -> dict:
|
||||
""" Returns a dictionary with the repository data. """
|
||||
repository_data: tuple = self.session.query(self.sbo_table).all()
|
||||
|
||||
repos_dict: dict = {
|
||||
data.name: {'location': data.location,
|
||||
'files': data.files,
|
||||
'version': data.version,
|
||||
'download': data.download,
|
||||
'download64': data.download64,
|
||||
'md5sum': data.md5sum,
|
||||
'md5sum64': data.md5sum64,
|
||||
'requires': data.requires,
|
||||
'description': data.short_description}
|
||||
for data in repository_data
|
||||
if not self.utils.blacklist_pattern(data.name)
|
||||
}
|
||||
return repos_dict
|
|
@ -4,9 +4,7 @@
|
|||
from slpkg.configs import Configs
|
||||
from slpkg.utilities import Utilities
|
||||
from slpkg.views.asciibox import AsciiBox
|
||||
from slpkg.sbos.queries import SBoQueries
|
||||
from slpkg.repositories import Repositories
|
||||
from slpkg.binaries.queries import BinQueries
|
||||
|
||||
|
||||
class SearchPackage(Configs):
|
||||
|
|
Loading…
Reference in a new issue