mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-10 20:01:54 +01:00
Merge branch 'develop'
This commit is contained in:
commit
5eeed7f5b1
56 changed files with 1275 additions and 671 deletions
21
.gitlab-ci.yml
Normal file
21
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
image: "python:3.7"
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- python --version
|
||||||
|
- pip install -r requirements.txt
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- Static Analysis
|
||||||
|
- Test
|
||||||
|
|
||||||
|
flake8:
|
||||||
|
stage: Static Analysis
|
||||||
|
script:
|
||||||
|
- flake8 --max-line-length=120 bild/*.py
|
||||||
|
|
||||||
|
unit_test:
|
||||||
|
stage: Test
|
||||||
|
script:
|
||||||
|
- export PYTHONPATH="$PYTHONPATH:."
|
||||||
|
- python -c "import sys;print(sys.path)"
|
||||||
|
- pytest
|
|
@ -1,7 +0,0 @@
|
||||||
language: python
|
|
||||||
python:
|
|
||||||
- "2.7"
|
|
||||||
# command to install dependencies
|
|
||||||
install: "pip install -r requirements.txt"
|
|
||||||
# command to run tests
|
|
||||||
script: nosetests
|
|
|
@ -1,6 +1,12 @@
|
||||||
|
3.7.5 - 15/01/2020
|
||||||
|
Fixed:
|
||||||
|
- Bugfix: merge files with slack repository between current and slack versions
|
||||||
|
Updated:
|
||||||
|
- code to improve for Python 3
|
||||||
|
|
||||||
3.7.4 - 20/12/2019
|
3.7.4 - 20/12/2019
|
||||||
Fixed:
|
Fixed:
|
||||||
-Bugfix: UnicodeDecodeError: 'utf-8' codec can't decode byte
|
- Bugfix: UnicodeDecodeError: 'utf-8' codec can't decode byte
|
||||||
|
|
||||||
3.7.3 - 11/12/2019
|
3.7.3 - 11/12/2019
|
||||||
FIxed:
|
FIxed:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
First you need to run '`slpkg update`' to synchronize the lists of packages, also every time you add
|
First you need to run '`slpkg update`' to synchronize the lists of packages, also every time you add
|
||||||
a new repository. To add or remove repositories must edit the file '`/etc/slpkg/repositories.conf`'
|
a new repository. To add or remove repositories must edit the file '`/etc/slpkg/repositories.conf`'
|
||||||
or run '`slpkg repo-enable`' (python2-pythondialog required). Add custom repositories with the
|
or run '`slpkg repo-enable`' (python3-pythondialog required). Add custom repositories with the
|
||||||
command '`slpkg add-repo <repository name> <URL>`' and after run '`slpkg update`' to update package
|
command '`slpkg add-repo <repository name> <URL>`' and after run '`slpkg update`' to update package
|
||||||
list. View list of repositories with the command `slpkg repo-list` or get repository information
|
list. View list of repositories with the command `slpkg repo-list` or get repository information
|
||||||
with the command '`slpkg repo-info <repository>`'.
|
with the command '`slpkg repo-info <repository>`'.
|
||||||
|
@ -74,7 +74,7 @@ remove packages from your system events. Notable mention you must give in the co
|
||||||
after editing configuration file '`/etc/slpkg/slpkg.conf`' (default is disable) or add additional
|
after editing configuration file '`/etc/slpkg/slpkg.conf`' (default is disable) or add additional
|
||||||
option '`--deps`'. Also you can check if the packages they are used as dependency with additional
|
option '`--deps`'. Also you can check if the packages they are used as dependency with additional
|
||||||
option '`--check-deps`'. Option '`--tag`' allow to remove packages with by TAG. Optional you can use
|
option '`--check-deps`'. Option '`--tag`' allow to remove packages with by TAG. Optional you can use
|
||||||
the dialog utility with the additional option '`--checklist`' (require python2-pythondialog). Rmove
|
the dialog utility with the additional option '`--checklist`' (require python3-pythondialog). Rmove
|
||||||
third-party packages with the option '`--third-party`'.
|
third-party packages with the option '`--third-party`'.
|
||||||
|
|
||||||
The command '`slpkg -d <packages>`' is useful to print the entire contents of a package.
|
The command '`slpkg -d <packages>`' is useful to print the entire contents of a package.
|
||||||
|
@ -85,7 +85,7 @@ Some examples you will see below.
|
||||||
##### Slpkg Examples
|
##### Slpkg Examples
|
||||||
|
|
||||||
Enable or disable default repositories, edit '`/etc/slpkg/repositories.conf`' file or with the command.
|
Enable or disable default repositories, edit '`/etc/slpkg/repositories.conf`' file or with the command.
|
||||||
(require pythondialog, install with '`slpkg -s sbo python2-pythondialog`'):
|
(require pythondialog, install with '`slpkg -s sbo python3-pythondialog`'):
|
||||||
|
|
||||||
```
|
```
|
||||||
$ slpkg repo-enable
|
$ slpkg repo-enable
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# slpkg 3.7.4
|
# slpkg 3.7.5
|
||||||
|
|
||||||
Slpkg is a powerful software package manager that installs, updates, and removes packages on
|
Slpkg is a powerful software package manager that installs, updates, and removes packages on
|
||||||
[Slackware](http://www.slackware.com/) based systems. It automatically computes dependencies and
|
[Slackware](http://www.slackware.com/) based systems. It automatically computes dependencies and
|
||||||
|
|
4
clean.py
4
clean.py
|
@ -49,11 +49,11 @@ class Clean:
|
||||||
def start(self):
|
def start(self):
|
||||||
for f in self.files:
|
for f in self.files:
|
||||||
if os.path.isfile(f):
|
if os.path.isfile(f):
|
||||||
print("Remove file --> {0}".format(f))
|
print(f"Remove file --> {f}")
|
||||||
os.remove(f)
|
os.remove(f)
|
||||||
for d in self.dirs:
|
for d in self.dirs:
|
||||||
if os.path.exists(d):
|
if os.path.exists(d):
|
||||||
print("Remove directory --> {0}".format(d))
|
print(f"Remove directory --> {d}")
|
||||||
shutil.rmtree(d)
|
shutil.rmtree(d)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ Additional options:
|
||||||
.PP
|
.PP
|
||||||
\fB--skip=[packages...]\fP : Skip packages from upgrade separate by comma like "# slpkg -c sbo --skip=jdk,pep8,pip" (See REGEX).
|
\fB--skip=[packages...]\fP : Skip packages from upgrade separate by comma like "# slpkg -c sbo --skip=jdk,pep8,pip" (See REGEX).
|
||||||
.PP
|
.PP
|
||||||
\fB--checklist\fP : Enable dialog utility and checklist option. (Require python2-pythondialog)
|
\fB--checklist\fP : Enable dialog utility and checklist option. (Require python3-pythondialog)
|
||||||
|
|
||||||
.SS -s, --sync, synchronize packages, download, build and install package with all dependencies
|
.SS -s, --sync, synchronize packages, download, build and install package with all dependencies
|
||||||
\fBslpkg\fP \fB-s\fP <\fIrepository\fP> <\fInames of packages\fP>, \fB--resolve-off\fP, \fB--case-ins\fP, \fB--patches\fP
|
\fBslpkg\fP \fB-s\fP <\fIrepository\fP> <\fInames of packages\fP>, \fB--resolve-off\fP, \fB--case-ins\fP, \fB--patches\fP
|
||||||
|
|
743
man/slpkg.html
Normal file
743
man/slpkg.html
Normal file
|
@ -0,0 +1,743 @@
|
||||||
|
<!-- Creator : groff version 1.22.3 -->
|
||||||
|
<!-- CreationDate: Sat Dec 28 15:39:55 2019 -->
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/html4/loose.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta name="generator" content="groff -Thtml, see www.gnu.org">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
||||||
|
<meta name="Content-Style" content="text/css">
|
||||||
|
<style type="text/css">
|
||||||
|
p { margin-top: 0; margin-bottom: 0; vertical-align: top }
|
||||||
|
pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
|
||||||
|
table { margin-top: 0; margin-bottom: 0; vertical-align: top }
|
||||||
|
h1 { text-align: center }
|
||||||
|
</style>
|
||||||
|
<title>Slpkg</title>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1 align="center">Slpkg</h1>
|
||||||
|
|
||||||
|
<a href="#NAME">NAME</a><br>
|
||||||
|
<a href="#SYNOPSIS">SYNOPSIS</a><br>
|
||||||
|
<a href="#DESCRIPTION">DESCRIPTION</a><br>
|
||||||
|
<a href="#GLOBAL OPTIONS">GLOBAL OPTIONS</a><br>
|
||||||
|
<a href="#COMMANDS">COMMANDS</a><br>
|
||||||
|
<a href="#OPTIONS">OPTIONS</a><br>
|
||||||
|
<a href="#HELP OPTION">HELP OPTION</a><br>
|
||||||
|
<a href="#DEFAULT REPOSITORIES">DEFAULT REPOSITORIES</a><br>
|
||||||
|
<a href="#COLORS">COLORS</a><br>
|
||||||
|
<a href="#REGEX">REGEX</a><br>
|
||||||
|
<a href="#PASS VARIABLES TO THE SCRIPT">PASS VARIABLES TO THE SCRIPT</a><br>
|
||||||
|
<a href="#FILES">FILES</a><br>
|
||||||
|
<a href="#AUTHOR">AUTHOR</a><br>
|
||||||
|
<a href="#HOMEPAGE">HOMEPAGE</a><br>
|
||||||
|
<a href="#COPYRIGHT">COPYRIGHT</a><br>
|
||||||
|
<a href="#SEE ALSO">SEE ALSO</a><br>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
|
||||||
|
<h2>NAME
|
||||||
|
<a name="NAME"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Slpkg is a
|
||||||
|
user-friendly package manager for Slackware
|
||||||
|
installations</p>
|
||||||
|
|
||||||
|
<h2>SYNOPSIS
|
||||||
|
<a name="SYNOPSIS"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">slpkg
|
||||||
|
[COMMANDS|OPTIONS] {repository|package...}</p>
|
||||||
|
|
||||||
|
<h2>DESCRIPTION
|
||||||
|
<a name="DESCRIPTION"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Slpkg is a
|
||||||
|
powerful software package manager that installs, updates,
|
||||||
|
and removes packages on Slackware based systems. It
|
||||||
|
automatically computes dependencies and figures out what
|
||||||
|
things should occur to install packages. Slpkg makes it
|
||||||
|
easier to maintain groups of machines without having to
|
||||||
|
manually update.</p>
|
||||||
|
|
||||||
|
<h2>GLOBAL OPTIONS
|
||||||
|
<a name="GLOBAL OPTIONS"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>−v</b>,
|
||||||
|
<b>−−version</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Print the
|
||||||
|
version of program and exit.</p>
|
||||||
|
|
||||||
|
<h2>COMMANDS
|
||||||
|
<a name="COMMANDS"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">The following
|
||||||
|
commands are available.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>update,
|
||||||
|
create and update packages list <br>
|
||||||
|
slpkg update</b>,
|
||||||
|
<b>--repositories=[repositories...]</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Used to
|
||||||
|
re-synchronize the package lists and create some important
|
||||||
|
files. This command must run every new repository is added
|
||||||
|
or new updates is available.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Additional
|
||||||
|
options:</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--repositories=[repositories...]</b>
|
||||||
|
: Update at specifically repositories separate by comma.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>upgrade,
|
||||||
|
recreate packages list <br>
|
||||||
|
slpkg upgrade</b>,
|
||||||
|
<b>--repositories=[repositories...]</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">It is sometimes
|
||||||
|
useful to create all of the base file from the beginning so
|
||||||
|
this command delete all the package lists and recreated.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Additional
|
||||||
|
options:</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--repositories=[repositories...]</b>
|
||||||
|
: Update at specifically repositories separate by comma.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>repo-add,
|
||||||
|
add custom repository <br>
|
||||||
|
slpkg repo-add</b> <<i>repository name</i>>
|
||||||
|
<<i>URL</i>></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Add custom
|
||||||
|
binary repository. The repositories will be added to this
|
||||||
|
command should contain at least the files
|
||||||
|
"PACKAGES.TXT" and "CHECKSUMS.md5" and
|
||||||
|
optional file "ChangeLog.txt" used to control
|
||||||
|
changes.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>repo-remove,
|
||||||
|
remove custom repository <br>
|
||||||
|
slpkg repo-remove</b> <<i>repository</i>></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Remove custom
|
||||||
|
repository by name.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>repo-enable,
|
||||||
|
enable or disable repositories <br>
|
||||||
|
slpkg repo-enable</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Enable or
|
||||||
|
disable repositories via dialog utility (require
|
||||||
|
python3-pythondialog)</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>repo-list,
|
||||||
|
repositories list <br>
|
||||||
|
slpkg repo-list</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Lists all
|
||||||
|
enabled or disabled repositories.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>repo-info,
|
||||||
|
repository information <br>
|
||||||
|
slpkg repo-info</b> <<i>repository</i>></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">View repository
|
||||||
|
information.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>update
|
||||||
|
slpkg, update slpkg itself <br>
|
||||||
|
slpkg update slpkg</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">You can check
|
||||||
|
for new versions and update slpkg itself.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>health,
|
||||||
|
health check installed packages <br>
|
||||||
|
slpkg health</b>, <b>--silent</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Check file list
|
||||||
|
from packages of files installed.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Additional
|
||||||
|
options:</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--silent</b>
|
||||||
|
: Print only errors.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>deps-status,
|
||||||
|
print dependencies status <br>
|
||||||
|
slpkg deps-status --graph=[type]</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Print
|
||||||
|
dependencies status used by packages. Prerequisite packages
|
||||||
|
have been installed with the option "# slpkg -s
|
||||||
|
<repository> <packages>".</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Additional
|
||||||
|
options:</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--graph=[type]</b>
|
||||||
|
: Drawing dependencies diagram. (example for type: ascii,
|
||||||
|
image.x11, image.png etc. Require pygraphviz)</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--tree</b> :
|
||||||
|
Switch to tree view.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>new-config,
|
||||||
|
manage .new configuration files <br>
|
||||||
|
slpkg new-config</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">This command
|
||||||
|
searches for .new configuration files in /etc/ path and ask
|
||||||
|
the user what todo with those files.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>clean-tmp,
|
||||||
|
clean the tmp/ directory <br>
|
||||||
|
slpkg clean-tmp</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Clean the
|
||||||
|
/tmp/slpkg/ directory from downloaded packages and
|
||||||
|
sources.</p>
|
||||||
|
|
||||||
|
<h2>OPTIONS
|
||||||
|
<a name="OPTIONS"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">The following
|
||||||
|
arguments are available.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-a,
|
||||||
|
--autobuild, auto build packages <br>
|
||||||
|
slpkg -a</b> <<i>script.tar.gz</i>>
|
||||||
|
<<i>sources</i>></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">If you already
|
||||||
|
have download the script and source with this argument you
|
||||||
|
can build Slackware package from source quickly and easy.
|
||||||
|
Slpkg will grab checksum from the .info file to make control
|
||||||
|
if he does not agree with the versions you will get the
|
||||||
|
wrong message. If you want switch off checksum from the
|
||||||
|
configuration file.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-b,
|
||||||
|
--blacklist, add, remove, view packages in blacklist <br>
|
||||||
|
slpkg -b</b> <<i>name of packages</i>> <b>--add</b>,
|
||||||
|
<b>--remove</b>, <b>list</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Add, remove or
|
||||||
|
listed packages from blacklist file. The settings here
|
||||||
|
affect all repositories. Remove all packages from blacklist
|
||||||
|
use argument like "# slpkg -b --remove". Use
|
||||||
|
asterisk "*" to match pagkages like "# slpkg
|
||||||
|
-b py* --add", this add all installed packages with
|
||||||
|
starts string "py" or "# slpkg -b
|
||||||
|
multi:*multilib* --add", this add all multilib packages
|
||||||
|
from repository "multi".</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-q, --queue,
|
||||||
|
add, remove, view packages in queue <br>
|
||||||
|
slpkg -q</b> <<i>names of packages</i>> <b>--add</b>,
|
||||||
|
<b>--remove <br>
|
||||||
|
slpkg -q list</b>, <b>build</b>, <b>install</b>,
|
||||||
|
<b>build-install</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Add, remove and
|
||||||
|
listed sbo packages from queue. This argument is very useful
|
||||||
|
if you want to build and install multiple packages together.
|
||||||
|
Note the correct order if there are dependencies. If you
|
||||||
|
want to remove all the packages from the list run "#
|
||||||
|
slpkg -q --remove". (these arguments only working for
|
||||||
|
the sbo repository) Build or install or build and install
|
||||||
|
packages are queued.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-g,
|
||||||
|
--config, configuration file management <br>
|
||||||
|
slpkg -g print</b>, <b>edit</b>, <b>reset</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Print, reset or
|
||||||
|
edit configuration file.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-l, --list,
|
||||||
|
list of installed packages <br>
|
||||||
|
slpkg -l</b> <<i>repository</i>>, <b>--index</b>,
|
||||||
|
<b>--installed</b>, <b>--name</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Print a list of
|
||||||
|
all available packages from repository, index or print only
|
||||||
|
packages installed on the system. Support command
|
||||||
|
"grep" like "# slpkg -l sbo | grep
|
||||||
|
python".</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Additional
|
||||||
|
options:</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--index</b>
|
||||||
|
: Count packages per page.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--installed</b>
|
||||||
|
: Highlight installed packages.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--name</b> :
|
||||||
|
Print package name only.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-c, --check,
|
||||||
|
check if your packages is up to date <br>
|
||||||
|
slpkg -c</b> <<i>repository</i>> <b>--upgrade
|
||||||
|
--rebuild --skip=[packages...]</b>, <b>--resolve-off</b>,
|
||||||
|
<b>--checklist</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Check your
|
||||||
|
packages if up to date. Slackware patches repository works
|
||||||
|
independently of the others i.e not need before updating the
|
||||||
|
list of packages by choosing "# slpkg update",
|
||||||
|
works directly with the official repository and so always
|
||||||
|
you can have updated your system.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Additional
|
||||||
|
options:</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-c</b> :
|
||||||
|
Check ChangeLog.txt files for changes.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--upgrade</b>
|
||||||
|
: Check and install packages for upgrade.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--rebuild</b>
|
||||||
|
: Rebuild packages from sbo repository.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--resolve-off</b>
|
||||||
|
: Switch off automatic resolve dependencies.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--skip=[packages...]</b>
|
||||||
|
: Skip packages from upgrade separate by comma like "#
|
||||||
|
slpkg -c sbo --skip=jdk,pep8,pip" (See REGEX).</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--checklist</b>
|
||||||
|
: Enable dialog utility and checklist option. (Require
|
||||||
|
python3-pythondialog)</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-s, --sync,
|
||||||
|
synchronize packages, download, build and install package
|
||||||
|
with all dependencies <br>
|
||||||
|
slpkg -s</b> <<i>repository</i>> <<i>names of
|
||||||
|
packages</i>>, <b>--resolve-off</b>, <b>--case-ins</b>,
|
||||||
|
<b>--patches</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Installs or
|
||||||
|
upgrade packages from the repositories with automatically
|
||||||
|
resolving all dependencies of the package.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Additional
|
||||||
|
options:</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--rebuild</b>
|
||||||
|
: Rebuild packages from sbo repository.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--reinstall</b>
|
||||||
|
: Reinstall binary packages from repositories.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--resolve-off</b>
|
||||||
|
: Switch off automatic resolve dependencies.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--download-only</b>
|
||||||
|
: Download packages without install.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--directory-prefix=[path/to/dir/]</b>
|
||||||
|
: Download packages in specific directory.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--case-ins</b>
|
||||||
|
: Search package name in repository with case
|
||||||
|
insensitive.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--patches</b>
|
||||||
|
: Switch to patches directory, only for slack
|
||||||
|
repository.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-t,
|
||||||
|
--tracking, tracking dependencies <br>
|
||||||
|
slpkg -t</b> <<i>repository</i>> <<i>name of
|
||||||
|
package</i>>, <b>--check-deps</b>, <b>--graph=[type]
|
||||||
|
--case-ins</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Tracking all
|
||||||
|
dependencies of that package. The sequence shown is that you
|
||||||
|
must follow to correctly install package. Also you can check
|
||||||
|
if the installed package has all the required
|
||||||
|
dependencies.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Additional
|
||||||
|
options:</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--check-deps</b>
|
||||||
|
: Check if installed packages used by other packages.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--graph=[type]</b>
|
||||||
|
: Drawing dependencies graph. (example for type: ascii,
|
||||||
|
image.x11, image.png etc. Require pygraphviz)</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--case-ins</b>
|
||||||
|
: Search package name in repository with case
|
||||||
|
insensitive.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-p, --desc,
|
||||||
|
print packages description <br>
|
||||||
|
slpkg -p</b> <<i>repository</i>> <<i>name of
|
||||||
|
package</i>>, <b>--color=[]</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Print package
|
||||||
|
description from remote repository with color. Available
|
||||||
|
colors: red, green, yellow, cyan, grey</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Additional
|
||||||
|
options:</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--color=[]</b>
|
||||||
|
: Change color print.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-F, --FIND,
|
||||||
|
find packages from repositories <br>
|
||||||
|
slpkg -F</b> <<i>names of packages</i>>,
|
||||||
|
<i>--case-ins</i></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Find packages
|
||||||
|
from all repositories are enabled. Useful command to find
|
||||||
|
all available packages per repository.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Additional
|
||||||
|
options:</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--case-ins</b>
|
||||||
|
: Search package name in repository with case
|
||||||
|
insensitive.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-f, --find,
|
||||||
|
find installed packages <br>
|
||||||
|
slpkg -f</b> <<i>names of packages</i>>,
|
||||||
|
<b>--case-ins</b>, <b>--third-party</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Find installed
|
||||||
|
packages with view total file size. Example you can view all
|
||||||
|
installed sbo packages like "# slpkg -f _SBo".</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Additional
|
||||||
|
options:</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--case-ins</b>
|
||||||
|
: Search package name with case insensitive.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--third-party</b>
|
||||||
|
: View all the third-party packages.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-n,
|
||||||
|
--network, view SBo packages <br>
|
||||||
|
slpkg -n</b> <<i>name of package</i>>,
|
||||||
|
<<i>[pattern], --checklist</i>>, <b>--case-ins</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">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".</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Additional
|
||||||
|
options:</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--checklist</b>
|
||||||
|
: Enable dialog utility and checklist option. (Require
|
||||||
|
python3-pythondialog)</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--case-ins</b>
|
||||||
|
: Search package name in repository with case
|
||||||
|
insensitive.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-i,
|
||||||
|
--installpkg, install Slackware binary packages <br>
|
||||||
|
slpkg -i [--warn, --md5sum, --root /otherroot, --infobox,
|
||||||
|
--menu, --terse, --ask, --priority ADD|REC|OPT|SKP,
|
||||||
|
--tagfile /somedir/tagfile]</b>
|
||||||
|
<<i>packages.t?z</i>></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Installs single
|
||||||
|
binary packages designed for use with the Slackware Linux
|
||||||
|
distribution into your system. More information please read
|
||||||
|
"man installpkg".</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-u,
|
||||||
|
--upgradepkg, install-upgrade Slackware binary packages with
|
||||||
|
new <br>
|
||||||
|
slpkg -u [--dry-run, --install-new, --reinstall,
|
||||||
|
--verbose]</b> <<i>packages.t?z</i>></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Normally
|
||||||
|
upgrade only upgrades packages that are already installed on
|
||||||
|
the system, and will skip any packages that do not already
|
||||||
|
have a version installed. More information please read
|
||||||
|
"man upgradepkg".</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-r,
|
||||||
|
--removepkg, remove previously installed Slackware binary
|
||||||
|
packages <br>
|
||||||
|
slpkg -r [-copy, -keep, -preserve, -warn]</b> <<i>names
|
||||||
|
of packages</i>>, <b>--deps</b>, <b>--check-deps</b>,
|
||||||
|
<b>--tag</b>, <b>--checklist</b>, <b>--third-party</b></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Removes a
|
||||||
|
previously installed Slackware package, while writing a
|
||||||
|
progress report to the standard output. A package may be
|
||||||
|
specified either by the full package name (as you’d
|
||||||
|
see listed in /var/log/packages/), or by the base package
|
||||||
|
name. If installed packages with command "# slpkg -s
|
||||||
|
<repo> <packages>" then write a file in
|
||||||
|
/var/log/slpkg/dep/ with all dependencies and it allows you
|
||||||
|
can remove them all together. More information please read
|
||||||
|
"man removepkg".</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Additional
|
||||||
|
options:</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--deps</b> :
|
||||||
|
Remove packages with dependencies.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--check-deps</b>
|
||||||
|
: Check if installed packages used by other packages.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--tag</b> :
|
||||||
|
Remove packages with by TAG.</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--checklist</b>
|
||||||
|
: Enable dialog utility and checklist option. (Require
|
||||||
|
python3-pythondialog)</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>--third-party</b>
|
||||||
|
: Remove all the third-party packages. (Be sure update the
|
||||||
|
package lists before)</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em"><b>-d,
|
||||||
|
--display, display the installed packages contents and file
|
||||||
|
list <br>
|
||||||
|
slpkg -d</b> <<i>names of packages</i>></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Display the
|
||||||
|
installed Slackware packages contents and file list with all
|
||||||
|
descriptions.</p>
|
||||||
|
|
||||||
|
<h2>HELP OPTION
|
||||||
|
<a name="HELP OPTION"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Specifying the
|
||||||
|
help option displays help for slpkg itself, or a command.
|
||||||
|
<br>
|
||||||
|
For example: <b><br>
|
||||||
|
slpkg −−help</b> - display help for slpkg</p>
|
||||||
|
|
||||||
|
<h2>DEFAULT REPOSITORIES
|
||||||
|
<a name="DEFAULT REPOSITORIES"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">slackware.com =
|
||||||
|
"slack" <br>
|
||||||
|
SlackBuilds.org = "sbo" <br>
|
||||||
|
Alien’s = "alien" <br>
|
||||||
|
slacky.eu = "slacky" <br>
|
||||||
|
rworkman’s = "rlw" <br>
|
||||||
|
Conraid’s = "conrad" <br>
|
||||||
|
slackonly.com = "slonly" <br>
|
||||||
|
Alien’s ktown = "ktown{latest}" <br>
|
||||||
|
Alien’s multilib = "multi" <br>
|
||||||
|
Slacke E17 and E18 = "slacke{18}" <br>
|
||||||
|
SalixOS = "salix" <br>
|
||||||
|
Slackel.gr = "slackel" <br>
|
||||||
|
Alien’s restricted = "rested" <br>
|
||||||
|
MATE Desktop Environment = "msb{1.18}" <br>
|
||||||
|
Cinnamon Desktop Environment = "csb" <br>
|
||||||
|
Connochaetos slack-n-free = "connos" <br>
|
||||||
|
Microlinux mles = "mles"</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Default enable
|
||||||
|
repository is "slack" and "sbo". <br>
|
||||||
|
Add or remove default repository in configuration file
|
||||||
|
"/etc/slpkg/repositories.conf". <br>
|
||||||
|
Read REPOSITORIES file for particularities.</p>
|
||||||
|
|
||||||
|
<h2>COLORS
|
||||||
|
<a name="COLORS"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">red, green,
|
||||||
|
yellow, cyan, grey</p>
|
||||||
|
|
||||||
|
<h2>REGEX
|
||||||
|
<a name="REGEX"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">For options
|
||||||
|
"--skip=" and blacklist file.</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">All packages
|
||||||
|
starts with: "string*" <br>
|
||||||
|
All packages ends with: "*string" <br>
|
||||||
|
All packages include: "*string*"</p>
|
||||||
|
|
||||||
|
<h2>PASS VARIABLES TO THE SCRIPT
|
||||||
|
<a name="PASS VARIABLES TO THE SCRIPT"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">If you want to
|
||||||
|
pass variables to the script exported as: <br>
|
||||||
|
Usage: <NAME_VARIABLE=value></p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Example: <br>
|
||||||
|
"# export FFMPEG_X264=yes FFMPEG_LAME=yes"</p>
|
||||||
|
|
||||||
|
<h2>FILES
|
||||||
|
<a name="FILES"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">/etc/slpkg/slpkg.conf
|
||||||
|
<br>
|
||||||
|
General configuration of slpkg</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">/etc/slpkg/repositories.conf
|
||||||
|
<br>
|
||||||
|
Configuration file for repositories</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">/etc/slpkg/blacklist
|
||||||
|
<br>
|
||||||
|
List of packages to skip</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">/etc/slpkg/slackware-mirrors
|
||||||
|
<br>
|
||||||
|
List of Slackware Mirrors</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">/etc/slpkg/default-repositories
|
||||||
|
<br>
|
||||||
|
List of default repositories</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">/etc/slpkg/custom-repositories
|
||||||
|
<br>
|
||||||
|
List of custom repositories</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">/etc/slpkg/rlworkman.deps
|
||||||
|
<br>
|
||||||
|
Rworkman’s repository dependencies</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">/etc/slpkg/pkg_security
|
||||||
|
<br>
|
||||||
|
List of packages for security reasons</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">/var/log/slpkg
|
||||||
|
<br>
|
||||||
|
ChangeLog.txt repositories files <br>
|
||||||
|
SlackBuilds logs and dependencies files</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">/var/lib/slpkg
|
||||||
|
<br>
|
||||||
|
PACKAGES.TXT files <br>
|
||||||
|
SLACKBUILDS.TXT files <br>
|
||||||
|
CHECKSUMS.md5 files <br>
|
||||||
|
FILELIST.TXT files</p>
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">/tmp/slpkg <br>
|
||||||
|
Slpkg temporary downloaded files and build packages</p>
|
||||||
|
|
||||||
|
<h2>AUTHOR
|
||||||
|
<a name="AUTHOR"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Dimitris
|
||||||
|
Zlatanidis <d.zlatanidis@gmail.com></p>
|
||||||
|
|
||||||
|
<h2>HOMEPAGE
|
||||||
|
<a name="HOMEPAGE"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">https://dslackw.gitlab.io/slpkg/</p>
|
||||||
|
|
||||||
|
<h2>COPYRIGHT
|
||||||
|
<a name="COPYRIGHT"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">Copyright
|
||||||
|
© 2014-2019 Dimitris Zlatanidis</p>
|
||||||
|
|
||||||
|
<h2>SEE ALSO
|
||||||
|
<a name="SEE ALSO"></a>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
|
||||||
|
<p style="margin-left:11%; margin-top: 1em">installpkg(8),
|
||||||
|
upgradepkg(8), removepkg(8), pkgtool(8), slackpkg(8),
|
||||||
|
explodepkg(8), makepkg(8).</p>
|
||||||
|
<hr>
|
||||||
|
</body>
|
||||||
|
</html>
|
4
pytest.ini
Normal file
4
pytest.ini
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[pytest]
|
||||||
|
python_files = test_*
|
||||||
|
python_classes = *Tests
|
||||||
|
python_functions = test_*
|
|
@ -12,3 +12,5 @@
|
||||||
# python3-pythondialog >= 3.5.0 (Python interface to the UNIX dialog utility)
|
# python3-pythondialog >= 3.5.0 (Python interface to the UNIX dialog utility)
|
||||||
|
|
||||||
urllib3 >= 1.25.7
|
urllib3 >= 1.25.7
|
||||||
|
flake8 >= 3.5.0
|
||||||
|
pytest >= 5.3.2
|
4
setup.py
4
setup.py
|
@ -35,7 +35,9 @@ except ImportError:
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
|
||||||
docs_requires = []
|
docs_requires = []
|
||||||
tests_requires = []
|
tests_requires = [
|
||||||
|
"pytest>=5.3.2"
|
||||||
|
]
|
||||||
install_requires = [
|
install_requires = [
|
||||||
"urllib3>=1.25.7"
|
"urllib3>=1.25.7"
|
||||||
]
|
]
|
||||||
|
|
|
@ -40,7 +40,7 @@ def update_repositories(repositories, conf_path):
|
||||||
"""
|
"""
|
||||||
Upadate with user custom repositories
|
Upadate with user custom repositories
|
||||||
"""
|
"""
|
||||||
repo_file = "{0}custom-repositories".format(conf_path)
|
repo_file = f"{conf_path}custom-repositories"
|
||||||
if os.path.isfile(repo_file):
|
if os.path.isfile(repo_file):
|
||||||
f = open(repo_file, "r")
|
f = open(repo_file, "r")
|
||||||
repositories_list = f.read()
|
repositories_list = f.read()
|
||||||
|
@ -78,7 +78,7 @@ class MetaData:
|
||||||
|
|
||||||
__all__ = "slpkg"
|
__all__ = "slpkg"
|
||||||
__author__ = "dslackw"
|
__author__ = "dslackw"
|
||||||
__version_info__ = (3, 7, 4)
|
__version_info__ = (3, 7, 5)
|
||||||
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
||||||
__license__ = "GNU General Public License v3 (GPLv3)"
|
__license__ = "GNU General Public License v3 (GPLv3)"
|
||||||
__email__ = "d.zlatanidis@gmail.com"
|
__email__ = "d.zlatanidis@gmail.com"
|
||||||
|
@ -90,11 +90,11 @@ class MetaData:
|
||||||
slack_rel = "stable"
|
slack_rel = "stable"
|
||||||
|
|
||||||
# Configuration path
|
# Configuration path
|
||||||
conf_path = "/etc/{0}/".format(__all__)
|
conf_path = f"/etc/{__all__}/"
|
||||||
|
|
||||||
# tmp paths
|
# tmp paths
|
||||||
tmp = "/tmp/"
|
tmp = "/tmp/"
|
||||||
tmp_path = "{0}{1}/".format(tmp, __all__)
|
tmp_path = f"{tmp}{__all__}/"
|
||||||
|
|
||||||
# Default configuration values
|
# Default configuration values
|
||||||
_conf_slpkg = {
|
_conf_slpkg = {
|
||||||
|
@ -138,8 +138,8 @@ class MetaData:
|
||||||
# read value from configuration file
|
# read value from configuration file
|
||||||
repositories = []
|
repositories = []
|
||||||
for files in ["slpkg.conf", "repositories.conf"]:
|
for files in ["slpkg.conf", "repositories.conf"]:
|
||||||
if os.path.isfile("%s%s" % (conf_path, files)):
|
if os.path.isfile(f"{conf_path}{files}"):
|
||||||
f = open("%s%s" % (conf_path, files), "r")
|
f = open(f"{conf_path}{files}", "r")
|
||||||
conf = f.read()
|
conf = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
for line in conf.splitlines():
|
for line in conf.splitlines():
|
||||||
|
@ -217,8 +217,8 @@ class MetaData:
|
||||||
"ENDC": ""
|
"ENDC": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECKSUMS_link = ("https://gitlab.com/{0}/{1}/raw/"
|
CHECKSUMS_link = (f"https://gitlab.com/{__author__}/{__all__}/raw/"
|
||||||
"master/CHECKSUMS.md5".format(__author__, __all__))
|
"master/CHECKSUMS.md5")
|
||||||
|
|
||||||
# file spacer
|
# file spacer
|
||||||
sp = "-"
|
sp = "-"
|
||||||
|
|
|
@ -30,8 +30,7 @@ from slpkg.slack.slack_version import slack_ver
|
||||||
|
|
||||||
def header():
|
def header():
|
||||||
"""help header message"""
|
"""help header message"""
|
||||||
print("\nslpkg - version {0} | Slackware release: {1} - {2}\n".format(
|
print(f"\nslpkg - version {_meta_.__version__} | Slackware release: {_meta_.slack_rel} - {slack_ver()}\n")
|
||||||
_meta_.__version__, _meta_.slack_rel, slack_ver()))
|
|
||||||
|
|
||||||
|
|
||||||
def options():
|
def options():
|
||||||
|
@ -220,11 +219,11 @@ def usage(repo):
|
||||||
all_repos = RepoList().all_repos.keys()
|
all_repos = RepoList().all_repos.keys()
|
||||||
del RepoList().all_repos
|
del RepoList().all_repos
|
||||||
if repo in all_repos:
|
if repo in all_repos:
|
||||||
error_repo = ("slpkg: Error: Repository '{0}' is not activated"
|
error_repo = (f"slpkg: Error: Repository '{repo}' is not activated"
|
||||||
"\n".format(repo))
|
"\n")
|
||||||
else:
|
else:
|
||||||
error_repo = ("slpkg: Error: Repository '{0}' does not exist"
|
error_repo = (f"slpkg: Error: Repository '{repo}' does not exist"
|
||||||
"\n".format(repo))
|
"\n")
|
||||||
print("\n" + error_repo)
|
print("\n" + error_repo)
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
print(usage.__doc__)
|
print(usage.__doc__)
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from slpkg.messages import Msg
|
from slpkg.messages import Msg
|
||||||
from slpkg.__metadata__ import MetaData as _meta_
|
from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
@ -35,7 +33,10 @@ class Auto:
|
||||||
"""
|
"""
|
||||||
def __init__(self, packages):
|
def __init__(self, packages):
|
||||||
self.packages = packages
|
self.packages = packages
|
||||||
self.meta = _meta_
|
self.green = _meta_.color["GREEN"]
|
||||||
|
self.red = _meta_.color["RED"]
|
||||||
|
self.cyan = _meta_.color["CYAN"]
|
||||||
|
self.endc = _meta_.color["ENDC"]
|
||||||
self.msg = Msg()
|
self.msg = Msg()
|
||||||
self.commands = {
|
self.commands = {
|
||||||
"i": "installpkg",
|
"i": "installpkg",
|
||||||
|
@ -54,10 +55,7 @@ class Auto:
|
||||||
print("| Choose a Slackware command:")
|
print("| Choose a Slackware command:")
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
for com in sorted(self.commands):
|
for com in sorted(self.commands):
|
||||||
print("| {0}{1}{2}) {3}{4}{5}".format(
|
print(f"| {self.red}{com}{self.endc}) {self.green}{self.commands[com]}{self.endc}")
|
||||||
self.meta.color["RED"], com, self.meta.color["ENDC"],
|
|
||||||
self.meta.color["GREEN"], self.commands[com],
|
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
try:
|
try:
|
||||||
self.choice = input(" > ")
|
self.choice = input(" > ")
|
||||||
|
@ -65,9 +63,7 @@ class Auto:
|
||||||
print()
|
print()
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
if self.choice in self.commands.keys():
|
if self.choice in self.commands.keys():
|
||||||
print(" \x1b[1A{0}{1}{2}\n\n".format(
|
print(f" \x1b[1A{self.cyan}{self.commands[self.choice]}{self.endc}", end="\n\n")
|
||||||
self.meta.color["CYAN"], self.commands[self.choice],
|
|
||||||
self.meta.color["ENDC"]), end="")
|
|
||||||
print(end="", flush=True)
|
print(end="", flush=True)
|
||||||
self.execute()
|
self.execute()
|
||||||
|
|
||||||
|
|
|
@ -165,8 +165,7 @@ class Requires:
|
||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
else:
|
else:
|
||||||
PACKAGES_TXT = Utils().read_file("{0}{1}_repo/PACKAGES.TXT".format(
|
PACKAGES_TXT = Utils().read_file(f"{_meta_.lib_path}{self.repo}_repo/PACKAGES.TXT")
|
||||||
_meta_.lib_path, self.repo))
|
|
||||||
for line in PACKAGES_TXT.splitlines():
|
for line in PACKAGES_TXT.splitlines():
|
||||||
if line.startswith("PACKAGE NAME:"):
|
if line.startswith("PACKAGE NAME:"):
|
||||||
pkg_name = split_package(line[14:].strip())[0]
|
pkg_name = split_package(line[14:].strip())[0]
|
||||||
|
|
|
@ -60,6 +60,11 @@ class BinaryInstall:
|
||||||
self.repo = repo
|
self.repo = repo
|
||||||
self.flag = flag
|
self.flag = flag
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
self.green = _meta_.color["GREEN"]
|
||||||
|
self.red = _meta_.color["RED"]
|
||||||
|
self.grey = _meta_.color["GREY"]
|
||||||
|
self.yellow = _meta_.color['YELLOW']
|
||||||
|
self.endc = _meta_.color["ENDC"]
|
||||||
self.msg = Msg()
|
self.msg = Msg()
|
||||||
self.version = self.meta.slack_rel
|
self.version = self.meta.slack_rel
|
||||||
self.tmp_path = self.meta.slpkg_tmp_packages
|
self.tmp_path = self.meta.slpkg_tmp_packages
|
||||||
|
@ -124,22 +129,16 @@ class BinaryInstall:
|
||||||
if self.matching and [""] != self.packages:
|
if self.matching and [""] != self.packages:
|
||||||
print("\nMatching summary")
|
print("\nMatching summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("Total {0} matching packages\n".format(sum(sums)))
|
print(f"Total {sum(sums)} matching packages\n")
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total {1} {2}.".format(self.meta.color["GREY"],
|
print(f"{self.grey}Total {sum(sums)} {self.msg.pkg(sum(sums))}.")
|
||||||
sum(sums),
|
print(f"{sums[2]} {self.msg.pkg(sums[2])} will be installed, {sums[1]} will be upgraded and "
|
||||||
self.msg.pkg(sum(sums))))
|
f"{sums[0]} will be reinstalled.")
|
||||||
print("{0} {1} will be installed, {2} will be upgraded and "
|
print(f"Need to get {size[0]} {unit[0]} of archives.")
|
||||||
"{3} will be reinstalled.".format(sums[2],
|
print(f"After this process, {size[1]} {unit[1]} of additional disk "
|
||||||
self.msg.pkg(sums[2]),
|
f"space will be used.{self.endc}")
|
||||||
sums[1], sums[0]))
|
|
||||||
print("Need to get {0} {1} of archives.".format(size[0],
|
|
||||||
unit[0]))
|
|
||||||
print("After this process, {0} {1} of additional disk "
|
|
||||||
"space will be used.{2}".format(size[1], unit[1],
|
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
print()
|
print()
|
||||||
self.if_all_installed()
|
self.if_all_installed()
|
||||||
if self.msg.answer() in ["y", "Y"]:
|
if self.msg.answer() in ["y", "Y"]:
|
||||||
|
@ -221,20 +220,17 @@ class BinaryInstall:
|
||||||
installs, upgraded = [], []
|
installs, upgraded = [], []
|
||||||
for inst in (self.dep_install + self.install):
|
for inst in (self.dep_install + self.install):
|
||||||
package = (self.tmp_path + inst).split()
|
package = (self.tmp_path + inst).split()
|
||||||
pkg_ver = "{0}-{1}".format(split_package(inst)[0],
|
pkg_ver = f"{split_package(inst)[0]}-{split_package(inst)[1]}"
|
||||||
split_package(inst)[1])
|
|
||||||
self.checksums(inst)
|
self.checksums(inst)
|
||||||
if GetFromInstalled(split_package(inst)[0]).name():
|
if GetFromInstalled(split_package(inst)[0]).name():
|
||||||
print("[ {0}upgrading{1} ] --> {2}".format(
|
print(f"[ {self.yellow}upgrading{self.endc} ] --> {inst}")
|
||||||
self.meta.color["YELLOW"], self.meta.color["ENDC"], inst))
|
|
||||||
upgraded.append(pkg_ver)
|
upgraded.append(pkg_ver)
|
||||||
if "--reinstall" in self.flag:
|
if "--reinstall" in self.flag:
|
||||||
PackageManager(package).upgrade("--reinstall")
|
PackageManager(package).upgrade("--reinstall")
|
||||||
else:
|
else:
|
||||||
PackageManager(package).upgrade("--install-new")
|
PackageManager(package).upgrade("--install-new")
|
||||||
else:
|
else:
|
||||||
print("[ {0}installing{1} ] --> {2}".format(
|
print(f"[ {self.green}installing{self.endc} ] --> {inst}")
|
||||||
self.meta.color["GREEN"], self.meta.color["ENDC"], inst))
|
|
||||||
installs.append(pkg_ver)
|
installs.append(pkg_ver)
|
||||||
PackageManager(package).upgrade("--install-new")
|
PackageManager(package).upgrade("--install-new")
|
||||||
return [installs, upgraded]
|
return [installs, upgraded]
|
||||||
|
@ -249,8 +245,7 @@ class BinaryInstall:
|
||||||
ins_ver = "0"
|
ins_ver = "0"
|
||||||
if parse_version(rep_ver) < parse_version(ins_ver):
|
if parse_version(rep_ver) < parse_version(ins_ver):
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| Package {0} don't downgrade, "
|
print(f"| Package {name} don't downgrade, setting by user")
|
||||||
"setting by user".format(name))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -302,26 +297,18 @@ class BinaryInstall:
|
||||||
COLOR = self.meta.color["RED"]
|
COLOR = self.meta.color["RED"]
|
||||||
uni_sum += 1
|
uni_sum += 1
|
||||||
ver = GetFromInstalled(pkg_repo[0]).version()
|
ver = GetFromInstalled(pkg_repo[0]).version()
|
||||||
print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>11}{12}".format(
|
print(f" {COLOR}{pkg_repo[0] + ver}{self.endc}"
|
||||||
COLOR, pkg_repo[0] + ver, self.meta.color["ENDC"],
|
f"{' ' * (23-len(pkg_repo[0] + ver))} {pkg_repo[1]}"
|
||||||
" " * (23-len(pkg_repo[0] + ver)), pkg_repo[1],
|
f"{' ' * (18-len(pkg_repo[1]))} {pkg_repo[2]}"
|
||||||
" " * (18-len(pkg_repo[1])), pkg_repo[2],
|
f"{' ' * (8-len(pkg_repo[2]))}{pkg_repo[3]}"
|
||||||
" " * (8-len(pkg_repo[2])), pkg_repo[3],
|
f"{' ' * (7-len(pkg_repo[3]))}{repo}{comp:>11}{' K'}")
|
||||||
" " * (7-len(pkg_repo[3])), repo,
|
|
||||||
comp, " K").rstrip())
|
|
||||||
return [pkg_sum, upg_sum, uni_sum]
|
return [pkg_sum, upg_sum, uni_sum]
|
||||||
|
|
||||||
def top_view(self):
|
def top_view(self):
|
||||||
"""Print packages status bar
|
"""Print packages status bar
|
||||||
"""
|
"""
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
|
print(f"| Package{' ' * 17}New Version{' ' * 8}Arch{' ' * 4}Build{' ' * 2}Repos{' ' * 10}Size")
|
||||||
"| Package", " " * 17,
|
|
||||||
"New Version", " " * 8,
|
|
||||||
"Arch", " " * 4,
|
|
||||||
"Build", " " * 2,
|
|
||||||
"Repos", " " * 10,
|
|
||||||
"Size"))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
|
|
||||||
def store(self, packages):
|
def store(self, packages):
|
||||||
|
@ -338,7 +325,7 @@ class BinaryInstall:
|
||||||
if (pk and pkg == split_package(pk)[0] and
|
if (pk and pkg == split_package(pk)[0] and
|
||||||
pk not in install and
|
pk not in install and
|
||||||
split_package(pk)[0] not in self.blacklist):
|
split_package(pk)[0] not in self.blacklist):
|
||||||
dwn.append("{0}{1}/{2}".format(self.mirror, loc, pk))
|
dwn.append(f"{self.mirror}{loc}/{pk}")
|
||||||
install.append(pk)
|
install.append(pk)
|
||||||
comp_sum.append(comp)
|
comp_sum.append(comp)
|
||||||
uncomp_sum.append(uncomp)
|
uncomp_sum.append(uncomp)
|
||||||
|
@ -349,7 +336,7 @@ class BinaryInstall:
|
||||||
name = split_package(pk)[0]
|
name = split_package(pk)[0]
|
||||||
if (pk and pkg in name and name not in self.blacklist):
|
if (pk and pkg in name and name not in self.blacklist):
|
||||||
self.matching = True
|
self.matching = True
|
||||||
dwn.append("{0}{1}/{2}".format(self.mirror, loc, pk))
|
dwn.append(f"{self.mirror}{loc}/{pk}")
|
||||||
install.append(pk)
|
install.append(pk)
|
||||||
comp_sum.append(comp)
|
comp_sum.append(comp)
|
||||||
uncomp_sum.append(uncomp)
|
uncomp_sum.append(uncomp)
|
||||||
|
|
|
@ -41,22 +41,21 @@ class RepoInit:
|
||||||
|
|
||||||
def fetch(self):
|
def fetch(self):
|
||||||
if self.repo in self.meta.default_repositories:
|
if self.repo in self.meta.default_repositories:
|
||||||
exec("self._init_{0}()".format(self.repo))
|
exec(f"self._init_{self.repo}()")
|
||||||
else:
|
else:
|
||||||
exec("self._init_custom()")
|
exec("self._init_custom()")
|
||||||
self.lib = self.meta.lib_path + "{0}_repo/PACKAGES.TXT".format(
|
self.lib = self.meta.lib_path + f"{self.repo}_repo/PACKAGES.TXT"
|
||||||
self.repo)
|
|
||||||
PACKAGES_TXT = Utils().read_file(self.lib)
|
PACKAGES_TXT = Utils().read_file(self.lib)
|
||||||
return PACKAGES_TXT, self.mirror
|
return PACKAGES_TXT, self.mirror
|
||||||
|
|
||||||
def _init_custom(self):
|
def _init_custom(self):
|
||||||
self.mirror = "{0}".format(Repo().custom_repository()[self.repo])
|
self.mirror = f"{Repo.custom_repository()[self.repo]}"
|
||||||
|
|
||||||
def _init_slack(self):
|
def _init_slack(self):
|
||||||
self.mirror = mirrors(name="", location="")
|
self.mirror = mirrors(name="", location="")
|
||||||
|
|
||||||
def _init_rlw(self):
|
def _init_rlw(self):
|
||||||
self.mirror = "{0}{1}/".format(self.def_repo_dict["rlw"], slack_ver())
|
self.mirror = f"{self.def_repo_dict}{slack_ver()}/"
|
||||||
|
|
||||||
def _init_alien(self):
|
def _init_alien(self):
|
||||||
ver = slack_ver()
|
ver = slack_ver()
|
||||||
|
@ -65,30 +64,28 @@ class RepoInit:
|
||||||
arch = "x86_64"
|
arch = "x86_64"
|
||||||
if self.meta.slack_rel == "current":
|
if self.meta.slack_rel == "current":
|
||||||
ver = self.meta.slack_rel
|
ver = self.meta.slack_rel
|
||||||
self.mirror = "{0}{1}/{2}/".format(self.def_repo_dict["alien"],
|
self.mirror = f"{self.def_repo_dict['alien']}{ver}/{arch}/"
|
||||||
ver, arch)
|
|
||||||
|
|
||||||
def _init_slacky(self):
|
def _init_slacky(self):
|
||||||
arch = ""
|
arch = ""
|
||||||
if self.meta.arch == "x86_64":
|
if self.meta.arch == "x86_64":
|
||||||
arch = "64"
|
arch = "64"
|
||||||
self.mirror = "{0}slackware{1}-{2}/".format(
|
self.mirror = f"{self.def_repo_dict}slackware{arch}-{slack_ver()}/"
|
||||||
self.def_repo_dict["slacky"], arch, slack_ver())
|
|
||||||
|
|
||||||
def _init_conrad(self):
|
def _init_conrad(self):
|
||||||
self.mirror = self.def_repo_dict["conrad"]
|
self.mirror = self.def_repo_dict["conrad"]
|
||||||
|
|
||||||
def _init_slonly(self):
|
def _init_slonly(self):
|
||||||
ver = slack_ver()
|
ver = slack_ver()
|
||||||
arch = "{0}-x86".format(ver)
|
arch = f"{ver}-x86"
|
||||||
if self.meta.arch == "x86_64":
|
if self.meta.arch == "x86_64":
|
||||||
arch = "{0}-x86_64".format(ver)
|
arch = f"{ver}-x86_64"
|
||||||
if self.meta.slack_rel == "current":
|
if self.meta.slack_rel == "current":
|
||||||
if self.meta.arch == "x86_64":
|
if self.meta.arch == "x86_64":
|
||||||
arch = "{0}-x86_64".format(self.meta.slack_rel)
|
arch = f"{self.meta.slack_rel}-x86_64"
|
||||||
else:
|
else:
|
||||||
arch = "{0}-x86".format(self.meta.slack_rel)
|
arch = f"{self.meat.slack_rel}-x86"
|
||||||
self.mirror = "{0}{1}/".format(self.def_repo_dict["slonly"], arch)
|
self.mirror = f"{self.def_repo_dict['slonly']}{arch}/"
|
||||||
|
|
||||||
def _init_ktown(self):
|
def _init_ktown(self):
|
||||||
self.mirror = self.def_repo_dict["ktown"]
|
self.mirror = self.def_repo_dict["ktown"]
|
||||||
|
@ -103,23 +100,20 @@ class RepoInit:
|
||||||
arch = ""
|
arch = ""
|
||||||
if self.meta.arch == "x86_64":
|
if self.meta.arch == "x86_64":
|
||||||
arch = "64"
|
arch = "64"
|
||||||
self.mirror = "{0}slacke{1}/slackware{2}-{3}/".format(
|
self.mirror = (f"{self.def_repo_dict['slacke']}"
|
||||||
self.def_repo_dict["slacke"], self.meta.slacke_sub_repo[1:-1],
|
f"slacke{self.meta.slacke_sub_repo[1:-1]}/slackware{arch}-{slack_ver()}/")
|
||||||
arch, slack_ver())
|
|
||||||
|
|
||||||
def _init_salix(self):
|
def _init_salix(self):
|
||||||
arch = "i486"
|
arch = "i486"
|
||||||
if self.meta.arch == "x86_64":
|
if self.meta.arch == "x86_64":
|
||||||
arch = "x86_64"
|
arch = "x86_64"
|
||||||
self.mirror = "{0}{1}/{2}/".format(self.def_repo_dict["salix"],
|
self.mirror = f"{self.def_repo_dict['salix']}{arch}/{slack_ver()}/"
|
||||||
arch, slack_ver())
|
|
||||||
|
|
||||||
def _init_slackl(self):
|
def _init_slackl(self):
|
||||||
arch = "i486"
|
arch = "i486"
|
||||||
if self.meta.arch == "x86_64":
|
if self.meta.arch == "x86_64":
|
||||||
arch = "x86_64"
|
arch = "x86_64"
|
||||||
self.mirror = "{0}{1}/current/".format(self.def_repo_dict["slackl"],
|
self.mirror = f"{self.def_repo_dict['slackl']}{arch}/current/"
|
||||||
arch)
|
|
||||||
|
|
||||||
def _init_rested(self):
|
def _init_rested(self):
|
||||||
self.mirror = self.def_repo_dict["rested"]
|
self.mirror = self.def_repo_dict["rested"]
|
||||||
|
@ -128,28 +122,22 @@ class RepoInit:
|
||||||
arch = "x86"
|
arch = "x86"
|
||||||
if self.meta.arch == "x86_64":
|
if self.meta.arch == "x86_64":
|
||||||
arch = "x86_64"
|
arch = "x86_64"
|
||||||
self.mirror = "{0}{1}/{2}/{3}/".format(
|
self.mirror = f"{self.def_repo_dict['msb']}{slack_ver()}/{self.meta.msb_sub_repo[1:-1]}/{arch}/"
|
||||||
self.def_repo_dict["msb"], slack_ver(),
|
|
||||||
self.meta.msb_sub_repo[1:-1], arch)
|
|
||||||
|
|
||||||
def _init_csb(self):
|
def _init_csb(self):
|
||||||
arch = "x86"
|
arch = "x86"
|
||||||
if self.meta.arch == "x86_64":
|
if self.meta.arch == "x86_64":
|
||||||
arch = "x86_64"
|
arch = "x86_64"
|
||||||
self.mirror = "{0}{1}/{2}".format(
|
self.mirror = f"{self.def_repo_dict['csb']}{slack_ver()}/{arch}"
|
||||||
self.def_repo_dict["csb"], slack_ver(), arch)
|
|
||||||
|
|
||||||
def _init_connos(self):
|
def _init_connos(self):
|
||||||
arch = ""
|
arch = ""
|
||||||
if self.meta.arch == "x86_64":
|
if self.meta.arch == "x86_64":
|
||||||
arch = "64"
|
arch = "64"
|
||||||
self.mirror = "{0}slack-n-free{1}-{2}/".format(
|
self.mirror = f"{self.def_repo_dict['connos']}slack-n-free{arch}-{slack_ver()}/"
|
||||||
self.def_repo_dict["connos"], arch, slack_ver())
|
|
||||||
|
|
||||||
def _init_mles(self):
|
def _init_mles(self):
|
||||||
arch = "32"
|
arch = "32"
|
||||||
if self.meta.arch == "x86_64":
|
if self.meta.arch == "x86_64":
|
||||||
arch = "64"
|
arch = "64"
|
||||||
self.mirror = "{0}{1}-{2}-{3}bit/".format(
|
self.mirror = f"{self.def_repo_dict['mles']}{self.meta.mles_sub_repo[1:-1]}-{slack_ver()}-{arch}bit/"
|
||||||
self.def_repo_dict["mles"],
|
|
||||||
self.meta.mles_sub_repo[1:-1], slack_ver(), arch)
|
|
|
@ -33,8 +33,7 @@ def search_pkg(name, repo):
|
||||||
"""Search if package exists in PACKAGES.TXT file
|
"""Search if package exists in PACKAGES.TXT file
|
||||||
and return the name.
|
and return the name.
|
||||||
"""
|
"""
|
||||||
PACKAGES_TXT = Utils().read_file(_meta_.lib_path + "{0}_repo/"
|
PACKAGES_TXT = Utils().read_file(_meta_.lib_path + f"{repo}_repo/PACKAGES.TXT")
|
||||||
"PACKAGES.TXT".format(repo))
|
|
||||||
names = Utils().package_name(PACKAGES_TXT)
|
names = Utils().package_name(PACKAGES_TXT)
|
||||||
blacklist = BlackList().packages(pkgs=names, repo=repo)
|
blacklist = BlackList().packages(pkgs=names, repo=repo)
|
||||||
for line in PACKAGES_TXT.splitlines():
|
for line in PACKAGES_TXT.splitlines():
|
||||||
|
|
|
@ -33,8 +33,10 @@ class BlackList:
|
||||||
"""Blacklist class to add, remove or listed packages
|
"""Blacklist class to add, remove or listed packages
|
||||||
in blacklist file."""
|
in blacklist file."""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.meta = _meta_
|
|
||||||
self.quit = False
|
self.quit = False
|
||||||
|
self.green = _meta_.color["GREEN"]
|
||||||
|
self.red = _meta_.color["RED"]
|
||||||
|
self.endc = _meta_.color["ENDC"]
|
||||||
self.blackfile = "/etc/slpkg/blacklist"
|
self.blackfile = "/etc/slpkg/blacklist"
|
||||||
self.black_conf = ""
|
self.black_conf = ""
|
||||||
if os.path.isfile(self.blackfile):
|
if os.path.isfile(self.blackfile):
|
||||||
|
@ -56,8 +58,7 @@ class BlackList:
|
||||||
print("\nPackages in the blacklist:\n")
|
print("\nPackages in the blacklist:\n")
|
||||||
for black in self.get_black():
|
for black in self.get_black():
|
||||||
if black:
|
if black:
|
||||||
print("{0}{1}{2}".format(self.meta.color["GREEN"], black,
|
print(f"{self.green}{black}{self.endc}")
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
self.quit = True
|
self.quit = True
|
||||||
if self.quit:
|
if self.quit:
|
||||||
print() # new line at exit
|
print() # new line at exit
|
||||||
|
@ -71,8 +72,7 @@ class BlackList:
|
||||||
with open(self.blackfile, "a") as black_conf:
|
with open(self.blackfile, "a") as black_conf:
|
||||||
for pkg in pkgs:
|
for pkg in pkgs:
|
||||||
if pkg not in blacklist:
|
if pkg not in blacklist:
|
||||||
print("{0}{1}{2}".format(self.meta.color["GREEN"], pkg,
|
print(f"{self.green}{pkg}{self.endc}")
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
black_conf.write(pkg + "\n")
|
black_conf.write(pkg + "\n")
|
||||||
self.quit = True
|
self.quit = True
|
||||||
black_conf.close()
|
black_conf.close()
|
||||||
|
@ -88,8 +88,7 @@ class BlackList:
|
||||||
if line not in pkgs:
|
if line not in pkgs:
|
||||||
remove.write(line + "\n")
|
remove.write(line + "\n")
|
||||||
else:
|
else:
|
||||||
print("{0}{1}{2}".format(self.meta.color["RED"], line,
|
print(f"{self.red}{line}{self.endc}")
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
self.quit = True
|
self.quit = True
|
||||||
remove.close()
|
remove.close()
|
||||||
if self.quit:
|
if self.quit:
|
||||||
|
|
|
@ -34,6 +34,9 @@ class Updates:
|
||||||
def __init__(self, repo):
|
def __init__(self, repo):
|
||||||
self.repo = repo
|
self.repo = repo
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
self.green = _meta_.color["GREEN"]
|
||||||
|
self.grey = _meta_.color["GREY"]
|
||||||
|
self.endc = _meta_.color["ENDC"]
|
||||||
self.msg = Msg()
|
self.msg = Msg()
|
||||||
self.check = 2
|
self.check = 2
|
||||||
self.st = ""
|
self.st = ""
|
||||||
|
@ -111,15 +114,14 @@ class Updates:
|
||||||
self.count_repo += 1
|
self.count_repo += 1
|
||||||
if self.check == 1:
|
if self.check == 1:
|
||||||
self.count_news += 1
|
self.count_news += 1
|
||||||
self.st = "{0}News in ChangeLog.txt{1}".format(
|
self.st = f"{self.green}News in ChangeLog.txt{self.endc}"
|
||||||
self.meta.color["GREEN"], self.meta.color["ENDC"])
|
|
||||||
elif self.check == 0:
|
elif self.check == 0:
|
||||||
self.st = "No changes in ChangeLog.txt"
|
self.st = "No changes in ChangeLog.txt"
|
||||||
|
|
||||||
def print_status(self, repo):
|
def print_status(self, repo):
|
||||||
"""Print status
|
"""Print status
|
||||||
"""
|
"""
|
||||||
print(" {0}{1}{2}".format(repo, " " * (19 - len(repo)), self.st))
|
print(f" {repo}{' ' * (19 - len(repo))}{self.st}")
|
||||||
|
|
||||||
def summary(self):
|
def summary(self):
|
||||||
"""Print summary
|
"""Print summary
|
||||||
|
@ -131,6 +133,4 @@ class Updates:
|
||||||
cmd = "Repository is updated."
|
cmd = "Repository is updated."
|
||||||
if self.count_news > 0:
|
if self.count_news > 0:
|
||||||
cmd = "Run the command 'slpkg update'."
|
cmd = "Run the command 'slpkg update'."
|
||||||
print("{0}From {1} repositories need {2} updating. {3}{4}\n".format(
|
print(f"{self.grey}From {self.count_repo} repositories need {self.count_news} updating. {cmd}{self.endc}", end="\n")
|
||||||
self.meta.color["GREY"], self.count_repo, self.count_news, cmd,
|
|
||||||
self.meta.color["ENDC"]))
|
|
|
@ -36,6 +36,10 @@ class Config:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.config_file = "/etc/slpkg/slpkg.conf"
|
self.config_file = "/etc/slpkg/slpkg.conf"
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
self.green = _meta_.color["GREEN"]
|
||||||
|
self.red = _meta_.color["RED"]
|
||||||
|
self.cyan = _meta_.color["CYAN"]
|
||||||
|
self.endc = _meta_.color["ENDC"]
|
||||||
|
|
||||||
def view(self):
|
def view(self):
|
||||||
"""View slpkg config file
|
"""View slpkg config file
|
||||||
|
@ -70,25 +74,20 @@ class Config:
|
||||||
read_conf = Utils().read_file(self.config_file)
|
read_conf = Utils().read_file(self.config_file)
|
||||||
for line in read_conf.splitlines():
|
for line in read_conf.splitlines():
|
||||||
if not line.startswith("#") and line.split("=")[0] in conf_args:
|
if not line.startswith("#") and line.split("=")[0] in conf_args:
|
||||||
print("{0}".format(line))
|
print(line)
|
||||||
else:
|
else:
|
||||||
print("{0}{1}{2}".format(self.meta.color["CYAN"], line,
|
print(f"{self.cyan}{line}{self.endc}", end="\n")
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
print() # new line at end
|
|
||||||
|
|
||||||
def edit(self):
|
def edit(self):
|
||||||
"""Edit configuration file
|
"""Edit configuration file
|
||||||
"""
|
"""
|
||||||
subprocess.call("{0} {1}".format(self.meta.editor,
|
subprocess.call(f"{self.meta.editor} {self.config_file}", shell=True)
|
||||||
self.config_file), shell=True)
|
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
"""Reset slpkg.conf file with default values
|
"""Reset slpkg.conf file with default values
|
||||||
"""
|
"""
|
||||||
shutil.copy2(self.config_file + ".orig", self.config_file)
|
shutil.copy2(self.config_file + ".orig", self.config_file)
|
||||||
if filecmp.cmp(self.config_file + ".orig", self.config_file):
|
if filecmp.cmp(self.config_file + ".orig", self.config_file):
|
||||||
print("{0}The reset was done{1}".format(
|
print(f"{self.green}The reset was done{self.endc}")
|
||||||
self.meta.color["GREEN"], self.meta.color["ENDC"]))
|
|
||||||
else:
|
else:
|
||||||
print("{0}Reset failed{1}".format(self.meta.color["RED"],
|
print(f"{self.red}Reset failed{self.endc}")
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
|
|
|
@ -38,20 +38,17 @@ class PkgDesc:
|
||||||
self.paint = paint
|
self.paint = paint
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
self.msg = Msg()
|
self.msg = Msg()
|
||||||
self.COLOR = ""
|
|
||||||
self.lib = ""
|
self.lib = ""
|
||||||
color_text = {
|
self.color = {
|
||||||
"red": self.meta.color["RED"],
|
"red": self.meta.color["RED"],
|
||||||
"green": self.meta.color["GREEN"],
|
"green": self.meta.color["GREEN"],
|
||||||
"yellow": self.meta.color["YELLOW"],
|
"yellow": self.meta.color["YELLOW"],
|
||||||
"cyan": self.meta.color["CYAN"],
|
"cyan": self.meta.color["CYAN"],
|
||||||
"grey": self.meta.color["GREY"],
|
"grey": self.meta.color["GREY"],
|
||||||
"": ""
|
"": ""
|
||||||
}
|
}[self.paint]
|
||||||
self.COLOR = color_text[self.paint]
|
|
||||||
if self.repo in self.meta.repositories and self.repo != "sbo":
|
if self.repo in self.meta.repositories and self.repo != "sbo":
|
||||||
self.lib = self.meta.lib_path + "{0}_repo/PACKAGES.TXT".format(
|
self.lib = f"{self.meta.lib_path}{self.repo}_repo/PACKAGES.TXT"
|
||||||
self.repo)
|
|
||||||
|
|
||||||
def view(self):
|
def view(self):
|
||||||
"""Print package description by repository
|
"""Print package description by repository
|
||||||
|
@ -69,8 +66,7 @@ class PkgDesc:
|
||||||
if count == 11:
|
if count == 11:
|
||||||
break
|
break
|
||||||
if description:
|
if description:
|
||||||
print("{0}{1}{2}".format(self.COLOR, description,
|
print(f"{self.color}{description}{self.meta.color['ENDC']}")
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
else:
|
else:
|
||||||
self.msg.pkg_not_found("", self.name, "No matching", "\n")
|
self.msg.pkg_not_found("", self.name, "No matching", "\n")
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|
|
@ -42,6 +42,9 @@ class Download:
|
||||||
self.repo = repo
|
self.repo = repo
|
||||||
self.file_name = ""
|
self.file_name = ""
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
self.green = _meta_.color["GREEN"]
|
||||||
|
self.red = _meta_.color["RED"]
|
||||||
|
self.endc = _meta_.color["ENDC"]
|
||||||
self.msg = Msg()
|
self.msg = Msg()
|
||||||
self.dir_prefix = ""
|
self.dir_prefix = ""
|
||||||
self.downder = self.meta.downder
|
self.downder = self.meta.downder
|
||||||
|
@ -61,24 +64,13 @@ class Download:
|
||||||
self._make_tarfile(self.file_name, source_dir)
|
self._make_tarfile(self.file_name, source_dir)
|
||||||
|
|
||||||
self._check_certificate()
|
self._check_certificate()
|
||||||
print("\n[{0}/{1}][ {2}Download{3} ] --> {4}\n".format(
|
print(f"\n[{dwn_count}/{len(self.url)}][ {self.green}Download{self.endc} ] --> {self.file_name}\n")
|
||||||
dwn_count, len(self.url), self.meta.color["GREEN"],
|
|
||||||
self.meta.color["ENDC"],
|
|
||||||
self.file_name))
|
|
||||||
if self.downder in ["wget"]:
|
if self.downder in ["wget"]:
|
||||||
subprocess.call("{0} {1} {2}{3} {4}".format(
|
subprocess.call(f"{self.downder} {self.downder_options} {self.dir_prefix}{self.path} {dwn}", shell=True)
|
||||||
self.downder, self.downder_options,
|
|
||||||
self.dir_prefix, self.path, dwn),
|
|
||||||
shell=True)
|
|
||||||
if self.downder in ["aria2c"]:
|
if self.downder in ["aria2c"]:
|
||||||
subprocess.call("{0} {1} {2}{3} {4}".format(
|
subprocess.call(f"{self.downder} {self.downder_options} {self.dir_prefix}{self.path[:-1]} {dwn}", shell=True)
|
||||||
self.downder, self.downder_options,
|
|
||||||
self.dir_prefix, self.path[:-1], dwn),
|
|
||||||
shell=True)
|
|
||||||
elif self.downder in ["curl", "http"]:
|
elif self.downder in ["curl", "http"]:
|
||||||
subprocess.call("{0} {1} {2}{3} {4}".format(
|
subprocess.call(f"{self.downder} {self.downder_options} {self.path}{self.file_name} {dwn}", shell=True)
|
||||||
self.downder, self.downder_options,
|
|
||||||
self.path, self.file_name, dwn), shell=True)
|
|
||||||
self._check_if_downloaded()
|
self._check_if_downloaded()
|
||||||
dwn_count += 1
|
dwn_count += 1
|
||||||
|
|
||||||
|
@ -102,9 +94,7 @@ class Download:
|
||||||
if not os.path.isfile(self.path + self.file_name):
|
if not os.path.isfile(self.path + self.file_name):
|
||||||
print()
|
print()
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| Download '{0}' file [ {1}FAILED{2} ]".format(
|
print(f"| Download '{self.file_name}' file [ {self.red}FAILED{self.endc} ]")
|
||||||
self.file_name, self.meta.color["RED"],
|
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print()
|
print()
|
||||||
if not self.msg.answer() in ["y", "Y"]:
|
if not self.msg.answer() in ["y", "Y"]:
|
||||||
|
@ -118,10 +108,9 @@ class Download:
|
||||||
certificate = (' --no-check-certificate --header="Cookie: '
|
certificate = (' --no-check-certificate --header="Cookie: '
|
||||||
'oraclelicense=accept-securebackup-cookie"')
|
'oraclelicense=accept-securebackup-cookie"')
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| '{0}' need to go ahead downloading".format(
|
print(f"| '{certificate[:23].strip()}' need to go ahead downloading")
|
||||||
certificate[:23].strip()))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print()
|
print()
|
||||||
self.downder_options += certificate
|
self.downder_options += certificate
|
||||||
if not self.msg.answer() in ["y", "Y"]:
|
if not self.msg.answer() in ["y", "Y"]:
|
||||||
raise SystemExit()
|
raise SystemExit()
|
|
@ -26,6 +26,12 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
# class ImportErrorGraphEasy(Exception):
|
||||||
|
# def __init__(self, GraphEasyImportError):
|
||||||
|
# Exception.__init__(self, "graph-easy required")
|
||||||
|
# self.GraphEasyImportError = GraphEasyImportError
|
||||||
|
|
||||||
|
|
||||||
class Graph:
|
class Graph:
|
||||||
"""Drawing dependencies diagram
|
"""Drawing dependencies diagram
|
||||||
"""
|
"""
|
||||||
|
@ -46,13 +52,10 @@ class Graph:
|
||||||
try:
|
try:
|
||||||
import pygraphviz as pgv
|
import pygraphviz as pgv
|
||||||
except ImportError:
|
except ImportError:
|
||||||
graph_easy, comma = "", ""
|
if self.image == "ascii" and not os.path.isfile("/usr/bin/graph-easy"):
|
||||||
if (self.image == "ascii" and
|
print("Require 'grap_easy': Install with 'slpkg -s sbo graph-easy'")
|
||||||
not os.path.isfile("/usr/bin/graph-easy")):
|
else:
|
||||||
comma = ","
|
print("Require 'pygraphviz: Install with 'slpkg -s sbo pygraphviz'")
|
||||||
graph_easy = " graph-easy"
|
|
||||||
print("Require 'pygraphviz{0}{1}': Install with 'slpkg -s sbo "
|
|
||||||
"pygraphviz{1}'".format(comma, graph_easy))
|
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
if self.image != "ascii":
|
if self.image != "ascii":
|
||||||
self.check_file()
|
self.check_file()
|
||||||
|
@ -60,24 +63,23 @@ class Graph:
|
||||||
G = pgv.AGraph(deps_dict)
|
G = pgv.AGraph(deps_dict)
|
||||||
G.layout(prog="fdp")
|
G.layout(prog="fdp")
|
||||||
if self.image == "ascii":
|
if self.image == "ascii":
|
||||||
G.write("{0}.dot".format(self.image))
|
G.write(f"{self.image}.dot")
|
||||||
self.graph_easy()
|
self.graph_easy()
|
||||||
G.draw(self.image)
|
G.draw(self.image)
|
||||||
except IOError:
|
except IOError:
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
if os.path.isfile(self.image):
|
if os.path.isfile(self.image):
|
||||||
print("Graph image file '{0}' created".format(self.image))
|
print(f"Graph image file '{self.image}' created")
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
|
|
||||||
def check_file(self):
|
def check_file(self):
|
||||||
"""Check for file format and type
|
"""Check for file format and type
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
image_type = ".{0}".format(self.image.split(".")[1])
|
image_type = f".{self.image.split('.')[1]}"
|
||||||
if image_type not in self.file_format:
|
if image_type not in self.file_format:
|
||||||
print("Format: '{0}' not recognized. Use one of "
|
print(f"Format: '{self.image.split('.')[1]}' not recognized. Use one of "
|
||||||
"them:\n{1}".format(self.image.split(".")[1],
|
f"them:\n{', '.join(self.file_format)}")
|
||||||
", ".join(self.file_format)))
|
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
except IndexError:
|
except IndexError:
|
||||||
print("slpkg: Error: Image file suffix missing")
|
print("slpkg: Error: Image file suffix missing")
|
||||||
|
@ -91,12 +93,12 @@ class Graph:
|
||||||
"graph-easy'")
|
"graph-easy'")
|
||||||
self.remove_dot()
|
self.remove_dot()
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
subprocess.call("graph-easy {0}.dot".format(self.image), shell=True)
|
subprocess.call(f"graph-easy {self.image}.dot", shell=True)
|
||||||
self.remove_dot()
|
self.remove_dot()
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
|
|
||||||
def remove_dot(self):
|
def remove_dot(self):
|
||||||
"""Remove .dot files
|
"""Remove .dot files
|
||||||
"""
|
"""
|
||||||
if os.path.isfile("{0}.dot".format(self.image)):
|
if os.path.isfile(f"{self.image}.dot"):
|
||||||
os.remove("{0}.dot".format(self.image))
|
os.remove(f"{self.image}.dot")
|
|
@ -39,11 +39,11 @@ def pkg_checksum(binary, repo):
|
||||||
elif repo == "slpkg":
|
elif repo == "slpkg":
|
||||||
CHECKSUMS_md5 = URL(_meta_.CHECKSUMS_link).reading()
|
CHECKSUMS_md5 = URL(_meta_.CHECKSUMS_link).reading()
|
||||||
else:
|
else:
|
||||||
lib = "{0}{1}_repo/CHECKSUMS.md5".format(_meta_.lib_path, repo)
|
lib = f"{_meta_.lib_path}{repo}_repo/CHECKSUMS.md5"
|
||||||
f = open(lib, "r")
|
f = open(lib, "r")
|
||||||
CHECKSUMS_md5 = f.read()
|
CHECKSUMS_md5 = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
for line in CHECKSUMS_md5.splitlines():
|
for line in CHECKSUMS_md5.splitlines():
|
||||||
if line.endswith("/{0}".format(binary)):
|
if line.endswith(f"/{binary}"):
|
||||||
md5 = line.split()[0]
|
md5 = line.split()[0]
|
||||||
return md5
|
return md5
|
||||||
|
|
|
@ -36,6 +36,10 @@ class PackageHealth:
|
||||||
def __init__(self, mode):
|
def __init__(self, mode):
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
self.green = _meta_.color["GREEN"]
|
||||||
|
self.red = _meta_.color["RED"]
|
||||||
|
self.yellow = _meta_.color["YELLOW"]
|
||||||
|
self.endc = _meta_.color["ENDC"]
|
||||||
self.msg = Msg()
|
self.msg = Msg()
|
||||||
self.pkg_path = _meta_.pkg_path
|
self.pkg_path = _meta_.pkg_path
|
||||||
self.installed = []
|
self.installed = []
|
||||||
|
@ -56,9 +60,7 @@ class PackageHealth:
|
||||||
"/incoming/" not in line):
|
"/incoming/" not in line):
|
||||||
if not os.path.isfile(r"/" + line):
|
if not os.path.isfile(r"/" + line):
|
||||||
self.cn += 1
|
self.cn += 1
|
||||||
print("Not installed: {0}/{1}{2} --> {3}".format(
|
print(f"Not installed: {self.red}/{line}{self.endc} --> {pkg}")
|
||||||
self.meta.color["RED"], line, self.meta.color["ENDC"],
|
|
||||||
pkg))
|
|
||||||
elif not self.mode:
|
elif not self.mode:
|
||||||
print(line)
|
print(line)
|
||||||
except IOError:
|
except IOError:
|
||||||
|
@ -76,7 +78,7 @@ class PackageHealth:
|
||||||
with open(self.pkg_path + pkg, "r") as fopen:
|
with open(self.pkg_path + pkg, "r") as fopen:
|
||||||
for line in fopen:
|
for line in fopen:
|
||||||
if "\0" in line:
|
if "\0" in line:
|
||||||
print("Null: {0}").format(line)
|
print(f"Null: {line}")
|
||||||
break
|
break
|
||||||
self.cf += 1 # count all files
|
self.cf += 1 # count all files
|
||||||
self.lf += 1 # count each package files
|
self.lf += 1 # count each package files
|
||||||
|
@ -90,18 +92,14 @@ class PackageHealth:
|
||||||
print()
|
print()
|
||||||
per = int(round((float(self.cf) / (self.cf + self.cn)) * 100))
|
per = int(round((float(self.cf) / (self.cf + self.cn)) * 100))
|
||||||
if per > 90:
|
if per > 90:
|
||||||
color = self.meta.color["GREEN"]
|
color = self.green
|
||||||
elif per < 90 and per > 60:
|
elif per < 90 and per > 60:
|
||||||
color = self.meta.color["YELLOW"]
|
color = self.yellow
|
||||||
elif per < 60:
|
elif per < 60:
|
||||||
color = self.meta.color["RED"]
|
color = self.red
|
||||||
health = "{0}{1}%{2}".format(color, str(per), self.meta.color["ENDC"])
|
health = f"{color}{str(per)}%{self.endc}"
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| {0}{1}{2}{3}{4}".format(
|
print(f"| Total files{' ' * 7}Not installed{' ' * 40}Health")
|
||||||
"Total files", " " * 7, "Not installed", " " * 40, "Health"))
|
|
||||||
self.msg.template(78)
|
|
||||||
print("| {0}{1}{2}{3}{4:>4}".format(
|
|
||||||
self.cf, " " * (18-len(str(self.cf))),
|
|
||||||
self.cn, " " * (55-len(str(self.cn))),
|
|
||||||
health))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
|
print(f"| {self.cf}{' ' * (18-len(str(self.cf)))}{self.cn}{' ' * (55-len(str(self.cn)))}{health:>4}")
|
||||||
|
self.msg.template(78)
|
162
slpkg/init.py
162
slpkg/init.py
|
@ -73,7 +73,7 @@ class Initialization:
|
||||||
"""
|
"""
|
||||||
repo = Repo().custom_repository()[name]
|
repo = Repo().custom_repository()[name]
|
||||||
log = self.log_path + name + "/"
|
log = self.log_path + name + "/"
|
||||||
lib = self.lib_path + "{0}_repo/".format(name)
|
lib = self.lib_path + f"{name}_repo/"
|
||||||
repo_name = log[:-1].split("/")[-1]
|
repo_name = log[:-1].split("/")[-1]
|
||||||
lib_file = "PACKAGES.TXT"
|
lib_file = "PACKAGES.TXT"
|
||||||
# lst_file = ""
|
# lst_file = ""
|
||||||
|
@ -83,10 +83,10 @@ class Initialization:
|
||||||
os.mkdir(log)
|
os.mkdir(log)
|
||||||
if not os.path.exists(lib):
|
if not os.path.exists(lib):
|
||||||
os.mkdir(lib)
|
os.mkdir(lib)
|
||||||
PACKAGES_TXT = "{0}{1}".format(repo, lib_file)
|
PACKAGES_TXT = f"{name}{lib_file}"
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = "{0}{1}".format(repo, md5_file)
|
CHECKSUMS_MD5 = f"{repo}{md5_file}"
|
||||||
ChangeLog_txt = "{0}{1}".format(repo, log_file)
|
ChangeLog_txt = f"{repo}{log_file}"
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, PACKAGES_TXT, repo_name)
|
self.down(lib, PACKAGES_TXT, repo_name)
|
||||||
|
@ -161,10 +161,10 @@ class Initialization:
|
||||||
os.mkdir(log)
|
os.mkdir(log)
|
||||||
if not os.path.exists(lib):
|
if not os.path.exists(lib):
|
||||||
os.mkdir(lib)
|
os.mkdir(lib)
|
||||||
SLACKBUILDS_TXT = "{0}{1}/{2}".format(repo, slack_ver(), lib_file)
|
SLACKBUILDS_TXT = f"{repo}{slack_ver()}/{lib_file}"
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = ""
|
CHECKSUMS_MD5 = ""
|
||||||
ChangeLog_txt = "{0}{1}/{2}".format(repo, slack_ver(), log_file)
|
ChangeLog_txt = f"{repo}{slack_ver()}/{log_file}"
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, SLACKBUILDS_TXT, repo_name)
|
self.down(lib, SLACKBUILDS_TXT, repo_name)
|
||||||
|
@ -187,10 +187,10 @@ class Initialization:
|
||||||
os.mkdir(log)
|
os.mkdir(log)
|
||||||
if not os.path.exists(lib):
|
if not os.path.exists(lib):
|
||||||
os.mkdir(lib)
|
os.mkdir(lib)
|
||||||
PACKAGES_TXT = "{0}{1}/{2}".format(repo, slack_ver(), lib_file)
|
PACKAGES_TXT = f"{repo}{slack_ver()}/{lib_file}"
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = "{0}{1}/{2}".format(repo, slack_ver(), md5_file)
|
CHECKSUMS_MD5 = f"{repo}{slack_ver()}/{md5_file}"
|
||||||
ChangeLog_txt = "{0}{1}/{2}".format(repo, slack_ver(), log_file)
|
ChangeLog_txt = f"{repo}{slack_ver()}/{log_file}"
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, PACKAGES_TXT, repo_name)
|
self.down(lib, PACKAGES_TXT, repo_name)
|
||||||
|
@ -221,10 +221,10 @@ class Initialization:
|
||||||
ar = arch
|
ar = arch
|
||||||
if self.meta.slack_rel == "current":
|
if self.meta.slack_rel == "current":
|
||||||
ver = self.meta.slack_rel
|
ver = self.meta.slack_rel
|
||||||
PACKAGES_TXT = "{0}/{1}/{2}/{3}".format(repo, ver, ar, lib_file)
|
PACKAGES_TXT = f"{repo}/{ver}/{ar}/{lib_file}"
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = "{0}/{1}/{2}/{3}".format(repo, ver, ar, md5_file)
|
CHECKSUMS_MD5 = f"{repo}/{ver}/{ar}/{md5_file}"
|
||||||
ChangeLog_txt = "{0}{1}".format(repo, log_file)
|
ChangeLog_txt = f"{repo}{log_file}"
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, PACKAGES_TXT, repo_name)
|
self.down(lib, PACKAGES_TXT, repo_name)
|
||||||
|
@ -252,14 +252,11 @@ class Initialization:
|
||||||
os.mkdir(lib)
|
os.mkdir(lib)
|
||||||
if arch == "x86_64":
|
if arch == "x86_64":
|
||||||
ar = "64"
|
ar = "64"
|
||||||
PACKAGES_TXT = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
|
PACKAGES_TXT = f"{repo}slackware{ar}-{slack_ver()}/{lib_file}"
|
||||||
lib_file)
|
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
|
CHECKSUMS_MD5 = f"{repo}slackware{ar}-{slack_ver()}/{md5_file}"
|
||||||
md5_file)
|
|
||||||
|
|
||||||
ChangeLog_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
|
ChangeLog_txt = f"{repo}slackware{ar}-{slack_ver()}/{log_file}"
|
||||||
log_file)
|
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, PACKAGES_TXT, repo_name)
|
self.down(lib, PACKAGES_TXT, repo_name)
|
||||||
|
@ -283,10 +280,10 @@ class Initialization:
|
||||||
os.mkdir(log)
|
os.mkdir(log)
|
||||||
if not os.path.exists(lib):
|
if not os.path.exists(lib):
|
||||||
os.mkdir(lib)
|
os.mkdir(lib)
|
||||||
PACKAGES_TXT = "{0}{1}".format(repo, lib_file)
|
PACKAGES_TXT = f"{repo}{lib_file}"
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = "{0}{1}".format(repo, md5_file)
|
CHECKSUMS_MD5 = f"{repo}{md5_file}"
|
||||||
ChangeLog_txt = "{0}{1}".format(repo, log_file)
|
ChangeLog_txt = f"{repo}{log_file}"
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, PACKAGES_TXT, repo_name)
|
self.down(lib, PACKAGES_TXT, repo_name)
|
||||||
|
@ -299,7 +296,7 @@ class Initialization:
|
||||||
"""Creating slackers local library
|
"""Creating slackers local library
|
||||||
"""
|
"""
|
||||||
ver = slack_ver()
|
ver = slack_ver()
|
||||||
ar = "{0}-x86".format(ver)
|
ar = f"{ver}-x86"
|
||||||
arch = self.meta.arch
|
arch = self.meta.arch
|
||||||
repo = self.def_repos_dict["slonly"]
|
repo = self.def_repos_dict["slonly"]
|
||||||
log = self.log_path + "slonly/"
|
log = self.log_path + "slonly/"
|
||||||
|
@ -314,15 +311,15 @@ class Initialization:
|
||||||
if not os.path.exists(lib):
|
if not os.path.exists(lib):
|
||||||
os.mkdir(lib)
|
os.mkdir(lib)
|
||||||
if arch == "x86_64":
|
if arch == "x86_64":
|
||||||
ar = "{0}-x86_64".format(ver)
|
ar = f"{ver}-x86_64"
|
||||||
if self.meta.slack_rel == "current":
|
if self.meta.slack_rel == "current":
|
||||||
ar = "{0}-x86".format(self.meta.slack_rel)
|
ar = f"{self.meta.slack_rel}-x86"
|
||||||
if self.meta.slack_rel == "current" and arch == "x86_64":
|
if self.meta.slack_rel == "current" and arch == "x86_64":
|
||||||
ar = "{0}-x86_64".format(self.meta.slack_rel)
|
ar = f"{self.meta.slack_rel}-x86_64"
|
||||||
PACKAGES_TXT = "{0}{1}/{2}".format(repo, ar, lib_file)
|
PACKAGES_TXT = f"{repo}{ar}/{lib_file}"
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = "{0}{1}/{2}".format(repo, ar, md5_file)
|
CHECKSUMS_MD5 = f"{repo}{ar}/{md5_file}"
|
||||||
ChangeLog_txt = "{0}{1}/{2}".format(repo, ar, log_file)
|
ChangeLog_txt = f"{repo}{ar}/{log_file}"
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, PACKAGES_TXT, repo_name)
|
self.down(lib, PACKAGES_TXT, repo_name)
|
||||||
|
@ -346,10 +343,10 @@ class Initialization:
|
||||||
os.mkdir(log)
|
os.mkdir(log)
|
||||||
if not os.path.exists(lib):
|
if not os.path.exists(lib):
|
||||||
os.mkdir(lib)
|
os.mkdir(lib)
|
||||||
PACKAGES_TXT = "{0}{1}".format(repo, lib_file)
|
PACKAGES_TXT = f"{repo}{lib_file}"
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = "{0}{1}".format(repo, md5_file)
|
CHECKSUMS_MD5 = f"{repo}{md5_file}"
|
||||||
ChangeLog_txt = "{0}{1}".format(repo, log_file)
|
ChangeLog_txt = f"{repo}{log_file}"
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, PACKAGES_TXT, repo_name)
|
self.down(lib, PACKAGES_TXT, repo_name)
|
||||||
|
@ -376,10 +373,10 @@ class Initialization:
|
||||||
os.mkdir(lib)
|
os.mkdir(lib)
|
||||||
if self.meta.slack_rel == "current":
|
if self.meta.slack_rel == "current":
|
||||||
ver = self.meta.slack_rel
|
ver = self.meta.slack_rel
|
||||||
PACKAGES_TXT = "{0}{1}/{2}".format(repo, ver, lib_file)
|
PACKAGES_TXT = f"{repo}{ver}/{lib_file}"
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = "{0}{1}/{2}".format(repo, ver, md5_file)
|
CHECKSUMS_MD5 = f"{repo}{ver}/{md5_file}"
|
||||||
ChangeLog_txt = "{0}{1}".format(repo, log_file)
|
ChangeLog_txt = f"{repo}{log_file}"
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, PACKAGES_TXT, repo_name)
|
self.down(lib, PACKAGES_TXT, repo_name)
|
||||||
|
@ -408,13 +405,10 @@ class Initialization:
|
||||||
if arch == "x86_64":
|
if arch == "x86_64":
|
||||||
ar = "64"
|
ar = "64"
|
||||||
version = self.meta.slacke_sub_repo[1:-1]
|
version = self.meta.slacke_sub_repo[1:-1]
|
||||||
PACKAGES_TXT = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
|
PACKAGES_TXT = f"{repo}slacke{version}/slackware{ar}-{slack_ver()}/{lib_file}"
|
||||||
repo, version, ar, slack_ver(), lib_file)
|
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
|
CHECKSUMS_MD5 = f"{repo}slacke{version}/slackware{ar}-{slack_ver()}/{md5_file}"
|
||||||
repo, version, ar, slack_ver(), md5_file)
|
ChangeLog_txt = f"{repo}slacke{version}/slackware{ar}-{slack_ver()}/{log_file}"
|
||||||
ChangeLog_txt = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
|
|
||||||
repo, version, ar, slack_ver(), log_file)
|
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, PACKAGES_TXT, repo_name)
|
self.down(lib, PACKAGES_TXT, repo_name)
|
||||||
|
@ -442,10 +436,10 @@ class Initialization:
|
||||||
os.mkdir(lib)
|
os.mkdir(lib)
|
||||||
if arch == "x86_64":
|
if arch == "x86_64":
|
||||||
ar = "x86_64"
|
ar = "x86_64"
|
||||||
PACKAGES_TXT = "{0}{1}/{2}/{3}".format(repo, ar, slack_ver(), lib_file)
|
PACKAGES_TXT = f"{repo}{ar}/{slack_ver()}/{lib_file}"
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = "{0}{1}/{2}/{3}".format(repo, ar, slack_ver(), md5_file)
|
CHECKSUMS_MD5 = f"{repo}{ar}/{slack_ver()}/{md5_file}"
|
||||||
ChangeLog_txt = "{0}{1}/{2}/{3}".format(repo, ar, slack_ver(), log_file)
|
ChangeLog_txt = f"{repo}{ar}/{slack_ver()}/{log_file}"
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, PACKAGES_TXT, repo_name)
|
self.down(lib, PACKAGES_TXT, repo_name)
|
||||||
|
@ -473,10 +467,10 @@ class Initialization:
|
||||||
os.mkdir(lib)
|
os.mkdir(lib)
|
||||||
if arch == "x86_64":
|
if arch == "x86_64":
|
||||||
ar = "x86_64"
|
ar = "x86_64"
|
||||||
PACKAGES_TXT = "{0}{1}/current/{2}".format(repo, ar, lib_file)
|
PACKAGES_TXT = f"{repo}{ar}/current/{lib_file}"
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = "{0}{1}/current/{2}".format(repo, ar, md5_file)
|
CHECKSUMS_MD5 = f"{repo}{ar}/current/{md5_file}"
|
||||||
ChangeLog_txt = "{0}{1}/current/{2}".format(repo, ar, log_file)
|
ChangeLog_txt = f"{repo}{ar}/current/{log_file}"
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, PACKAGES_TXT, repo_name)
|
self.down(lib, PACKAGES_TXT, repo_name)
|
||||||
|
@ -500,10 +494,10 @@ class Initialization:
|
||||||
os.mkdir(log)
|
os.mkdir(log)
|
||||||
if not os.path.exists(lib):
|
if not os.path.exists(lib):
|
||||||
os.mkdir(lib)
|
os.mkdir(lib)
|
||||||
PACKAGES_TXT = "{0}{1}".format(repo, lib_file)
|
PACKAGES_TXT = f"{repo}{lib_file}"
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = "{0}{1}".format(repo, md5_file)
|
CHECKSUMS_MD5 = f"{repo}{md5_file}"
|
||||||
ChangeLog_txt = "{0}{1}".format(repo, log_file)
|
ChangeLog_txt = f"{repo}{log_file}"
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, PACKAGES_TXT, repo_name)
|
self.down(lib, PACKAGES_TXT, repo_name)
|
||||||
|
@ -535,12 +529,10 @@ class Initialization:
|
||||||
version = self.meta.msb_sub_repo[1:-1]
|
version = self.meta.msb_sub_repo[1:-1]
|
||||||
if self.meta.slack_rel == "current":
|
if self.meta.slack_rel == "current":
|
||||||
ver_slack = self.meta.slack_rel
|
ver_slack = self.meta.slack_rel
|
||||||
PACKAGES_TXT = "{0}{1}/{2}/{3}/{4}".format(
|
PACKAGES_TXT = f"{repo}{ver_slack}/{version}/{ar}/{md5_file}"
|
||||||
repo, ver_slack, version, ar, lib_file)
|
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = "{0}{1}/{2}/{3}/{4}".format(
|
CHECKSUMS_MD5 = f"{repo}{ver_slack}/{version}/{ar}/{md5_file}"
|
||||||
repo, ver_slack, version, ar, md5_file)
|
ChangeLog_txt = f"{repo}{log_file}"
|
||||||
ChangeLog_txt = "{0}{1}".format(repo, log_file)
|
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, PACKAGES_TXT, repo_name)
|
self.down(lib, PACKAGES_TXT, repo_name)
|
||||||
|
@ -571,12 +563,10 @@ class Initialization:
|
||||||
ar = "x86_64"
|
ar = "x86_64"
|
||||||
if self.meta.slack_rel == "current":
|
if self.meta.slack_rel == "current":
|
||||||
ver_slack = self.meta.slack_rel
|
ver_slack = self.meta.slack_rel
|
||||||
PACKAGES_TXT = "{0}{1}/{2}/{3}".format(
|
PACKAGES_TXT = f"{repo}{ver_slack}/{ar}/{lib_file}"
|
||||||
repo, ver_slack, ar, lib_file)
|
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = "{0}{1}/{2}/{3}".format(
|
CHECKSUMS_MD5 = f"{repo}{ver_slack}/{ar}/{md5_file}"
|
||||||
repo, ver_slack, ar, md5_file)
|
ChangeLog_txt = f"{repo}{log_file}"
|
||||||
ChangeLog_txt = "{0}{1}".format(repo, log_file)
|
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, PACKAGES_TXT, repo_name)
|
self.down(lib, PACKAGES_TXT, repo_name)
|
||||||
|
@ -605,14 +595,10 @@ class Initialization:
|
||||||
os.mkdir(lib)
|
os.mkdir(lib)
|
||||||
if arch == "x86_64":
|
if arch == "x86_64":
|
||||||
ar = "64"
|
ar = "64"
|
||||||
PACKAGES_TXT = "{0}{1}{2}-{3}/{4}".format(repo, nickname, ar,
|
PACKAGES_TXT = f"{repo}{nickname}{ar}-{slack_ver()}/{lib_file}"
|
||||||
slack_ver(), lib_file)
|
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = "{0}{1}{2}-{3}/{4}".format(repo, nickname, ar,
|
CHECKSUMS_MD5 = f"{repo}{nickname}{ar}-{slack_ver()}/{md5_file}"
|
||||||
slack_ver(), md5_file)
|
ChangeLog_txt = f"{repo}{nickname}{ar}-{slack_ver()}/{log_file}"
|
||||||
|
|
||||||
ChangeLog_txt = "{0}{1}{2}-{3}/{4}".format(repo, nickname, ar,
|
|
||||||
slack_ver(), log_file)
|
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, PACKAGES_TXT, repo_name)
|
self.down(lib, PACKAGES_TXT, repo_name)
|
||||||
|
@ -641,13 +627,10 @@ class Initialization:
|
||||||
if arch == "x86_64":
|
if arch == "x86_64":
|
||||||
ar = "64"
|
ar = "64"
|
||||||
version = self.meta.mles_sub_repo[1:-1]
|
version = self.meta.mles_sub_repo[1:-1]
|
||||||
PACKAGES_TXT = "{0}{1}-{2}-{3}bit/{4}".format(
|
PACKAGES_TXT = f"{repo}{version}-{slack_ver()}-{ar}bit/{lib_file}"
|
||||||
repo, version, slack_ver(), ar, lib_file)
|
|
||||||
FILELIST_TXT = ""
|
FILELIST_TXT = ""
|
||||||
CHECKSUMS_MD5 = "{0}{1}-{2}-{3}bit/{4}".format(
|
CHECKSUMS_MD5 = f"{repo}{version}-{slack_ver()}-{ar}bit/{md5_file}"
|
||||||
repo, version, slack_ver(), ar, md5_file)
|
ChangeLog_txt = f"{repo}{version}-{slack_ver()}-{ar}bit/{log_file}"
|
||||||
ChangeLog_txt = "{0}{1}-{2}-{3}bit/{4}".format(
|
|
||||||
repo, version, slack_ver(), ar, log_file)
|
|
||||||
if self.check:
|
if self.check:
|
||||||
return self.checks_logs(log, ChangeLog_txt)
|
return self.checks_logs(log, ChangeLog_txt)
|
||||||
self.down(lib, PACKAGES_TXT, repo_name)
|
self.down(lib, PACKAGES_TXT, repo_name)
|
||||||
|
@ -705,9 +688,10 @@ class Initialization:
|
||||||
code = "utf-8"
|
code = "utf-8"
|
||||||
with open(path + outfile, 'w', encoding=code) as out_f:
|
with open(path + outfile, 'w', encoding=code) as out_f:
|
||||||
for f in infiles:
|
for f in infiles:
|
||||||
if os.path.isfile("{0}{1}".format(path, f)):
|
if os.path.isfile(f"{path}{f}"):
|
||||||
# checking the encoding before read the file
|
# checking the encoding before read the file
|
||||||
code = Utils.check_encoding(path, f)
|
utils = Utils()
|
||||||
|
code = utils.check_encoding(path, f)
|
||||||
with open(path + f, "r", encoding=code) as in_f:
|
with open(path + f, "r", encoding=code) as in_f:
|
||||||
for line in in_f:
|
for line in in_f:
|
||||||
out_f.write(line)
|
out_f.write(line)
|
||||||
|
@ -737,14 +721,12 @@ class Initialization:
|
||||||
if only:
|
if only:
|
||||||
repositories = only
|
repositories = only
|
||||||
for repo in repositories:
|
for repo in repositories:
|
||||||
changelogs = "{0}{1}{2}".format(self.log_path, repo,
|
changelogs = f"{self.log_path}{repo}/ChangeLog.txt"
|
||||||
"/ChangeLog.txt")
|
|
||||||
if os.path.isfile(changelogs):
|
if os.path.isfile(changelogs):
|
||||||
os.remove(changelogs)
|
os.remove(changelogs)
|
||||||
if os.path.isdir(self.lib_path + "{0}_repo/".format(repo)):
|
if os.path.isdir(self.lib_path + f"{repo}_repo/"):
|
||||||
for f in (os.listdir(self.lib_path + "{0}_repo/".format(
|
for f in (os.listdir(self.lib_path + f"{repo}_repo/")):
|
||||||
repo))):
|
files = f"{self.lib_path}{repo}_repo/{f}"
|
||||||
files = "{0}{1}_repo/{2}".format(self.lib_path, repo, f)
|
|
||||||
if os.path.isfile(files):
|
if os.path.isfile(files):
|
||||||
os.remove(files)
|
os.remove(files)
|
||||||
elif os.path.isdir(files):
|
elif os.path.isdir(files):
|
||||||
|
@ -757,10 +739,12 @@ class Update:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.initialization = globals()['Initialization'](False)
|
self.initialization = globals()['Initialization'](False)
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
self.done = "{0}Done{1}\n".format(self.meta.color["GREY"],
|
self.grey = _meta_.color["GREY"]
|
||||||
self.meta.color["ENDC"])
|
self.red = _meta_.color["RED"]
|
||||||
self.error = "{0}Error{1}\n".format(self.meta.color["RED"],
|
self.cyan = _meta_.color["CYAN"]
|
||||||
self.meta.color["ENDC"])
|
self.endc = _meta_.color["ENDC"]
|
||||||
|
self.done = f"{self.grey}Done{self.endc}\n"
|
||||||
|
self.error = f"{self.red}Error{self.endc}\n"
|
||||||
|
|
||||||
def repository(self, only):
|
def repository(self, only):
|
||||||
"""Update repositories lists
|
"""Update repositories lists
|
||||||
|
@ -773,11 +757,7 @@ class Update:
|
||||||
for repo in enabled:
|
for repo in enabled:
|
||||||
if check_for_local_repos(repo) is True:
|
if check_for_local_repos(repo) is True:
|
||||||
continue
|
continue
|
||||||
print("{0}Check repository [{1}{2}{3}] ... "
|
print(f"{self.grey}Check repository [{self.cyan}{repo}{self.grey}] ... {self.endc}", end="", flush=True)
|
||||||
"{4}".format(self.meta.color["GREY"],
|
|
||||||
self.meta.color["CYAN"], repo,
|
|
||||||
self.meta.color["GREY"],
|
|
||||||
self.meta.color["ENDC"]), end="", flush=True)
|
|
||||||
if repo in default:
|
if repo in default:
|
||||||
update = getattr(self.initialization, repo)
|
update = getattr(self.initialization, repo)
|
||||||
update()
|
update()
|
||||||
|
@ -800,8 +780,8 @@ def check_exists_repositories(repo):
|
||||||
if check_for_local_repos(repo) is True:
|
if check_for_local_repos(repo) is True:
|
||||||
pkg_list = "PACKAGES.TXT"
|
pkg_list = "PACKAGES.TXT"
|
||||||
return ""
|
return ""
|
||||||
if not os.path.isfile("{0}{1}{2}".format(
|
if not os.path.isfile(f"{_meta_.lib_path}{repo}_repo/{pkg_list}"):
|
||||||
_meta_.lib_path, repo, "_repo/{0}".format(pkg_list))):
|
# .format(_meta_.lib_path, repo, "_repo/{0}".format(pkg_list))):
|
||||||
return repo
|
return repo
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
|
@ -37,14 +37,12 @@ def library(repo):
|
||||||
pkg_list, packages = [], ""
|
pkg_list, packages = [], ""
|
||||||
if repo == "sbo":
|
if repo == "sbo":
|
||||||
if (os.path.isfile(
|
if (os.path.isfile(
|
||||||
_meta_.lib_path + "{0}_repo/SLACKBUILDS.TXT".format(repo))):
|
_meta_.lib_path + f"{repo}_repo/SLACKBUILDS.TXT")):
|
||||||
packages = Utils().read_file(_meta_.lib_path + "{0}_repo/"
|
packages = Utils().read_file(_meta_.lib_path + f"{repo}_repo/SLACKBUILDS.TXT")
|
||||||
"SLACKBUILDS.TXT".format(repo))
|
|
||||||
else:
|
else:
|
||||||
if (os.path.isfile(
|
if (os.path.isfile(
|
||||||
_meta_.lib_path + "{0}_repo/PACKAGES.TXT".format(repo))):
|
_meta_.lib_path + f"{repo}_repo/PACKAGES.TXT")):
|
||||||
packages = Utils().read_file(_meta_.lib_path + "{0}_repo/"
|
packages = Utils().read_file(_meta_.lib_path + f"{repo}_repo/PACKAGES.TXT")
|
||||||
"PACKAGES.TXT".format(repo))
|
|
||||||
for line in packages.splitlines():
|
for line in packages.splitlines():
|
||||||
if repo == "sbo":
|
if repo == "sbo":
|
||||||
if line.startswith("SLACKBUILD NAME: "):
|
if line.startswith("SLACKBUILD NAME: "):
|
||||||
|
|
|
@ -677,8 +677,7 @@ class ArgParse:
|
||||||
self.args.remove(arg)
|
self.args.remove(arg)
|
||||||
break
|
break
|
||||||
if tag and tag not in colors:
|
if tag and tag not in colors:
|
||||||
print("\nslpkg: Error: Available colors {0}\n".format(
|
print(f"\nslpkg: Error: Available colors {colors}\n")
|
||||||
colors))
|
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
if (len(self.args) == 3 and self.args[0] in options and
|
if (len(self.args) == 3 and self.args[0] in options and
|
||||||
self.args[1] in self.meta.repositories and tag in colors):
|
self.args[1] in self.meta.repositories and tag in colors):
|
||||||
|
@ -779,7 +778,7 @@ class ArgParse:
|
||||||
from dialog import Dialog
|
from dialog import Dialog
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print("Require 'pythondialog': Install with 'slpkg -s sbo "
|
print("Require 'pythondialog': Install with 'slpkg -s sbo "
|
||||||
"python2-pythondialog'")
|
"python3-pythondialog'")
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,4 +32,4 @@ def md5(source):
|
||||||
source = source.replace("%2B", "+")
|
source = source.replace("%2B", "+")
|
||||||
with open(source, "rb") as file_to_check:
|
with open(source, "rb") as file_to_check:
|
||||||
data = file_to_check.read()
|
data = file_to_check.read()
|
||||||
return hashlib.md5(data).hexdigest()
|
return hashlib.md5(data).hexdigest()
|
|
@ -32,32 +32,34 @@ class Msg:
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
self.grey = _meta_.color["GREY"]
|
||||||
|
self.red = _meta_.color["RED"]
|
||||||
|
self.cyan = _meta_.color["CYAN"]
|
||||||
|
self.endc = _meta_.color["ENDC"]
|
||||||
|
|
||||||
def pkg_not_found(self, bol, pkg, message, eol):
|
def pkg_not_found(self, bol, pkg, message, eol):
|
||||||
"""Print message when package not found
|
"""Print message when package not found
|
||||||
"""
|
"""
|
||||||
print("{0}No such package {1}: {2}{3}".format(bol, pkg, message, eol))
|
print(f"{bol}No such package {pkg}: {message}{eol}")
|
||||||
|
|
||||||
def pkg_found(self, prgnam):
|
def pkg_found(self, prgnam):
|
||||||
"""Print message when package found
|
"""Print message when package found
|
||||||
"""
|
"""
|
||||||
print("| Package {0} is already installed".format(prgnam))
|
print(f"| Package {prgnam} is already installed")
|
||||||
|
|
||||||
def pkg_installed(self, pkg):
|
def pkg_installed(self, pkg):
|
||||||
"""Print message when package installed
|
"""Print message when package installed
|
||||||
"""
|
"""
|
||||||
print("| Package {0} installed".format(pkg))
|
print(f"| Package {pkg} installed")
|
||||||
|
|
||||||
def build_FAILED(self, prgnam):
|
def build_FAILED(self, prgnam):
|
||||||
"""Print error message if build failed
|
"""Print error message if build failed
|
||||||
"""
|
"""
|
||||||
self.template(78)
|
self.template(78)
|
||||||
print("| Some error on the package {0} [ {1}FAILED{2} ]".format(
|
print(f"| Some error on the package {prgnam} [ {self.red}FAILED{self.endc} ]")
|
||||||
prgnam, self.meta.color["RED"], self.meta.color["ENDC"]))
|
|
||||||
self.template(78)
|
self.template(78)
|
||||||
print("| See the log file in '{0}/var/log/slpkg/sbo/build_logs{1}' "
|
print(f"| See the log file in '{self.cyan}/var/log/slpkg/sbo/build_logs{self.endc}' "
|
||||||
"directory or read the README file".format(
|
f"directory or read the README file")
|
||||||
self.meta.color["CYAN"], self.meta.color["ENDC"]))
|
|
||||||
self.template(78)
|
self.template(78)
|
||||||
print() # new line at end
|
print() # new line at end
|
||||||
|
|
||||||
|
@ -69,29 +71,22 @@ class Msg:
|
||||||
def checking(self):
|
def checking(self):
|
||||||
"""Message checking
|
"""Message checking
|
||||||
"""
|
"""
|
||||||
print("{0}Checking...{1} ".format(self.meta.color["GREY"],
|
print(f"{self.grey}Checking...{self.endc} ", end="", flush=True)
|
||||||
self.meta.color["ENDC"]), end="",
|
|
||||||
flush=True)
|
|
||||||
|
|
||||||
def reading(self):
|
def reading(self):
|
||||||
"""Message reading
|
"""Message reading
|
||||||
"""
|
"""
|
||||||
print("{0}Reading package lists...{1} ".format(
|
print(f"{self.grey}Reading package lists...{self.endc} ", end="", flush=True)
|
||||||
self.meta.color["GREY"], self.meta.color["ENDC"]), end="",
|
|
||||||
flush=True)
|
|
||||||
|
|
||||||
def resolving(self):
|
def resolving(self):
|
||||||
"""Message resolving
|
"""Message resolving
|
||||||
"""
|
"""
|
||||||
print("{0}Resolving dependencies...{1} ".format(
|
print(f"{self.grey}Resolving dependencies...{self.endc} ", end="", flush=True)
|
||||||
self.meta.color["GREY"], self.meta.color["ENDC"]), end="",
|
|
||||||
flush=True)
|
|
||||||
|
|
||||||
def done(self):
|
def done(self):
|
||||||
"""Message done
|
"""Message done
|
||||||
"""
|
"""
|
||||||
print("\b{0}Done{1}\n".format(self.meta.color["GREY"],
|
print(f"\b{self.grey}Done{self.endc}\n", end="")
|
||||||
self.meta.color["ENDC"]), end="")
|
|
||||||
|
|
||||||
def pkg(self, count):
|
def pkg(self, count):
|
||||||
"""Print singular plural
|
"""Print singular plural
|
||||||
|
@ -135,12 +130,11 @@ class Msg:
|
||||||
"""
|
"""
|
||||||
print()
|
print()
|
||||||
self.template(78)
|
self.template(78)
|
||||||
print("| {0}{1}*** WARNING ***{2}").format(
|
print(f"| {' ' * 27}{self.red}*** WARNING ***{self.endc}")
|
||||||
" " * 27, self.meta.color["RED"], self.meta.color["ENDC"])
|
|
||||||
self.template(78)
|
self.template(78)
|
||||||
print("| Before proceed with the package '{0}' will you must read\n"
|
print(f"| Before proceed with the package '{pkg}' will you must read\n"
|
||||||
"| the README file. You can use the command "
|
f"| the README file. You can use the command "
|
||||||
"'slpkg -n {1}'").format(pkg, pkg)
|
f"'slpkg -n {pkg}'")
|
||||||
self.template(78)
|
self.template(78)
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
@ -149,23 +143,19 @@ class Msg:
|
||||||
and upgraded
|
and upgraded
|
||||||
"""
|
"""
|
||||||
self.template(78)
|
self.template(78)
|
||||||
print("| Total {0} {1} installed and {2} {3} upgraded".format(
|
print(f"| Total {len(install)} {self.pkg(len(install))} installed and "
|
||||||
len(install), self.pkg(len(install)),
|
f"{len(upgrade)} {self.pkg(len(upgrade))} upgraded")
|
||||||
len(upgrade), self.pkg(len(upgrade))))
|
|
||||||
self.template(78)
|
self.template(78)
|
||||||
for installed, upgraded in itertools.zip_longest(install, upgrade):
|
for installed, upgraded in itertools.zip_longest(install, upgrade):
|
||||||
if upgraded:
|
if upgraded:
|
||||||
print("| Package {0} upgraded successfully".format(upgraded))
|
print(f"| Package {upgraded} upgraded successfully")
|
||||||
if installed:
|
if installed:
|
||||||
print("| Package {0} installed successfully".format(installed))
|
print(f"| Package {installed} installed successfully")
|
||||||
self.template(78)
|
self.template(78)
|
||||||
print()
|
print()
|
||||||
|
|
||||||
def matching(self, packages):
|
def matching(self, packages):
|
||||||
"""Message for matching packages
|
"""Message for matching packages
|
||||||
"""
|
"""
|
||||||
print("\nNot found package with the name [ {0}{1}{2} ]. "
|
print(f"\nNot found package with the name [ {self.cyan}{''.join(packages)}{self.endc} ]. "
|
||||||
"Matching packages:\nNOTE: Not dependenc"
|
f"Matching packages:\nNOTE: Not dependencies are resolved\n")
|
||||||
"ies are resolved\n".format(self.meta.color["CYAN"],
|
|
||||||
"".join(packages),
|
|
||||||
self.meta.color["ENDC"]))
|
|
|
@ -51,11 +51,10 @@ class NewConfig:
|
||||||
"""
|
"""
|
||||||
self.find_new()
|
self.find_new()
|
||||||
for n in self.news:
|
for n in self.news:
|
||||||
print("{0}".format(n))
|
print(f"{n}")
|
||||||
print()
|
print()
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| Installed {0} new configuration files:".format(
|
print(f"| Installed {len(self.news)} new configuration files:")
|
||||||
len(self.news)))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
self.choices()
|
self.choices()
|
||||||
|
|
||||||
|
@ -76,16 +75,12 @@ class NewConfig:
|
||||||
def choices(self):
|
def choices(self):
|
||||||
"""Menu options for new configuration files
|
"""Menu options for new configuration files
|
||||||
"""
|
"""
|
||||||
print("| {0}K{1}{2}eep the old and .new files, no changes".format(
|
print(f"| {self.red}K{self.endc}{self.br}eep the old and .new files, no changes")
|
||||||
self.red, self.endc, self.br))
|
print(f"| {self.red}O{self.endc}{self.br}verwrite all old configuration files with new ones")
|
||||||
print("| {0}O{1}{2}verwrite all old configuration files with new "
|
|
||||||
"ones".format(self.red, self.endc, self.br))
|
|
||||||
print("| The old files will be saved with suffix .old")
|
print("| The old files will be saved with suffix .old")
|
||||||
print("| {0}R{1}{2}emove all .new files".format(
|
print(f"| {self.red}R{self.endc}{self.br}emove all .new files")
|
||||||
self.red, self.endc, self.br))
|
print(f"| {self.red}P{self.endc}{self.br}rompt K, O, R, D, M option for each single file")
|
||||||
print("| {0}P{1}{2}rompt K, O, R, D, M option for each single "
|
print(f"| {self.red}Q{self.endc}{self.br}uit from menu")
|
||||||
"file".format(self.red, self.endc, self.br))
|
|
||||||
print("| {0}Q{1}{2}uit from menu".format(self.red, self.endc, self.br))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
try:
|
try:
|
||||||
choose = input("\nWhat would you like to do [K/O/R/P/Q]? ")
|
choose = input("\nWhat would you like to do [K/O/R/P/Q]? ")
|
||||||
|
@ -141,7 +136,7 @@ class NewConfig:
|
||||||
"""Choose what do to file by file
|
"""Choose what do to file by file
|
||||||
"""
|
"""
|
||||||
print()
|
print()
|
||||||
prompt_ask = input("{0} [K/O/R/D/M/Q]? ".format(n))
|
prompt_ask = input(f"{n} [K/O/R/D/M/Q]? ")
|
||||||
print()
|
print()
|
||||||
if prompt_ask in ("K", "k"):
|
if prompt_ask in ("K", "k"):
|
||||||
self.keep()
|
self.keep()
|
||||||
|
@ -163,7 +158,7 @@ class NewConfig:
|
||||||
if os.path.isfile(n):
|
if os.path.isfile(n):
|
||||||
os.remove(n)
|
os.remove(n)
|
||||||
if not os.path.isfile(n):
|
if not os.path.isfile(n):
|
||||||
print("File '{0}' removed".format(n))
|
print(f"File '{n}' removed")
|
||||||
|
|
||||||
def _overwrite(self, n):
|
def _overwrite(self, n):
|
||||||
"""Overwrite old file with new and keep file with suffix .old
|
"""Overwrite old file with new and keep file with suffix .old
|
||||||
|
@ -195,15 +190,15 @@ class NewConfig:
|
||||||
c += 1
|
c += 1
|
||||||
if s1 != s2:
|
if s1 != s2:
|
||||||
break
|
break
|
||||||
print("@@ -{0},{1} +{2},{3} @@\n".format(ln, c, ln, c))
|
print(f"@@ -{ln},{c} +{ln},{c} @@\n")
|
||||||
for line in lines[-3:]:
|
for line in lines[-3:]:
|
||||||
print("{0}".format(line))
|
print(f"{line}")
|
||||||
if a is None:
|
if a is None:
|
||||||
a = ""
|
a = ""
|
||||||
print("{0}{1}{2}{3}".format(self.red, "-", self.endc, a))
|
print(f"{self.red}-{self.endc}{a}")
|
||||||
if b is None:
|
if b is None:
|
||||||
b = ""
|
b = ""
|
||||||
print("{0}{1}{2}{3}".format(self.green, "+", self.endc, b))
|
print(f"{self.green}+{self.endc}{b}")
|
||||||
lines = []
|
lines = []
|
||||||
c = 0
|
c = 0
|
||||||
else:
|
else:
|
||||||
|
@ -230,4 +225,4 @@ class NewConfig:
|
||||||
n.split("/")[-1], n[:-4].split("/")[-1]))
|
n.split("/")[-1], n[:-4].split("/")[-1]))
|
||||||
|
|
||||||
def quit(self):
|
def quit(self):
|
||||||
raise SystemExit()
|
raise SystemExit()
|
|
@ -52,7 +52,7 @@ class BuildPackage:
|
||||||
self.msg = Msg()
|
self.msg = Msg()
|
||||||
self._SOURCES = self.meta.SBo_SOURCES
|
self._SOURCES = self.meta.SBo_SOURCES
|
||||||
self.prgnam = self.script[:-7]
|
self.prgnam = self.script[:-7]
|
||||||
self.log_file = "build_{0}_log".format(self.prgnam)
|
self.log_file = f"build_{self.prgnam}_log"
|
||||||
self.sbo_logs = self.meta.log_path + "sbo/"
|
self.sbo_logs = self.meta.log_path + "sbo/"
|
||||||
self.build_logs = self.sbo_logs + "build_logs/"
|
self.build_logs = self.sbo_logs + "build_logs/"
|
||||||
self.start_log_time = time.strftime("%H:%M:%S")
|
self.start_log_time = time.strftime("%H:%M:%S")
|
||||||
|
@ -94,27 +94,21 @@ class BuildPackage:
|
||||||
shutil.copy2(src, self.path + self.prgnam)
|
shutil.copy2(src, self.path + self.prgnam)
|
||||||
os.chdir(self.path + self.prgnam)
|
os.chdir(self.path + self.prgnam)
|
||||||
# change permissions
|
# change permissions
|
||||||
subprocess.call("chmod +x {0}.SlackBuild".format(self.prgnam),
|
subprocess.call(f"chmod +x {self.prgnam}.SlackBuild", shell=True)
|
||||||
shell=True)
|
|
||||||
pass_var = self._pass_variable()
|
pass_var = self._pass_variable()
|
||||||
if self.meta.sbo_build_log in ["on", "ON"]:
|
if self.meta.sbo_build_log in ["on", "ON"]:
|
||||||
if os.path.isfile(self.build_logs + self.log_file):
|
if os.path.isfile(self.build_logs + self.log_file):
|
||||||
os.remove(self.build_logs + self.log_file)
|
os.remove(self.build_logs + self.log_file)
|
||||||
# start log write
|
# start log write
|
||||||
log_head(self.build_logs, self.log_file, self.start_log_time)
|
log_head(self.build_logs, self.log_file, self.start_log_time)
|
||||||
subprocess.Popen("{0} ./{1}.SlackBuild 2>&1 | tee -a "
|
subprocess.Popen(f"{' '.join(pass_var)} ./{self.prgnam}.SlackBuild 2>&1 | tee -a "
|
||||||
"{2}{3}".format(" ".join(pass_var),
|
f"{self.build_logs}{self.log_file}", shell=True, stdout=sys.stdout).communicate()
|
||||||
self.prgnam, self.build_logs,
|
|
||||||
self.log_file), shell=True,
|
|
||||||
stdout=sys.stdout).communicate()
|
|
||||||
sum_time = build_time(self.start_time)
|
sum_time = build_time(self.start_time)
|
||||||
# write end in log file
|
# write end in log file
|
||||||
log_end(self.build_logs, self.log_file, sum_time)
|
log_end(self.build_logs, self.log_file, sum_time)
|
||||||
print("Total build time for the package {0} : {1}\n".format(
|
print(f"Total build time for the package {self.prgnam} : {sum_time}\n")
|
||||||
self.prgnam, sum_time))
|
|
||||||
else:
|
else:
|
||||||
subprocess.call("{0} ./{1}.SlackBuild".format(
|
subprocess.call(f"{' '.join(pass_ver)} ./{self.prgnam}.SlackBuild", shell=True)
|
||||||
" ".join(pass_var), self.prgnam), shell=True)
|
|
||||||
os.chdir(self.path)
|
os.chdir(self.path)
|
||||||
except KeyboardInterrupt: # (OSError, IOError):
|
except KeyboardInterrupt: # (OSError, IOError):
|
||||||
self.msg.pkg_not_found("\n", self.prgnam, "Wrong file", "\n")
|
self.msg.pkg_not_found("\n", self.prgnam, "Wrong file", "\n")
|
||||||
|
@ -141,7 +135,7 @@ class BuildPackage:
|
||||||
"""
|
"""
|
||||||
if self.meta.makeflags in ["on", "ON"]:
|
if self.meta.makeflags in ["on", "ON"]:
|
||||||
cpus = multiprocessing.cpu_count()
|
cpus = multiprocessing.cpu_count()
|
||||||
os.environ["MAKEFLAGS"] = "-j{0}".format(cpus)
|
os.environ["MAKEFLAGS"] = f"-j{cpus}"
|
||||||
|
|
||||||
def _pass_variable(self):
|
def _pass_variable(self):
|
||||||
"""Return enviroment variables
|
"""Return enviroment variables
|
||||||
|
@ -150,7 +144,7 @@ class BuildPackage:
|
||||||
for var in os.environ.keys():
|
for var in os.environ.keys():
|
||||||
expVAR = var.split("_")
|
expVAR = var.split("_")
|
||||||
if expVAR[0] == self.prgnam.upper() and expVAR[1] != "PATH":
|
if expVAR[0] == self.prgnam.upper() and expVAR[1] != "PATH":
|
||||||
pass_var.append("{0}={1}".format(expVAR[1], os.environ[var]))
|
pass_var.append(f"{expVAR[1]}={os.environ[var]}")
|
||||||
return pass_var
|
return pass_var
|
||||||
|
|
||||||
def _delete_sbo_tar_gz(self):
|
def _delete_sbo_tar_gz(self):
|
||||||
|
@ -188,7 +182,7 @@ def log_end(path, log_file, sum_time):
|
||||||
log.seek(2)
|
log.seek(2)
|
||||||
log.write("#" * 79 + "\n\n")
|
log.write("#" * 79 + "\n\n")
|
||||||
log.write("Time : " + time.strftime("%H:%M:%S") + "\n")
|
log.write("Time : " + time.strftime("%H:%M:%S") + "\n")
|
||||||
log.write("Total build time : {0}\n".format(sum_time))
|
log.write(f"Total build time : {sum_time}\n")
|
||||||
log.write(" " * 38 + "E N D\n\n")
|
log.write(" " * 38 + "E N D\n\n")
|
||||||
log.write("#" * 79 + "\n\n")
|
log.write("#" * 79 + "\n\n")
|
||||||
log.close()
|
log.close()
|
||||||
|
@ -204,11 +198,9 @@ def build_time(start_time):
|
||||||
elif diff_time > 59.99 and diff_time <= 3599.99:
|
elif diff_time > 59.99 and diff_time <= 3599.99:
|
||||||
sum_time = round(diff_time / 60, 2)
|
sum_time = round(diff_time / 60, 2)
|
||||||
sum_time_list = re.findall(r"\d+", str(sum_time))
|
sum_time_list = re.findall(r"\d+", str(sum_time))
|
||||||
sum_time = ("{0} Min {1} Sec".format(sum_time_list[0],
|
sum_time = (f"{sum_time_list[0]} Min {sum_time_list[1]} Sec")
|
||||||
sum_time_list[1]))
|
|
||||||
elif diff_time > 3599.99:
|
elif diff_time > 3599.99:
|
||||||
sum_time = round(diff_time / 3600, 2)
|
sum_time = round(diff_time / 3600, 2)
|
||||||
sum_time_list = re.findall(r"\d+", str(sum_time))
|
sum_time_list = re.findall(r"\d+", str(sum_time))
|
||||||
sum_time = ("{0} Hours {1} Min".format(sum_time_list[0],
|
sum_time = (f"{sum_time_list[0]} Hours {sum_time_list[1]} Min")
|
||||||
sum_time_list[1]))
|
|
||||||
return sum_time
|
return sum_time
|
||||||
|
|
|
@ -45,6 +45,12 @@ class PackageManager:
|
||||||
def __init__(self, binary):
|
def __init__(self, binary):
|
||||||
self.binary = binary
|
self.binary = binary
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
self.green = _meta_.color["GREEN"]
|
||||||
|
self.red = _meta_.color["RED"]
|
||||||
|
self.yellow = _meta_.color["YELLOW"]
|
||||||
|
self.cyan = _meta_.color["CYAN"]
|
||||||
|
self.grey = _meta_.color["GREY"]
|
||||||
|
self.endc = _meta_.color["ENDC"]
|
||||||
self.msg = Msg()
|
self.msg = Msg()
|
||||||
self.skip = []
|
self.skip = []
|
||||||
self.size = 0
|
self.size = 0
|
||||||
|
@ -56,8 +62,7 @@ class PackageManager:
|
||||||
"""
|
"""
|
||||||
for pkg in self.binary:
|
for pkg in self.binary:
|
||||||
try:
|
try:
|
||||||
subprocess.call("installpkg {0} {1}".format(flag, pkg),
|
subprocess.call(f"installpkg {flag} {pkg}", shell=True)
|
||||||
shell=True)
|
|
||||||
check = pkg[:-4].split("/")[-1]
|
check = pkg[:-4].split("/")[-1]
|
||||||
if os.path.isfile(self.meta.pkg_path + check):
|
if os.path.isfile(self.meta.pkg_path + check):
|
||||||
print("Completed!\n")
|
print("Completed!\n")
|
||||||
|
@ -72,8 +77,7 @@ class PackageManager:
|
||||||
"""
|
"""
|
||||||
for pkg in self.binary:
|
for pkg in self.binary:
|
||||||
try:
|
try:
|
||||||
subprocess.call("upgradepkg {0} {1}".format(flag, pkg),
|
subprocess.call(f"upgradepkg {flag} {pkg}", shell=True)
|
||||||
shell=True)
|
|
||||||
check = pkg[:-4].split("/")[-1]
|
check = pkg[:-4].split("/")[-1]
|
||||||
if os.path.isfile(self.meta.pkg_path + check):
|
if os.path.isfile(self.meta.pkg_path + check):
|
||||||
print("Completed!\n")
|
print("Completed!\n")
|
||||||
|
@ -183,8 +187,7 @@ class PackageManager:
|
||||||
for pkg in self.binary:
|
for pkg in self.binary:
|
||||||
name = GetFromInstalled(pkg).name()
|
name = GetFromInstalled(pkg).name()
|
||||||
ver = GetFromInstalled(pkg).version()
|
ver = GetFromInstalled(pkg).version()
|
||||||
package = find_package("{0}{1}{2}".format(
|
package = find_package(f"{name}{ver}{self.meta.sp}", self.meta.pkg_path)
|
||||||
name, ver, self.meta.sp), self.meta.pkg_path)
|
|
||||||
if pkg and name == pkg:
|
if pkg and name == pkg:
|
||||||
removed.append(pkg)
|
removed.append(pkg)
|
||||||
packages.append(package[0])
|
packages.append(package[0])
|
||||||
|
@ -197,14 +200,12 @@ class PackageManager:
|
||||||
"""View packages before removed
|
"""View packages before removed
|
||||||
"""
|
"""
|
||||||
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
||||||
self.meta.color["CYAN"], ", ".join(self.binary),
|
self.cyan, ", ".join(self.binary), self.endc))
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
removed, packages = self._get_removed()
|
removed, packages = self._get_removed()
|
||||||
if packages and "--checklist" in self.extra:
|
if packages and "--checklist" in self.extra:
|
||||||
removed = []
|
removed = []
|
||||||
text = "Press 'spacebar' to unchoose packages from the remove"
|
text = "Press 'spacebar' to unchoose packages from the remove"
|
||||||
backtitle = "{0} {1}".format(self.meta.__all__,
|
backtitle = f"{self.meta.__all__} {self.meta.__version__}"
|
||||||
self.meta.__version__)
|
|
||||||
status = True
|
status = True
|
||||||
pkgs = DialogUtil(packages, text, " Remove ", backtitle,
|
pkgs = DialogUtil(packages, text, " Remove ", backtitle,
|
||||||
status).checklist()
|
status).checklist()
|
||||||
|
@ -215,16 +216,14 @@ class PackageManager:
|
||||||
else:
|
else:
|
||||||
for rmv, pkg in zip(removed, packages):
|
for rmv, pkg in zip(removed, packages):
|
||||||
self._sizes(pkg)
|
self._sizes(pkg)
|
||||||
print("[ {0}delete{1} ] --> [ {2} ] - {3}".format(
|
print(f"[ {self.red}delete{self.endc} ] --> [ {self.file_size} ] - {pkg}")
|
||||||
self.meta.color["RED"], self.meta.color["ENDC"],
|
|
||||||
self.file_size, pkg))
|
|
||||||
self._calc_sizes()
|
self._calc_sizes()
|
||||||
self._remove_summary()
|
self._remove_summary()
|
||||||
if "--third-party" in self.extra:
|
if "--third-party" in self.extra:
|
||||||
print("\n")
|
print("\n")
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print(("| {0}{1}*** WARNING ***{2}").format(
|
print(("| {0}{1}*** WARNING ***{2}").format(
|
||||||
" " * 27, self.meta.color["RED"], self.meta.color["ENDC"]))
|
" " * 27, self.red, self.endc))
|
||||||
print("| Before you use third-party option, be sure you have"
|
print("| Before you use third-party option, be sure you have"
|
||||||
" updated the packages \n| lists. Run the command"
|
" updated the packages \n| lists. Run the command"
|
||||||
" 'slpkg update' and 'slpkg -c slack --upgrade'")
|
" 'slpkg update' and 'slpkg -c slack --upgrade'")
|
||||||
|
@ -248,8 +247,7 @@ class PackageManager:
|
||||||
print("\nRemoved summary")
|
print("\nRemoved summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Size of removed packages {1} {2}.{3}".format(
|
print("{0}Size of removed packages {1} {2}.{3}".format(
|
||||||
self.meta.color["GREY"], round(self.size, 2), self.unit,
|
self.grey, round(self.size, 2), self.unit, self.endc))
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
|
|
||||||
def _view_deps(self, path, package):
|
def _view_deps(self, path, package):
|
||||||
"""View dependencies before remove
|
"""View dependencies before remove
|
||||||
|
@ -267,8 +265,7 @@ class PackageManager:
|
||||||
if "--checklist" in self.extra:
|
if "--checklist" in self.extra:
|
||||||
deps, dependencies = [], []
|
deps, dependencies = [], []
|
||||||
text = "Found dependencies for the package {0}".format(package)
|
text = "Found dependencies for the package {0}".format(package)
|
||||||
backtitle = "{0} {1}".format(self.meta.__all__,
|
backtitle = f"{self.meta.__all__} {self.meta.__version__}"
|
||||||
self.meta.__version__)
|
|
||||||
status = True
|
status = True
|
||||||
deps = DialogUtil(packages, text, " Remove ", backtitle,
|
deps = DialogUtil(packages, text, " Remove ", backtitle,
|
||||||
status).checklist()
|
status).checklist()
|
||||||
|
@ -278,19 +275,16 @@ class PackageManager:
|
||||||
else:
|
else:
|
||||||
print() # new line at start
|
print() # new line at start
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| Found dependencies for the package {0}:".format(
|
print(f"| Found dependencies for the package {package}:")
|
||||||
package))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
find = find_package(pkg + self.meta.sp, self.meta.pkg_path)
|
find = find_package(pkg + self.meta.sp, self.meta.pkg_path)
|
||||||
self._sizes(find[0])
|
self._sizes(find[0])
|
||||||
print("| {0}{1}{2}".format(self.meta.color["RED"], pkg,
|
print(f"| {self.red}{pkg}{self.endc}")
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
self._calc_sizes()
|
self._calc_sizes()
|
||||||
print("| {0}Size of removed dependencies {1} {2}{3}".format(
|
print("| {0}Size of removed dependencies {1} {2}{3}".format(
|
||||||
self.meta.color["GREY"], round(self.size, 2), self.unit,
|
self.grey, round(self.size, 2), self.unit, self.endc))
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
return dependencies
|
return dependencies
|
||||||
|
|
||||||
|
@ -298,8 +292,7 @@ class PackageManager:
|
||||||
"""removepkg Slackware command
|
"""removepkg Slackware command
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
subprocess.call("removepkg {0} {1}".format(self.flag, package),
|
subprocess.call(f"removepkg {self.flag} {package}", shell=True)
|
||||||
shell=True)
|
|
||||||
if os.path.isfile(self.dep_path + package):
|
if os.path.isfile(self.dep_path + package):
|
||||||
os.remove(self.dep_path + package) # remove log
|
os.remove(self.dep_path + package) # remove log
|
||||||
except subprocess.CalledProcessError as er:
|
except subprocess.CalledProcessError as er:
|
||||||
|
@ -354,17 +347,14 @@ class PackageManager:
|
||||||
deps = Utils().read_file(self.dep_path + pkg)
|
deps = Utils().read_file(self.dep_path + pkg)
|
||||||
for rmv in removes:
|
for rmv in removes:
|
||||||
if GetFromInstalled(rmv).name() and rmv in deps.split():
|
if GetFromInstalled(rmv).name() and rmv in deps.split():
|
||||||
pkg_dep.append(
|
pkg_dep.append(f"{rmv} is dependency of the package --> {pkg}")
|
||||||
"{0} is dependency of the package --> {1}".format(
|
|
||||||
rmv, pkg))
|
|
||||||
package.append(pkg)
|
package.append(pkg)
|
||||||
dependency.append(rmv)
|
dependency.append(rmv)
|
||||||
if package:
|
if package:
|
||||||
if "--checklist" in self.extra:
|
if "--checklist" in self.extra:
|
||||||
text = ("Press 'spacebar' to choose packages for the"
|
text = ("Press 'spacebar' to choose packages for the"
|
||||||
" remove exception")
|
" remove exception")
|
||||||
backtitle = "{0} {1}".format(self.meta.__all__,
|
backtitle = f"{self.meta.__all__} {self.meta.__version__}"
|
||||||
self.meta.__version__)
|
|
||||||
status = False
|
status = False
|
||||||
choose = DialogUtil(pkg_dep, text, " !!! WARNING !!! ",
|
choose = DialogUtil(pkg_dep, text, " !!! WARNING !!! ",
|
||||||
backtitle, status).checklist()
|
backtitle, status).checklist()
|
||||||
|
@ -373,15 +363,11 @@ class PackageManager:
|
||||||
else:
|
else:
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| {0}{1}{2}".format(
|
print("| {0}{1}{2}".format(
|
||||||
self.meta.color["RED"], " " * 30 + "!!! WARNING !!!",
|
self.red, " " * 30 + "!!! WARNING !!!", self.endc))
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
for p, d in zip(package, dependency):
|
for p, d in zip(package, dependency):
|
||||||
print("| {0}{1}{2} is dependency of the package --> "
|
print(f"| {self.yellow}{d}{self.endc} is dependency of the package --> "
|
||||||
"{3}{4}{5}".format(self.meta.color["YELLOW"], d,
|
f"{self.green}{p}{self.endc}")
|
||||||
self.meta.color["ENDC"],
|
|
||||||
self.meta.color["GREEN"], p,
|
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
self._skip_remove()
|
self._skip_remove()
|
||||||
|
|
||||||
|
@ -393,13 +379,13 @@ class PackageManager:
|
||||||
msg_pkg = "package"
|
msg_pkg = "package"
|
||||||
if len(removes) > 1:
|
if len(removes) > 1:
|
||||||
msg_pkg = "packages"
|
msg_pkg = "packages"
|
||||||
print("| Total {0} {1} removed".format(len(removes), msg_pkg))
|
print(f"| Total {len(removes)} {msg_pkg} removed")
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
for pkg in removes:
|
for pkg in removes:
|
||||||
if not GetFromInstalled(pkg).name():
|
if not GetFromInstalled(pkg).name():
|
||||||
print("| Package {0} removed".format(pkg))
|
print(f"| Package {pkg} removed")
|
||||||
else:
|
else:
|
||||||
print("| Package {0} not found".format(pkg))
|
print(f"| Package {pkg} not found")
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print() # new line at end
|
print() # new line at end
|
||||||
|
|
||||||
|
@ -410,8 +396,7 @@ class PackageManager:
|
||||||
pkg_cache, match_cache = "", ""
|
pkg_cache, match_cache = "", ""
|
||||||
slack_packages, slack_names = slackware_repository()
|
slack_packages, slack_names = slackware_repository()
|
||||||
print("\nPackages with matching name [ {0}{1}{2} ]\n".format(
|
print("\nPackages with matching name [ {0}{1}{2} ]\n".format(
|
||||||
self.meta.color["CYAN"], ", ".join(self.binary),
|
self.cyan, ", ".join(self.binary), self.endc))
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
for pkg in self.binary:
|
for pkg in self.binary:
|
||||||
for match in find_package("", self.meta.pkg_path):
|
for match in find_package("", self.meta.pkg_path):
|
||||||
pkg_cache = pkg
|
pkg_cache = pkg
|
||||||
|
@ -434,9 +419,7 @@ class PackageManager:
|
||||||
for pkgs in packages:
|
for pkgs in packages:
|
||||||
matching += 1
|
matching += 1
|
||||||
self._sizes(pkgs)
|
self._sizes(pkgs)
|
||||||
print("[ {0}installed{1} ] [ {2} ] - {3}".format(
|
print(f"[ {self.green}installed{self.endc} ] [ {self.file_size} ] - {pkgs}")
|
||||||
self.meta.color["GREEN"], self.meta.color["ENDC"],
|
|
||||||
self.file_size, pkgs))
|
|
||||||
if matching == 0:
|
if matching == 0:
|
||||||
message = "Can't find"
|
message = "Can't find"
|
||||||
self.msg.pkg_not_found("", ", ".join(self.binary), message, "\n")
|
self.msg.pkg_not_found("", ", ".join(self.binary), message, "\n")
|
||||||
|
@ -446,10 +429,9 @@ class PackageManager:
|
||||||
print("\nFound summary")
|
print("\nFound summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total found {1} matching packages.{2}".format(
|
print("{0}Total found {1} matching packages.{2}".format(
|
||||||
self.meta.color["GREY"], matching, self.meta.color["ENDC"]))
|
self.grey, matching, self.endc))
|
||||||
print("{0}Size of installed packages {1} {2}.{3}\n".format(
|
print("{0}Size of installed packages {1} {2}.{3}\n".format(
|
||||||
self.meta.color["GREY"], round(self.size, 2), self.unit,
|
self.grey, round(self.size, 2), self.unit, self.endc))
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
|
|
||||||
def _sizes(self, package):
|
def _sizes(self, package):
|
||||||
"""Package size summary
|
"""Package size summary
|
||||||
|
@ -472,8 +454,7 @@ class PackageManager:
|
||||||
for pkg in self.binary:
|
for pkg in self.binary:
|
||||||
name = GetFromInstalled(pkg).name()
|
name = GetFromInstalled(pkg).name()
|
||||||
ver = GetFromInstalled(pkg).version()
|
ver = GetFromInstalled(pkg).version()
|
||||||
find = find_package("{0}{1}{2}".format(name, ver, self.meta.sp),
|
find = find_package(f"{name}{ver}{self.meta.sp}", self.meta.pkg_path)
|
||||||
self.meta.pkg_path)
|
|
||||||
if find:
|
if find:
|
||||||
package = Utils().read_file(
|
package = Utils().read_file(
|
||||||
self.meta.pkg_path + "".join(find))
|
self.meta.pkg_path + "".join(find))
|
||||||
|
@ -501,28 +482,16 @@ class PackageManager:
|
||||||
print()
|
print()
|
||||||
for pkg in sorted(pkg_list):
|
for pkg in sorted(pkg_list):
|
||||||
pkg = self._splitting_packages(pkg, repo, name)
|
pkg = self._splitting_packages(pkg, repo, name)
|
||||||
if installed:
|
if installed and repo:
|
||||||
if repo == "sbo":
|
if pkg in all_installed_names:
|
||||||
if pkg in all_installed_names:
|
pkg = f"{self.green}{pkg}{self.endc}"
|
||||||
pkg = ("{0}{1}{2}".format(self.meta.color["GREEN"],
|
|
||||||
pkg,
|
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
else:
|
|
||||||
if pkg in all_installed_names:
|
|
||||||
pkg = ("{0}{1}{2}".format(self.meta.color["GREEN"],
|
|
||||||
pkg,
|
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
if INDEX:
|
if INDEX:
|
||||||
index += 1
|
index += 1
|
||||||
pkg = self.list_color_tag(pkg)
|
pkg = self.list_color_tag(pkg)
|
||||||
print("{0}{1}:{2} {3}".format(
|
print(f"{self.grey}{index}:{self.endc} {pkg}")
|
||||||
self.meta.color["GREY"], index,
|
|
||||||
self.meta.color["ENDC"], pkg))
|
|
||||||
if index == page:
|
if index == page:
|
||||||
read = input("\nPress {0}Enter{1} to "
|
read = input(f"\nPress {self.cyan}Enter{self.endc} to continue... ")
|
||||||
"continue... ".format(
|
|
||||||
self.meta.color["CYAN"],
|
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
if read in ["Q", "q"]:
|
if read in ["Q", "q"]:
|
||||||
break
|
break
|
||||||
print() # new line after page
|
print() # new line after page
|
||||||
|
@ -567,14 +536,11 @@ class PackageManager:
|
||||||
packages = ""
|
packages = ""
|
||||||
if repo == "sbo":
|
if repo == "sbo":
|
||||||
if (os.path.isfile(
|
if (os.path.isfile(
|
||||||
self.meta.lib_path + "{0}_repo/SLACKBUILDS.TXT".format(
|
self.meta.lib_path + f"{repo}_repo/SLACKBUILDS.TXT")):
|
||||||
repo))):
|
packages = Utils().read_file(self.meta.lib_path + f"{repo}_repo/SLACKBUILDS.TXT")
|
||||||
packages = Utils().read_file(self.meta.lib_path + "{0}_repo/"
|
|
||||||
"SLACKBUILDS.TXT".format(repo))
|
|
||||||
else:
|
else:
|
||||||
if (os.path.isfile(
|
if (os.path.isfile(
|
||||||
self.meta.lib_path + "{0}_repo/PACKAGES.TXT".format(
|
self.meta.lib_path + f"{repo}_repo/PACKAGES.TXT")):
|
||||||
repo))):
|
|
||||||
packages = Utils().read_file(self.meta.lib_path + "{0}_repo/"
|
packages = Utils().read_file(self.meta.lib_path + "{0}_repo/"
|
||||||
"PACKAGES.TXT".format(repo))
|
"PACKAGES.TXT".format(repo))
|
||||||
return packages
|
return packages
|
||||||
|
@ -587,8 +553,7 @@ class PackageManager:
|
||||||
if pkg.endswith(".txz") or pkg.endswith(".tgz"):
|
if pkg.endswith(".txz") or pkg.endswith(".tgz"):
|
||||||
find = pkg[:-4]
|
find = pkg[:-4]
|
||||||
if find_package(find, self.meta.pkg_path):
|
if find_package(find, self.meta.pkg_path):
|
||||||
pkg = "{0}{1}{2}".format(self.meta.color["GREEN"], pkg,
|
pkg = f"{self.green}{pkg}{self.endc}"
|
||||||
self.meta.color["ENDC"])
|
|
||||||
return pkg
|
return pkg
|
||||||
|
|
||||||
def list_of_installed(self, repo, name):
|
def list_of_installed(self, repo, name):
|
||||||
|
|
|
@ -45,11 +45,9 @@ class FindFromRepos:
|
||||||
def find(self, pkg, flag):
|
def find(self, pkg, flag):
|
||||||
"""Start to find packages and print
|
"""Start to find packages and print
|
||||||
"""
|
"""
|
||||||
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
print(f"\nPackages with name matching [ {self.cyan}{', '.join(pkg)}{self.endc} ]\n")
|
||||||
self.cyan, ", ".join(pkg), self.endc))
|
|
||||||
Msg().template(78)
|
Msg().template(78)
|
||||||
print("| {0} {1}{2}{3}".format("Repository", "Package", " " * 54,
|
print(f"| Repository Package {' ' * 54}Size")
|
||||||
"Size"))
|
|
||||||
Msg().template(78)
|
Msg().template(78)
|
||||||
for repo in _meta_.repositories:
|
for repo in _meta_.repositories:
|
||||||
PACKAGES_TXT = PackageManager(pkg).list_lib(repo)
|
PACKAGES_TXT = PackageManager(pkg).list_lib(repo)
|
||||||
|
@ -69,16 +67,12 @@ class FindFromRepos:
|
||||||
self.cache = repo
|
self.cache = repo
|
||||||
self.count_pkg += 1
|
self.count_pkg += 1
|
||||||
ver = self.sbo_version(repo, find)
|
ver = self.sbo_version(repo, find)
|
||||||
print(" {0}{1}{2}{3}{4} {5}{6:>11}".format(
|
print(f" {self.cyan}{repo}{self.endc}{' ' * (12 - len(repo))}{find + ver} "
|
||||||
self.cyan, repo, self.endc,
|
f"{' ' * (53 -len(find + ver))}{size:>11}")
|
||||||
" " * (12 - len(repo)),
|
|
||||||
find + ver, " " * (53 - len(find + ver)),
|
|
||||||
size))
|
|
||||||
print("\nFound summary")
|
print("\nFound summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total found {1} packages in {2} repositories."
|
print(f"{self.grey}Total found {self.count_pkg} packages in "
|
||||||
"{3}\n".format(self.grey, self.count_pkg,
|
f"{self.count_repo} repositories.{self.endc}\n")
|
||||||
self.count_repo, self.endc))
|
|
||||||
|
|
||||||
def sbo_version(self, repo, find):
|
def sbo_version(self, repo, find):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -36,6 +36,9 @@ class RepoEnable:
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
self.red = _meta_.color["RED"]
|
||||||
|
self.grey = _meta_.color["GREY"]
|
||||||
|
self.endc = _meta_.color["ENDC"]
|
||||||
self.msg = Msg()
|
self.msg = Msg()
|
||||||
self.tag = "[REPOSITORIES]"
|
self.tag = "[REPOSITORIES]"
|
||||||
self.tag_line = False
|
self.tag_line = False
|
||||||
|
@ -101,8 +104,7 @@ Keys: SPACE select or deselect the highlighted repositories,
|
||||||
"""Update repositories.conf file with enabled or disabled
|
"""Update repositories.conf file with enabled or disabled
|
||||||
repositories
|
repositories
|
||||||
"""
|
"""
|
||||||
with open("{0}{1}".format(self.meta.conf_path,
|
with open(f"{self.meta.conf_path}{self.repositories_conf}", "w") as new_conf:
|
||||||
self.repositories_conf), "w") as new_conf:
|
|
||||||
for line in self.conf.splitlines():
|
for line in self.conf.splitlines():
|
||||||
line = line.lstrip()
|
line = line.lstrip()
|
||||||
if self.tag in line:
|
if self.tag in line:
|
||||||
|
@ -130,15 +132,12 @@ Keys: SPACE select or deselect the highlighted repositories,
|
||||||
"""
|
"""
|
||||||
total_enabled = ", ".join(self.selected)
|
total_enabled = ", ".join(self.selected)
|
||||||
if len(total_enabled) < 1:
|
if len(total_enabled) < 1:
|
||||||
total_enabled = ("{0}Are you crazy? This is a package "
|
total_enabled = (f"{self.red}Are you crazy? This is a package "
|
||||||
"manager for packages :p{1}".format(
|
f"manager for packages :p{self.endc}")
|
||||||
self.meta.color["RED"],
|
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| Enabled repositories:")
|
print("| Enabled repositories:")
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| {0}".format(total_enabled))
|
print(f"| {total_enabled}")
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("{0}Total {1}/{2} repositories enabled.{3}\n".format(
|
print(f"{self.grey}Total {len(self.selected)}/{len(self.enabled + self.disabled)} "
|
||||||
self.meta.color["GREY"], len(self.selected),
|
f"repositories enabled.{self.endc}\n")
|
||||||
len(self.enabled + self.disabled), self.meta.color["ENDC"]))
|
|
|
@ -35,6 +35,9 @@ class RepoInfo:
|
||||||
"""Repository information
|
"""Repository information
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self.green = _meta_.color["GREEN"]
|
||||||
|
self.red = _meta_.color["RED"]
|
||||||
|
self.endc = _meta_.color["ENDC"]
|
||||||
self.form = {
|
self.form = {
|
||||||
"Last updated:": "",
|
"Last updated:": "",
|
||||||
"Number of packages:": "",
|
"Number of packages:": "",
|
||||||
|
@ -55,17 +58,14 @@ class RepoInfo:
|
||||||
"""
|
"""
|
||||||
View repository information
|
View repository information
|
||||||
"""
|
"""
|
||||||
status = "{0}disabled{1}".format(self.meta.color["RED"],
|
status = f"{self.red}disabled{self.endc}"
|
||||||
self.meta.color["ENDC"])
|
|
||||||
self.form["Status:"] = status
|
self.form["Status:"] = status
|
||||||
self.form["Default:"] = "no"
|
self.form["Default:"] = "no"
|
||||||
if repo in self.meta.default_repositories:
|
if repo in self.meta.default_repositories:
|
||||||
self.form["Default:"] = "yes"
|
self.form["Default:"] = "yes"
|
||||||
if (repo in self.meta.repositories and
|
if (repo in self.meta.repositories and
|
||||||
os.path.isfile(self.meta.lib_path + "{0}_repo/PACKAGES."
|
os.path.isfile(self.meta.lib_path + f"{repo}_repo/PACKAGES.TXT")):
|
||||||
"TXT".format(repo))):
|
status = f"{self.green}enabled{self.endc}"
|
||||||
status = "{0}enabled{1}".format(self.meta.color["GREEN"],
|
|
||||||
self.meta.color["ENDC"])
|
|
||||||
if repo != "sbo":
|
if repo != "sbo":
|
||||||
data = self.repository_data(repo)
|
data = self.repository_data(repo)
|
||||||
size = units(data[1], data[2])
|
size = units(data[1], data[2])
|
||||||
|
|
|
@ -68,6 +68,5 @@ class AutoBuild:
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
for src in self.sources:
|
for src in self.sources:
|
||||||
if not os.path.isfile(self.path + src):
|
if not os.path.isfile(self.path + src):
|
||||||
print("\nslpkg: Error: Source file '{0}' not found\n".format(
|
print(f"\nslpkg: Error: Source file '{src}' not found\n")
|
||||||
src))
|
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
|
|
|
@ -40,11 +40,9 @@ class BuildNumber:
|
||||||
def get(self):
|
def get(self):
|
||||||
num = "NO_BUILD"
|
num = "NO_BUILD"
|
||||||
if self.sbo_url:
|
if self.sbo_url:
|
||||||
SlackBuild = URL("{0}{1}.SlackBuild".format(
|
SlackBuild = URL(f"{self.sbo_url}{self.pkg}.SlackBuild").reading()
|
||||||
self.sbo_url, self.pkg)).reading()
|
|
||||||
else:
|
else:
|
||||||
SlackBuild = Utils().read_file("{0}{1}/{2}.SlackBuild".format(
|
SlackBuild = Utils().read_file(f"{self.meta.build_path}{self.pkg}/{self.pkg}.SlackBuild")
|
||||||
self.meta.build_path, self.pkg, self.pkg))
|
|
||||||
for line in SlackBuild.splitlines():
|
for line in SlackBuild.splitlines():
|
||||||
line = line.lstrip()
|
line = line.lstrip()
|
||||||
if line.startswith("BUILD="):
|
if line.startswith("BUILD="):
|
||||||
|
|
|
@ -47,8 +47,8 @@ def sbo_upgrade(skip, flag):
|
||||||
name = split_package(pkg)[0]
|
name = split_package(pkg)[0]
|
||||||
ver = split_package(pkg)[1]
|
ver = split_package(pkg)[1]
|
||||||
if (name in data and name not in skip and name not in blacklist):
|
if (name in data and name not in skip and name not in blacklist):
|
||||||
sbo_package = ("{0}-{1}".format(name, SBoGrep(name).version()))
|
sbo_package = f"{name}-{SBoGrep(name).version()}"
|
||||||
package = ("{0}-{1}".format(name, ver))
|
package = f"{name}-{ver}"
|
||||||
if parse_version(sbo_package) > parse_version(package):
|
if parse_version(sbo_package) > parse_version(package):
|
||||||
upgrade_names.append(name)
|
upgrade_names.append(name)
|
||||||
Msg().done()
|
Msg().done()
|
||||||
|
|
|
@ -36,11 +36,11 @@ class SBoGrep:
|
||||||
self.line_name = "SLACKBUILD NAME: "
|
self.line_name = "SLACKBUILD NAME: "
|
||||||
self.line_files = "SLACKBUILD FILES: "
|
self.line_files = "SLACKBUILD FILES: "
|
||||||
self.line_down = "SLACKBUILD DOWNLOAD: "
|
self.line_down = "SLACKBUILD DOWNLOAD: "
|
||||||
self.line_down_64 = "SLACKBUILD DOWNLOAD_{0}: ".format(arch64)
|
self.line_down_64 = f"SLACKBUILD DOWNLOAD_{arch64}: "
|
||||||
self.line_req = "SLACKBUILD REQUIRES: "
|
self.line_req = "SLACKBUILD REQUIRES: "
|
||||||
self.line_ver = "SLACKBUILD VERSION: "
|
self.line_ver = "SLACKBUILD VERSION: "
|
||||||
self.line_md5 = "SLACKBUILD MD5SUM: "
|
self.line_md5 = "SLACKBUILD MD5SUM: "
|
||||||
self.line_md5_64 = "SLACKBUILD MD5SUM_{0}: ".format(arch64)
|
self.line_md5_64 = f"SLACKBUILD MD5SUM_{arch64}: "
|
||||||
self.line_des = "SLACKBUILD SHORT DESCRIPTION: "
|
self.line_des = "SLACKBUILD SHORT DESCRIPTION: "
|
||||||
self.sbo_txt = self.meta.lib_path + "sbo_repo/SLACKBUILDS.TXT"
|
self.sbo_txt = self.meta.lib_path + "sbo_repo/SLACKBUILDS.TXT"
|
||||||
self.answer = ["y", "Y"]
|
self.answer = ["y", "Y"]
|
||||||
|
|
|
@ -94,7 +94,7 @@ class SBoNetwork:
|
||||||
from slackbuilds.org
|
from slackbuilds.org
|
||||||
"""
|
"""
|
||||||
if self.sbo_url and self.name not in self.blacklist:
|
if self.sbo_url and self.name not in self.blacklist:
|
||||||
self.prgnam = ("{0}-{1}".format(self.name, self.sbo_version))
|
self.prgnam = f"{self.name}-{self.sbo_version}"
|
||||||
self.view_sbo()
|
self.view_sbo()
|
||||||
while True:
|
while True:
|
||||||
self.read_choice()
|
self.read_choice()
|
||||||
|
@ -147,10 +147,10 @@ class SBoNetwork:
|
||||||
commands = {
|
commands = {
|
||||||
"r": "README",
|
"r": "README",
|
||||||
"R": "README",
|
"R": "README",
|
||||||
"s": "{0}.SlackBuild".format(self.name),
|
"s": f"{self.name}.SlackBuild",
|
||||||
"S": "{0}.SlackBuild".format(self.name),
|
"S": f"{self.name}.SlackBuild",
|
||||||
"f": "{0}.info".format(self.name),
|
"f": f"{self.name}.info",
|
||||||
"F": "{0}.info".format(self.name),
|
"F": f"{self.name}.info",
|
||||||
"o": "doinst.sh",
|
"o": "doinst.sh",
|
||||||
"O": "doinst.sh",
|
"O": "doinst.sh",
|
||||||
"d": "download",
|
"d": "download",
|
||||||
|
@ -171,8 +171,7 @@ class SBoNetwork:
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
message = " Choose an option > "
|
message = " Choose an option > "
|
||||||
self.choice = input("{0}{1}{2}".format(self.grey, message,
|
self.choice = input(f"{self.grey}{message}{self.endc}")
|
||||||
self.endc))
|
|
||||||
except EOFError:
|
except EOFError:
|
||||||
print()
|
print()
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
|
@ -263,49 +262,27 @@ class SBoNetwork:
|
||||||
fix_sp = ""
|
fix_sp = ""
|
||||||
print() # new line at start
|
print() # new line at start
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| {0}{1}SlackBuilds Repository{2}".format(" " * 28, self.grey,
|
print(f"| {' ' * 28}{self.grey}SlackBuilds Repository{self.endc}")
|
||||||
self.endc))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| {0} > {1} > {2}{3}{4}".format(slack_ver(),
|
print(f"| {slack_ver()} > {sbo_url.split('/')[-3].title()} > {self.cyan}{self.name}{self.endc}")
|
||||||
sbo_url.split("/")[-3].title(),
|
|
||||||
self.cyan, self.name,
|
|
||||||
self.endc))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| {0}Package url{1}: {2}".format(self.green, self.endc,
|
print(f"| {self.green}Package url{self.endc}: {sbo_url}")
|
||||||
sbo_url))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| {0}Description: {1}{2}".format(self.green,
|
print(f"| {self.green}Description: {self.endc}{self.sbo_desc}")
|
||||||
self.endc, self.sbo_desc))
|
print(f"| {self.green}SlackBuild: {self.endc}{self.sbo_dwn.split('/')[-1]}")
|
||||||
print("| {0}SlackBuild: {1}{2}".format(self.green, self.endc,
|
print(f"| {self.green}Sources: {self.endc}{', '.join([src.split('/')[-1] for src in self.source_dwn])}")
|
||||||
self.sbo_dwn.split("/")[-1]))
|
print(f"| {self.yellow}Requirements: {self.endc}{', '.join(self.sbo_req)}")
|
||||||
print("| {0}Sources: {1}{2}".format(
|
|
||||||
self.green, self.endc,
|
|
||||||
(", ".join([src.split("/")[-1] for src in self.source_dwn]))))
|
|
||||||
print("| {0}Requirements: {1}{2}".format(self.yellow,
|
|
||||||
self.endc,
|
|
||||||
", ".join(self.sbo_req)))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| {0}R{1}{2}EADME View the README file".format(
|
print(f"| {self.red}R{self.endc}{br2}EADME View the README file")
|
||||||
self.red, self.endc, br2))
|
print(f"| {self.red}S{self.endc}{br2}lackBuild View the .SlackBuild file")
|
||||||
print("| {0}S{1}{2}lackBuild View the .SlackBuild "
|
print(f"| In{br1}{self.red}f{self.endc}{br2}o{fix_sp} View the .info file")
|
||||||
"file".format(self.red, self.endc, br2))
|
|
||||||
print("| In{0}{1}f{2}{3}o{4} View the .info "
|
|
||||||
"file".format(br1, self.red, self.endc, br2, fix_sp))
|
|
||||||
if "doinst.sh" in self.sbo_files.split():
|
if "doinst.sh" in self.sbo_files.split():
|
||||||
print("| D{0}{1}o{2}{3}inst.sh{4} View the doinst.sh "
|
print(f"| D{br1}{self.red}o{self.endc}{br2}inst.sh{fix_sp} View the doinst.sh file")
|
||||||
"file".format(br1, self.red, self.endc, br2, fix_sp))
|
print(f"| {self.red}D{self.endc}{br2}ownload Download this package")
|
||||||
print("| {0}D{1}{2}ownload Download this package".format(
|
print(f"| {self.red}B{self.endc}{br2}uild Download and build")
|
||||||
self.red, self.endc, br2))
|
print(f"| {self.red}I{self.endc}{br2}nstall Download/Build/Install")
|
||||||
print("| {0}B{1}{2}uild Download and build".format(
|
print(f"| {self.red}C{self.endc}{br2}lear Clear screen")
|
||||||
self.red, self.endc, br2))
|
print(f"| {self.red}Q{self.endc}{br2}uit Quit")
|
||||||
print("| {0}I{1}{2}nstall Download/Build/Install".format(
|
|
||||||
self.red, self.endc, br2))
|
|
||||||
print("| {0}C{1}{2}lear Clear screen".format(self.red,
|
|
||||||
self.endc,
|
|
||||||
br2))
|
|
||||||
print("| {0}Q{1}{2}uit Quit".format(self.red,
|
|
||||||
self.endc, br2))
|
|
||||||
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
|
|
||||||
def with_checklist(self):
|
def with_checklist(self):
|
||||||
|
@ -321,7 +298,7 @@ class SBoNetwork:
|
||||||
if data:
|
if data:
|
||||||
text = "Press 'spacebar' to choose SlackBuild for view"
|
text = "Press 'spacebar' to choose SlackBuild for view"
|
||||||
title = " SlackBuilds.org "
|
title = " SlackBuilds.org "
|
||||||
backtitle = "{0} {1}".format(_meta_.__all__, _meta_.__version__)
|
backtitle = f"{_meta_.__all__} {_meta_.__version__}"
|
||||||
status = False
|
status = False
|
||||||
pkg = DialogUtil(data, text, title, backtitle, status).checklist()
|
pkg = DialogUtil(data, text, title, backtitle, status).checklist()
|
||||||
if pkg and len(pkg) > 1:
|
if pkg and len(pkg) > 1:
|
||||||
|
@ -367,8 +344,7 @@ class SBoNetwork:
|
||||||
if self.FAULT:
|
if self.FAULT:
|
||||||
print()
|
print()
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| Package {0} {1} {2} {3}".format(self.prgnam, self.red,
|
print(f"| Package {self.prgnam} {self.red} {self.FAULT} {self.endc}")
|
||||||
self.FAULT, self.endc))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
else:
|
else:
|
||||||
sources = []
|
sources = []
|
||||||
|
@ -391,6 +367,5 @@ class SBoNetwork:
|
||||||
"""Install SBo package found in /tmp directory.
|
"""Install SBo package found in /tmp directory.
|
||||||
"""
|
"""
|
||||||
binary = slack_package(self.prgnam)
|
binary = slack_package(self.prgnam)
|
||||||
print("[ {0}Installing{1} ] --> {2}".format(self.green, self.endc,
|
print(f"[ {self.green}Installing{self.endc} ] --> {self.name}")
|
||||||
self.name))
|
|
||||||
PackageManager(binary).upgrade(flag="--install-new")
|
PackageManager(binary).upgrade(flag="--install-new")
|
||||||
|
|
|
@ -50,6 +50,9 @@ class QueuePkgs:
|
||||||
"#\n"
|
"#\n"
|
||||||
]
|
]
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
self.green = _meta_.color["GREEN"]
|
||||||
|
self.red = _meta_.color["RED"]
|
||||||
|
self.endc = _meta_.color["ENDC"]
|
||||||
self.quit = False
|
self.quit = False
|
||||||
self.queue = self.meta.lib_path + "queue/"
|
self.queue = self.meta.lib_path + "queue/"
|
||||||
self.queue_list = self.queue + "queue_list"
|
self.queue_list = self.queue + "queue_list"
|
||||||
|
@ -82,8 +85,7 @@ class QueuePkgs:
|
||||||
print("\nPackages in the queue:\n")
|
print("\nPackages in the queue:\n")
|
||||||
for pkg in self.packages():
|
for pkg in self.packages():
|
||||||
if pkg:
|
if pkg:
|
||||||
print("{0}{1}{2}".format(self.meta.color["GREEN"], pkg,
|
print(f"{self.green}{pkg}{self.endc}")
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
self.quit = True
|
self.quit = True
|
||||||
if self.quit:
|
if self.quit:
|
||||||
print() # new line at exit
|
print() # new line at exit
|
||||||
|
@ -98,13 +100,11 @@ class QueuePkgs:
|
||||||
for pkg in pkgs:
|
for pkg in pkgs:
|
||||||
find = sbo_search_pkg(pkg)
|
find = sbo_search_pkg(pkg)
|
||||||
if pkg not in queue_list and find is not None:
|
if pkg not in queue_list and find is not None:
|
||||||
print("{0}{1}{2}".format(self.meta.color["GREEN"], pkg,
|
print(f"{self.green}{pkg}{self.endc}")
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
queue.write(pkg + "\n")
|
queue.write(pkg + "\n")
|
||||||
self.quit = True
|
self.quit = True
|
||||||
else:
|
else:
|
||||||
print("{0}{1}{2}".format(self.meta.color["RED"], pkg,
|
print(f"{self.red}{pkg}{self.endc}")
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
self.quit = True
|
self.quit = True
|
||||||
queue.close()
|
queue.close()
|
||||||
if self.quit:
|
if self.quit:
|
||||||
|
@ -119,8 +119,7 @@ class QueuePkgs:
|
||||||
if line not in pkgs:
|
if line not in pkgs:
|
||||||
queue.write(line + "\n")
|
queue.write(line + "\n")
|
||||||
else:
|
else:
|
||||||
print("{0}{1}{2}".format(self.meta.color["RED"], line,
|
print(f"{self.red}{line}{self.endc}")
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
self.quit = True
|
self.quit = True
|
||||||
queue.close()
|
queue.close()
|
||||||
if self.quit:
|
if self.quit:
|
||||||
|
@ -161,13 +160,13 @@ class QueuePkgs:
|
||||||
print() # new line at start
|
print() # new line at start
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
ver = SBoGrep(pkg).version()
|
ver = SBoGrep(pkg).version()
|
||||||
prgnam = "{0}-{1}".format(pkg, ver)
|
prgnam = f"{pkg}-{ver}"
|
||||||
if find_package(prgnam, self.meta.output):
|
if find_package(prgnam, self.meta.output):
|
||||||
binary = slack_package(prgnam)
|
binary = slack_package(prgnam)
|
||||||
PackageManager(binary).upgrade(flag="--install-new")
|
PackageManager(binary).upgrade(flag="--install-new")
|
||||||
else:
|
else:
|
||||||
print("\nPackage {0} not found in the {1} for "
|
print(f"\nPackage {prgnam} not found in the {self.meta.output} for "
|
||||||
"installation\n".format(prgnam, self.meta.output))
|
f"installation\n")
|
||||||
else:
|
else:
|
||||||
print("\nPackages not found in the queue for installation\n")
|
print("\nPackages not found in the queue for installation\n")
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|
|
@ -34,7 +34,7 @@ def sbo_search_pkg(name):
|
||||||
return url
|
return url
|
||||||
"""
|
"""
|
||||||
repo = Repo().default_repository()["sbo"]
|
repo = Repo().default_repository()["sbo"]
|
||||||
sbo_url = "{0}{1}/".format(repo, slack_ver())
|
sbo_url = f"{repo}{slack_ver()}/"
|
||||||
SLACKBUILDS_TXT = Utils().read_file(
|
SLACKBUILDS_TXT = Utils().read_file(
|
||||||
_meta_.lib_path + "sbo_repo/SLACKBUILDS.TXT")
|
_meta_.lib_path + "sbo_repo/SLACKBUILDS.TXT")
|
||||||
for line in SLACKBUILDS_TXT.splitlines():
|
for line in SLACKBUILDS_TXT.splitlines():
|
||||||
|
|
|
@ -57,6 +57,10 @@ class SBoInstall:
|
||||||
pkg_security(self.slackbuilds)
|
pkg_security(self.slackbuilds)
|
||||||
self.flag = flag
|
self.flag = flag
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
self.green = _meta_.color["GREEN"]
|
||||||
|
self.yellow = _meta_.color["YELLOW"]
|
||||||
|
self.grey = _meta_.color["GREY"]
|
||||||
|
self.endc = _meta_.color["ENDC"]
|
||||||
self.msg = Msg()
|
self.msg = Msg()
|
||||||
self.arch = SBoArch().get()
|
self.arch = SBoArch().get()
|
||||||
self.build_folder = self.meta.build_path
|
self.build_folder = self.meta.build_path
|
||||||
|
@ -145,19 +149,15 @@ class SBoInstall:
|
||||||
if self.match and [""] != self.slackbuilds:
|
if self.match and [""] != self.slackbuilds:
|
||||||
print("\nMatching summary")
|
print("\nMatching summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("Total {0} matching packages\n".format(count_total))
|
print(f"Total {count_total} matching packages\n")
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total {1} {2}.".format(
|
print(f"{self.grey}Total {count_total} {self.msg.pkg(count_total)}.")
|
||||||
self.meta.color["GREY"], count_total,
|
print(f"{self.count_uni} {self.msg.pkg(self.count_uni)} will be installed, "
|
||||||
self.msg.pkg(count_total)))
|
f"{self.count_ins} already installed and "
|
||||||
print("{0} {1} will be installed, {2} already installed and "
|
f"{self.count_upg} {self.msg.pkg(self.count_upg)}")
|
||||||
"{3} {4}".format(self.count_uni,
|
print(f"will be upgraded.{self.endc}\n")
|
||||||
self.msg.pkg(self.count_uni),
|
|
||||||
self.count_ins, self.count_upg,
|
|
||||||
self.msg.pkg(self.count_upg)))
|
|
||||||
print("will be upgraded.{0}\n".format(self.meta.color["ENDC"]))
|
|
||||||
self.continue_to_install()
|
self.continue_to_install()
|
||||||
else:
|
else:
|
||||||
self.msg.not_found(self.is_upgrade)
|
self.msg.not_found(self.is_upgrade)
|
||||||
|
@ -178,9 +178,10 @@ class SBoInstall:
|
||||||
def update_deps(self):
|
def update_deps(self):
|
||||||
"""Update dependencies dictionary with all package
|
"""Update dependencies dictionary with all package
|
||||||
"""
|
"""
|
||||||
|
utils = Utils()
|
||||||
onelist, dependencies = [], []
|
onelist, dependencies = [], []
|
||||||
onelist = Utils().dimensional_list(self.deps)
|
onelist = utils.dimensional_list(self.deps)
|
||||||
dependencies = Utils().remove_dbs(onelist)
|
dependencies = utils.remove_dbs(onelist)
|
||||||
for dep in dependencies:
|
for dep in dependencies:
|
||||||
deps = Requires(self.flag).sbo(dep)
|
deps = Requires(self.flag).sbo(dep)
|
||||||
self.deps_dict[dep] = self.one_for_all(deps)
|
self.deps_dict[dep] = self.one_for_all(deps)
|
||||||
|
@ -227,7 +228,7 @@ class SBoInstall:
|
||||||
sbo_versions, sources = [], []
|
sbo_versions, sources = [], []
|
||||||
for sbo in slackbuilds:
|
for sbo in slackbuilds:
|
||||||
status(0.02)
|
status(0.02)
|
||||||
sbo_ver = "{0}-{1}".format(sbo, SBoGrep(sbo).version())
|
sbo_ver = f"{sbo}-{SBoGrep(sbo).version()}"
|
||||||
sbo_versions.append(sbo_ver)
|
sbo_versions.append(sbo_ver)
|
||||||
sources.append(SBoGrep(sbo).source())
|
sources.append(SBoGrep(sbo).source())
|
||||||
return [sbo_versions, sources]
|
return [sbo_versions, sources]
|
||||||
|
@ -250,13 +251,12 @@ class SBoInstall:
|
||||||
"""View top template
|
"""View top template
|
||||||
"""
|
"""
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
|
print(f"| Packages{' ' * 16}"
|
||||||
"| Package", " " * 17,
|
f"New version{' ' * 8}"
|
||||||
"New version", " " * 8,
|
f"Arch{' ' * 4}"
|
||||||
"Arch", " " * 4,
|
f"Build{' ' * 2}"
|
||||||
"Build", " " * 2,
|
f"Repos{' ' * 10}"
|
||||||
"Repos", " " * 10,
|
f"Size")
|
||||||
"Size"))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
|
|
||||||
def view_packages(self, *args):
|
def view_packages(self, *args):
|
||||||
|
@ -267,12 +267,11 @@ class SBoInstall:
|
||||||
args[3] arch
|
args[3] arch
|
||||||
"""
|
"""
|
||||||
ver = GetFromInstalled(args[1]).version()
|
ver = GetFromInstalled(args[1]).version()
|
||||||
print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>11}{12}".format(
|
print(f" {args[0]}{args[1] + ver}{self.endc}"
|
||||||
args[0], args[1] + ver, self.meta.color["ENDC"],
|
f"{' ' * (24-len(args[1] + ver))}{args[2]}"
|
||||||
" " * (23-len(args[1] + ver)), args[2],
|
f"{' ' * (18-len(args[2]))} {args[3]}"
|
||||||
" " * (18-len(args[2])), args[3],
|
f"{' ' * (15-len(args[3]))}{''}"
|
||||||
" " * (15-len(args[3])), "",
|
f"{''}SBo{''}{'':>11}{''}")
|
||||||
"", "SBo", "", "").rstrip())
|
|
||||||
|
|
||||||
def tag(self, sbo):
|
def tag(self, sbo):
|
||||||
"""Tag with color green if package already installed,
|
"""Tag with color green if package already installed,
|
||||||
|
@ -337,9 +336,7 @@ class SBoInstall:
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
elif self.unst[0] in src_link or self.unst[1] in src_link:
|
elif self.unst[0] in src_link or self.unst[1] in src_link:
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| Package {0} {1}{2}{3}".format(
|
print(f"| Package {prgnam} {self.red}{''.join(src_link)}{self.endc}")
|
||||||
prgnam, self.meta.color["RED"], "".join(src_link),
|
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
else:
|
else:
|
||||||
sbo_url = sbo_search_pkg(pkg)
|
sbo_url = sbo_search_pkg(pkg)
|
||||||
|
@ -358,14 +355,10 @@ class SBoInstall:
|
||||||
binary = slack_package(prgnam)
|
binary = slack_package(prgnam)
|
||||||
if os.path.isfile("".join(binary)):
|
if os.path.isfile("".join(binary)):
|
||||||
if GetFromInstalled(pkg).name() == pkg:
|
if GetFromInstalled(pkg).name() == pkg:
|
||||||
print("[ {0}Upgrading{1} ] --> {2}".format(
|
print(f"[ {self.yellow}Upgrading{self.endc} ] --> {prgnam}")
|
||||||
self.meta.color["YELLOW"],
|
|
||||||
self.meta.color["ENDC"], prgnam))
|
|
||||||
upgraded.append(prgnam)
|
upgraded.append(prgnam)
|
||||||
else:
|
else:
|
||||||
print("[ {0}Installing{1} ] --> {2}".format(
|
print(f"[ {self.green}Installing{self.endc} ] --> {prgnam}")
|
||||||
self.meta.color["GREEN"],
|
|
||||||
self.meta.color["ENDC"], prgnam))
|
|
||||||
installs.append(prgnam)
|
installs.append(prgnam)
|
||||||
if ("--rebuild" in self.flag and
|
if ("--rebuild" in self.flag and
|
||||||
GetFromInstalled(pkg).name() == pkg):
|
GetFromInstalled(pkg).name() == pkg):
|
||||||
|
@ -384,8 +377,8 @@ class SBoInstall:
|
||||||
ins_ver = "0"
|
ins_ver = "0"
|
||||||
if parse_version(sbo_ver) < parse_version(ins_ver):
|
if parse_version(sbo_ver) < parse_version(ins_ver):
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| Package {0} don't downgrade, "
|
print(f"| Package {name} don't downgrade, "
|
||||||
"setting by user".format(name))
|
f"setting by user")
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -393,9 +386,8 @@ class SBoInstall:
|
||||||
"""Alternative repository for sbo sources"""
|
"""Alternative repository for sbo sources"""
|
||||||
sources = []
|
sources = []
|
||||||
name = "-".join(prgnam.split("-")[:-1])
|
name = "-".join(prgnam.split("-")[:-1])
|
||||||
category = "{0}/{1}/".format(sbo_link.split("/")[-2], name)
|
category = f"{sbo_link.split('/')[-2]}/{name}/"
|
||||||
for link in src_link:
|
for link in src_link:
|
||||||
source = link.split("/")[-1]
|
source = link.split("/")[-1]
|
||||||
sources.append("{0}{1}{2}".format(self.meta.sbosrcarch_link,
|
sources.append(f"{self.meta.sbosrcarch_link}{category}{source}")
|
||||||
category, source))
|
|
||||||
return sources
|
return sources
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
def units(comp_sum, uncomp_sum):
|
def units(comp_sum, uncomp_sum):
|
||||||
"""Calculate package size
|
"""Calculate package size
|
||||||
"""
|
"""
|
||||||
|
print(comp_sum, uncomp_sum)
|
||||||
compressed = round((sum(map(float, comp_sum)) / 1024), 2)
|
compressed = round((sum(map(float, comp_sum)) / 1024), 2)
|
||||||
uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2)
|
uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2)
|
||||||
comp_unit = uncomp_unit = "Mb"
|
comp_unit = uncomp_unit = "Mb"
|
||||||
|
@ -40,4 +41,5 @@ def units(comp_sum, uncomp_sum):
|
||||||
if uncompressed < 1:
|
if uncompressed < 1:
|
||||||
uncompressed = sum(map(int, uncomp_sum))
|
uncompressed = sum(map(int, uncomp_sum))
|
||||||
uncomp_unit = "Kb"
|
uncomp_unit = "Kb"
|
||||||
return [comp_unit, uncomp_unit], [compressed, uncompressed]
|
print(comp_unit, uncomp_unit, compressed, uncompressed)
|
||||||
|
return [comp_unit, uncomp_unit], [compressed, uncompressed]
|
|
@ -38,17 +38,17 @@ def mirrors(name, location):
|
||||||
repo = Repo().slack()
|
repo = Repo().slack()
|
||||||
if _meta_.arch == "x86_64":
|
if _meta_.arch == "x86_64":
|
||||||
if rel == "stable":
|
if rel == "stable":
|
||||||
http = repo + "slackware64-{0}/{1}{2}".format(ver, location, name)
|
http = f"{repo}slackware64-{ver}/{location}{name}"
|
||||||
else:
|
else:
|
||||||
http = repo + "slackware64-{0}/{1}{2}".format(rel, location, name)
|
http = f"{repo}slackware64-{rel}/{location}{name}"
|
||||||
elif _meta_.arch.startswith("arm"):
|
elif _meta_.arch.startswith("arm"):
|
||||||
if rel == "stable":
|
if rel == "stable":
|
||||||
http = repo + "slackwarearm-{0}/{1}{2}".format(ver, location, name)
|
http = f"{repo}slackwarearm-{ver}/{location}{name}"
|
||||||
else:
|
else:
|
||||||
http = repo + "slackwarearm-{0}/{1}{2}".format(rel, location, name)
|
http = f"{repo}slackwarearm-{rel}/{location}{name}"
|
||||||
else:
|
else:
|
||||||
if rel == "stable":
|
if rel == "stable":
|
||||||
http = repo + "slackware-{0}/{1}{2}".format(ver, location, name)
|
http = f"{repo}slackware-{ver}/{location}{name}"
|
||||||
else:
|
else:
|
||||||
http = repo + "slackware-{0}/{1}{2}".format(rel, location, name)
|
http = f"{repo}slackware-{rel}/{location}{name}"
|
||||||
return http
|
return http
|
||||||
|
|
|
@ -58,6 +58,11 @@ class Patches:
|
||||||
self.skip = skip
|
self.skip = skip
|
||||||
self.flag = flag
|
self.flag = flag
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
self.grey = _meta_.color["GREY"]
|
||||||
|
self.yellow = _meta_.color["YELLOW"]
|
||||||
|
self.green = _meta_.color["GREEN"]
|
||||||
|
self.red = _meta_.color["RED"]
|
||||||
|
self.endc = _meta_.color["ENDC"]
|
||||||
self.msg = Msg()
|
self.msg = Msg()
|
||||||
self.version = self.meta.slack_rel
|
self.version = self.meta.slack_rel
|
||||||
self.patch_path = self.meta.slpkg_tmp_patches
|
self.patch_path = self.meta.slpkg_tmp_patches
|
||||||
|
@ -89,29 +94,20 @@ class Patches:
|
||||||
self.dialog_checklist()
|
self.dialog_checklist()
|
||||||
print("\nThese packages need upgrading:\n")
|
print("\nThese packages need upgrading:\n")
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
|
print(f"| Package{' ' * 17}New Version{' ' * 8}Arch"
|
||||||
"| Package", " " * 17,
|
f"{' ' * 4}Build{' ' * 2}Repo{' ' * 11}Size")
|
||||||
"New Version", " " * 8,
|
|
||||||
"Arch", " " * 4,
|
|
||||||
"Build", " " * 2,
|
|
||||||
"Repos", " " * 10,
|
|
||||||
"Size"))
|
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("Upgrading:")
|
print("Upgrading:")
|
||||||
self.views()
|
self.views()
|
||||||
unit, size = units(self.comp_sum, self.uncomp_sum)
|
unit, size = units(self.comp_sum, self.uncomp_sum)
|
||||||
print("\nInstalling summary")
|
print("\nInstalling summary")
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
print("{0}Total {1} {2} will be upgraded and {3} will be "
|
print(f"{self.grey}Total {self.count_upg}"
|
||||||
"installed.".format(self.meta.color["GREY"],
|
f"{self.msg.pkg(len(self.upgrade_all))} will be upgraded and"
|
||||||
self.count_upg,
|
f" {self.count_added} will be installed.")
|
||||||
self.msg.pkg(len(self.upgrade_all)),
|
print(f"Need to get {size[0]} {unit[0]} of archives.")
|
||||||
self.count_added))
|
print(f"After this process, {size[1]} {unit[1]} of additional disk space "
|
||||||
print("Need to get {0} {1} of archives.".format(size[0],
|
f"will be used.{self.endc}")
|
||||||
unit[0]))
|
|
||||||
print("After this process, {0} {1} of additional disk space "
|
|
||||||
"will be used.{2}".format(size[1], unit[1],
|
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
print()
|
print()
|
||||||
if self.msg.answer() in ["y", "Y"]:
|
if self.msg.answer() in ["y", "Y"]:
|
||||||
Download(self.patch_path, self.dwn_links,
|
Download(self.patch_path, self.dwn_links,
|
||||||
|
@ -132,8 +128,8 @@ class Patches:
|
||||||
slack_arch = ""
|
slack_arch = ""
|
||||||
if self.meta.arch == "x86_64":
|
if self.meta.arch == "x86_64":
|
||||||
slack_arch = "64"
|
slack_arch = "64"
|
||||||
print("\nSlackware{0} '{1}' v{2} distribution is up to "
|
print(f"\nSlackware{slack_arch} '{self.version}' v{slack_ver()}"
|
||||||
"date!\n".format(slack_arch, self.version, slack_ver()))
|
f"distribution is up to date!\n")
|
||||||
|
|
||||||
def store(self):
|
def store(self):
|
||||||
"""
|
"""
|
||||||
|
@ -147,8 +143,7 @@ class Patches:
|
||||||
if (not os.path.isfile(self.meta.pkg_path + name[:-4]) and
|
if (not os.path.isfile(self.meta.pkg_path + name[:-4]) and
|
||||||
repo_pkg_name not in black and
|
repo_pkg_name not in black and
|
||||||
repo_pkg_name not in self.skip):
|
repo_pkg_name not in self.skip):
|
||||||
self.dwn_links.append("{0}{1}/{2}".format(mirrors("", ""),
|
self.dwn_links.append(f"{mirrors('', '')}{loc}/{name}")
|
||||||
loc, name))
|
|
||||||
self.comp_sum.append(comp)
|
self.comp_sum.append(comp)
|
||||||
self.uncomp_sum.append(uncomp)
|
self.uncomp_sum.append(uncomp)
|
||||||
self.upgrade_all.append(name)
|
self.upgrade_all.append(name)
|
||||||
|
@ -167,8 +162,7 @@ class Patches:
|
||||||
data.append(upg[:-4])
|
data.append(upg[:-4])
|
||||||
text = "Press 'spacebar' to unchoose packages from upgrade"
|
text = "Press 'spacebar' to unchoose packages from upgrade"
|
||||||
title = " Upgrade "
|
title = " Upgrade "
|
||||||
backtitle = "{0} {1}".format(self.meta.__all__,
|
backtitle = f"{self.meta.__all__} {self.meta.__version__}"
|
||||||
self.meta.__version__)
|
|
||||||
status = True
|
status = True
|
||||||
pkgs = DialogUtil(data, text, title, backtitle,
|
pkgs = DialogUtil(data, text, title, backtitle,
|
||||||
status).checklist()
|
status).checklist()
|
||||||
|
@ -198,13 +192,11 @@ class Patches:
|
||||||
if pkg_repo[0] == pkg_inst:
|
if pkg_repo[0] == pkg_inst:
|
||||||
color = self.meta.color["YELLOW"]
|
color = self.meta.color["YELLOW"]
|
||||||
ver = GetFromInstalled(pkg_repo[0]).version()
|
ver = GetFromInstalled(pkg_repo[0]).version()
|
||||||
print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>12}{12}".format(
|
print(f" {color}{pkg_repo[0] + ver}{self.endc}"
|
||||||
color, pkg_repo[0] + ver, self.meta.color["ENDC"],
|
f"{' ' * (23-len(pkg_repo[0] + ver))} {pkg_repo[1]}"
|
||||||
" " * (23-len(pkg_repo[0] + ver)), pkg_repo[1],
|
f"{' ' * (18-len(pkg_repo[1]))} {pkg_repo[2]}"
|
||||||
" " * (18-len(pkg_repo[1])), pkg_repo[2],
|
f"{' ' * (8-len(pkg_repo[2]))}{pkg_repo[3]}"
|
||||||
" " * (8-len(pkg_repo[2])), pkg_repo[3],
|
f"{' ' * (7-len(pkg_repo[3]))}Slack{size:>12} K")
|
||||||
" " * (7-len(pkg_repo[3])), "Slack",
|
|
||||||
size, " K").rstrip())
|
|
||||||
|
|
||||||
def upgrade(self):
|
def upgrade(self):
|
||||||
"""
|
"""
|
||||||
|
@ -213,20 +205,15 @@ class Patches:
|
||||||
for pkg in self.upgrade_all:
|
for pkg in self.upgrade_all:
|
||||||
check_md5(pkg_checksum(pkg, "slack_patches"),
|
check_md5(pkg_checksum(pkg, "slack_patches"),
|
||||||
self.patch_path + pkg)
|
self.patch_path + pkg)
|
||||||
pkg_ver = "{0}-{1}".format(split_package(pkg)[0],
|
pkg_ver = f"{split_package(pkg)[0]}-{split_package(pkg)[1]}"
|
||||||
split_package(pkg)[1])
|
|
||||||
if find_package(split_package(pkg)[0] + self.meta.sp,
|
if find_package(split_package(pkg)[0] + self.meta.sp,
|
||||||
self.meta.pkg_path):
|
self.meta.pkg_path):
|
||||||
print("[ {0}upgrading{1} ] --> {2}".format(
|
print(f"[ {self.yellow}upgrading{self.endc} ] --> {pkg[:-4]}")
|
||||||
self.meta.color["YELLOW"], self.meta.color["ENDC"],
|
|
||||||
pkg[:-4]))
|
|
||||||
PackageManager((self.patch_path + pkg).split()).upgrade(
|
PackageManager((self.patch_path + pkg).split()).upgrade(
|
||||||
"--install-new")
|
"--install-new")
|
||||||
self.upgraded.append(pkg_ver)
|
self.upgraded.append(pkg_ver)
|
||||||
else:
|
else:
|
||||||
print("[ {0}installing{1} ] --> {2}".format(
|
print(f"[ {self.green}installing{self.endc} ] --> {pkg[:-4]}")
|
||||||
self.meta.color["GREEN"], self.meta.color["ENDC"],
|
|
||||||
pkg[:-4]))
|
|
||||||
PackageManager((self.patch_path + pkg).split()).upgrade(
|
PackageManager((self.patch_path + pkg).split()).upgrade(
|
||||||
"--install-new")
|
"--install-new")
|
||||||
self.installed.append(pkg_ver)
|
self.installed.append(pkg_ver)
|
||||||
|
@ -243,9 +230,8 @@ class Patches:
|
||||||
else:
|
else:
|
||||||
print()
|
print()
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
print("| {0}*** HIGHLY recommended reinstall boot loader "
|
print(f"| {self.red}*** HIGHLY recommended reinstall "
|
||||||
"***{1}".format(self.meta.color["RED"],
|
f"boot loader ***{self.endc}")
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
print("| L=lilo / E=elilo / G=grub")
|
print("| L=lilo / E=elilo / G=grub")
|
||||||
self.msg.template(78)
|
self.msg.template(78)
|
||||||
try:
|
try:
|
||||||
|
@ -269,8 +255,6 @@ class Patches:
|
||||||
"""This replace slackpkg ChangeLog.txt file with new
|
"""This replace slackpkg ChangeLog.txt file with new
|
||||||
from Slackware official mirrors after update distribution.
|
from Slackware official mirrors after update distribution.
|
||||||
"""
|
"""
|
||||||
print(mirrors("ChangeLog.txt", ""))
|
|
||||||
|
|
||||||
NEW_ChangeLog_txt = URL(mirrors("ChangeLog.txt", "")).reading()
|
NEW_ChangeLog_txt = URL(mirrors("ChangeLog.txt", "")).reading()
|
||||||
if os.path.isfile(self.meta.slackpkg_lib_path + "ChangeLog.txt.old"):
|
if os.path.isfile(self.meta.slackpkg_lib_path + "ChangeLog.txt.old"):
|
||||||
os.remove(self.meta.slackpkg_lib_path + "ChangeLog.txt.old")
|
os.remove(self.meta.slackpkg_lib_path + "ChangeLog.txt.old")
|
||||||
|
@ -285,8 +269,7 @@ class Patches:
|
||||||
"""Update packages list and ChangeLog.txt file after
|
"""Update packages list and ChangeLog.txt file after
|
||||||
upgrade distribution
|
upgrade distribution
|
||||||
"""
|
"""
|
||||||
print("{0}Update the package lists ?{1}".format(
|
print(f"{self.green}Update the package lists ?{self.endc}")
|
||||||
self.meta.color["GREEN"], self.meta.color["ENDC"]))
|
|
||||||
print("=" * 79)
|
print("=" * 79)
|
||||||
if self.msg.answer() in ["y", "Y"]:
|
if self.msg.answer() in ["y", "Y"]:
|
||||||
Update().repository(["slack"])
|
Update().repository(["slack"])
|
|
@ -34,7 +34,6 @@ def status(sec):
|
||||||
if _meta_.prg_bar in ["on", "ON"]:
|
if _meta_.prg_bar in ["on", "ON"]:
|
||||||
syms = ["|", "/", "-", "\\"]
|
syms = ["|", "/", "-", "\\"]
|
||||||
for sym in syms:
|
for sym in syms:
|
||||||
print("\b{0}{1}{2}".format(_meta_.color["GREY"], sym,
|
print(f"\b{_meta_.color['GREY']}{sym}{_meta_.color['ENDC']}", end="")
|
||||||
_meta_.color["ENDC"]), end="")
|
|
||||||
print(end="", flush=True)
|
print(end="", flush=True)
|
||||||
time.sleep(float(sec))
|
time.sleep(float(sec))
|
||||||
|
|
|
@ -81,20 +81,16 @@ class TrackingDeps:
|
||||||
pkg_len = len(self.name) + 24
|
pkg_len = len(self.name) + 24
|
||||||
print() # new line at start
|
print() # new line at start
|
||||||
self.msg.template(pkg_len)
|
self.msg.template(pkg_len)
|
||||||
print("| Package {0}{1}{2} dependencies :".format(
|
print(f"| Package {self.cyan}{self.name}{self.endc} dependencies :")
|
||||||
self.cyan, self.name, self.endc))
|
|
||||||
self.msg.template(pkg_len)
|
self.msg.template(pkg_len)
|
||||||
print("\\")
|
print("\\")
|
||||||
print(" +---{0}[ Tree of dependencies ]{1}".format(self.yellow,
|
print(f" +---{self.yellow}[ Tree of dependencies ]{self.endc}")
|
||||||
self.endc))
|
|
||||||
index = 0
|
index = 0
|
||||||
for pkg in self.dependencies:
|
for pkg in self.dependencies:
|
||||||
if "--check-deps" in self.flag:
|
if "--check-deps" in self.flag:
|
||||||
used = self.check_used(pkg)
|
used = self.check_used(pkg)
|
||||||
self.deps_used(pkg, used)
|
self.deps_used(pkg, used)
|
||||||
used = "{0} {1}{2}{3}".format(
|
used = f"is dependence on --> {self.cyan}{', '.join(used)}{self.endc}"
|
||||||
"is dependence on -->", self.cyan,
|
|
||||||
", ".join(used), self.endc)
|
|
||||||
else:
|
else:
|
||||||
used = ""
|
used = ""
|
||||||
index += 1
|
index += 1
|
||||||
|
@ -103,14 +99,10 @@ class TrackingDeps:
|
||||||
if self.meta.use_colors in ["off", "OFF"]:
|
if self.meta.use_colors in ["off", "OFF"]:
|
||||||
installed = "* "
|
installed = "* "
|
||||||
print(" |")
|
print(" |")
|
||||||
print(" {0}{1}: {2}{3}{4} {5}{6}".format(
|
print(f" +--{index}: {self.green}{pkg}{self.endc} {installed}{used}")
|
||||||
"+--", index, self.green, pkg,
|
|
||||||
self.endc, installed, used))
|
|
||||||
else:
|
else:
|
||||||
print(" |")
|
print(" |")
|
||||||
print(" {0}{1}: {2}{3}{4} {5}".format(
|
print(f" +--{index}: {self.red}{pkg}{self.endc} {installed}")
|
||||||
"+--", index, self.red, pkg,
|
|
||||||
self.endc, installed))
|
|
||||||
if self.meta.use_colors in ["off", "OFF"]:
|
if self.meta.use_colors in ["off", "OFF"]:
|
||||||
print("\n * = Installed\n")
|
print("\n * = Installed\n")
|
||||||
else:
|
else:
|
||||||
|
@ -132,7 +124,7 @@ class TrackingDeps:
|
||||||
self.dependencies_list = Requires(self.flag).sbo(self.name)
|
self.dependencies_list = Requires(self.flag).sbo(self.name)
|
||||||
else:
|
else:
|
||||||
PACKAGES_TXT = Utils().read_file(
|
PACKAGES_TXT = Utils().read_file(
|
||||||
self.meta.lib_path + "{0}_repo/PACKAGES.TXT".format(self.repo))
|
self.meta.lib_path + f"{self.repo}_repo/PACKAGES.TXT")
|
||||||
self.names = Utils().package_name(PACKAGES_TXT)
|
self.names = Utils().package_name(PACKAGES_TXT)
|
||||||
self.bin_case_insensitive()
|
self.bin_case_insensitive()
|
||||||
self.find_pkg = search_pkg(self.name, self.repo)
|
self.find_pkg = search_pkg(self.name, self.repo)
|
||||||
|
|
|
@ -31,19 +31,19 @@ from slpkg.pkg.installed import GetFromInstalled
|
||||||
|
|
||||||
|
|
||||||
def choose_upg(packages):
|
def choose_upg(packages):
|
||||||
"""Create checklist to choose packages for upgrade
|
"""Creating checklist to choose packages for upgrade
|
||||||
"""
|
"""
|
||||||
selected_packages, data = [], []
|
selected_packages, data = [], []
|
||||||
if packages:
|
if packages:
|
||||||
for pkg in packages:
|
for pkg in packages:
|
||||||
name = GetFromInstalled(pkg).name()
|
name = GetFromInstalled(pkg).name()
|
||||||
ver = GetFromInstalled(pkg).version()
|
ver = GetFromInstalled(pkg).version()
|
||||||
binary = "{0}{1}".format(name, ver)
|
binary = f"{name}{ver}"
|
||||||
installed = find_package(binary + _meta_.sp, _meta_.pkg_path)[0]
|
installed = find_package(binary + _meta_.sp, _meta_.pkg_path)[0]
|
||||||
data.append(installed)
|
data.append(installed)
|
||||||
text = "Press 'spacebar' to unchoose packages from upgrade"
|
text = "Press 'spacebar' to unchoose packages from upgrade"
|
||||||
title = " Upgrade "
|
title = " Upgrade "
|
||||||
backtitle = "{0} {1}".format(_meta_.__all__, _meta_.__version__)
|
backtitle = f"{_meta_.__all__} {_meta_.__version__}"
|
||||||
status = True
|
status = True
|
||||||
pkgs = DialogUtil(data, text, title, backtitle,
|
pkgs = DialogUtil(data, text, title, backtitle,
|
||||||
status).checklist()
|
status).checklist()
|
||||||
|
|
|
@ -33,6 +33,8 @@ class URL:
|
||||||
def __init__(self, link):
|
def __init__(self, link):
|
||||||
self.link = link
|
self.link = link
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
self.red = _meta_.color["RED"]
|
||||||
|
self.endc = _meta_.color["ENDC"]
|
||||||
self.http = urllib3.PoolManager()
|
self.http = urllib3.PoolManager()
|
||||||
|
|
||||||
def reading(self):
|
def reading(self):
|
||||||
|
@ -42,7 +44,5 @@ class URL:
|
||||||
f = self.http.request('GET', self.link)
|
f = self.http.request('GET', self.link)
|
||||||
return f.data.decode("utf-8", "ignore")
|
return f.data.decode("utf-8", "ignore")
|
||||||
except urllib3.exceptions.NewConnectionError:
|
except urllib3.exceptions.NewConnectionError:
|
||||||
print("\n{0}Can't read the file '{1}'{2}".format(
|
print(f"\n{self.red}Can't read the file '{self.link.split('/')[-1]}'{self.endc}")
|
||||||
self.meta.color["RED"], self.link.split("/")[-1],
|
|
||||||
self.meta.color["ENDC"]))
|
|
||||||
return " "
|
return " "
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
from slpkg.splitting import split_package
|
from slpkg.splitting import split_package
|
||||||
|
|
||||||
|
@ -50,18 +51,16 @@ class Utils:
|
||||||
def remove_dbs(self, double):
|
def remove_dbs(self, double):
|
||||||
"""Remove double item from list
|
"""Remove double item from list
|
||||||
"""
|
"""
|
||||||
one = []
|
return list(OrderedDict.fromkeys(double))
|
||||||
for dup in double:
|
|
||||||
if dup not in one:
|
|
||||||
one.append(dup)
|
|
||||||
return one
|
|
||||||
|
|
||||||
def read_file(self, registry):
|
def read_file(self, registry):
|
||||||
"""Returns reading file
|
"""Returns reading file
|
||||||
"""
|
"""
|
||||||
with open(registry, "r") as file_txt:
|
code = self.check_encoding('', registry)
|
||||||
|
if not code:
|
||||||
|
code = "utf-8"
|
||||||
|
with open(registry, "r", encoding=code) as file_txt:
|
||||||
read_file = file_txt.read()
|
read_file = file_txt.read()
|
||||||
file_txt.close()
|
|
||||||
return read_file
|
return read_file
|
||||||
|
|
||||||
def package_name(self, PACKAGES_TXT):
|
def package_name(self, PACKAGES_TXT):
|
||||||
|
@ -102,8 +101,7 @@ class Utils:
|
||||||
else:
|
else:
|
||||||
return file_name
|
return file_name
|
||||||
|
|
||||||
@staticmethod
|
def check_encoding(self, path, f):
|
||||||
def check_encoding(path, f):
|
|
||||||
"""Checking the file encoding default is utf-8
|
"""Checking the file encoding default is utf-8
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
|
11
tests/test_md5sum.py
Normal file
11
tests/test_md5sum.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
from slpkg.md5sum import md5
|
||||||
|
|
||||||
|
|
||||||
|
def test_md5_superuser():
|
||||||
|
result = md5('slpkg/superuser.py')
|
||||||
|
assert result == "e6cebdf37fbc1b8e9d3c5e3e53b300c1"
|
||||||
|
|
||||||
|
|
||||||
|
def test_md5_security():
|
||||||
|
result = md5('slpkg/security.py')
|
||||||
|
assert result == "d395d2fcf1c7b1a91ef6ce3dc8eb047b"
|
5
tests/test_units.py
Normal file
5
tests/test_units.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
from slpkg.sizes import units
|
||||||
|
|
||||||
|
|
||||||
|
def test_units():
|
||||||
|
assert ["Kb", "Kb"], ["100", "100"] == units(['100', ['100']])
|
17
tests/test_utils.py
Normal file
17
tests/test_utils.py
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
from slpkg.utils import Utils
|
||||||
|
|
||||||
|
|
||||||
|
def test_units():
|
||||||
|
assert ["Kb", "Kb"], ["100", "100"] == units(['100', ['100']])
|
||||||
|
|
||||||
|
|
||||||
|
def test_dimensional_list():
|
||||||
|
lists = [[1, 2, 3, 4, 5]]
|
||||||
|
utils = Utils()
|
||||||
|
assert [1, 2, 3, 4, 5] == utils.dimensional_list(lists)
|
||||||
|
|
||||||
|
|
||||||
|
def test_remove_dbs():
|
||||||
|
lists = [1, 2, 3, 3, 4, 5, 2, 1]
|
||||||
|
utils = Utils()
|
||||||
|
assert [1, 2, 3, 4, 5] == utils.remove_dbs(lists)
|
Loading…
Reference in a new issue