diff --git a/ChangeLog.txt b/ChangeLog.txt
index afff4620..b7d3ac55 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,10 @@
+4.0.2 - 30/05/2022
+Removed:
+- Repositories rlw, mles, ktown, rested, slacke, slacky, slackl
+- Option --directory-prefix
+- Option --autobuild
+- Option --network
+
4.0.1 - 30/05/2022
Added:
- SQLAlchemy Object Relational Mapper
diff --git a/EXAMPLES.md b/EXAMPLES.md
index 2c2858f2..1c67a747 100644
--- a/EXAMPLES.md
+++ b/EXAMPLES.md
@@ -21,13 +21,9 @@ $ slpkg update
Update repository [slack] ... Done
Update repository [sbo] ... Done
Update repository [alien] ... Done
-Update repository [slacky] ... Done
Update repository [conrad] ... Done
Update repository [slonly] ... Done
-Update repository [ktown] ... Done
Update repository [salix] ... Done
-Update repository [slacke] ... Done
-Update repository [slackl] ... Done
Update repository [multi] ... Done
Update repository [msb] ... Done
@@ -35,7 +31,7 @@ Update repository [msb] ... Done
Update specifically repositories:
```
-$ slpkg update --repositories=sbo,msb,slacky
+$ slpkg update --repositories=sbo,msb
```
Also you can check ChangeLog.txt for changes, like:
@@ -60,13 +56,11 @@ $ slpkg --check
+==============================================================================
slack No changes in ChangeLog.txt
sbo News in ChangeLog.txt
- slacky News in ChangeLog.txt
alien No changes in ChangeLog.txt
- rlw No changes in ChangeLog.txt
Summary
===============================================================================
-From 5 repositories need 2 updating. Run the command 'slpkg update'.
+From 3 repositories need 2 updating. Run the command 'slpkg update'.
```
Add and remove custom repositories:
@@ -95,24 +89,18 @@ $ slpkg repo-list
| Repo id Repo URL Default Status
+==============================================================================
alien http://www.slackware.com/~alien/slackbuilds/ yes disabled
- ktown http://alien.slackbook.org/ktown/ yes disabled
msb http://slackware.org.uk/msb/ yes enabled
multi http://www.slackware.com/~alien/multilib/ yes disabled
ponce http://ponce.cc/slackware/slackware64-14.2/packa~ no enabled
- rested http://taper.alienbase.nl/mirrors/people/alien/r~ yes disabled
- rlw http://rlworkman.net/pkgs/ yes disabled
salix http://download.salixos.org/ yes disabled
sbo http://slackbuilds.org/slackbuilds/ yes enabled
slack http://ftp.cc.uoc.gr/mirrors/linux/slackware/ yes enabled
- slacke http://ngc891.blogdns.net/pub/ yes disabled
- slackl http://www.slackel.gr/repo/ yes disabled
- conrad http://slack.conraid.net/repository/slackware64-~ yes disabled
- slacky http://repository.slacky.eu/ yes disabled
+ conrad http://slack.conraid.net/repository/slackware64-~ yes disabled
slonly https://slackonly.com/pub/packages/ yes disabled
Repositories summary
===============================================================================
-3/14 enabled default repositories and 1 custom.
+3/9 enabled default repositories and 1 custom.
For enable or disable default repositories edit '/etc/slpkg/repositories.conf'
file.
@@ -477,7 +465,7 @@ will be upgraded.
Would you like to continue [y/N]?
-$ slpkg -c slacky --upgrade
+$ slpkg -c alien --upgrade
Checking... Done
Reading package lists... Done
Resolving dependencies... Done
@@ -486,7 +474,7 @@ Resolving dependencies... Done
| Package New version Arch Build Repos Size
+==============================================================================
Upgrading:
- gstreamer1-1.4.1 1.4.4 x86_64 1 slacky 1563 K
+ gstreamer1-1.4.1 1.4.4 x86_64 1 alien 1563 K
Installing summary
===============================================================================
@@ -528,13 +516,12 @@ Would you like to continue [y/N]?
Upgrade only distribution:
```
-$ slpkg -c slack --upgrade --skip="multi:*multilib*,ktown:*" // This upgrade
-Checking... Done // distribution
- // and skip all
-Slackware64 'stable' v14.2 distribution is up to date // packages from
- // ktown repository
- // and multilib
- // from multi.
+$ slpkg -c slack --upgrade
+Checking... Done
+
+Slackware64 'stable' v14.2 distribution is up to date
+
+
```
Skip packages when upgrading:
diff --git a/README.rst b/README.rst
index d7ab5e55..5e91b8f9 100644
--- a/README.rst
+++ b/README.rst
@@ -1,5 +1,5 @@
***********
-slpkg 4.0.1
+slpkg 4.0.2
***********
Slpkg is a powerful software package manager that installs, updates, and removes packages on
@@ -35,9 +35,9 @@ Install from the official third party `SBo repository , <\fI[pattern], --checklist\fP>, \fB--case-ins\fP
-.PP
-View complete slackbuilds.org site in your terminal. Read file, download,
-build or install etc. Use "--checklist" additional option to load all repository, example:
-"# slpkg -n --checklist".
-.PP
-Additional options:
-.PP
-\fB--checklist\fP : Enable dialog utility and checklist option. (Require python3-pythondialog)
-.PP
-\fB--case-ins\fP : Search package name in repository with case insensitive.
-
.SS -i, --installpkg, install Slackware binary packages
\fBslpkg\fP \fB-i\fP \fB[--warn, --md5sum, --root /otherroot, --infobox, --menu, --terse,
--ask, --priority ADD|REC|OPT|SKP, --tagfile /somedir/tagfile]\fP <\fIpackages.t?z\fP>
@@ -324,20 +309,13 @@ For example:
slackware.com = "slack"
SlackBuilds.org = "sbo"
Alien's = "alien"
- slacky.eu = "slacky"
- rworkman's = "rlw"
Conraid's = "conrad"
slackonly.com = "slonly"
- Alien's ktown = "ktown{latest}"
Alien's multilib = "multi"
- Slacke E17 and E18 = "slacke{18}"
SalixOS = "salix"
- Slackel.gr = "slackel"
- Alien's restricted = "rested"
MATE Desktop Environment = "msb{1.18}"
Cinnamon Desktop Environment = "csb"
Connochaetos slack-n-free = "connos"
- Microlinux mles = "mles"
Default enable repository is "slack" and "sbo".
Add or remove default repository in configuration file "/etc/slpkg/repositories.conf".
diff --git a/man/slpkg.html b/man/slpkg.html
index 57d26c63..d6e624d0 100644
--- a/man/slpkg.html
+++ b/man/slpkg.html
@@ -379,10 +379,6 @@ options:
: Download packages without install.
---directory-prefix=[path/to/dir/]
-: Download packages in specific directory.
-
-
--case-ins
: Search package name in repository with case
insensitive.
@@ -474,29 +470,6 @@ options:
--third-party
: View all the third-party packages.
--n,
---network, view SBo packages
-slpkg -n <name of package>,
-<[pattern], --checklist>, --case-ins
-
-View complete
-slackbuilds.org site in your terminal. Read file, download,
-build or install etc. Use "--checklist" additional
-option to load all repository, example: "# slpkg -n
---checklist".
-
-Additional
-options:
-
-
---checklist
-: Enable dialog utility and checklist option. (Require
-python3-pythondialog)
-
-
---case-ins
-: Search package name in repository with case
-insensitive.
-i,
--installpkg, install Slackware binary packages
@@ -592,20 +565,13 @@ slpkg −−help - display help for slpkg
"slack"
SlackBuilds.org = "sbo"
Alien’s = "alien"
-slacky.eu = "slacky"
-rworkman’s = "rlw"
Conraid’s = "conrad"
slackonly.com = "slonly"
-Alien’s ktown = "ktown{latest}"
Alien’s multilib = "multi"
-Slacke E17 and E18 = "slacke{18}"
SalixOS = "salix"
-Slackel.gr = "slackel"
-Alien’s restricted = "rested"
MATE Desktop Environment = "msb{1.18}"
Cinnamon Desktop Environment = "csb"
Connochaetos slack-n-free = "connos"
-Microlinux mles = "mles"
Default enable
repository is "slack" and "sbo".
diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py
index bf04d38c..b012a9a2 100644
--- a/slpkg/__metadata__.py
+++ b/slpkg/__metadata__.py
@@ -77,7 +77,7 @@ class MetaData:
__all__ = "slpkg"
__author__ = "dslackw"
- __version_info__ = (4, 0, 1)
+ __version_info__ = (4, 0, 2)
__version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"
@@ -99,11 +99,8 @@ class MetaData:
"RELEASE": STABLE,
"SLACKWARE_VERSION": "off",
"COMP_ARCH": "off",
- "REPOSITORIES": ["slack", "sbo", "rlw", "alien",
- "slacky", "conrad", "slonly",
- "ktown{latest}", "multi", "slacke{18}",
- "salix", "slackl", "rested", "msb{1.18}",
- "csb", "connos", "mles{desktop}"],
+ "REPOSITORIES": ["slack", "sbo", "alien", "conrad", "slonly",
+ "multi", "salix", "msb{1.26}", "csb", "connos"],
"BUILD_PATH": "/tmp/slpkg/build/",
"SBOSRCARCH": "off",
"SBOSRCARCH_LINK": "http://slackware.uk/sbosrcarch/by-name/",
@@ -129,9 +126,9 @@ class MetaData:
"HTTP_PROXY": "",
}
- default_repositories = ["slack", "sbo", "rlw", "alien", "slacky", "conrad",
- "slonly", "ktown", "multi", "slacke", "salix",
- "slackl", "rested", "msb", "csb", "connos", "mles"]
+ default_repositories = ["slack", "sbo", "alien", "conrad",
+ "slonly", "multi", "salix", "msb",
+ "csb", "connos"]
# reads values from the configuration file
repositories = []
@@ -186,10 +183,7 @@ class MetaData:
slack_rel = select_slack_release(slack_rel)
# Grabs sub repositories
- ktown_kde_repo = grab_sub_repo(repositories, "ktown")
- slacke_sub_repo = grab_sub_repo(repositories, "slacke")
msb_sub_repo = grab_sub_repo(repositories, "msb")
- mles_sub_repo = grab_sub_repo(repositories, "mles")
# removes no default repositories
repositories = list(remove_repositories(repositories,
diff --git a/slpkg/arguments.py b/slpkg/arguments.py
index 3f5a5429..31ceb221 100644
--- a/slpkg/arguments.py
+++ b/slpkg/arguments.py
@@ -85,12 +85,6 @@ Optional arguments:
-v | --version Print program version and exit.
- -a | --autobuild, [script] [source...] Auto build SBo packages.
- If you have already downloaded the
- script and the source code you can
- build a new package with this
- command.
-
-b | --blacklist, [package...] --add, Manage packages in the blacklist.
--remove, list Add or remove packages and print
the list. Each package is added
@@ -119,7 +113,6 @@ Optional arguments:
-s | --sync, [repository] [package...], Sync packages. Install packages
--rebuild, --reinstall, directly from remote repositories
--resolve-off, --download-only, with all dependencies.
- --directory-prefix=[dir],
--case-ins, --patches
-t | --tracking, [repository] [package], Tracking package dependencies and
@@ -133,11 +126,6 @@ Optional arguments:
--color=[] directly from the repository and
change color text.
- -n | --network, [package], --checklist, View a standard of SBo page in
- --case-ins terminal and manage multiple
- options like reading, downloading,
- building, installation, etc.
-
-F | --FIND, [package...], --case-ins Find packages from each enabled
repository and view results.
@@ -190,7 +178,6 @@ def usage(repo, stderr):
Optional arguments:
[-h] [-v]
- [-a [script] [sources...]]
[-b [package...] --add, --remove,
[list]]
[-q [package...] --add, --remove,
@@ -201,12 +188,10 @@ def usage(repo, stderr):
--resolve-off, --checklist]
[-s [repository] [package...], --rebuild, --reinstall,
--resolve-off, --download-only,
- --directory-prefix=[dir],
--case-ins, --patches]
[-t [repository] [package], --check-deps, --graph=[type],
--case-ins]
[-p [repository] [package], --color=[]]
- [-n [SBo package], --checklist, --case-ins]
[-F [package...], --case-ins]
[-f [package...], --case-ins, --third-party]
[-i [options] [package...]]
diff --git a/slpkg/binary/__init__.py b/slpkg/binaries/__init__.py
similarity index 100%
rename from slpkg/binary/__init__.py
rename to slpkg/binaries/__init__.py
diff --git a/slpkg/binary/check.py b/slpkg/binaries/check.py
similarity index 96%
rename from slpkg/binary/check.py
rename to slpkg/binaries/check.py
index 2d64a64c..09b14f3f 100644
--- a/slpkg/binary/check.py
+++ b/slpkg/binaries/check.py
@@ -31,8 +31,8 @@ from slpkg.__metadata__ import MetaData as _meta_
from slpkg.pkg.find import find_package
-from slpkg.binary.greps import repo_data
-from slpkg.binary.repo_init import RepoInit
+from slpkg.binaries.queries import repo_data
+from slpkg.binaries.repo_init import RepoInit
def pkg_upgrade(repo, skip, flag):
diff --git a/slpkg/binary/dependency.py b/slpkg/binaries/dependency.py
similarity index 81%
rename from slpkg/binary/dependency.py
rename to slpkg/binaries/dependency.py
index 3045e208..d0159f61 100644
--- a/slpkg/binary/dependency.py
+++ b/slpkg/binaries/dependency.py
@@ -26,23 +26,23 @@ import sys
from functools import lru_cache
from slpkg.__metadata__ import MetaData as _meta_
-
-from slpkg.binary.greps import Requires
+from slpkg.blacklist import BlackList
+from slpkg.binaries.queries import Requires
class Dependencies:
"""Resolving binary dependencies
"""
- def __init__(self, repo, black):
+ def __init__(self, repo):
self.repo = repo
- self.black = black
+ self.black = BlackList().get()
self.dep_results = []
self.meta = _meta_
- def binary(self, name, flag):
+ def binary(self, name):
"""Builds all dependencies of a package
"""
- if self.meta.rsl_deps in ["on", "ON"] and "--resolve-off" not in flag:
+ if self.meta.rsl_deps in ["on", "ON"]:
sys.setrecursionlimit(10000)
dependencies = []
requires = Requires(name, self.repo).get_deps()
@@ -54,7 +54,7 @@ class Dependencies:
if req and req not in self.black:
dependencies.append(req)
- self.deep_check(tuple(dependencies), tuple(flag))
+ self.deep_check(tuple(dependencies))
return self.dep_results
@@ -62,9 +62,9 @@ class Dependencies:
return []
@lru_cache
- def deep_check(self, dependencies, flag):
+ def deep_check(self, dependencies):
"""Checking if dependencies are finnished
"""
if dependencies:
self.dep_results.append(dependencies)
- [self.binary(dep, flag) for dep in dependencies]
+ [self.binary(dep) for dep in dependencies]
diff --git a/slpkg/binary/install.py b/slpkg/binaries/install.py
similarity index 92%
rename from slpkg/binary/install.py
rename to slpkg/binaries/install.py
index 75b2f63d..4ff06aea 100644
--- a/slpkg/binary/install.py
+++ b/slpkg/binaries/install.py
@@ -43,12 +43,12 @@ from slpkg.pkg.find import find_package
from slpkg.pkg.manager import PackageManager
from slpkg.pkg.installed import GetFromInstalled
-from slpkg.binary.greps import repo_data
-from slpkg.binary.repo_init import RepoInit
-from slpkg.binary.dependency import Dependencies
+from slpkg.binaries.queries import repo_data
+from slpkg.binaries.repo_init import RepoInit
+from slpkg.binaries.dependency import Dependencies
-class BinaryInstall(BlackList, Utils):
+class BinaryInstall(Utils):
"""Installs binaries packages with all dependencies from
repository
"""
@@ -67,7 +67,6 @@ class BinaryInstall(BlackList, Utils):
self.msg = Msg()
self.version = self.meta.slack_rel
self.tmp_path = self.meta.slpkg_tmp_packages
- self.init_flags()
self.dwn, self.dep_dwn = [], []
self.install, self.dep_install = [], []
self.comp_sum, self.dep_comp_sum = [], []
@@ -83,20 +82,9 @@ class BinaryInstall(BlackList, Utils):
for name in self.data[0]:
self.repo_pkg_names.append(split_package(name)[0])
- self.blacklist = list(self.get_black())
+ self.blacklist = BlackList().get()
self.matching = False
- def init_flags(self):
- """Flags initiliazation
- """
- for fl in self.flag:
-
- if fl.startswith("--directory-prefix="):
- self.tmp_path = fl.split("=")[1]
-
- if not self.tmp_path.endswith("/"):
- self.tmp_path += "/"
-
def start(self, is_upgrade):
"""Installs packages from official Slackware distribution
"""
@@ -105,6 +93,7 @@ class BinaryInstall(BlackList, Utils):
self.is_upgrade = is_upgrade
mas_sum = dep_sum = sums = 0, 0, 0, 0
self.msg.done()
+
self.dependencies = self.resolving_deps()
self.update_deps()
@@ -237,12 +226,11 @@ class BinaryInstall(BlackList, Utils):
self.packages[index] = value
def update_deps(self):
- """Updates dependencies dictionary with all package
+ """Updates dependencies dictionary with all packages
"""
for dep in self.dependencies:
deps = self.dimensional_list(Dependencies(
- self.repo, self.blacklist).binary(
- dep, self.flag))
+ self.repo).binary(dep))
self.deps_dict[dep] = deps
@@ -251,7 +239,7 @@ class BinaryInstall(BlackList, Utils):
or if added to install two or more times
"""
packages = []
- for mas in self.remove_dbs(self.packages):
+ for mas in self.packages:
if mas not in self.dependencies:
packages.append(mas)
@@ -310,18 +298,24 @@ class BinaryInstall(BlackList, Utils):
"""
requires = []
- if (self.meta.rsl_deps in ["on", "ON"] and
- self.flag != "--resolve-off"):
- self.msg.resolving()
+ if (self.meta.rsl_deps in ["off", "OFF"] and
+ "--resolve-off" not in self.flag):
+ return requires
+
+ self.msg.resolving()
for dep in self.packages:
- dependencies = []
- dependencies = self.dimensional_list(Dependencies(
- self.repo, self.blacklist).binary(dep, self.flag))
- requires += list(self._fix_deps_repos(dependencies))
- self.deps_dict[dep] = self.remove_dbs(requires)
- return self.remove_dbs(requires)
+ dependencies = []
+
+ dependencies = self.dimensional_list(Dependencies(
+ self.repo).binary(dep))
+
+ requires += list(self._fix_deps_repos(dependencies))
+
+ self.deps_dict[dep] = requires
+
+ return requires
def _fix_deps_repos(self, dependencies):
"""Fixes store deps include in the repository
diff --git a/slpkg/binaries/queries.py b/slpkg/binaries/queries.py
new file mode 100644
index 00000000..2f431655
--- /dev/null
+++ b/slpkg/binaries/queries.py
@@ -0,0 +1,152 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+
+# greps.py file is part of slpkg.
+
+# Copyright 2014-2022 Dimitris Zlatanidis
+# All rights reserved.
+
+# Slpkg is a user-friendly package manager for Slackware installations
+
+# https://gitlab.com/dslackw/slpkg
+
+# Slpkg is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+
+from slpkg.utils import Utils
+from slpkg.splitting import split_package
+from slpkg.__metadata__ import MetaData as _meta_
+
+from slpkg.slack.slack_version import slack_ver
+from slpkg.models.models import AlienTable, session
+
+
+class PkgQuery:
+
+ def __init__(self, name):
+ self.name = name
+ self.session = session
+
+ def location(self):
+
+ location = self.session.query(AlienTable).filter(
+ AlienTable.location == self.name).first()
+
+ return location[0]
+
+
+def repo_data(PACKAGES_TXT, repo, flag):
+ """Grabs data packages
+ """
+ (name, location, size, unsize,
+ rname, rlocation, rsize, runsize) = ([] for i in range(8))
+
+ for line in PACKAGES_TXT.splitlines():
+ if line.startswith("PACKAGE NAME:"):
+ name.append(line[15:].strip())
+
+ if line.startswith("PACKAGE LOCATION:"):
+ location.append(line[21:].strip())
+
+ if line.startswith("PACKAGE SIZE (compressed):"):
+ size.append(line[28:-2].strip())
+
+ if line.startswith("PACKAGE SIZE (uncompressed):"):
+ unsize.append(line[30:-2].strip())
+
+ if repo == "slack" and "--upgrade" not in flag:
+ (rname,
+ rlocation,
+ rsize,
+ runsize
+ ) = slack_filter(name, location, size, unsize, flag)
+
+ elif repo == "alien":
+ (rname,
+ rlocation,
+ rsize,
+ runsize
+ ) = alien_filter(name, location, size, unsize)
+
+ else:
+ rname, rlocation, rsize, runsize = name, location, size, unsize
+
+ return [rname, rlocation, rsize, runsize]
+
+
+def slack_filter(name, location, size, unsize, flag):
+ """Slackware filter seperate packages from patches/ directory
+ """
+ (fname, flocation, fsize, funsize) = ([] for i in range(4))
+
+ if "--patches" not in flag:
+
+ for n, l, s, u in zip(name, location, size, unsize):
+
+ if f"_slack{slack_ver()}" not in n:
+ fname.append(n)
+ flocation.append(l)
+ fsize.append(s)
+ funsize.append(u)
+
+ if "--patches" in flag:
+
+ for n, l, s, u in zip(name, location, size, unsize):
+
+ if f"_slack{slack_ver()}" in n:
+ fname.append(n)
+ flocation.append(l)
+ fsize.append(s)
+ funsize.append(u)
+
+ return [fname, flocation, fsize, funsize]
+
+
+def alien_filter(name, location, size, unsize):
+ """Fix to avoid packages include in slackbuilds folder
+ """
+ (fname, flocation, fsize, funsize) = ([] for i in range(4))
+
+ for n, l, s, u in zip(name, location, size, unsize):
+
+ if "slackbuilds" != l:
+ fname.append(n)
+ flocation.append(l)
+ fsize.append(s)
+ funsize.append(u)
+
+ return [fname, flocation, fsize, funsize]
+
+
+class Requires:
+
+ def __init__(self, name, repo):
+ self.name = name
+ self.repo = repo
+
+ def get_deps(self):
+ """Grabs package requirements from repositories
+ """
+ PACKAGES_TXT = Utils().read_file(f"{_meta_.lib_path}"
+ f"{self.repo}_repo/PACKAGES.TXT")
+
+ for line in PACKAGES_TXT.splitlines():
+
+ if line.startswith("PACKAGE NAME:"):
+ pkg_name = split_package(line[14:].strip())[0]
+
+ if line.startswith("PACKAGE REQUIRED:"):
+
+ if pkg_name == self.name:
+
+ if line[18:].strip():
+ return line.replace("PACKAGE REQUIRED:", "").split(",")
diff --git a/slpkg/binary/repo_init.py b/slpkg/binaries/repo_init.py
similarity index 75%
rename from slpkg/binary/repo_init.py
rename to slpkg/binaries/repo_init.py
index 56a1d9cf..7885bc93 100644
--- a/slpkg/binary/repo_init.py
+++ b/slpkg/binaries/repo_init.py
@@ -57,9 +57,6 @@ class RepoInit(Utils):
def _init_slack(self):
self.mirror = mirrors(name="", location="")
- def _init_rlw(self):
- self.mirror = f"{self.def_repo_dict}{slack_ver()}/"
-
def _init_alien(self):
ver = slack_ver()
arch = "x86"
@@ -71,13 +68,6 @@ class RepoInit(Utils):
self.mirror = f"{self.def_repo_dict['alien']}{ver}/{arch}/"
- def _init_slacky(self):
- arch = ""
- if self.meta.arch == "x86_64":
- arch = "64"
-
- self.mirror = f"{self.def_repo_dict}slackware{arch}-{slack_ver()}/"
-
def _init_conrad(self):
self.mirror = self.def_repo_dict["conrad"]
@@ -97,9 +87,6 @@ class RepoInit(Utils):
self.mirror = f"{self.def_repo_dict['slonly']}{arch}/"
- def _init_ktown(self):
- self.mirror = self.def_repo_dict["ktown"]
-
def _init_multi(self):
ver = slack_ver()
if self.meta.slack_rel == "current":
@@ -107,15 +94,6 @@ class RepoInit(Utils):
self.mirror = self.def_repo_dict["multi"] + ver + "/"
- def _init_slacke(self):
- arch = ""
- if self.meta.arch == "x86_64":
- arch = "64"
-
- self.mirror = (f"{self.def_repo_dict['slacke']}"
- f"slacke{self.meta.slacke_sub_repo[1:-1]}/slackware"
- f"{arch}-{slack_ver()}/")
-
def _init_salix(self):
arch = "i486"
if self.meta.arch == "x86_64":
@@ -123,16 +101,6 @@ class RepoInit(Utils):
self.mirror = f"{self.def_repo_dict['salix']}{arch}/{slack_ver()}/"
- def _init_slackl(self):
- arch = "i486"
- if self.meta.arch == "x86_64":
- arch = "x86_64"
-
- self.mirror = f"{self.def_repo_dict['slackl']}{arch}/current/"
-
- def _init_rested(self):
- self.mirror = self.def_repo_dict["rested"]
-
def _init_msb(self):
arch = "x86"
if self.meta.arch == "x86_64":
@@ -153,11 +121,3 @@ class RepoInit(Utils):
arch = "64"
self.mirror = (f"{self.def_repo_dict['connos']}slack-n-free"
f"{arch}-{slack_ver()}/")
-
- def _init_mles(self):
- arch = "32"
- if self.meta.arch == "x86_64":
- arch = "64"
- self.mirror = (f"{self.def_repo_dict['mles']}"
- f"{self.meta.mles_sub_repo[1:-1]}-"
- f"{slack_ver()}-{arch}bit/")
diff --git a/slpkg/binary/search.py b/slpkg/binaries/search.py
similarity index 97%
rename from slpkg/binary/search.py
rename to slpkg/binaries/search.py
index 31f24b2b..1b609a94 100644
--- a/slpkg/binary/search.py
+++ b/slpkg/binaries/search.py
@@ -37,7 +37,7 @@ def search_pkg(name, repo):
text = utils.read_file(_meta_.lib_path + f"{repo}_repo/PACKAGES.TXT")
PACKAGES_TXT = list(utils.package_name(text))
- blacklist = list(black.get_black())
+ blacklist = black.get()
if name in PACKAGES_TXT and name not in blacklist:
return name
diff --git a/slpkg/binary/greps.py b/slpkg/binary/greps.py
deleted file mode 100644
index 125560a5..00000000
--- a/slpkg/binary/greps.py
+++ /dev/null
@@ -1,284 +0,0 @@
-#!/usr/bin/python3
-# -*- coding: utf-8 -*-
-
-# greps.py file is part of slpkg.
-
-# Copyright 2014-2022 Dimitris Zlatanidis
-# All rights reserved.
-
-# Slpkg is a user-friendly package manager for Slackware installations
-
-# https://gitlab.com/dslackw/slpkg
-
-# Slpkg is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-
-from functools import lru_cache
-from slpkg.utils import Utils
-from slpkg.splitting import split_package
-from slpkg.__metadata__ import MetaData as _meta_
-
-from slpkg.slack.slack_version import slack_ver
-
-
-def repo_data(PACKAGES_TXT, repo, flag):
- """Grabs data packages
- """
- (name, location, size, unsize,
- rname, rlocation, rsize, runsize) = ([] for i in range(8))
-
- for line in PACKAGES_TXT.splitlines():
-
- if line.startswith("PACKAGE NAME:"):
- name.append(line[15:].strip())
-
- if line.startswith("PACKAGE LOCATION:"):
- location.append(line[21:].strip())
-
- if line.startswith("PACKAGE SIZE (compressed):"):
- size.append(line[28:-2].strip())
-
- if line.startswith("PACKAGE SIZE (uncompressed):"):
- unsize.append(line[30:-2].strip())
-
- if repo == "slack" and "--upgrade" not in flag:
- (rname,
- rlocation,
- rsize,
- runsize
- ) = slack_filter(name, location, size, unsize, flag)
-
- elif repo == "rlw":
- (rname,
- rlocation,
- rsize,
- runsize
- ) = rlw_filter(name, location, size, unsize)
-
- elif repo == "alien":
- (rname,
- rlocation,
- rsize,
- runsize
- ) = alien_filter(name, location, size, unsize)
-
- elif repo == "rested":
- (rname,
- rlocation,
- rsize,
- runsize
- ) = rested_filter(name, location, size, unsize)
-
- elif repo == "ktown":
- (rname,
- rlocation,
- rsize,
- runsize
- ) = ktown_filter(name, location, size, unsize)
-
- else:
- rname, rlocation, rsize, runsize = name, location, size, unsize
-
- return [rname, rlocation, rsize, runsize]
-
-
-def slack_filter(name, location, size, unsize, flag):
- """Slackware filter seperate packages from patches/ directory
- """
- (fname, flocation, fsize, funsize) = ([] for i in range(4))
-
- if "--patches" not in flag:
-
- for n, l, s, u in zip(name, location, size, unsize):
-
- if f"_slack{slack_ver()}" not in n:
- fname.append(n)
- flocation.append(l)
- fsize.append(s)
- funsize.append(u)
-
- if "--patches" in flag:
-
- for n, l, s, u in zip(name, location, size, unsize):
-
- if f"_slack{slack_ver()}" in n:
- fname.append(n)
- flocation.append(l)
- fsize.append(s)
- funsize.append(u)
-
- return [fname, flocation, fsize, funsize]
-
-
-def rlw_filter(name, location, size, unsize):
- """Filter rlw repository data
- """
- arch = _meta_.arch
-
- if arch.startswith("i") and arch.endswith("86"):
- arch = "i486"
-
- (fname, flocation, fsize, funsize) = ([] for i in range(4))
-
- for n, l, s, u in zip(name, location, size, unsize):
-
- loc = l.split("/")
-
- if arch == loc[-1]:
- fname.append(n)
- flocation.append(l)
- fsize.append(s)
- funsize.append(u)
-
- return [fname, flocation, fsize, funsize]
-
-
-def alien_filter(name, location, size, unsize):
- """Fix to avoid packages include in slackbuilds folder
- """
- (fname, flocation, fsize, funsize) = ([] for i in range(4))
-
- for n, l, s, u in zip(name, location, size, unsize):
-
- if "slackbuilds" != l:
- fname.append(n)
- flocation.append(l)
- fsize.append(s)
- funsize.append(u)
-
- return [fname, flocation, fsize, funsize]
-
-
-def rested_filter(name, location, size, unsize):
- """Filter Alien"s repository data
- """
- ver = slack_ver()
- if _meta_.slack_rel == "current":
- ver = "current"
-
- path_pkg = "pkg"
-
- if _meta_.arch == "x86_64":
- path_pkg = "pkg64"
-
- (fname, flocation, fsize, funsize) = ([] for i in range(4))
-
- for n, l, s, u in zip(name, location, size, unsize):
-
- if path_pkg == l.split("/")[-2] and ver == l.split("/")[-1]:
- fname.append(n)
- flocation.append(l)
- fsize.append(s)
- funsize.append(u)
-
- return [fname, flocation, fsize, funsize]
-
-
-def ktown_filter(name, location, size, unsize):
- """Filter Alien"s ktown repository data
- """
- ver = slack_ver()
-
- if _meta_.slack_rel == "current":
- ver = "current"
-
- path_pkg = "x86"
-
- if _meta_.arch == "x86_64":
- path_pkg = _meta_.arch
-
- (fname, flocation, fsize, funsize) = ([] for i in range(4))
-
- for n, l, s, u in zip(name, location, size, unsize):
-
- if (path_pkg in l and _meta_.ktown_kde_repo[1:-1] in l and
- l.startswith(ver)):
- fname.append(n)
- flocation.append(l)
- fsize.append(s)
- funsize.append(u)
-
- return [fname, flocation, fsize, funsize]
-
-
-class Requires:
-
- def __init__(self, name, repo):
- self.name = name
- self.repo = repo
-
- def get_deps(self):
- """Grabs package requirements from repositories
- """
- if self.repo == "rlw":
-
- dependencies = {}
- rlw_deps = Utils().read_file(_meta_.conf_path + "rlworkman.deps")
-
- for line in rlw_deps.splitlines():
-
- if line and not line.startswith("#"):
- pkgs = line.split(":")
- dependencies[pkgs[0]] = pkgs[1]
-
- if self.name in dependencies.keys():
- return dependencies[self.name].split()
-
- else:
- return ""
-
- else:
- PACKAGES_TXT = Utils().read_file(f"{_meta_.lib_path}"
- f"{self.repo}_repo/PACKAGES.TXT")
-
- for line in PACKAGES_TXT.splitlines():
-
- if line.startswith("PACKAGE NAME:"):
- pkg_name = split_package(line[14:].strip())[0]
-
- if line.startswith("PACKAGE REQUIRED:"):
-
- if pkg_name == self.name:
-
- if line[18:].strip():
- return self._req_fix(line)
-
- @lru_cache
- def _req_fix(self, line):
- """Fix slacky and salix requirements because many dependencies
- splitting with "," and others with "|"
- """
- deps = []
-
- for dep in line[18:].strip().split(","):
- dep = dep.split("|")
-
- if self.repo == "slacky":
-
- if len(dep) > 1:
-
- for d in dep:
- deps.append(d.split()[0])
-
- dep = "".join(dep)
- deps.append(dep.split()[0])
-
- else:
-
- if len(dep) > 1:
-
- for d in dep:
- deps.append(d)
-
- deps.append(dep[0])
-
- return deps
diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py
index e22f2d13..a91dcd21 100644
--- a/slpkg/blacklist.py
+++ b/slpkg/blacklist.py
@@ -43,7 +43,10 @@ class BlackList(Utils):
if os.path.isfile(self.blackfile):
self.black_conf = self.read_file(self.blackfile)
- def get_black(self):
+ def get(self):
+ return list(self.black_list())
+
+ def black_list(self):
"""Return blacklist packages from /etc/slpkg/blacklist
configuration file."""
blacklist = list(self.black_filter())
diff --git a/slpkg/checks.py b/slpkg/checks.py
index aaa10025..c0cb4c2c 100644
--- a/slpkg/checks.py
+++ b/slpkg/checks.py
@@ -46,21 +46,14 @@ class Updates:
self.all_repos = {
"slack": self._init.slack,
"sbo": self._init.sbo,
- "rlw": self._init.rlw,
"alien": self._init.alien,
- "slacky": self._init.slacky,
"conrad": self._init.conrad,
"slonly": self._init.slonly,
- "ktown": self._init.ktown,
"multi": self._init.multi,
- "slacke": self._init.slacke,
"salix": self._init.salix,
- "slackl": self._init.slackl,
- "rested": self._init.rested,
"msb": self._init.msb,
"csb": self._init.csb,
"connos": self._init.msb,
- "mles": self._init.mles
}
def status_bar(self):
diff --git a/slpkg/desc.py b/slpkg/desc.py
index 97e4a6f8..91cd4ea9 100644
--- a/slpkg/desc.py
+++ b/slpkg/desc.py
@@ -26,7 +26,7 @@ from slpkg.utils import Utils
from slpkg.messages import Msg
from slpkg.__metadata__ import MetaData as _meta_
-from slpkg.sbo.greps import SBoGrep
+from slpkg.sbo.queries import SboQuery
class PkgDesc(Utils):
@@ -57,7 +57,7 @@ class PkgDesc(Utils):
description, count = "", 0
if self.repo == "sbo":
- description = SBoGrep(self.name).description()
+ description = SboQuery(self.name).description()
else:
PACKAGES_TXT = self.read_file(self.lib)
diff --git a/slpkg/init.py b/slpkg/init.py
index 406913b3..a9311d70 100644
--- a/slpkg/init.py
+++ b/slpkg/init.py
@@ -34,7 +34,7 @@ from slpkg.__metadata__ import MetaData as _meta_
from slpkg.slack.mirrors import mirrors
from slpkg.slack.slack_version import slack_ver
-from slpkg.models.models import SBoTable, session
+from slpkg.models.models import SBoTable, AlienTable, session
class Init(Utils):
@@ -195,36 +195,6 @@ class Init(Utils):
self.remote(log, ChangeLog_txt, lib, SLACKBUILDS_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
- def rlw(self):
- """Creating rlw local library
- """
- repo = self.def_repos_dict["rlw"]
- log = self.log_path + "rlw/"
- lib = self.lib_path + "rlw_repo/"
- repo_name = Init.rlw.__name__
-
- lib_file = "PACKAGES.TXT"
- # lst_file = ""
- md5_file = "CHECKSUMS.md5"
- log_file = "ChangeLog.txt"
-
- self.make_dir([log, lib])
-
- PACKAGES_TXT = f"{repo}{self.slack_ver}/{lib_file}"
- FILELIST_TXT = ""
- CHECKSUMS_MD5 = f"{repo}{self.slack_ver}/{md5_file}"
- ChangeLog_txt = f"{repo}{self.slack_ver}/{log_file}"
-
- if self.check:
- return self.checks_logs(log, ChangeLog_txt)
-
- self.down(lib, PACKAGES_TXT, repo_name)
- self.down(lib, CHECKSUMS_MD5, repo_name)
- self.down(log, ChangeLog_txt, repo_name)
-
- self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
- FILELIST_TXT, repo_name)
-
def alien(self):
"""Creating alien local library
"""
@@ -263,43 +233,8 @@ class Init(Utils):
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
- def slacky(self):
- """Creating slacky.eu local library
- """
- ar = ""
- repo = self.def_repos_dict["slacky"]
- log = self.log_path + "slacky/"
- lib = self.lib_path + "slacky_repo/"
- repo_name = Init.slacky.__name__
-
- lib_file = "PACKAGES.TXT"
- # lst_file = ""
- md5_file = "CHECKSUMS.md5"
- log_file = "ChangeLog.txt"
-
- self.make_dir([log, lib])
-
- if self.arch == "x86_64":
- ar = "64"
-
- PACKAGES_TXT = f"{repo}slackware{ar}-{self.slack_ver}/{lib_file}"
- FILELIST_TXT = ""
- CHECKSUMS_MD5 = f"{repo}slackware{ar}-{self.slack_ver}/{md5_file}"
-
- ChangeLog_txt = f"{repo}slackware{ar}-{self.slack_ver}/{log_file}"
-
- if self.check:
- return self.checks_logs(log, ChangeLog_txt)
-
- self.down(lib, PACKAGES_TXT, repo_name)
- self.down(lib, CHECKSUMS_MD5, repo_name)
- self.down(log, ChangeLog_txt, repo_name)
-
- self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
- FILELIST_TXT, repo_name)
-
def conrad(self):
- """Creating slackers local library
+ """Creating conrad local library
"""
repo = self.def_repos_dict["conrad"]
log = self.log_path + "conrad/"
@@ -328,7 +263,7 @@ class Init(Utils):
FILELIST_TXT, repo_name)
def slonly(self):
- """Creating slackers local library
+ """Creating slonly local library
"""
ar = f"{self.slack_ver}-x86"
repo = self.def_repos_dict["slonly"]
@@ -367,36 +302,6 @@ class Init(Utils):
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
- def ktown(self):
- """Creating alien ktown local library
- """
- repo = self.def_repos_dict["ktown"]
- log = self.log_path + "ktown/"
- lib = self.lib_path + "ktown_repo/"
- repo_name = Init.ktown.__name__
-
- lib_file = "PACKAGES.TXT"
- # lst_file = ""
- md5_file = "CHECKSUMS.md5"
- log_file = "ChangeLog.txt"
-
- self.make_dir([log, lib])
-
- PACKAGES_TXT = f"{repo}{lib_file}"
- FILELIST_TXT = ""
- CHECKSUMS_MD5 = f"{repo}{md5_file}"
- ChangeLog_txt = f"{repo}{log_file}"
-
- if self.check:
- return self.checks_logs(log, ChangeLog_txt)
-
- self.down(lib, PACKAGES_TXT, repo_name)
- self.down(lib, CHECKSUMS_MD5, repo_name)
- self.down(log, ChangeLog_txt, repo_name)
-
- self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
- FILELIST_TXT, repo_name)
-
def multi(self):
"""Creating alien multilib local library
"""
@@ -431,44 +336,6 @@ class Init(Utils):
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
- def slacke(self):
- """Creating Slacke local library
- """
- ar = ""
- repo = self.def_repos_dict["slacke"]
- log = self.log_path + "slacke/"
- lib = self.lib_path + "slacke_repo/"
- repo_name = Init.slacke.__name__
-
- lib_file = "PACKAGES.TXT"
- # lst_file = ""
- md5_file = "CHECKSUMS.md5"
- log_file = "ChangeLog.txt"
-
- self.make_dir([log, lib])
-
- if self.arch == "x86_64":
- ar = "64"
-
- version = self.meta.slacke_sub_repo[1:-1]
- PACKAGES_TXT = (f"{repo}slacke{version}/slackware{ar}-"
- f"{self.slack_ver}/{lib_file}")
- FILELIST_TXT = ""
- CHECKSUMS_MD5 = (f"{repo}slacke{version}/slackware{ar}-"
- f"{self.slack_ver}/{md5_file}")
- ChangeLog_txt = (f"{repo}slacke{version}/slackware{ar}-"
- f"{self.slack_ver}/{log_file}")
-
- if self.check:
- return self.checks_logs(log, ChangeLog_txt)
-
- self.down(lib, PACKAGES_TXT, repo_name)
- self.down(lib, CHECKSUMS_MD5, repo_name)
- self.down(log, ChangeLog_txt, repo_name)
-
- self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
- FILELIST_TXT, repo_name)
-
def salix(self):
"""Creating SalixOS local library
"""
@@ -503,70 +370,6 @@ class Init(Utils):
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
- def slackl(self):
- """Creating slackel.gr local library
- """
- ar = "i486"
- repo = self.def_repos_dict["slackl"]
- log = self.log_path + "slackl/"
- lib = self.lib_path + "slackl_repo/"
- repo_name = Init.slackl.__name__
-
- lib_file = "PACKAGES.TXT"
- # lst_file = ""
- md5_file = "CHECKSUMS.md5"
- log_file = "ChangeLog.txt"
-
- self.make_dir([log, lib])
-
- if self.arch == "x86_64":
- ar = "x86_64"
-
- PACKAGES_TXT = f"{repo}{ar}/current/{lib_file}"
- FILELIST_TXT = ""
- CHECKSUMS_MD5 = f"{repo}{ar}/current/{md5_file}"
- ChangeLog_txt = f"{repo}{ar}/current/{log_file}"
-
- if self.check:
- return self.checks_logs(log, ChangeLog_txt)
-
- self.down(lib, PACKAGES_TXT, repo_name)
- self.down(lib, CHECKSUMS_MD5, repo_name)
- self.down(log, ChangeLog_txt, repo_name)
-
- self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
- FILELIST_TXT, repo_name)
-
- def rested(self):
- """Creating alien restricted local library
- """
- repo = self.def_repos_dict["rested"]
- log = self.log_path + "rested/"
- lib = self.lib_path + "rested_repo/"
- repo_name = Init.rested.__name__
-
- lib_file = "PACKAGES.TXT"
- # lst_file = ""
- md5_file = "CHECKSUMS.md5"
- log_file = "ChangeLog.txt"
-
- self.make_dir([log, lib])
-
- PACKAGES_TXT = f"{repo}{lib_file}"
- FILELIST_TXT = ""
- CHECKSUMS_MD5 = f"{repo}{md5_file}"
- ChangeLog_txt = f"{repo}{log_file}"
-
- if self.check:
- return self.checks_logs(log, ChangeLog_txt)
-
- self.down(lib, PACKAGES_TXT, repo_name)
- self.down(lib, CHECKSUMS_MD5, repo_name)
- self.down(log, ChangeLog_txt, repo_name)
-
- self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
- FILELIST_TXT, repo_name)
-
def msb(self):
"""Creating MATE local library
"""
@@ -679,41 +482,6 @@ class Init(Utils):
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
- def mles(self):
- """Creating Microlinux local library
- """
- ar = "32"
- repo = self.def_repos_dict["mles"]
- log = self.log_path + "mles/"
- lib = self.lib_path + "mles_repo/"
- repo_name = Init.mles.__name__
-
- lib_file = "PACKAGES.TXT"
- # lst_file = ""
- md5_file = "CHECKSUMS.md5"
- log_file = "ChangeLog.txt"
-
- self.make_dir([log, lib])
-
- if self.arch == "x86_64":
- ar = "64"
-
- version = self.meta.mles_sub_repo[1:-1]
- PACKAGES_TXT = f"{repo}{version}-{self.slack_ver}-{ar}bit/{lib_file}"
- FILELIST_TXT = ""
- CHECKSUMS_MD5 = f"{repo}{version}-{self.slack_ver}-{ar}bit/{md5_file}"
- ChangeLog_txt = f"{repo}{version}-{self.slack_ver}-{ar}bit/{log_file}"
-
- if self.check:
- return self.checks_logs(log, ChangeLog_txt)
-
- self.down(lib, PACKAGES_TXT, repo_name)
- self.down(lib, CHECKSUMS_MD5, repo_name)
- self.down(log, ChangeLog_txt, repo_name)
-
- self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
- FILELIST_TXT, repo_name)
-
def down(self, path, link, repo):
"""Downloads files
"""
@@ -731,7 +499,6 @@ class Init(Utils):
CHECKSUMS_MD5 = args[4]
FILELIST_TXT = args[5]
repo = args[6]
-
if self.checks_logs(log_path, ChangeLog_txt):
# remove old files
self.file_remove(log_path, ChangeLog_txt.split("/")[-1])
@@ -760,9 +527,7 @@ class Init(Utils):
self.down(lib_path, FILELIST_TXT, repo)
self.down(log_path, ChangeLog_txt, repo)
- if repo == 'sbo':
- self.session.query(SBoTable).delete() # delete all data
- self.session.commit()
+ delete_table_data(repo)
def merge(self, path, outfile, infiles):
"""Merging files
@@ -798,7 +563,6 @@ class Init(Utils):
if os.path.isfile(log_path + filename):
local = FileSize(log_path + filename).local()
-
if server != local:
return True
@@ -846,10 +610,7 @@ class Upgrade:
update = Update()
update.run(repos)
- def del_tables(self, repo):
- if repo == 'sbo':
- self.session.query(SBoTable).delete() # delete all data
- self.session.commit()
+ delete_table_data(repo)
class Update:
@@ -909,12 +670,25 @@ class Update:
if self.session.query(SBoTable).first() is None:
db.insert_sbo_table()
+ if self.session.query(AlienTable).first() is None:
+ db.insert_alien_table()
+
def done_msg(self, repo):
print(f"{self.grey}Checking repository "
f"[{self.cyan}{repo}{self.grey}] ... "
f"{self.endc}", end="", flush=True)
+def delete_table_data(repo):
+ if repo == 'sbo':
+ session.query(SBoTable).delete()
+ session.commit()
+
+ if repo == 'alien':
+ session.query(AlienTable).delete()
+ session.commit()
+
+
def check_exists_repositories(repo):
"""Checking if repositories exists by PACKAGES.TXT file
"""
diff --git a/slpkg/main.py b/slpkg/main.py
index a197928e..3c35e93b 100644
--- a/slpkg/main.py
+++ b/slpkg/main.py
@@ -57,22 +57,21 @@ from slpkg.pkg.manager import PackageManager
from slpkg.sbo.queue import QueuePkgs
from slpkg.sbo.check import sbo_upgrade
-from slpkg.sbo.network import SBoNetwork
-from slpkg.sbo.autobuild import AutoBuild
from slpkg.sbo.slackbuild import SBoInstall
from slpkg.slack.patches import Patches
-from slpkg.binary.check import pkg_upgrade
-from slpkg.binary.install import BinaryInstall
+from slpkg.binaries.check import pkg_upgrade
+from slpkg.binaries.install import BinaryInstall
-class ArgParse(BlackList):
+class ArgParse:
def __init__(self, args):
super().__init__()
self.args = args
self.meta = _meta_
self.msg = Msg()
+ self.blacklist = BlackList().get()
self.commands = [
"update",
"upgrade",
@@ -292,20 +291,6 @@ class ArgParse(BlackList):
else:
usage("", 1)
- def auto_build(self):
- """Auto built tool
- """
- options = [
- "-a",
- "--autobuild"
- ]
-
- if len(self.args) >= 3 and self.args[0] in options:
- AutoBuild(self.args[1], self.args[2:], self.meta.path).run()
-
- else:
- usage("", 1)
-
def pkg_list(self):
"""List of packages by repository
"""
@@ -437,7 +422,6 @@ class ArgParse(BlackList):
additional_options = [
"--resolve-off",
"--download-only",
- "--directory-prefix=",
"--case-ins",
"--rebuild",
"--reinstall",
@@ -524,40 +508,6 @@ class ArgParse(BlackList):
else:
usage("", 1)
- def sbo_network(self):
- """Views slackbuilds packages
- """
- flag = []
- options = [
- "-n",
- "--network"
- ]
- additional_options = [
- "--checklist",
- "--case-ins"
- ]
-
- for add in additional_options:
-
- if add in self.args:
- flag.append(add)
- self.args.remove(add)
-
- if "--checklist" in flag:
- self.if_checklist()
-
- if (len(self.args) == 2 and self.args[0] in options and
- "sbo" in self.meta.repositories):
- SBoNetwork(self.args[1], flag).view()
-
- elif (len(self.args) == 1 and self.args[0] in options and
- "sbo" in self.meta.repositories and
- additional_options[0] in flag):
- SBoNetwork("", flag).view()
-
- else:
- usage("sbo", 1)
-
def pkg_blacklist(self):
"""Manages blacklist packages
"""
@@ -584,7 +534,7 @@ class ArgParse(BlackList):
elif (len(self.args) == 2 and self.args[0] in options and
flag[1] in self.args):
self.args.remove(flag[1])
- self.black_remove(list(self.get_black()))
+ self.black_remove(self.blacklist)
elif (len(self.args) > 2 and self.args[0] in options and
flag[1] in self.args):
@@ -998,8 +948,6 @@ def main():
"deps-status": argparse.command_deps_status,
"new-config": argparse.command_new_config,
"clean-tmp": argparse.command_clean_tmp,
- "-a": argparse.auto_build,
- "--autobuild": argparse.auto_build,
"-l": argparse.pkg_list,
"--list": argparse.pkg_list,
"-c": argparse.pkg_upgrade,
@@ -1008,8 +956,6 @@ def main():
"--sync": argparse.pkg_install,
"-t": argparse.pkg_tracking,
"--tracking": argparse.pkg_tracking,
- "-n": argparse.sbo_network,
- "--netwotk": argparse.sbo_network,
"-b": argparse.pkg_blacklist,
"--blacklist": argparse.pkg_blacklist,
"-q": argparse.pkg_queue,
diff --git a/slpkg/models/data.py b/slpkg/models/data.py
index b406012b..3f6c11bd 100644
--- a/slpkg/models/data.py
+++ b/slpkg/models/data.py
@@ -24,7 +24,7 @@
from progress.bar import Bar
from slpkg.__metadata__ import MetaData as _meta_
-from slpkg.models.models import SBoTable, session
+from slpkg.models.models import SBoTable, AlienTable, session
class Database:
@@ -33,6 +33,21 @@ class Database:
self.lib_path = _meta_.lib_path
self.session = session
+ self.pkg_tags = [
+ "PACKAGE NAME:",
+ "PACKAGE LOCATION:",
+ "PACKAGE SIZE (compressed):",
+ "PACKAGE SIZE (uncompressed):",
+ "PACKAGE REQUIRED:",
+ "PACKAGE CONFLICTS:",
+ "PACKAGE SUGGESTS:",
+ "PACKAGE DESCRIPTION:"
+ ]
+
+ def open_file(self, file):
+ with open(file, "r", encoding="utf-8") as f:
+ return f.readlines()
+
def insert_sbo_table(self):
"""Grabbing data line by line and inserting them into the database
"""
@@ -65,7 +80,8 @@ class Database:
cache.append(line)
if (i % 11) == 0:
- data = SBoTable(name=cache[0], location=cache[1],
+ data = SBoTable(name=cache[0],
+ location=cache[1].split('/')[1:-1][0],
files=cache[2], version=cache[3],
download=cache[4], download64=cache[5],
md5sum=cache[6], md5sum64=cache[7],
@@ -79,6 +95,33 @@ class Database:
self.session.commit()
- def open_file(self, file):
- with open(file, "r", encoding="utf-8") as f:
- return f.readlines()
+ def insert_alien_table(self):
+ pkg_file = self.open_file(f"{self.lib_path}alien_repo/PACKAGES.TXT")
+
+ bar = Bar("Creating alien database", max=len(pkg_file),
+ suffix="%(percent)d%% - %(eta)ds")
+
+ cache = [] # init cache
+
+ for i, line in enumerate(pkg_file, 1):
+
+ for p in self.pkg_tags:
+ if line.startswith(p):
+ line = line.replace(p, "").strip()
+ cache.append(line)
+
+ if (i % 20) == 0:
+ data = AlienTable(name=cache[0],
+ location=cache[1][2:],
+ comp_size=cache[2][:-2],
+ uncomp_size=cache[3][:-2],
+ required=cache[4], conflicts=cache[5],
+ suggests=cache[6], description=cache[7])
+ self.session.add(data)
+
+ cache = [] # reset cache after 11 lines
+
+ bar.next()
+ bar.finish()
+
+ self.session.commit()
diff --git a/slpkg/models/models.py b/slpkg/models/models.py
index 5dfd0958..a278b0d5 100644
--- a/slpkg/models/models.py
+++ b/slpkg/models/models.py
@@ -55,4 +55,19 @@ class SBoTable(Base):
short_description = Column(Text)
+class AlienTable(Base):
+
+ __tablename__ = "alientable"
+
+ id = Column(Integer, primary_key=True)
+ name = Column(Text)
+ location = Column(Text)
+ comp_size = Column(Integer)
+ uncomp_size = Column(Integer)
+ required = Column(Text)
+ conflicts = Column(Text)
+ suggests = Column(Text)
+ description = Column(Text)
+
+
Base.metadata.create_all(engine)
diff --git a/slpkg/pkg/build.py b/slpkg/pkg/build.py
index 6bbfe032..36fd7591 100644
--- a/slpkg/pkg/build.py
+++ b/slpkg/pkg/build.py
@@ -37,7 +37,7 @@ from slpkg.messages import Msg
from slpkg.checksum import check_md5
from slpkg.__metadata__ import MetaData as _meta_
-from slpkg.sbo.greps import SBoGrep
+from slpkg.sbo.queries import SboQuery
class BuildPackage(Utils):
@@ -146,7 +146,7 @@ class BuildPackage(Utils):
"""
self.sbo_md5 = {}
- md5_lists = SBoGrep(self.prgnam).checksum()
+ md5_lists = SboQuery(self.prgnam).checksum()
for src, md5 in itertools.zip_longest(self.sources, md5_lists):
self.sbo_md5[src] = md5
diff --git a/slpkg/pkg/find.py b/slpkg/pkg/find.py
index 8c4bd149..5448817f 100644
--- a/slpkg/pkg/find.py
+++ b/slpkg/pkg/find.py
@@ -34,7 +34,7 @@ def searching(find_pkg, directory):
if os.path.isdir(directory):
installed = os.listdir(directory)
- blacklist = list(black.get_black())
+ blacklist = black.get()
if os.path.exists(directory):
diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py
index 0ddbefb0..e67ec6a3 100644
--- a/slpkg/pkg/manager.py
+++ b/slpkg/pkg/manager.py
@@ -35,6 +35,7 @@ from slpkg.messages import Msg
from slpkg.dialog_box import DialogUtil
from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_
+from slpkg.sbo.queries import SboQuery
from slpkg.slack.slackware_repo import slackware_repository
@@ -617,15 +618,13 @@ class PackageManager(Utils):
"""Grabs packages
"""
pkg_list, pkg_size = [], []
- for line in packages.splitlines():
- if repo == "sbo":
+ if repo == "sbo":
+ pkg_list = SboQuery(name="").names()
- if line.startswith("SLACKBUILD NAME: "):
- pkg_list.append(line[17:].strip())
- pkg_size.append("0 K")
+ else:
- else:
+ for line in packages.splitlines():
if line.startswith("PACKAGE NAME: "):
pkg_list.append(line[15:].strip())
@@ -633,7 +632,7 @@ class PackageManager(Utils):
if line.startswith("PACKAGE SIZE (compressed): "):
pkg_size.append(line[26:].strip())
- if repo == "alien" or repo == "ktown":
+ if repo == "alien":
return alien_filter(pkg_list, pkg_size)
return pkg_list, pkg_size
@@ -649,7 +648,6 @@ class PackageManager(Utils):
self.meta.lib_path + "sbo_repo/SLACKBUILDS.TXT")):
packages = self.read_file(f"{self.meta.lib_path}"
"sbo_repo/SLACKBUILDS.TXT")
-
else:
if (os.path.isfile(
diff --git a/slpkg/pkg_find.py b/slpkg/pkg_find.py
index 7b21d32a..e95124b9 100644
--- a/slpkg/pkg_find.py
+++ b/slpkg/pkg_find.py
@@ -23,7 +23,7 @@
from slpkg.messages import Msg
-from slpkg.sbo.greps import SBoGrep
+from slpkg.sbo.queries import SboQuery
from slpkg.pkg.manager import PackageManager
from slpkg.__metadata__ import MetaData as _meta_
@@ -91,6 +91,6 @@ class FindFromRepos:
ver = ""
if repo == "sbo":
- ver = f"-{SBoGrep(find).version()}"
+ ver = f"-{SboQuery(find).version()}"
return ver
diff --git a/slpkg/repoinfo.py b/slpkg/repoinfo.py
index c1a17f5b..33d61ef0 100644
--- a/slpkg/repoinfo.py
+++ b/slpkg/repoinfo.py
@@ -132,7 +132,7 @@ class RepoInfo(Utils):
if line.startswith("PACKAGE SIZE (uncompressed): "):
unsize.append(line[30:-2].strip())
- if repo in ["salix", "slackl"]:
+ if repo == "salix":
log = self.read_file(
f"{self.meta.log_path}{repo}/ChangeLog.txt")
diff --git a/slpkg/sbo/autobuild.py b/slpkg/sbo/autobuild.py
deleted file mode 100644
index 1eaba5e4..00000000
--- a/slpkg/sbo/autobuild.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/python3
-# -*- coding: utf-8 -*-
-
-# autobuild.py file is part of slpkg.
-
-# Copyright 2014-2022 Dimitris Zlatanidis
-# All rights reserved.
-
-# Slpkg is a user-friendly package manager for Slackware installations
-
-# https://gitlab.com/dslackw/slpkg
-
-# Slpkg is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-
-import os
-
-from slpkg.pkg.build import BuildPackage
-
-from slpkg.sbo.greps import SBoGrep
-
-
-class AutoBuild:
- """Autobuild package if sources and script is already
- downloaded
- """
- def __init__(self, script, sources, path):
- self.script = script
- self.sources = sources
- self.prgnam = self.script[:-7]
- self.path = path
- self.sbo_sources = []
-
- def run(self):
- """Builds package and fix ordelist per checksum
- """
- self.files_exist()
- self.info_file()
- sources = self.sources
-
- if len(sources) > 1 and self.sbo_sources != sources:
- sources = self.sbo_sources
- # If the list does not have the same order uses from .info
- # order.
- BuildPackage(self.script, sources, self.path, auto=True).build()
-
- raise SystemExit()
-
- def info_file(self):
- """Grabs sources from .info file and stores filename
- """
- sources = SBoGrep(self.prgnam).source().split()
- for source in sources:
- self.sbo_sources.append(source.split("/")[-1])
-
- def files_exist(self):
- """Check if SlackBuild archive.tar.gz and sources exist
- """
- if not os.path.isfile(self.path + self.script):
- raise SystemExit("\nslpkg: Error: SlackBuild archive.tar.gz "
- "not found\n")
-
- for src in self.sources:
-
- if not os.path.isfile(self.path + src):
- raise SystemExit(f"\nslpkg: Error: Source file '{src}' "
- f"not found\n")
diff --git a/slpkg/sbo/check.py b/slpkg/sbo/check.py
index 3dd46c5e..f70adb9a 100644
--- a/slpkg/sbo/check.py
+++ b/slpkg/sbo/check.py
@@ -31,7 +31,7 @@ from slpkg.splitting import split_package
from slpkg.upgrade_checklist import choose_upg
from slpkg.__metadata__ import MetaData as _meta_
-from slpkg.sbo.greps import SBoGrep
+from slpkg.sbo.queries import SboQuery
def sbo_upgrade(skip, flag):
@@ -41,15 +41,15 @@ def sbo_upgrade(skip, flag):
black = BlackList()
msg.checking()
upgrade_names = []
- data = SBoGrep(name="").names()
- blacklist = list(black.get_black())
+ data = SboQuery(name="").names()
+ blacklist = black.get()
for pkg in sbo_list():
name = split_package(pkg)[0]
ver = split_package(pkg)[1]
if (name in data and name not in skip and name not in blacklist):
- sbo_package = f"{name}-{SBoGrep(name).version()}"
+ sbo_package = f"{name}-{SboQuery(name).version()}"
package = f"{name}-{ver}"
if parse_version(sbo_package) > parse_version(package):
diff --git a/conf/rlworkman.deps b/slpkg/sbo/dependencies.py
similarity index 53%
rename from conf/rlworkman.deps
rename to slpkg/sbo/dependencies.py
index 45f88cbe..b6423592 100644
--- a/conf/rlworkman.deps
+++ b/slpkg/sbo/dependencies.py
@@ -1,14 +1,15 @@
-# Rworkman's dependencies:
-#
-# rlworkman.deps file is part of slpkg.
-#
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+
+# dependencies.py file is part of slpkg.
+
# Copyright 2014-2022 Dimitris Zlatanidis
# All rights reserved.
-#
-# Slpkg is a user-friendly package manager for Slackware installations.
-#
+
+# Slpkg is a user-friendly package manager for Slackware installations
+
# https://gitlab.com/dslackw/slpkg
-#
+
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@@ -19,17 +20,29 @@
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-#
-# END OF LEGAL NOTICE
-#
-# ----------------------------------------------------------------------------
-# Some notes about package dependencies (all deps are also found here):
-# Rworkman's repository dependencies as shown in the central page
-# http://rlworkman.net/pkgs/
-# ----------------------------------------------------------------------------
-#
-# PACKAGE: DEPENDENCIES
-abiword: wv
-claws-mail: libetpan
-inkscape: lxml numpy BeautifulSoup
-xfburn: libburn libisofs
+
+
+from slpkg.sbo.queries import SboQuery
+from slpkg.blacklist import BlackList
+
+
+class Requires:
+ """Creates a list of dependencies with
+ the right order to install"""
+
+ def __init__(self, name):
+ self.name = name
+ self.black = BlackList().get()
+
+ def sbo(self):
+ requires = SboQuery(self.name).requires()
+
+ for r in requires:
+ if r not in self.black and r != "%README%":
+ sub = SboQuery(r).requires()
+ for s in sub:
+ requires.append(s)
+
+ requires.reverse()
+
+ return list(dict.fromkeys(requires))
diff --git a/slpkg/sbo/dependency.py b/slpkg/sbo/dependency.py
deleted file mode 100644
index ed83b74c..00000000
--- a/slpkg/sbo/dependency.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/python3
-# -*- coding: utf-8 -*-
-
-# dependency.py file is part of slpkg.
-
-# Copyright 2014-2022 Dimitris Zlatanidis
-# All rights reserved.
-
-# Slpkg is a user-friendly package manager for Slackware installations
-
-# https://gitlab.com/dslackw/slpkg
-
-# Slpkg is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-
-import sys
-from functools import lru_cache
-
-from slpkg.blacklist import BlackList
-from slpkg.__metadata__ import MetaData as _meta_
-
-from slpkg.sbo.greps import SBoGrep
-
-
-class Requires(BlackList):
- """Resolving SBo dependencies
- """
- def __init__(self, flag):
- super().__init__()
- self.flag = flag
- self.meta = _meta_
- self.SLACKBUILDS_TXT = SBoGrep(name="").names()
- self.blacklist = list(self.get_black())
- self.dep_results = []
-
- @lru_cache
- def sbo(self, name):
- """Builds all dependencies of a package
- """
- if (self.meta.rsl_deps in ["on", "ON"] and
- "--resolve-off" not in self.flag):
- sys.setrecursionlimit(10000)
- dependencies = []
- requires = SBoGrep(name).requires()
-
- if requires:
-
- for req in requires:
-
- # avoids adding %README% as dependency and if
- # requires in the blacklist
- if "%README%" not in req and req not in self.blacklist:
- dependencies.append(req)
-
- self.deep_check(tuple(dependencies))
-
- return self.dep_results
-
- else:
- return []
-
- @lru_cache
- def deep_check(self, dependencies):
- """Checking if dependencies are finished
- """
- if dependencies:
- self.dep_results.append(dependencies)
- [self.sbo(dep) for dep in dependencies]
diff --git a/slpkg/sbo/network.py b/slpkg/sbo/network.py
deleted file mode 100644
index fced7556..00000000
--- a/slpkg/sbo/network.py
+++ /dev/null
@@ -1,418 +0,0 @@
-#!/usr/bin/python3
-# -*- coding: utf-8 -*-
-
-# network.py file is part of slpkg.
-
-# Copyright 2014-2022 Dimitris Zlatanidis
-# All rights reserved.
-
-# Slpkg is a user-friendly package manager for Slackware installations
-
-# https://gitlab.com/dslackw/slpkg
-
-# Slpkg is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-
-import os
-import pydoc
-
-from slpkg.utils import Utils
-from slpkg.messages import Msg
-from slpkg.blacklist import BlackList
-from slpkg.downloader import Download
-from slpkg.remove import delete_folder
-from slpkg.dialog_box import DialogUtil
-from slpkg.security import pkg_security
-from slpkg.__metadata__ import MetaData as _meta_
-
-from slpkg.pkg.find import find_package
-from slpkg.pkg.build import BuildPackage
-from slpkg.pkg.manager import PackageManager
-
-from slpkg.sbo.read import ReadSBo
-from slpkg.sbo.greps import SBoGrep
-from slpkg.sbo.sbo_arch import SBoArch
-from slpkg.sbo.compressed import SBoLink
-from slpkg.sbo.search import sbo_search_pkg
-from slpkg.sbo.slack_find import slack_package
-
-from slpkg.slack.slack_version import slack_ver
-
-
-class SBoNetwork(BlackList, Utils):
- """View SBo site in the terminal and also read, build or
- install packages
- """
- def __init__(self, name, flag):
- super().__init__()
- self.name = name
- self.flag = flag
- self.meta = _meta_
- self.msg = Msg()
- self.data = SBoGrep(name="").names()
- self.check_pkg_exist()
- self.arch = SBoArch().get()
- self.comp_tar = ".tar.gz"
- self.choice = ""
- self.FAULT = ""
- self.green = self.meta.color["GREEN"]
- self.red = self.meta.color["RED"]
- self.yellow = self.meta.color["YELLOW"]
- self.cyan = self.meta.color["CYAN"]
- self.grey = self.meta.color["GREY"]
- self.endc = self.meta.color["ENDC"]
- self.build_folder = self.meta.build_path
- self._SOURCES = self.meta.SBo_SOURCES
- self.msg.reading()
- self.case_insensitive()
-
- if "--checklist" in self.flag:
- self.with_checklist()
-
- grep = SBoGrep(self.name)
- self.sbo_files = grep.files()
- self.sbo_url = sbo_search_pkg(self.name)
-
- if self.sbo_url:
- self.sbo_desc = grep.description()[len(self.name) + 2:-1]
- self.source_dwn = grep.source().split()
- self.sbo_req = grep.requires()
- self.sbo_dwn = SBoLink(self.sbo_url).tar_gz()
- self.sbo_version = grep.version()
- self.dwn_srcs = self.sbo_dwn.split() + self.source_dwn
-
- if "--checklist" not in self.flag or not self.sbo_url and self.name:
- self.msg.done()
-
- def check_pkg_exist(self):
- if self.name not in self.data:
- self.msg.pkg_not_found("\n", self.name, "can't find", "\n")
- raise SystemExit(1)
-
- def view(self):
- """View SlackBuild package, read or install them
- from slackbuilds.org
- """
- if self.sbo_url and self.name not in self.get_black():
- self.prgnam = f"{self.name}-{self.sbo_version}"
- self.view_sbo()
-
- while True:
-
- self.read_choice()
-
- choice = {
- "r": self.choice_README,
- "R": self.choice_README,
- "s": self.choice_SlackBuild,
- "S": self.choice_SlackBuild,
- "f": self.choice_info,
- "F": self.choice_info,
- "o": self.choice_doinst,
- "O": self.choice_doinst,
- "d": self.choice_download,
- "D": self.choice_download,
- "download": self.choice_download,
- "b": self.choice_build,
- "B": self.choice_build,
- "build": self.choice_build,
- "i": self.choice_install,
- "I": self.choice_install,
- "install": self.choice_install,
- "c": self.choice_clear_screen,
- "C": self.choice_clear_screen,
- "clear": self.choice_clear_screen,
- "q": self.choice_quit,
- "quit": self.choice_quit,
- "Q": self.choice_quit
- }
-
- try:
- choice[self.choice]()
- except KeyError:
- pass
-
- else:
- self.msg.pkg_not_found("\n", self.name, "Can't view", "\n")
- raise SystemExit(1)
-
- def case_insensitive(self):
- """Matching packages distinguish between uppercase and
- lowercase
- """
-
- if "--case-ins" in self.flag:
- data_dict = self.case_sensitive(self.data)
-
- for key, value in data_dict.items():
-
- if key == self.name.lower():
- self.name = value
-
- def read_choice(self):
- """Return choice
- """
- commands = {
- "r": "README",
- "R": "README",
- "s": f"{self.name}.SlackBuild",
- "S": f"{self.name}.SlackBuild",
- "f": f"{self.name}.info",
- "F": f"{self.name}.info",
- "o": "doinst.sh",
- "O": "doinst.sh",
- "d": "download",
- "D": "download",
- "download": "download",
- "b": "build",
- "B": "build",
- "build": "build",
- "i": "install",
- "I": "install",
- "install": "install",
- "c": "clear",
- "C": "clear",
- "clear": "clear",
- "q": "quit",
- "quit": "quit",
- "Q": "quit"
- }
-
- try:
- message = " Choose an option > "
- self.choice = input(f"{self.grey}{message}{self.endc}")
- except EOFError:
- raise SystemExit('\n')
-
- try:
- print("{0}\x1b[1A{1}{2}{3}\n".format(
- " " * len(message), self.cyan, commands[self.choice],
- self.endc), end="")
- print(end="", flush=True)
- except KeyError:
- pass
-
- def choice_README(self):
- """View README file
- """
- README = ReadSBo(self.sbo_url).readme("README")
- fill = self.fill_pager(README)
- self.pager(README + fill)
-
- def choice_SlackBuild(self):
- """View .SlackBuild file
- """
- SlackBuild = ReadSBo(self.sbo_url).slackbuild(self.name, ".SlackBuild")
- fill = self.fill_pager(SlackBuild)
- self.pager(SlackBuild + fill)
-
- def choice_info(self):
- """View .info file
- """
- info = ReadSBo(self.sbo_url).info(self.name, ".info")
- fill = self.fill_pager(info)
- self.pager(info + fill)
-
- def choice_doinst(self):
- """View doinst.sh file
- """
- if "doinst.sh" in self.sbo_files.split():
- doinst_sh = ReadSBo(self.sbo_url).doinst("doinst.sh")
- fill = self.fill_pager(doinst_sh)
- self.pager(doinst_sh + fill)
-
- def choice_download(self):
- """Download script.tar.gz and sources
- """
- Download(path="", url=self.dwn_srcs, repo="sbo").start()
- raise SystemExit()
-
- def choice_build(self):
- """Build package
- """
- self.build()
- delete_folder(self.build_folder)
- raise SystemExit()
-
- def choice_install(self):
- """Download, build and install the package
- """
- pkg_security([self.name])
-
- if not find_package(self.prgnam, self.meta.pkg_path):
- self.build()
- self.install()
- delete_folder(self.build_folder)
-
- raise SystemExit()
-
- else:
- self.msg.template(78)
- self.msg.pkg_found(self.prgnam)
- self.msg.template(78)
-
- raise SystemExit()
-
- def choice_clear_screen(self):
- """Clear screen
- """
- os.system("clear")
- self.view()
-
- def choice_quit(self):
- """Quit from choices
- """
- raise SystemExit()
-
- def view_sbo(self):
- """View slackbuild.org
- """
- sbo_url = self.sbo_url.replace("/slackbuilds/", "/repository/")
- br1, br2, fix_sp = "", "", " "
-
- if self.meta.use_colors in ["off", "OFF"]:
- br1 = "("
- br2 = ")"
- fix_sp = ""
-
- print() # new line at start
- self.msg.template(78)
- print(f"| {' ' * 28}{self.grey}SlackBuilds Repository{self.endc}")
- self.msg.template(78)
- print(f"| {slack_ver()} > {sbo_url.split('/')[-3].title()} > {self.cyan}{self.name}{self.endc}")
- self.msg.template(78)
- print(f"| {self.green}Package url{self.endc}: {sbo_url}")
- self.msg.template(78)
- print(f"| {self.green}Description: {self.endc}{self.sbo_desc}")
- print(f"| {self.green}SlackBuild: {self.endc}{self.sbo_dwn.split('/')[-1]}")
- print(f"| {self.green}Sources: {self.endc}{', '.join([src.split('/')[-1] for src in self.source_dwn])}")
- print(f"| {self.yellow}Requirements: {self.endc}{', '.join(self.sbo_req)}")
- self.msg.template(78)
- print(f"| {self.red}R{self.endc}{br2}EADME View the README file")
- print(f"| {self.red}S{self.endc}{br2}lackBuild View the .SlackBuild file")
- print(f"| In{br1}{self.red}f{self.endc}{br2}o{fix_sp} View the .info file")
-
- if "doinst.sh" in self.sbo_files.split():
- print(f"| D{br1}{self.red}o{self.endc}{br2}inst.sh{fix_sp} View the doinst.sh file")
-
- print(f"| {self.red}D{self.endc}{br2}ownload Download this package")
- print(f"| {self.red}B{self.endc}{br2}uild Download and build")
- print(f"| {self.red}I{self.endc}{br2}nstall Download/Build/Install")
- print(f"| {self.red}C{self.endc}{br2}lear Clear screen")
- print(f"| {self.red}Q{self.endc}{br2}uit Quit")
- self.msg.template(78)
-
- def with_checklist(self):
- """Using dialog and checklist option
- """
- data = []
-
- if not self.name:
- data = self.data
-
- else:
- for name in self.data:
- if self.name in name:
- data.append(name)
-
- if data:
- text = "Press 'spacebar' to choose SlackBuild for view"
- title = " SlackBuilds.org "
- backtitle = f"{_meta_.__all__} {_meta_.__version__}"
- status = False
- pkg = DialogUtil(data, text, title, backtitle, status).checklist()
-
- if pkg and len(pkg) > 1:
- os.system("clear")
- raise SystemExit("\nslpkg: Error: Choose only one package\n")
-
- if pkg is None:
- raise SystemExit(1)
-
- self.name = "".join(pkg)
- os.system("clear")
-
- def pager(self, text):
- """Read text
- """
- pydoc.pager(text)
-
- def fill_pager(self, page):
- """Fixes pager spaces
- """
- tty_size = os.popen("stty size", "r").read().split()
- rows = int(tty_size[0]) - 1
- lines = sum(1 for line in page.splitlines())
- diff = rows - lines
- fill = "\n" * diff
-
- if diff > 0:
- return fill
-
- else:
- return ""
-
- def error_uns(self):
- """Checks if the package supported by an arch
- before proceeding to install
- """
- self.FAULT = ""
- UNST = ["UNSUPPORTED", "UNTESTED"]
-
- if "".join(self.source_dwn) in UNST:
- self.FAULT = "".join(self.source_dwn)
-
- def build(self):
- """Builds slackware package
- """
- pkg_security([self.name])
- self.error_uns()
-
- if self.FAULT:
- print()
- self.msg.template(78)
- print(f"| Package {self.prgnam} {self.red} {self.FAULT} "
- f"{self.endc}")
- self.msg.template(78)
-
- else:
- sources = []
-
- if not os.path.exists(self.meta.build_path):
- os.makedirs(self.meta.build_path)
-
- if not os.path.exists(self._SOURCES):
- os.makedirs(self._SOURCES)
-
- os.chdir(self.meta.build_path)
-
- Download(self.meta.build_path, self.sbo_dwn.split(),
- repo="sbo").start()
-
- Download(self._SOURCES, self.source_dwn, repo="sbo").start()
-
- script = self.sbo_dwn.split("/")[-1]
-
- for src in self.source_dwn:
- sources.append(src.split("/")[-1])
-
- BuildPackage(script, sources, self.meta.build_path,
- auto=False).build()
-
- slack_package(self.prgnam) # check if build
-
- def install(self):
- """Installs SBo package found in /tmp directory.
- """
- binary = slack_package(self.prgnam)
- print(f"[ {self.green}Installing{self.endc} ] --> {self.name}")
- PackageManager(binary).upgrade(flag="--install-new")
diff --git a/slpkg/sbo/greps.py b/slpkg/sbo/queries.py
similarity index 97%
rename from slpkg/sbo/greps.py
rename to slpkg/sbo/queries.py
index 99d19e59..f090bc69 100644
--- a/slpkg/sbo/greps.py
+++ b/slpkg/sbo/queries.py
@@ -22,18 +22,16 @@
# along with this program. If not, see .
-from slpkg.utils import Utils
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.models.models import SBoTable, session
-class SBoGrep(Utils):
+class SboQuery:
"""Grabs data from sbo database
"""
def __init__(self, name):
self.name = name
self.meta = _meta_
- self.db = self.meta.db
self.arch64 = "x86_64"
self.session = session
diff --git a/slpkg/sbo/queue.py b/slpkg/sbo/queue.py
index dfb36dda..b13a1cb3 100644
--- a/slpkg/sbo/queue.py
+++ b/slpkg/sbo/queue.py
@@ -33,7 +33,7 @@ from slpkg.pkg.find import find_package
from slpkg.pkg.build import BuildPackage
from slpkg.pkg.manager import PackageManager
-from slpkg.sbo.greps import SBoGrep
+from slpkg.sbo.queries import SboQuery
from slpkg.sbo.compressed import SBoLink
from slpkg.sbo.search import sbo_search_pkg
from slpkg.sbo.slack_find import slack_package
@@ -145,7 +145,7 @@ class QueuePkgs(Utils):
for pkg in packages:
- if pkg not in SBoGrep(pkg).names():
+ if pkg not in SboQuery(pkg).names():
raise SystemExit(f"\nPackage '{pkg}' was not found in "
f"the SBo repository\n")
@@ -157,7 +157,7 @@ class QueuePkgs(Utils):
sbo_url = sbo_search_pkg(pkg)
sbo_dwn = SBoLink(sbo_url).tar_gz()
- source_dwn = SBoGrep(pkg).source().split()
+ source_dwn = SboQuery(pkg).source().split()
os.chdir(self.meta.build_path)
script = sbo_dwn.split("/")[-1]
@@ -186,7 +186,7 @@ class QueuePkgs(Utils):
for pkg in packages:
- ver = SBoGrep(pkg).version()
+ ver = SboQuery(pkg).version()
prgnam = f"{pkg}-{ver}"
if find_package(prgnam, self.meta.output):
diff --git a/slpkg/sbo/search.py b/slpkg/sbo/search.py
index 443cb3a5..b0add827 100644
--- a/slpkg/sbo/search.py
+++ b/slpkg/sbo/search.py
@@ -38,4 +38,4 @@ def sbo_search_pkg(name):
sbo = repo.default_repository()["sbo"]
sbo_url = f"{sbo}{slack_ver()}/"
- return f"{sbo_url}{location[0][2:]}/"
+ return f"{sbo_url}{location[0]}/{name}/"
diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py
index 924c687a..827c57b4 100644
--- a/slpkg/sbo/slackbuild.py
+++ b/slpkg/sbo/slackbuild.py
@@ -39,15 +39,15 @@ from slpkg.pkg.build import BuildPackage
from slpkg.pkg.manager import PackageManager
from slpkg.pkg.installed import GetFromInstalled
-from slpkg.sbo.greps import SBoGrep
+from slpkg.sbo.queries import SboQuery
from slpkg.sbo.sbo_arch import SBoArch
from slpkg.sbo.compressed import SBoLink
-from slpkg.sbo.dependency import Requires
from slpkg.sbo.search import sbo_search_pkg
+from slpkg.sbo.dependencies import Requires
from slpkg.sbo.slack_find import slack_package
-class SBoInstall(BlackList, Utils):
+class SBoInstall(Utils):
"""Build and install SBo packages with all dependencies
"""
def __init__(self, slackbuilds, flag):
@@ -65,7 +65,6 @@ class SBoInstall(BlackList, Utils):
self.arch = SBoArch().get()
self.build_folder = self.meta.build_path
self._SOURCES = self.meta.SBo_SOURCES
- self.init_flags()
self.unst = ["UNSUPPORTED", "UNTESTED"]
self.master_packages = []
self.deps = []
@@ -79,19 +78,8 @@ class SBoInstall(BlackList, Utils):
self.count_upg = 0
self.count_uni = 0
self.msg.reading()
- self.data = SBoGrep(name="").names()
- self.blacklist = list(self.get_black())
-
- def init_flags(self):
- """Flags initialization
- """
- for fl in self.flag:
-
- if fl.startswith("--directory-prefix="):
- self.build_folder = fl.split("=")[1]
-
- if not self.build_folder.endswith("/"):
- self.build_folder += "/"
+ self.data = SboQuery(name="").names()
+ self.blacklist = BlackList().get()
def start(self, is_upgrade):
"""Start view, build and install SBo packages
@@ -103,33 +91,35 @@ class SBoInstall(BlackList, Utils):
for _sbo in self.slackbuilds:
if _sbo in self.data and _sbo not in self.blacklist:
- sbo_deps = Requires(self.flag).sbo(_sbo)
+ sbo_deps = Requires(_sbo).sbo()
self.deps += sbo_deps
- self.deps_dict[_sbo] = self.one_for_all(sbo_deps)
+
+ self.deps_dict[_sbo] = sbo_deps
+
self.package_found.append(_sbo)
else:
self.package_not_found.append(_sbo)
- self.update_deps()
-
if not self.package_found:
self.match = True
self.matching()
self.master_packages, mas_src = self.sbo_version_source(
self.package_found)
+
self.msg.done()
if (self.meta.rsl_deps in ["on", "ON"] and
self.flag != "--resolve-off" and not self.match):
self.msg.resolving()
- self.dependencies, dep_src = self.sbo_version_source(
- self.one_for_all(self.deps))
+
+ self.dependencies, dep_src = self.sbo_version_source(self.deps)
if (self.meta.rsl_deps in ["on", "ON"] and
self.flag != "--resolve-off" and not self.match):
self.msg.done()
+
self.clear_masters()
if self.package_found:
@@ -198,17 +188,6 @@ class SBoInstall(BlackList, Utils):
if key == name.lower():
self.slackbuilds[index] = value
- def update_deps(self):
- """Update dependencies dictionary with all package
- """
- onelist, dependencies = [], []
- onelist = self.dimensional_list(self.deps)
- dependencies = self.remove_dbs(onelist)
-
- for dep in dependencies:
- deps = Requires(self.flag).sbo(dep)
- self.deps_dict[dep] = self.one_for_all(deps)
-
def continue_to_install(self):
"""Continue to install ?
"""
@@ -235,7 +214,6 @@ class SBoInstall(BlackList, Utils):
"""Clear master slackbuilds if already exist in dependencies
or if added to install two or more times
"""
- self.master_packages = self.remove_dbs(self.master_packages)
for mas in self.master_packages:
if mas in self.dependencies:
@@ -257,9 +235,9 @@ class SBoInstall(BlackList, Utils):
sbo_versions, sources = [], []
for sbo in slackbuilds:
- sbo_ver = f"{sbo}-{SBoGrep(sbo).version()}"
+ sbo_ver = f"{sbo}-{SboQuery(sbo).version()}"
sbo_versions.append(sbo_ver)
- sources.append(SBoGrep(sbo).source())
+ sources.append(SboQuery(sbo).source())
return [sbo_versions, sources]
@@ -376,7 +354,7 @@ class SBoInstall(BlackList, Utils):
pkg = "-".join(prgnam.split("-")[:-1])
installed = "".join(find_package(prgnam, self.meta.pkg_path))
- src_link = SBoGrep(pkg).source().split()
+ src_link = SboQuery(pkg).source().split()
if (installed and "--download-only" not in self.flag and
"--rebuild" not in self.flag):
diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py
index f5dbaf59..df8e1a80 100644
--- a/slpkg/slack/patches.py
+++ b/slpkg/slack/patches.py
@@ -46,13 +46,13 @@ from slpkg.pkg.find import find_package
from slpkg.pkg.manager import PackageManager
from slpkg.pkg.installed import GetFromInstalled
-from slpkg.binary.greps import repo_data
+from slpkg.binaries.queries import repo_data
from slpkg.slack.mirrors import mirrors
from slpkg.slack.slack_version import slack_ver
-class Patches(BlackList, Utils):
+class Patches(Utils):
"""Upgrades distribution from the official Slackware mirrors
"""
def __init__(self, skip, flag):
@@ -78,6 +78,7 @@ class Patches(BlackList, Utils):
self.comp_sum = []
self.uncomp_sum = []
self.msg.checking()
+ self.blacklist = BlackList().get()
if self.version == "stable":
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT",
@@ -153,7 +154,7 @@ class Patches(BlackList, Utils):
"""Stores and returns packages for upgrading
"""
data = repo_data(self.PACKAGES_TXT, "slack", self.flag)
- black = list(self.get_black())
+
for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]):
repo_pkg_name = split_package(name)[0]
@@ -162,7 +163,7 @@ class Patches(BlackList, Utils):
pkg_ver = split_package(name)[1]
if (GetFromInstalled(pkg_name).name() and
- repo_pkg_name not in black and
+ repo_pkg_name not in self.blacklist and
repo_pkg_name not in self.skip and
parse_version(pkg_ver) > parse_version(
GetFromInstalled(pkg_name).version())):
@@ -178,7 +179,7 @@ class Patches(BlackList, Utils):
self.count_upg -= 1
elif (not os.path.isfile(self.meta.pkg_path + name[:-4]) and
- repo_pkg_name not in black and
+ repo_pkg_name not in self.blacklist and
repo_pkg_name not in self.skip):
self.dwn_links.append(f"{mirrors('', '')}{loc}/{name}")
self.comp_sum.append(comp)
diff --git a/slpkg/slack/slackware_repo.py b/slpkg/slack/slackware_repo.py
index f8968db3..1234e520 100644
--- a/slpkg/slack/slackware_repo.py
+++ b/slpkg/slack/slackware_repo.py
@@ -23,7 +23,7 @@
from slpkg.utils import Utils
-from slpkg.binary.greps import repo_data
+from slpkg.binaries.queries import repo_data
from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_
diff --git a/slpkg/tracking.py b/slpkg/tracking.py
index 38f2d2f1..64e62728 100644
--- a/slpkg/tracking.py
+++ b/slpkg/tracking.py
@@ -22,7 +22,6 @@
# along with this program. If not, see .
-from slpkg.utils import Utils
from slpkg.graph import Graph
from slpkg.messages import Msg
from slpkg.blacklist import BlackList
@@ -30,20 +29,21 @@ from slpkg.__metadata__ import MetaData as _meta_
from slpkg.pkg.find import find_package
-from slpkg.sbo.greps import SBoGrep
-from slpkg.sbo.dependency import Requires
+from slpkg.sbo.queries import SboQuery
+from slpkg.sbo.dependencies import Requires
from slpkg.sbo.search import sbo_search_pkg
-from slpkg.binary.search import search_pkg
-from slpkg.binary.dependency import Dependencies
+from slpkg.binaries.search import search_pkg
+from slpkg.binaries.dependency import Dependencies
-class TrackingDeps(BlackList, Utils):
+class TrackingDeps:
"""Views tree of dependencies and also
highlights packages with the colour green
if already installed and the colour red
if not installed.
"""
+
def __init__(self, name, repo, flag):
super().__init__()
self.name = name
@@ -57,9 +57,8 @@ class TrackingDeps(BlackList, Utils):
self.red = self.meta.color["RED"]
self.endc = self.meta.color["ENDC"]
self.requires = []
- self.dependencies = []
- self.dependencies_list = []
self.deps_dict = {}
+ self.blacklist = BlackList()
self.init_flags()
def init_flags(self):
@@ -78,9 +77,6 @@ class TrackingDeps(BlackList, Utils):
self.repositories()
if self.find_pkg:
- self.dependencies_list.reverse()
- self.requires = self.dimensional_list(self.dependencies_list)
- self.dependencies = self.remove_dbs(self.requires)
if self.dependencies == []:
self.dependencies = ["No dependencies"]
@@ -152,7 +148,7 @@ class TrackingDeps(BlackList, Utils):
self.find_pkg = sbo_search_pkg(self.name)
if self.find_pkg:
- self.dependencies_list = Requires(self.flag).sbo(self.name)
+ self.dependencies = Requires(self.name).sbo()
else:
PACKAGES_TXT = self.read_file(
@@ -162,8 +158,8 @@ class TrackingDeps(BlackList, Utils):
self.find_pkg = search_pkg(self.name, self.repo)
if self.find_pkg:
- self.black = list(self.get_black())
- self.dependencies_list = Dependencies(
+ self.black = list(self.blacklist.get())
+ self.dependencies = Dependencies(
self.repo, self.black).binary(self.name, self.flag)
def sbo_case_insensitive(self):
@@ -171,7 +167,7 @@ class TrackingDeps(BlackList, Utils):
lowercase for sbo repository
"""
if "--case-ins" in self.flag:
- data = SBoGrep(name="").names()
+ data = SboQuery(name="").names()
data_dict = self.case_sensitive(data)
for key, value in data_dict.items():
@@ -219,7 +215,7 @@ class TrackingDeps(BlackList, Utils):
if self.repo == "sbo":
for dep in dependencies:
- deps = Requires(flag="").sbo(dep)
+ deps = Requires(dep).sbo()
if dep not in self.deps_dict.values():
self.deps_dict[dep] = self.dimensional_list(deps)
diff --git a/slpkg/utils.py b/slpkg/utils.py
index db348080..ba6b6ebe 100644
--- a/slpkg/utils.py
+++ b/slpkg/utils.py
@@ -23,7 +23,6 @@
import os
-from collections import OrderedDict
from slpkg.splitting import split_package
@@ -50,11 +49,6 @@ class Utils:
return one_list
- def remove_dbs(self, double):
- """Removes double item from list
- """
- return list(OrderedDict.fromkeys(double))
-
def read_file(self, registry):
"""Returns reading file
"""