Code rewritten

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2022-06-17 17:39:33 +03:00
parent c8e4860fe1
commit 685741efe0
134 changed files with 1069 additions and 15691 deletions

View file

@ -1 +0,0 @@
Dimitris Zlatanidis <d.zlatanidis at gmail.com>

View file

@ -1,151 +0,0 @@
These are the MD5 message digests for the files in this directory.
If you want to test your files, use 'md5sum' and compare the values to
the ones listed here.
To test all these files, use this command:
tail +13 CHECKSUMS.md5 | md5sum -c --quiet - | less
'md5sum' can be found in the GNU coreutils package on ftp.gnu.org in
/pub/gnu, or at any GNU mirror site.
MD5 message digest Filename
74d79364aef2717c00eae3a37c0e7479 ./slpkg-2.1.5.tar.gz
b37d59524be1ce9ef1c4e13e91ceb763 ./slpkg-2.2.0.tar.gz
3b869056c2309ee3f694b2c11f5533bd ./slpkg-2.2.1.tar.gz
c32bc46bcb2f5a7b4fbc681a6cccc3de ./slpkg-2.2.2.tar.gz
3c7259a18644573e116b4836095aebd8 ./slpkg-2.2.3.tar.gz
246571f3f6489dd98a67df3a2d1acb58 ./slpkg-2.2.5.tar.gz
bc70626560b37398bd66a02cc3c9f5ef ./slpkg-2.2.6.tar.gz
abea645bd382aa47500588631c299bb1 ./slpkg-2.2.7.tar.gz
5aa9870ad189864cfed45a910f5136b9 ./slpkg-2.2.8.tar.gz
cd3c213b4c0da976be970e9fe888e5e3 ./slpkg-2.2.9.tar.gz
08a345549a0a3e1de2103c3b4085b880 ./slpkg-2.3.0.tar.gz
ac61b4952462327f7f06f1d5ea11920d ./slpkg-2.3.1.tar.gz
70175c577672fd0f488cb9f5a715a2c3 ./slpkg-2.3.2.tar.gz
1f7b391e2e3e4f414f58660b094775d8 ./slpkg-2.3.3.tar.gz
141433a4e78e96b4efb0a2e32d75c1be ./slpkg-2.3.4.tar.gz
93b7a0d94695526e1821e3b04685b58f ./slpkg-2.3.5.tar.gz
d0bef671bb8a3f8def08e289f7a84b65 ./slpkg-2.3.6.tar.gz
03f8b36727bf10b46d78c581266670db ./slpkg-2.4.0.tar.gz
9f422c008b25820eb55202989f2871da ./slpkg-2.4.1.tar.gz
ae5ca3128a6ad05b3061541b088f3a1f ./slpkg-2.4.2.tar.gz
8b48e7080bd5363e8752666b9bf583e9 ./slpkg-2.4.3.tar.gz
41552b535b00cd03488d87060e561e05 ./slpkg-2.4.4.tar.gz
4df3325bbf2f67629a41ce498e55f2a6 ./slpkg-2.5.0.tar.gz
e4c638055b82a4590695e5c6b269aa53 ./slpkg-2.5.1.tar.gz
60e6bc9cfa456637112a942a461e6619 ./slpkg-2.5.2.tar.gz
0375ac84e760f51f1d575d96f3ba7fbf ./slpkg-2.5.3.tar.gz
205589985bf31249e6f1ab5c68c18e44 ./slpkg-2.5.4.tar.gz
dff6a5c677311f9c4d17e45088ef2f58 ./slpkg-2.5.5.tar.gz
7936eabe05be9acee42df45f75bc8107 ./slpkg-2.5.6.tar.gz
fd031880db1f60aa90eef0e0fc9a106b ./slpkg-2.5.7.tar.gz
9f8f748ab7ab99799a9e55891b11130c ./slpkg-2.5.8.tar.gz
cbc5213680f8db5c1283923ff07b066f ./slpkg-2.5.9.tar.gz
f6cb268e56051a958538c4182870f241 ./slpkg-2.6.0.tar.gz
8c7fde89ba7658d3505c88d5b7dd1b40 ./slpkg-2.6.1.tar.gz
1f0cca089df4d157201730f27afa4765 ./slpkg-2.6.2.tar.gz
95ccc27545a259087e0dd0b666cbb686 ./slpkg-2.6.3.tar.gz
8584d7d9d3666a93f6d14f5e42e4cb41 ./slpkg-2.6.4.tar.gz
2240d34cc28c69846ad47bea473f25e4 ./slpkg-2.6.5.tar.gz
e6ed625b553fd2f24f149162e4fa735f ./slpkg-2.6.6.tar.gz
48a3941cd990a1a037f11d989d2e5be0 ./slpkg-2.6.7.tar.gz
4f2df9ad3ffc303373e26200544d4af4 ./slpkg-2.6.8.tar.gz
f348ca49b0d8419f170f2211399a0851 ./slpkg-2.6.9.tar.gz
a41dbb2b95c34bd31319addcae0f1e49 ./slpkg-2.7.0.tar.gz
28ec4b26e87188f1ebf1eb0a8fcb64e2 ./slpkg-2.7.1.tar.gz
4a110faf3df50c336678b410736295e3 ./slpkg-2.7.2.tar.gz
18cb0f66a8a5fb27e9170efd59a7e1df ./slpkg-2.7.3.tar.gz
86579033c8789b5896a36b377508d367 ./slpkg-2.7.4.tar.gz
12dd03c8ed172eebc41f9ed84993780b ./slpkg-2.7.5.tar.gz
4484ede82d667badb6dd22873d2da785 ./slpkg-2.7.6.tar.gz
3bb2cb5f2427fa9024af8df9e6a6d51d ./slpkg-2.8.0.tar.gz
7545f9dbce24deb9b4b69d7303c00f28 ./slpkg-2.8.1.tar.gz
8158ab7fe2555a24553c9efa6d6f8ac9 ./slpkg-2.8.2.tar.gz
d6842f77b159a9f9db8183c10abcb83f ./slpkg-2.8.3.tar.gz
5247eb52e9864a1dd4d134893227a7a4 ./slpkg-2.8.4.tar.gz
64a22e9fbf7a6bc04b6f544609322434 ./slpkg-2.8.5.tar.gz
5e4ccdb74fe3abde188994a362de1d67 ./slpkg-2.8.6.tar.gz
cac1f51618665cebd8ed778f78a8d2fe ./slpkg-2.8.7.tar.gz
f65b1525da801a7cc2e460cf1eb5d4be ./slpkg-2.8.8.tar.gz
1a311e132d3b7957f3ab3d128072a10f ./slpkg-2.8.9.tar.gz
737b6a59dcb103708c4aeab4a96b517d ./slpkg-2.9.0.tar.gz
2ba8c1f63d05f368d9c7a6f12f4df387 ./slpkg-2.9.1.tar.gz
8970a287eafc773bc87905204fea35f6 ./slpkg-2.9.2.tar.gz
8d749508937faf31ee2432a05f64a46e ./slpkg-2.9.3.tar.gz
6616d6612e6eed897fd723777f5fb273 ./slpkg-2.9.4.tar.gz
f645936c1b143e4e1fa7c1637a4ea03f ./slpkg-2.9.5.tar.gz
d30ee37dbab0b113e6493fc61ee2f0b2 ./slpkg-2.9.6.tar.gz
a3a9e3768fc1ba3da91503b49325fee3 ./slpkg-2.9.7.tar.gz
96b1e1262a410e385f21e5413329ce18 ./slpkg-3.0.0.tar.gz
fab52c1b84e988cd5ec4b5ddbc95277c ./slpkg-3.0.1.tar.gz
4dd94caee2ef25501a5b70546ee0e3a4 ./slpkg-3.0.2.tar.gz
b88c991b2d29934f9f69104144a97e26 ./slpkg-3.0.3.tar.gz
1d50725d7bd271533442ca61bdf989fd ./slpkg-3.0.4.tar.gz
36a0b209ec8f194b86870112a3baa5b2 ./slpkg-3.0.5.tar.gz
101233e422a193f16d9056cf9f9d7b75 ./slpkg-3.0.6.tar.gz
9ec6024d77cd0e42292358ab1520973e ./slpkg-3.0.7.tar.gz
3e20b6d9ac4f36719ea76555910f6fe3 ./slpkg-3.0.8.tar.gz
44865cf611fc9a8d6425ce40f65d24f3 ./slpkg-3.0.9.tar.gz
fb2c0fedd2af291195faccfd304087be ./slpkg-3.1.0.tar.gz
e2b106a786a889c26385bf6ef266f09b ./slpkg-3.1.1.tar.gz
d9652f8d1ed42cb35084fdea88a8e483 ./slpkg-3.1.2.tar.gz
bb1ecf5cee734126f28241e810b77db3 ./slpkg-3.1.3.tar.gz
7b575cb93f3d2203fa2d3c41bd20f922 ./slpkg-3.1.4.tar.gz
f31a256221c02efbe4d356829d2a85e4 ./slpkg-3.1.5.tar.gz
9fbe32bd1f22e1784e2bb1ae7a288a4f ./slpkg-3.1.6.tar.gz
c3704b344c426151786a9760c4c62c4a ./slpkg-3.1.7.tar.gz
85df62558734a4113827e3b7f461c56e ./slpkg-3.1.8.tar.gz
9dc7d81d758a98ce3ad9c94364f33850 ./slpkg-3.1.9.tar.gz
1a006b491e0d3cb5613f37bdf1847c6c ./slpkg-3.2.0.tar.gz
88812d9fe483f30635f35ec8d19b74d1 ./slpkg-3.2.1.tar.gz
137a121ff3dc9f37abd3af6e2a6ae6c4 ./slpkg-3.2.2.tar.gz
33dddeeea7eb50420455a82bd32bce7c ./slpkg-3.2.3.tar.gz
57ba5c20050411095f2ae732e5012576 ./slpkg-3.2.4.tar.gz
ce4657f7e644ad58adb21eddfcea495a ./slpkg-3.2.5.tar.gz
95b595479e7fb6e0ed934f33a74c267c ./slpkg-3.2.6.tar.gz
a937c14f0d728ba36c1afd91a6800282 ./slpkg-3.2.7.tar.gz
9f10d66105681d304edb130d7948d92f ./slpkg-3.2.8.tar.gz
bd1ac24393c5cfdc8c7546fe9e9d0ff2 ./slpkg-3.2.9.tar.gz
d9b3a3a2903f2e3637b6f7d324f979b3 ./slpkg-3.3.0.tar.gz
65acf0561ba00fce3a012c0b76383292 ./slpkg-3.3.1.tar.gz
7eb3f0cd2d78fcd073420a5152ec14cd ./slpkg-3.3.2.tar.gz
da0c65f15f8c8b53edd964a703560e79 ./slpkg-3.3.3.tar.gz
0c08eaac7f40fd9d8304aed8c3e69050 ./slpkg-3.3.4.tar.gz
01c779d3f22439c2a8903015bc4d14b1 ./slpkg-3.3.5.tar.gz
e2e5c91996d68c248416c90127347233 ./slpkg-3.3.6.tar.gz
3fe4ca75b734a7880cf13a07d6e1b441 ./slpkg-3.3.7.tar.gz
86024e707ff696ebecf8de77da14500e ./slpkg-3.3.8.tar.gz
049284f54ea21e8443226dbb92f61095 ./slpkg-3.3.9.tar.gz
976baf5c4b98ecae3d2336de801e8906 ./slpkg-3.4.0.tar.gz
25c697d6039ddda6c0a79a0d28fe6145 ./slpkg-3.4.1.tar.gz
14ba9c085dea13238e39fd476ed299c8 ./slpkg-3.4.2.tar.gz
2f62cfc87b130310490ff0b76eb17b74 ./slpkg-3.4.3.tar.gz
deb10f0e2597ef8b201c039af2bd9c36 ./slpkg-3.7.0.tar.gz
04a0e87c5ed0a70b4aa9682b9d2a8cc9 ./slpkg-3.7.1.tar.gz
6740e8213bbaa8f8d674144f61954366 ./slpkg-3.7.2.tar.gz
dd97a05ee9ba37e0262f7e1c60d0eb61 ./slpkg-3.7.3.tar.gz
31d0c6aa7558bdc77d4eed4d4d5eb3f8 ./slpkg-3.7.4.tar.gz
a8298533001b4537939339dc6970e140 ./slpkg-3.8.0.tar.gz
4c2c7aecc7c08f2acf63ee154f1fe090 ./slpkg-3.8.1.tar.gz
e3215b66237bc6615da823725ad3ba66 ./slpkg-3.8.2.tar.gz
ad77a79f0fe059818d905d959df85064 ./slpkg-3.8.3.tar.gz
5a622c35ad6c8bd5a0a6bce2ea73d1dc ./slpkg-3.8.4.tar.gz
030bc3e2c9a82c95cbd8647872979652 ./slpkg-3.8.5.tar.gz
79019bd09837370c92fc301822da2c8b ./slpkg-3.8.6.tar.gz
2b41c1d3c21ff61d62cc119ee7def256 ./slpkg-3.8.7.tar.gz
e35b8a1b5bd51a6bf1a223f82f733af7 ./slpkg-3.8.8.tar.gz
d485c552637b510d2d3b7ff5be093ada ./slpkg-3.8.9.tar.gz
c23fcaeee005bdd7858f8269d7532f1f ./slpkg-3.9.0.tar.gz
19d4b05df424482d8532892fc6271666 ./slpkg-3.9.1.tar.gz
4fb0c6c100299d0a05aa2df3cd639c2f ./slpkg-3.9.2.tar.gz
784dbeb6f3dfa6f5825c58b8a4be6b27 ./slpkg-3.9.3.tar.gz
7f8053f4a6147e7c82ef981d61d34c66 ./slpkg-3.9.4.tar.gz
98c5079212e39d92144fc3805f93408a ./slpkg-3.9.5.tar.gz
4f4c6dc84a9834fc8b65a820ec52fa19 ./slpkg-3.9.6.tar.gz
63be7458372cdcfba46654c7423379ac ./slpkg-3.9.7.tar.gz
41b3f4f0f8fb8270e3b03abd2c73be2c ./slpkg-3.9.8.tar.gz
9c0ac9e08ae39c56a17c0aaf63dd94bb ./slpkg-3.9.9.tar.gz
7ad1bee7fc1db400aeb925485ed76b76 ./slpkg-4.0.0.tar.gz
5b1f9eb4738b5b578fea41cde6dcdddc ./slpkg-4.0.1.tar.gz
9beb1b86eece6c26a9153d0894aadda0 ./slpkg-4.0.2.tar.gz

View file

@ -1,3 +0,0 @@
sed -i "s/2014-2021/2014-2022/g" {} \; # Update the Copyright year
sed -i 's/^/# /' slackware-mirrors # Add first char (#) per line
sed -i 's/ *$//' slackware-mirrors # Remove spaces the end of line

View file

@ -1,11 +0,0 @@
Contributions are very much appreciated !!!
Pull requests should be based on and submitted to the "develop" branch
It would be preferable to have a basic knowledge about the distribution Slackware,
as important how a package is build.
Small changes in the code each time more appreciated.
Keep the style code applicable items.
Please ensure your changes work in Python >= 3.7

View file

@ -1,6 +1,6 @@
4.0.3 - 13/06/2022 4.1.0 - 20/06/2022
Removed: Updated:
- Unused flags --resolve-off, --download-prefix, --download-only - slpkg code re-written from the beginning and currently supports only the SBo repository
4.0.2 - 13/06/2022 4.0.2 - 13/06/2022
Fixed: Fixed:

File diff suppressed because it is too large Load diff

View file

@ -1,23 +0,0 @@
### Installation
##### Python & OS Support
Slpkg works with Python versions 3.7+ .
Slpkg works on Slackware distribution and possibly in some Slackware based
distribution like SalixOS, Slackel etc.
##### Install slpkg
There are mainly 2 ways:
1. Suggested method, download latest slpkg version from:
'`https://gitlab.com/dslackw/slpkg/releases`'
Untar or unzip the archive, change directory in '`slpkg-<version>`'
and run '`./install.sh`'.
slpkg auto-installed as Slackware package (root privileges are required).
2. Download binary package from '`https://sourceforge.net/projects/slpkg/files/binary/`'
and use Slackware command '`upgradepkg --install-new <slpkg binary>`'

3
ISSUES
View file

@ -1,3 +0,0 @@
Please report issues:
https://gitlab.com/dslackw/slpkg/issues

View file

@ -1 +0,0 @@
Known issues:

622
LICENSE
View file

@ -1,622 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS

21
LICENSE.txt Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Dimitris Zlatanidis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -1,8 +1,8 @@
*********** ***********
slpkg 4.0.2 slpkg 4.1.0
*********** ***********
Slpkg is a powerful software package manager that installs, updates, and removes packages on Slpkg is a 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
figures out what things should occur to install packages. Slpkg makes it easier to maintain groups figures out what things should occur to install packages. Slpkg makes it easier to maintain groups
of machines without having to manually update. of machines without having to manually update.
@ -11,12 +11,6 @@ Slpkg works in accordance with the standards of the organization `SlackBuilds.or
to build packages. Also uses the Slackware Linux instructions for installation, to build packages. Also uses the Slackware Linux instructions for installation,
upgrading or removing packages. upgrading or removing packages.
What makes slpkg distinguish from the other tools; The user-friendliness it's a primary
target as well as easy to understand and use, also uses colours to highlight packages and
display warning messages, etc.
Look in the `EXAMPLES.md <https://gitlab.com/dslackw/slpkg/blob/master/EXAMPLES.md>`_ file to explore some examples.
Install Install
------- -------
@ -26,9 +20,9 @@ Install from the official third party `SBo repository <https://slackbuilds.org/r
.. code-block:: bash .. code-block:: bash
$ wget slpkg-4.0.2.tar.gz $ wget slpkg-4.1.0.tar.gz
$ tar xvf slpkg-4.0.2.tar.gz $ tar xvf slpkg-4.1.0.tar.gz
$ cd slpkg-4.0.2 $ cd slpkg-4.1.0
$ ./install.sh $ ./install.sh
@ -38,15 +32,13 @@ Usage
.. code-block:: bash .. code-block:: bash
$ slpkg update $ slpkg update
$ slpkg -s sbo install <package_name> $ slpkg install <package_name>
$ slpkg --help $ slpkg --help
Copyright Copyright
--------- ---------
Copyright 2014-2022 © Dimitris Zlatanidis. - Copyright 2014-2022 © Dimitris Zlatanidis.
- Slackware® is a Registered Trademark of Patrick Volkerding.
Slackware® is a Registered Trademark of Patrick Volkerding. - Linux is a Registered Trademark of Linus Torvalds.
Linux is a Registered Trademark of Linus Torvalds.

View file

@ -1,56 +0,0 @@
## This file was created to explain some peculiarities of repositories used by the slpkg.
*NOTE: For more informations, refer directly to the repositories*
## Default repositories:
For the -current users who they use the sbo repository:
SlackBuilds.org (sbo) FAQ(15):
Slackware current is not supported, but as a general rule, the scripts
should work on it as well.
Rworkman's (rlw) repository use dependencies where displayed in a central site
'`http://rlworkman.net/pkgs/`' and only those. Unfortunately there is no fixed reference
dependencies in the file PACKAGES.TXT. You can make changes in '`/etc/slpkg/rlworkman.deps`'
file.
Conraid's (conrad) repository must be used only from Slackware64 current users and it has no
reference dependencies.
Slackel.gr (slackl) repository must be used only from Slackware{x86, x86_64} -current users.
MSB (msb) repository has one ChangeLog.txt file for three sub-repositories {1.14, 1.16, latest}.
So if you have updated the list of packages with the version 1.14 and you want to switch to
version 1.16 you must run '`slpkg upgrade`' instead of '`slpkg update`'. MSB (msb) repository
has no reference to the dependencies. Similarly apply and for the repository Cinnamon (csb)
but with the different versions. Both repositories Mate and Cinnamon support Slackware -current
x86_64 but not x86.
Slonly repository don't support -current for x86 arch.
Alien's ktown (ktown), Alien's multilib (multi), Slacke E17 and E18, slack-n-free, csb,
mles and Alien's restricted repository has no reference dependencies.
IMPORTANT: For Alien's (Eric Hameleers) repositories (alien, multi and ktown) should run
'`slpkg upgrade`' instant '`slpkg update`', if you want to spend from -stable in -current or
not, because there is no different file '`ChangeLog.txt`' for each version.
## Custom repositories:
There is the possibility of adding the repository directly from the user enough to address
the '`PACKAGES.TXT`' files and '`CHECKSUMS.md5`' at least. If not is there file '`ChangeLog.txt`'
will get warning messages that the '`ChangeLog.txt`' file can not be read but not worry, the process
is completed normally have each time you run the command '`slpkg update`' the package lists for such
a repository will be recreated from start automatically.
Sometimes you may experience some problems with these repositories such as the not correctly
resolve dependencies, and this may happen some specificities separate list which unfortunately
can not be calculated, good is the report these problems.
## Slackware ARM repositories:
Slackware ARM users will must use only two repositories at the moment slack and sbo.

26
THANKS
View file

@ -1,26 +0,0 @@
I want to Thank:
Dave Reese - https://github.com/wvragga
For your interest in the project and the small changes in the code.
Willy Sudiarto Raharjo - https://github.com/willysr
For the interesting and valuable advice around the systems of Slackware
and SBo packages.
Kostas Nikiforakis - Tester
For the tests in his system.
LinuxQuestions.org - http://www.linuxquestions.org
In all members of the community of Slackware forum linuxquestions.org.
OSarena - http://osarena.net/
Many thanks to OSarena website for reporting:
http://osarena.net/slpkg-dnamikos-kai-pio-filikos-package-manager-gia-slackware-kai-paragoges-dianomes
Special Thanks at Brenton Earl and Thomas Szteliga for their continuous references.

View file

@ -1 +0,0 @@
# [ bin ] directory

View file

@ -1,44 +1,12 @@
#!/usr/bin/python3 #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# slpkg file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
_ _
___| |_ __ | | ____ _
/ __| | '_ \| |/ / _` |
\__ \ | |_) | < (_| |
|___/_| .__/|_|\_\__, |
|_| |___/
Slpkg is a user-friendly package manager for Slackware installations
"""
from slpkg.main import main from slpkg.main import main
from slpkg.superuser import s_user, virtual_env
if __name__ == "__main__": if __name__ == "__main__":
try: try:
s_user()
virtual_env()
main() main()
except KeyboardInterrupt as err: except KeyboardInterrupt as err:
raise SystemExit(err) raise SystemExit(err)

View file

@ -1,66 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# clean.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import shutil
class Clean:
"""Clean all data like man page, log files, PACKAGES.TXT and
configuration files. This is useful if "slpkg" installed via
"pip" because pip uninstalls only Python packages and script
and not data. So if uninstall with "# pip uninstall slpkg" after
run "# python clean.py" to remove all data and configuration files.
NOTE: Run this script as root."""
def __init__(self):
self.files = [
"/usr/man/man8/slpkg.8.gz",
"/etc/bash_completion.d/slpkg.bash-completion",
"/etc/fish/completions/slpkg.fish"
]
self.dirs = [
"/etc/slpkg/",
"/var/log/slpkg/",
"/var/lib/slpkg/",
"/tmp/slpkg/"
]
def start(self):
for f in self.files:
if os.path.isfile(f):
print(f"Remove file --> {f}")
os.remove(f)
for d in self.dirs:
if os.path.exists(d):
print(f"Remove directory --> {d}")
shutil.rmtree(d)
if __name__ == "__main__":
clean = Clean()
clean.start()

View file

@ -1,35 +0,0 @@
# List of blacklist packages:
#
# blacklist file is part of slpkg.
#
# ----------------------------------------------------------------------------
# This is the blacklist file. Each package listed here may not be
# installed be upgraded be find or deleted.
# NOTE: The settings here affect all repositories.
#
# To blacklist the package 'wicd-1.7.2.4-x86_64-4.txz' the line will be:
# wicd
#
# To blacklist packages that start with name add * the end of the name:
# kernel*
#
#
# Sometimes the automatic kernel update creates problems because you
# may need to file intervention 'lilo'. The slpkg automatically detects
# if the core has been upgraded and running 'lilo'. If you want to avoid
# any problems uncomment the lines below.
# ----------------------------------------------------------------------------
#
# kernel-firmware
# kernel-generic
# kernel-generic-smp
# kernel-headers
# kernel-huge
# kernel-huge-smp
# kernel-modules
# kernel-modules-smp
# kernel-source
#
#
# aaa_elflibs should NOT be blacklisted!
#

View file

@ -1,32 +0,0 @@
# List File Repositories:
#
# custom-repositories file is part of slpkg.
#
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
#
# Slpkg is a user-friendly package manager for Slackware installations.
#
# https://gitlab.com/dslackw/slpkg
#
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# END OF LEGAL NOTICE
#
# ----------------------------------------------------------------------------
# This file is used to read, write and remove custom repositories by
# the user. The repositories will be added here should have a different
# name from existing repositories and the default. Also the URL must have
# contained the PACKAGES.TXT, CHECKSUMS.md5 and optional ChangeLog.txt files.
# ----------------------------------------------------------------------------
#
# NAME URL

View file

@ -1,53 +0,0 @@
# List File Repositories:
#
# default-repositories file is part of slpkg.
#
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
#
# Slpkg is a user-friendly package manager for Slackware installations.
#
# https://gitlab.com/dslackw/slpkg
#
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# END OF LEGAL NOTICE
#
# ----------------------------------------------------------------------------
# This file provide the URLs from repositories. Change only the URL
# if necessary finishing with "/". For local repository start with
# "file:///" avoid end path with "/". Do NOT change the name of the
# repository.
#
# Default repositories names:
# sbo, slack, rlw, alien, slacky, conrad, slonly, ktown, multi, slacke, salix,
# slackl, rested, msb, csb, connos, mles
# NOTE: Slackware repository (slack) served from file slackware-mirros
# -----------------------------------------------------------------------------
#
# NAME URL
sbo http://slackbuilds.org/slackbuilds/
rlw http://slackware.uk/people/rlworkman/
alien http://bear.alienbase.nl/mirrors/people/alien/sbrepos/
slacky http://repository.slacky.eu/
conrad http://slack.conraid.net/repository/slackware64-current/
slonly https://slackonly.com/pub/packages/
ktown http://alien.slackbook.org/ktown/
multi http://bear.alienbase.nl/mirrors/people/alien/multilib/
slacke http://ngc891.blogdns.net/pub/
salix http://download.salixos.org/
slackl http://www.slackel.gr/repo/
rested http://bear.alienbase.nl/mirrors/people/alien/restricted_slackbuilds/
msb http://slackware.org.uk/msb/
csb http://slackware.uk/csb/
connos https://connochaetos.org/slack-n-free/
mles http://slackware.uk/microlinux/

View file

@ -1,34 +0,0 @@
# Security file:
#
# pkg_security file is part of slpkg.
#
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
#
# Slpkg is a user-friendly package manager for Slackware installations.
#
# https://gitlab.com/dslackw/slpkg
#
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# END OF LEGAL NOTICE
#
# ----------------------------------------------------------------------------
# For some reasons some packages need extra management and attention before
# build, install or upgrade. So this list of packages will produce one warning
# message before action.
# You can add the packages you that believe need attention or please mention
# to me in the email dslackw@gmail.com
# ----------------------------------------------------------------------------
#
nvidia-kernel
nvidia-driver

View file

@ -1,59 +0,0 @@
# Repositories configuration file for slpkg
#
# repositories.conf file is part of slpkg.
#
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
#
# Slpkg is a user-friendly package manager for Slackware installations.
#
# https://gitlab.com/dslackw/slpkg
#
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# END OF LEGAL NOTICE
#
# ----------------------------------------------------------------------------
# conrad (Conraid's) repository must used from Slackware64 current.
# ktown (Alien"s ktown: 4.14.3 and latest) repository. Default ktown{latest}.
# slacke (Enlightenment: E17 and E18) repository. Default slacke{18}.
# msb (Mate: 1.14, 1.16, 1,18, latest) repository. Default msb{1.18}
# mles (Microlinux: desktop, extras, server) repository. Default mles{desktop}
#
# Slackware ARM users will must use only two repositories at the moment slack and sbo.
#
# Slpkg uses by default slack (Slackware) and sbo (SlackBuilds.org) repositories.
# Read the REPOSITORIES file for more instructions.
#
#
# KEEP FILE CLEAN AND UNCOMMENT ONLY REPOSITORIES
# Uncomment (remove the '#' character) to choose repositories:
# Do NOT change the name of the repository.
# ----------------------------------------------------------------------------
[REPOSITORIES]
slack
sbo
# alien
# rlw
# slacky
# conrad
# slonly
# ktown{latest}
# multi
# slacke{18}
# salix
# slackl
# rested
# msb{1.18}
# csb
# connos
# mles{desktop}

View file

@ -1,35 +0,0 @@
# Rworkman's dependencies:
#
# rlworkman.deps file is part of slpkg.
#
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
#
# Slpkg is a user-friendly package manager for Slackware installations.
#
# https://gitlab.com/dslackw/slpkg
#
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# END OF LEGAL NOTICE
#
# ----------------------------------------------------------------------------
# Some notes about package dependencies (all deps are also found here):
# Rworkman's repository dependencies as shown in the central page
# http://rlworkman.net/pkgs/
# ----------------------------------------------------------------------------
#
# PACKAGE: DEPENDENCIES
abiword: wv
claws-mail: libetpan
inkscape: lxml numpy BeautifulSoup
xfburn: libburn libisofs

View file

@ -1,138 +0,0 @@
# List of Slackware Mirrors copy from:
# http://mirrors.slackware.com/mirrorlist/
#
# slackware-mirrors file is part of slpkg.
#
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
#
# Slpkg is a user-friendly package manager for Slackware installations.
#
# https://gitlab.com/dslackw/slpkg
#
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# END OF LEGAL NOTICE
#
# ----------------------------------------------------------------------------
# Slpkg uses the central mirror "http://mirrors.slackware.com/slackware/"
# to find the nearest one. If however for some reason this troublesome
# please uncomment (remove the '#' character) only one mirror from
# the list available below. You can also add a new mirror in the list
# below. Be careful with the template.
# ----------------------------------------------------------------------------
#
#
# st Updated: Sun Feb 6 15:54:02 UTC 2022
#
# Available https mirrors:
#
# ar https://mirrors.eze.sysarmy.com/slackware/
# ar https://slackware.zero.com.ar/slackware/
# au https://slackware.mirror.digitalpacific.com.au/
# au https://syd.mirror.rackspace.com/slackware/
# bg https://mirror.telepoint.bg/slackware/
# bg https://mirrors.linux-bulgaria.org/slackware/
# bg https://mirrors.netix.net/slackware/
# br https://slackjeff.com.br/slackware/
# ca https://mirror.csclub.uwaterloo.ca/slackware/
# ca https://mirror.its.dal.ca/slackware/
# cn https://mirrors.bfsu.edu.cn/slackware/
# cr https://mirrors.ucr.ac.cr/slackware/
# de https://ftp6.gwdg.de/pub/linux/slackware/
# de https://linux.rz.rub.de/slackware/
# de https://mirror.de.leaseweb.net/slackware/
# de https://mirror.netcologne.de/slackware/
# dk https://mirrors.dotsrc.org/slackware/
# ec https://mirror.cedia.org.ec/slackware/
# gb https://lon.mirror.rackspace.com/slackware/
# gb https://mirror.bytemark.co.uk/slackware/
# gb https://www.mirrorservice.org/sites/ftp.slackware.com/pub/slackware/
# gr https://ftp.cc.uoc.gr/mirrors/linux/slackware/
# hk https://hkg.mirror.rackspace.com/slackware/
# hkg https://mirror-hk.koddos.net/slackware/
# hu https://quantum-mirror.hu/mirrors/pub/slackware/
# id https://iso.ukdw.ac.id/slackware/
# id https://repo.ukdw.ac.id/slackware/
# its https://slackware.mirror.garr.it/slackware/
# lt https://mirrors.atviras.lt/slackware/
# md https://mirror.ihost.md/slackware/
# nc https://mirror.lagoon.nc/slackware/
# nl https://ftp.nluug.nl/os/Linux/distr/slackware/
# nl https://mirror.koddos.net/slackware/
# nl https://mirror.nl.leaseweb.net/slackware/
# pl https://ftp.slackware.pl/pub/slackware/
# pl https://sunsite.icm.edu.pl/pub/Linux/slackware/
# pt https://ftp.rnl.tecnico.ulisboa.pt/pub/slackware/
# ro https://mirrors.nxthost.com/slackware/
# rub https://mirror.yandex.ru/slackware/
# sa https://mirror.lyrahosting.com/slackware/
# se https://ftp.acc.umu.se/mirror/slackware.com/
# se https://ftpmirror.infania.net/slackware/
# sk https://mirror.wheel.sk/slackware/
# tw https://ftp.yzu.edu.tw/Linux/Slackware/
# ua https://ifconfig.com.ua/slackware/
# ua https://mirrors.nix.org.ua/linux/slackware/
# us https://dfw.mirror.rackspace.com/slackware/
# us https://ftp.ussg.indiana.edu/linux/slackware/
# ussg https://mirror.cs.princeton.edu/pub/mirrors/slackware/
# ussg https://mirror.slackbuilds.org/slackware/
# ussg https://mirrors.kernel.org/slackware/
# ussg https://mirrors.syringanetworks.net/slackware/
# ussg https://mirrors.xmission.com/slackware/
# ussg https://plug-mirror.rcac.purdue.edu/slackware/
# ussg https://slackware.absolutehosting.net/pub/slackware/
#
#
# Available http mirrors:
#
# au http://ftp.cc.swin.edu.au/slackware/
# au http://ftp.swin.edu.au/slackware/
# au http://mirror.as24220.net/pub/slackware/slackware64-14.2/
# au http://mirror.internode.on.net/pub/slackware/
# bg http://mirrors.slackware.bg/slackware/
# bg http://mirrors.unixsol.org/slackware/
# bg http://slackware.telecoms.bg/slackware/
# br http://ftp.slackware-brasil.com.br/
# br http://linorg.usp.br/slackware/
# bytemark http://mirror.datacenter.by/pub/slackware/
# cz http://ftp.linux.cz/pub/linux/slackware/
# de http://download.dlackware.com/slackware/
# de http://ftp.tu-chemnitz.de/pub/linux/slackware/
# de http://mirrors.nav.ro/slackware/
# fr http://nephtys.lip6.fr/pub/linux/distributions/slackware/
# fr http://nephtys.lip6.fr/pub/linux/distributions/slackware/
# fr http://slackware.mirrors.ovh.net/ftp.slackware.com/
# gb http://slackware.uk/slackware/
# gr http://ftp.ntua.gr/pub/linux/slackware/
# hr http://mirror.slackware.hr/slackware/
# jp http://ftp.nara.wide.ad.jp/pub/Linux/slackware/
# jp http://ftp.riken.jp/Linux/slackware/
# lt http://slackware.laukas.lt
# mc http://slackware.qontinuum.space/slackware/
# nl http://bear.alienbase.nl/mirrors/slackware/
# nz http://ftp.slackware.org.nz/slackware/
# ph http://mirror.rise.ph/slackware/
# plug http://mirror.onet.pl/pub/mirrors/slackware/
# ru http://slackware.tsu.ru/slackware/
# sg http://download.nus.edu.sg/mirror/slackware/
# tr http://ftp.linux.org.tr/slackware/
# tw http://ftp.isu.edu.tw/pub/Linux/Slackware/
# ua http://slackware.ip-connect.info/
# usp http://ftp.slackware.com/pub/slackware/
# usp http://mirror.lug.udel.edu/pub/slackware/
# usp http://slackblog.com/slackware/
# usp http://slackware.cs.utah.edu/pub/slackware/
# usp http://slackware.mirrors.tds.net/pub/slackware/
# za http://ftp.is.co.za/mirror/ftp.slackware.com/pub/
# za http://ftp.wa.co.za/pub/slackware/
# za http://slackware.mirror.ac.za/

View file

@ -1,14 +0,0 @@
_slpkg()
{
local cur
cur=${COMP_WORDS[COMP_CWORD]}
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "--autobuild --blacklist --queue --list --check --sync --tracking --print --network --FIND --find --installpkg --upgradepkg --removepkg --display" -- $cur ))
else
_filedir
fi
}
complete -F _slpkg slpkg

View file

@ -1,129 +0,0 @@
# Configuration file for slpkg
#
# slpkg.conf file is part of slpkg.
#
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
#
# Slpkg is a user-friendly package manager for Slackware installations.
#
# https://gitlab.com/dslackw/slpkg
#
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# END OF LEGAL NOTICE
#
# ----------------------------------------------------------------------------
# Set Slackware release "stable" or "current". Default is "stable".
RELEASE=stable
# Set Slackware version if it's necessary. Default is "off".
SLACKWARE_VERSION=off
# Set computer architecture if it's necessary. Default is "off".
COMP_ARCH=off
# Build directory for repository "sbo" slackbuilds.org. In this
# directory downloaded sources and scripts for building.
# Default is "/tmp/slpkg/build/".
BUILD_PATH=/tmp/slpkg/build/
# Alternative source downloads for the "sbo" repository. Default is "off".
SBOSRCARCH=off
SBOSRCARCH_LINK=http://slackware.uk/sbosrcarch/by-name/
# Download directory for others repositories that use binaries files
# for installation. Default is "/tmp/slpkg/packages/"
PACKAGES=/tmp/slpkg/packages/
# Download directory for Slackware patches file.
PATCHES=/tmp/slpkg/patches/
# If CHECKMD5 is "on" the system will check all downloaded
# sources and Slackware packages. Default is "on".
CHECKMD5=on
# Delete all downloaded files if DEL_ALL is "on". Default is "on".
DEL_ALL=on
# Delete build directory after each process if DEL_BUILD is "on".
# Settings for the repository "sbo" slackbuilds.org. Default is "off".
DEL_BUILD=off
# Keep build log file if SBO_BUILD_LOG is "on". Default is "on".
SBO_BUILD_LOG=off
# Speed up SlackBuild scripts. If "on" slpkg auto detect the numbers of
# processor and apply into MAKEFLAGS variable. Some SlackBuilds fail if
# MAKEFLAGS is declared or the number of processors (-j <n>) is greater
# than one. Default if "off".
MAKEFLAGS=off
# Define default answer to slpkg questions.
# Choose "y" if you do not want to questions. Default is "n".
DEFAULT_ANSWER=n
# Define default answer for the removal of dependencies.
# Choose "y" if you do not want to question. Default is "n".
REMOVE_DEPS_ANSWER=n
# If you want build UNSUPPORTED or UNTESTED packages choose "y".
# Settings for the repository "sbo" slackbuilds.org. Default is "n".
SKIP_UNST=n
# If you want to disable automatic resovle dependencies choose "off".
# Default is "on".
RSL_DEPS=on
# Delete package dependencies if DEL_DEPS is on.
# You must be careful if you enable this option because it can remove
# packages related to distribution. Default is "off".
DEL_DEPS=off
# Use colors for highlighting. Choose "on" or "off". Default is "on".
USE_COLORS=on
# Downloader utility. Four options are supported "wget", "aria2c",
# "curl" and "http" (HTTPie). Default is "wget".
DOWNDER=wget
# Downloader [OPTION]. Pass downloader options, for curl use "-L -o" as
# using to download in specific directory and support any redirects
# such as from sourceforge repository. aria2c recommended "--allow-overwrite"
# options by default. Http recommended "-d -c -o" options by default.
# Default for wget is "-c -N".
DOWNDER_OPTIONS=-c -N
# Update slackpkg ChangeLog.txt file if SLACKPKG_LOG is "on".
# Automatically synchronizes the command "slackpkg update" with
# "slpkg -c slack --upgrade". Default is "on".
SLACKPKG_LOG=on
# This option applies only to the distribution upgrade and repository
# slack (Slackware). If you want to update only packages that are installed
# choose "on". Default is "off".
# NOTE: This option is not recommended at "on" because it can leave out
# packages required for distribution.
ONLY_INSTALLED=off
# Register a text editor that uses the slpkg in a few options.
# Default is "nano".
EDITOR=nano
# If you don't want slpkg downgrade packages, setting this variable to "on".
# Warning: Possible failure building packages or running applications after
# install. Default is "off".
NOT_DOWNGRADE=off
# If you are working under a proxy server you need to set
# your proxy server here. Default is null.
HTTP_PROXY=

View file

@ -1,18 +0,0 @@
complete --command slpkg --long-option help --short-option h --description 'Print this help message and exit.'
complete --command slpkg --long-option version --short-option v --description 'Print program version and exit.'
complete --command slpkg --long-option autobuild --short-option a --description 'Auto build SBo packages. If you already have downloaded the script and the source code you can build a new package with this command.'
complete --command slpkg --long-option blacklist --short-option b --description 'Manage packages in the blacklist. Add or remove packages and print the list. Each package is added here will not be accessible by the program.'
complete --command slpkg --long-option queue --short-option q --description 'Manage SBo packages in the queue. Add or remove and print the list build-install of packages. Build and then install the packages from the queue.'
complete --command slpkg --long-option config --short-option g --description 'Configuration file management. Print the configuration file or edit.'
complete --command slpkg --long-option list --short-option l --description 'Print a list of all available packages repository index or print only packages installed on the system.'
complete --command slpkg --long-option check --short-option c --description 'Check view and install updated packages from repositories.'
complete --command slpkg --long-option sync --short-option s --description 'Sync packages. Install packages directly from remote repositories with all dependencies.'
complete --command slpkg --long-option tracking --short-option t --description 'Tracking package dependencies and print package dependenies tree with highlight if packages is installed.'
complete --command slpkg --long-option print --short-option p --description 'Print description of a package directly from the repository and change color text.'
complete --command slpkg --long-option network --short-option n --description 'View a standard of SBo page in terminal and manage multiple options like reading downloading building installation etc.'
complete --command slpkg --long-option find --short-option f --description 'Find and print installed packages reporting the size and the sum.'
complete --command slpkg --long-option FIND --short-option F --description 'Find packages from repositories and search at each enabled repository and prints results.'
complete --command slpkg --long-option installpkg --short-option i --description 'Installs single or multiple Slackware binary packages.'
complete --command slpkg --long-option upgradepkg --short-option u --description 'Upgrade single or multiple Slackware binary packages from a older to a newer one.'
complete --command slpkg --long-option removepkg --short-option r --description 'Removes a previously installed Slackware binary packages.'
complete --command slpkg --long-option display --short-option d --description 'Display the installed packages contents and file list.'

22
config/slpkg.json Normal file
View file

@ -0,0 +1,22 @@
{
"os_arch": "x86_64",
"tmp_path": "/tmp",
"tmp_slpkg": "/tmp/slpkg",
"build_path": "/tmp/slpkg/build",
"lib_path": "/var/lib/slpkg",
"log_path": "/var/log/slpkg",
"db_path": "/var/lib/slpkg/database",
"sbo_repo_path": "/var/lib/slpkg/repository",
"log_packages": "/var/log/packages",
"database": "database.slpkg",
"repo_version": "15.0",
"sbo_url": "http://slackbuilds.org/slackbuilds/15.0",
"sbo_txt": "SLACKBUILDS.TXT",
"tar_suffix": ".tar.gz",
"pkg_suffix": ".tgz",
"repo_tag": "_SBo",
"installpkg": "upgradepkg --install-new",
"removepkg": "removepkg",
"colors": "on",
"wget_options": "-c -N"
}

View file

@ -33,7 +33,6 @@ VERSION=${VERSION:-$(__version)}
# Installation script. # Installation script.
# With this script allows you to install the slpkg as a Slackware package binary file. # With this script allows you to install the slpkg as a Slackware package binary file.
# Support wget download.
ARCHIVES="$PRGNAM-$VERSION.tar.gz $PRGNAM-$VERSION.zip v$VERSION.tar.gz v$VERSION.zip \ ARCHIVES="$PRGNAM-$VERSION.tar.gz $PRGNAM-$VERSION.zip v$VERSION.tar.gz v$VERSION.zip \
$PRGNAM-$VERSION.tar.bz2" $PRGNAM-$VERSION.tar.bz2"
cd .. cd ..

View file

@ -1,10 +0,0 @@
__ __
____| |__ ___ | | ______ __
/ | | ' \ | | / / ` |
/ ___| | __ \| |/ / __ |
\ \ | |__) | < (__| |
\____ \ | /| |\ \ |
| / | .___/ |__| \__\___, |
|____/__| | | |
|__| |_____/
____________ Slackware package manager _________________________

67
man/slpkg.1 Normal file
View file

@ -0,0 +1,67 @@
.TH slpkg 1 "Orestiada, Greece" "slpkg 4.1.0" dslackw
.SH NAME
.P
slpkg - [OPTIONS] [packages]
.SH SYNAPSES
.P
slpkg [-h|-v] [update] [build] [install] [remove] [clean-logs] --yes --resolve-off
.SH DESCRIPTION
.P
Slpkg is a 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
Slpkg works in accordance with the standards of the organization SlackBuilds.org to build packages. Also uses the Slackware Linux instructions for installation, upgrading or removing packages.
.SH OPTIONS
.P
-h |--help
.RS
Show help informatio and exit.
.RE
.P
-v |--version
.RS
Print version and exit.
.RE
.P
update
.RS
Updates the data packages and the database.
.RE
.P
build
.RS
Builds and creates only the scripts and puts them in the /tmp directory.
.RE
.P
install
.RS
Builds, creates and installs the packages in the correct order and also logs the packages with dependencies to use for removal.
.RE
.P
remove
.RS
Removes packages with dependencies if the packages was installed with slpkg install method.
.RE
.P
clean-logs
.RS
Purge logs of dependencies.
.RE
.P
--yes
.RS
Answer Yes to all questions.
.RE
.P
--resolve-off
.RS
Turns off dependency resolving.
.RE
.SH CONFIGURATION FILE
.P
Configuration file in the /etc/slpkg/slpkg.json file.
.SH REPORT BUGS
.P
Please report any found to https://gitlab.com/dslackw/slpkg/-/issues.
.SH AUTHORS
.P
Dimitris Zlatanidis <d.zlatanidis@gmail.com>

View file

@ -1,402 +0,0 @@
.\" -*- nroff -*-
.\" Copyright (C) 2014-2022 Dimitris Zlatanidis
.\"
.\" This program is free software: you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation, either version 3 of the License, or
.\" (at your option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.TH Slpkg "11" "05" 2022" "slpkg"
.SH NAME
Slpkg is a user-friendly package manager for Slackware installations
.SH SYNOPSIS
slpkg [COMMANDS|OPTIONS] {repository|package...}
.SH DESCRIPTION
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.
.SH GLOBAL OPTIONS
\fB\-v\fP, \fB\-\-version\fP
.PP
Print the version of program and exit.
.SH COMMANDS
.PP
The following commands are available.
.SS update, create and update packages list
\fBslpkg\fP \fBupdate\fP, \fB--repos=[repositories...]\fP
.PP
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.
.PP
Additional options:
.PP
\fB--repos=[repositories...]\fP : Update at specifically repositories separate by comma.
.SS upgrade, recreate packages list
\fBslpkg\fP \fBupgrade\fP, \fB--repos=[repositories...]\fP
.PP
It is sometimes useful to create all of the base file from the beginning so this
command delete all the package lists and recreated.
.PP
Additional options:
.PP
\fB--repos=[repositories...]\fP : Update at specifically repositories separate by comma.
.SS repo-add, add custom repository
\fBslpkg\fP \fBrepo-add\fP <\fIrepository name\fP> <\fIURL\fP>
.PP
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.
.SS repo-remove, remove custom repository
\fBslpkg\fP \fBrepo-remove\fP <\fIrepository\fP>
.PP
Remove custom repository by name.
.SS repo-enable, enable or disable repositories
\fBslpkg\fP \fBrepo-enable\fP
.PP
Enable or disable repositories via dialog utility (require python3-pythondialog)
.SS repo-list, repositories list
\fBslpkg\fP \fBrepo-list\fP
.PP
Lists all enabled or disabled repositories.
.SS repo-info, repository information
\fBslpkg\fP \fBrepo-info\fP <\fIrepository\fP>
.PP
View repository information.
.SS update slpkg, update slpkg itself
\fBslpkg\fP \fBupdate\fP \fBslpkg\fP
.PP
You can check for new versions and update slpkg itself.
.SS health, health check installed packages
\fBslpkg\fP \fBhealth\fP, \fB--silent\fP
.PP
Check file list from packages of files installed.
.PP
Additional options:
.PP
\fB--silent\fP : Print only errors.
.SS deps-status, print dependencies status
\fBslpkg\fP \fBdeps-status\fP \fB--graph=[type]\fP
.PP
Print dependencies status used by packages. Prerequisite packages have been installed
with the option "# slpkg -s <repository> <packages>".
.PP
Additional options:
.PP
\fB--graph=[type]\fP : Drawing dependencies diagram. (example for type: ascii, image.x11, image.png etc. Require pygraphviz)
.PP
\fB--tree\fP : Switch to tree view.
.SS new-config, manage .new configuration files
\fBslpkg\fP \fBnew-config\fP
.PP
This command searches for .new configuration files in /etc/ path and ask the user what todo with those
files.
.SS clean-tmp, clean the tmp/ directory
\fBslpkg\fP \fBclean-tmp\fP
.PP
Clean the /tmp/slpkg/ directory from downloaded packages and sources.
.SH OPTIONS
.PP
The following arguments are available.
.SS -a, --autobuild, auto build packages
\fBslpkg\fP \fB-a\fP <\fIscript.tar.gz\fP> <\fIsources\fP>
.PP
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.
.SS -b, --blacklist, add, remove, view packages in blacklist
\fBslpkg\fP \fB-b\fP <\fIname of packages\fP> \fB--add\fP, \fB--remove\fP, \fBlist\fP
.PP
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".
.SS -q, --queue, add, remove, view packages in queue
\fBslpkg\fP \fB-q\fP <\fInames of packages\fP> \fB--add\fP, \fB--remove\fP
.TP
\fBslpkg\fP \fB-q\fP \fBlist\fP, \fBbuild\fP, \fBinstall\fP, \fBbuild-install\fP
.PP
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.
.SS -g, --config, configuration file management
\fBslpkg\fP \fB-g\fP \fBprint\fP, \fBedit\fP, \fBreset\fP
.PP
Print, reset or edit configuration file.
.SS -l, --list, list of installed packages
\fBslpkg\fP \fB-l\fP <\fIrepository\fP>, \fB--index\fP, \fB--installed\fP, \fB--name\fP
.PP
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".
.PP
Additional options:
.PP
\fB--index\fP : Count packages per page.
.PP
\fB--installed\fP : Highlight installed packages.
.PP
\fB--name\fP : Print package name only.
.SS -c, --check, check if your packages is up to date
\fBslpkg\fP \fB-c\fP <\fIrepository\fP> \fB--upgrade\fP \fB--rebuild\fP \fB--skip=[packages...]\fP, \fB--checklist\fP
.PP
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.
.PP
Additional options:
.PP
\fB-c \fP : Check ChangeLog.txt files for changes.
.PP
\fB--upgrade\fP : Check and install packages for upgrade.
.PP
\fB--rebuild\fP : Rebuild packages from sbo repository.
.PP
\fB--skip=[packages...]\fP : Skip packages from upgrade separate by comma like "# slpkg -c sbo --skip=jdk,pep8,pip" (See REGEX).
.PP
\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
\fBslpkg\fP \fB-s\fP <\fIrepository\fP> <\fInames of packages\fP>, \fB--case-ins\fP, \fB--patches\fP
.PP
Installs or upgrade packages from the repositories with automatically resolving all
dependencies of the package.
.PP
Additional options:
.PP
\fB--rebuild\fP : Rebuild packages from sbo repository.
.PP
\fB--reinstall\fP : Reinstall binary packages from repositories.
.PP
\fB--case-ins\fP : Search package name in repository with case insensitive.
.PP
\fB--patches\fP : Switch to patches\ directory, only for slack repository.
.SS -t, --tracking, tracking dependencies
\fBslpkg\fP \fB-t\fP <\fIrepository\fP> <\fIname of package\fP>, \fB--check-deps\fP, \fB--graph=[type]\fP \fB--case-ins\fP
.PP
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.
.PP
Additional options:
.PP
\fB--check-deps\fP : Check if installed packages used by other packages.
.PP
\fB--graph=[type]\fP : Drawing dependencies graph. (example for type: ascii, image.x11, image.png etc. Require pygraphviz)
.PP
\fB--case-ins\fP : Search package name in repository with case insensitive.
.SS -p, --desc, print packages description
\fBslpkg\fP \fB-p\fP <\fIrepository\fP> <\fIname of package\fP>, \fB--color=[]\fP
.PP
Print package description from remote repository with color. Available colors:
red, green, yellow, cyan, grey
.PP
Additional options:
.PP
\fB--color=[]\fP : Change color print.
.SS -F, --FIND, find packages from repositories
\fBslpkg\fP \fB-F\fP <\fInames of packages\fP>, \fI--case-ins\fP
.PP
Find packages from all repositories are enabled. Useful command to find all available
packages per repository.
.PP
Additional options:
.PP
\fB--case-ins\fP : Search package name in repository with case insensitive.
.SS -f, --find, find installed packages
\fBslpkg\fP \fB-f\fP <\fInames of packages\fP>, \fB--case-ins\fP, \fB--third-party\fP
.PP
Find installed packages with view total file size.
Example you can view all installed sbo packages like "# slpkg -f _SBo".
.PP
Additional options:
.PP
\fB--case-ins\fP : Search package name with case insensitive.
.PP
\fB--third-party\fP : View all the third-party packages.
.SS -n, --network, view SBo packages
\fBslpkg\fP \fB-n\fP <\fIname of package\fP>, <\fI[pattern], --checklist\fP>, \fB--case-ins\fP
.PP
View complete slackbuilds.org site in your terminal. Read file, download,
build or install etc. Use "--checklist" additional option to load all repository, example:
"# slpkg -n --checklist".
.PP
Additional options:
.PP
\fB--checklist\fP : Enable dialog utility and checklist option. (Require python3-pythondialog)
.PP
\fB--case-ins\fP : Search package name in repository with case insensitive.
.SS -i, --installpkg, install Slackware binary packages
\fBslpkg\fP \fB-i\fP \fB[--warn, --md5sum, --root /otherroot, --infobox, --menu, --terse,
--ask, --priority ADD|REC|OPT|SKP, --tagfile /somedir/tagfile]\fP <\fIpackages.t?z\fP>
.PP
Installs single binary packages designed for use with the Slackware Linux
distribution into your system. More information please read "man installpkg".
.SS -u, --upgradepkg, install-upgrade Slackware binary packages with new
\fBslpkg\fP \fB-u\fP \fB[--dry-run, --install-new, --reinstall, --verbose]\fP <\fIpackages.t?z\fP>
.PP
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".
.SS -r, --removepkg, remove previously installed Slackware binary packages
\fBslpkg\fP \fB-r\fP \fB[-copy, -keep, -preserve, -warn]\fP <\fInames of packages\fP>, \fB--deps\fP, \fB--check-deps\fP, \fB--tag\fP, \fB--checklist\fP, \fB--third-party\fP
.PP
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".
.PP
Additional options:
.PP
\fB--deps\fP : Remove packages with dependencies.
.PP
\fB--check-deps\fP : Check if installed packages used by other packages.
.PP
\fB--tag\fP : Remove packages with by TAG.
.PP
\fB--checklist\fP : Enable dialog utility and checklist option. (Require python3-pythondialog)
.PP
\fB--third-party\fP : Remove all the third-party packages. (Be sure update the package lists before)
.SS -d, --display, display the installed packages contents and file list
\fBslpkg\fP \fB-d\fP <\fInames of packages\fP>
.PP
Display the installed Slackware packages contents and file list with all descriptions.
.SH HELP OPTION
Specifying the help option displays help for slpkg itself, or a
command.
.br
For example:
\fBslpkg \-\-help\fP - display help for slpkg
.SH DEFAULT REPOSITORIES
slackware.com = "slack"
SlackBuilds.org = "sbo"
Alien's = "alien"
slacky.eu = "slacky"
rworkman's = "rlw"
Conraid's = "conrad"
slackonly.com = "slonly"
Alien's ktown = "ktown{latest}"
Alien's multilib = "multi"
Slacke E17 and E18 = "slacke{18}"
SalixOS = "salix"
Slackel.gr = "slackel"
Alien's restricted = "rested"
MATE Desktop Environment = "msb{1.18}"
Cinnamon Desktop Environment = "csb"
Connochaetos slack-n-free = "connos"
Microlinux mles = "mles"
Default enable repository is "slack" and "sbo".
Add or remove default repository in configuration file "/etc/slpkg/repositories.conf".
Read REPOSITORIES file for particularities.
.SH COLORS
red, green, yellow, cyan, grey
.SH REGEX
For options "--skip=" and blacklist file.
All packages starts with: "string*"
All packages ends with: "*string"
All packages include: "*string*"
.SH PASS VARIABLES TO THE SCRIPT
If you want to pass variables to the script exported as:
Usage: <NAME_VARIABLE=value>
Example:
"# export FFMPEG_X264=yes FFMPEG_LAME=yes"
.SH FILES
/etc/slpkg/slpkg.conf
General configuration of slpkg
/etc/slpkg/repositories.conf
Configuration file for repositories
/etc/slpkg/blacklist
List of packages to skip
/etc/slpkg/slackware-mirrors
List of Slackware Mirrors
/etc/slpkg/default-repositories
List of default repositories
/etc/slpkg/custom-repositories
List of custom repositories
/etc/slpkg/rlworkman.deps
Rworkman's repository dependencies
/etc/slpkg/pkg_security
List of packages for security reasons
/var/log/slpkg
ChangeLog.txt repositories files
SlackBuilds logs and dependencies files
/var/lib/slpkg
PACKAGES.TXT files
SLACKBUILDS.TXT files
CHECKSUMS.md5 files
FILELIST.TXT files
/tmp/slpkg
Slpkg temporary downloaded files and build packages
.SH AUTHOR
Dimitris Zlatanidis <d.zlatanidis@gmail.com>
.SH HOMEPAGE
https://dslackw.gitlab.io/slpkg/
.SH COPYRIGHT
Copyright \(co 2014-2022 Dimitris Zlatanidis
.SH SEE ALSO
installpkg(8), upgradepkg(8), removepkg(8), pkgtool(8), slackpkg(8), explodepkg(8),
makepkg(8).

View file

@ -1,726 +0,0 @@
<!-- Creator : groff version 1.22.3 -->
<!-- CreationDate: Wed May 11 22:58:05 2022 -->
<!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>&minus;v</b>,
<b>&minus;&minus;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>--repos=[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>--repos=[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>--repos=[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>--repos=[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> &lt;<i>repository name</i>&gt;
&lt;<i>URL</i>&gt;</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
&quot;PACKAGES.TXT&quot; and &quot;CHECKSUMS.md5&quot; and
optional file &quot;ChangeLog.txt&quot; used to control
changes.</p>
<p style="margin-left:11%; margin-top: 1em"><b>repo-remove,
remove custom repository <br>
slpkg repo-remove</b> &lt;<i>repository</i>&gt;</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> &lt;<i>repository</i>&gt;</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 &quot;# slpkg -s
&lt;repository&gt; &lt;packages&gt;&quot;.</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> &lt;<i>script.tar.gz</i>&gt;
&lt;<i>sources</i>&gt;</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> &lt;<i>name of packages</i>&gt; <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 &quot;# slpkg -b --remove&quot;. Use
asterisk &quot;*&quot; to match pagkages like &quot;# slpkg
-b py* --add&quot;, this add all installed packages with
starts string &quot;py&quot; or &quot;# slpkg -b
multi:*multilib* --add&quot;, this add all multilib packages
from repository &quot;multi&quot;.</p>
<p style="margin-left:11%; margin-top: 1em"><b>-q, --queue,
add, remove, view packages in queue <br>
slpkg -q</b> &lt;<i>names of packages</i>&gt; <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 &quot;#
slpkg -q --remove&quot;. (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> &lt;<i>repository</i>&gt;, <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
&quot;grep&quot; like &quot;# slpkg -l sbo | grep
python&quot;.</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> &lt;<i>repository</i>&gt; <b>--upgrade
--rebuild --skip=[packages...]</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 &quot;# slpkg update&quot;,
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>--skip=[packages...]</b>
: Skip packages from upgrade separate by comma like &quot;#
slpkg -c sbo --skip=jdk,pep8,pip&quot; (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> &lt;<i>repository</i>&gt; &lt;<i>names of
packages</i>&gt;, <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>--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&nbsp;directory, only for slack
repository.</p>
<p style="margin-left:11%; margin-top: 1em"><b>-t,
--tracking, tracking dependencies <br>
slpkg -t</b> &lt;<i>repository</i>&gt; &lt;<i>name of
package</i>&gt;, <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> &lt;<i>repository</i>&gt; &lt;<i>name of
package</i>&gt;, <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> &lt;<i>names of packages</i>&gt;,
<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> &lt;<i>names of packages</i>&gt;,
<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 &quot;# slpkg -f _SBo&quot;.</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> &lt;<i>name of package</i>&gt;,
&lt;<i>[pattern], --checklist</i>&gt;, <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 &quot;--checklist&quot; additional
option to load all repository, example: &quot;# slpkg -n
--checklist&quot;.</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>
&lt;<i>packages.t?z</i>&gt;</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
&quot;man installpkg&quot;.</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> &lt;<i>packages.t?z</i>&gt;</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
&quot;man upgradepkg&quot;.</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> &lt;<i>names
of packages</i>&gt;, <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&rsquo;d
see listed in /var/log/packages/), or by the base package
name. If installed packages with command &quot;# slpkg -s
&lt;repo&gt; &lt;packages&gt;&quot; 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
&quot;man removepkg&quot;.</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> &lt;<i>names of packages</i>&gt;</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 &minus;&minus;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 =
&quot;slack&quot; <br>
SlackBuilds.org = &quot;sbo&quot; <br>
Alien&rsquo;s = &quot;alien&quot; <br>
slacky.eu = &quot;slacky&quot; <br>
rworkman&rsquo;s = &quot;rlw&quot; <br>
Conraid&rsquo;s = &quot;conrad&quot; <br>
slackonly.com = &quot;slonly&quot; <br>
Alien&rsquo;s ktown = &quot;ktown{latest}&quot; <br>
Alien&rsquo;s multilib = &quot;multi&quot; <br>
Slacke E17 and E18 = &quot;slacke{18}&quot; <br>
SalixOS = &quot;salix&quot; <br>
Slackel.gr = &quot;slackel&quot; <br>
Alien&rsquo;s restricted = &quot;rested&quot; <br>
MATE Desktop Environment = &quot;msb{1.18}&quot; <br>
Cinnamon Desktop Environment = &quot;csb&quot; <br>
Connochaetos slack-n-free = &quot;connos&quot; <br>
Microlinux mles = &quot;mles&quot;</p>
<p style="margin-left:11%; margin-top: 1em">Default enable
repository is &quot;slack&quot; and &quot;sbo&quot;. <br>
Add or remove default repository in configuration file
&quot;/etc/slpkg/repositories.conf&quot;. <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
&quot;--skip=&quot; and blacklist file.</p>
<p style="margin-left:11%; margin-top: 1em">All packages
starts with: &quot;string*&quot; <br>
All packages ends with: &quot;*string&quot; <br>
All packages include: &quot;*string*&quot;</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: &lt;NAME_VARIABLE=value&gt;</p>
<p style="margin-left:11%; margin-top: 1em">Example: <br>
&quot;# export FFMPEG_X264=yes FFMPEG_LAME=yes&quot;</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&rsquo;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 &lt;d.zlatanidis@gmail.com&gt;</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
&copy; 2014-2022 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>

View file

@ -1,16 +1,2 @@
# Slackware Linux (based) SQLAlchemy>=1.4.36
# Python 3.7+
# GNU wget
# GNU coreutils
# sqlite3
# progress
# SQLAlchemy
#
# [OPTIONAL]
# aria2 (alternative downloader)
# curl (alternative downloader)
# httpie (alternative downloader)
# pygraphviz >= 1.3.1 (drawing dependencies diagram)
# perl 5 language and graph-easy >= 0.75 (drawing dependencies ascii diagram)
# python3-pythondialog >= 3.5.0 (Python interface to the UNIX dialog utility)
# flake8 >= 3.5.0

125
setup.py
View file

@ -1,102 +1,47 @@
#!/usr/bin/python3 #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# setup.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com> from setuptools import setup
# All rights reserved. from slpkg.metadata import Metadata
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os install_requires = ['SQLAlchemy>=1.4.36']
import time
from slpkg.__metadata__ import MetaData as _meta_
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
docs_requires = []
tests_requires = []
install_requires = [
"SQLAlchemy>=1.4.36",
"progress>=1.6"
]
optional_requires = [
"pythondialog>=3.5.1",
"pygraphviz>=1.3.1"
]
# Non-Python/non-PyPI optional dependencies:
# ascii diagram: graph-easy (available from SBo repository)
def print_logo():
"""print slpkg logo"""
logo_fname = os.path.join(os.path.dirname(__file__), 'logo.txt')
with open(logo_fname, 'rb') as f:
logo = f.read().decode('utf-8')
print(logo)
time.sleep(0.5)
print_logo()
setup( setup(
name="slpkg", name='slpkg',
packages=["slpkg", "slpkg/sbo", "slpkg/pkg", "slpkg/slack", packages=['slpkg', 'slpkg/models', 'slpkg/views'],
"slpkg/binary", "slpkg/models"], scripts=['bin/slpkg'],
scripts=["bin/slpkg"], version=Metadata.version,
version=_meta_.__version__, description='Package manager for Slackware installations',
description="Package manager for Slackware installations", long_description=open('README.rst').read(),
long_description=open("README.rst").read(), keywords=['slackware', 'slpkg', 'update', 'build', 'install', 'remove',
keywords=["slackware", "slpkg", "upgrade", "install", "remove", 'slackpkg', 'tool'],
"view", "slackpkg", "tool", "build"], author=Metadata.author,
author=_meta_.__author__, author_email=Metadata.email,
author_email=_meta_.__email__, url='https://dslackw.gitlab.io/slpkg/',
url="https://dslackw.gitlab.io/slpkg/", package_data={'': ['LICENSE', 'README.rst', 'ChangeLog.txt']},
package_data={"": ["LICENSE", "README.rst", "CHANGELOG"]}, data_files=[('/etc/slpkg', ['config/slpkg.json']),
data_files=[("man/man8", ["man/slpkg.8"]), ('/var/lib/slpkg/database', []),
("/etc/bash_completion.d", ["conf/slpkg.bash-completion"]), ('/var/lib/slpkg/repository', []),
("/etc/fish/completions", ["conf/slpkg.fish"]), ('/tmp/slpkg/build', [])],
("/var/lib/slpkg/database", [])],
install_requires=install_requires, install_requires=install_requires,
extras_require={
"optional": optional_requires,
"docs": docs_requires,
"tests": tests_requires,
},
classifiers=[ classifiers=[
"Development Status :: 5 - Production/Stable", 'Development Status :: 5 - Production/Stable',
"Environment :: Console", 'Environment :: Console',
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)", 'License :: OSI Approved :: MIT License',
"Operating System :: POSIX :: Linux", 'Operating System :: POSIX :: Linux',
"Operating System :: Unix", 'Operating System :: Unix',
"Programming Language :: Python", 'Programming Language :: Python',
"Programming Language :: Python :: 3", 'Programming Language :: Python :: 3',
"Programming Language :: Unix Shell", 'Programming Language :: Unix Shell',
"Topic :: Software Development :: Build Tools", 'Topic :: Software Development :: Build Tools',
"Topic :: System :: Archiving :: Packaging", 'Topic :: System :: Archiving :: Packaging',
"Topic :: System :: Software Distribution", 'Topic :: System :: Software Distribution',
"Topic :: System :: Installation/Setup", 'Topic :: System :: Installation/Setup',
"Topic :: System :: Systems Administration", 'Topic :: System :: Systems Administration',
"Topic :: System :: Software Distribution", 'Topic :: System :: Software Distribution',
"Topic :: Utilities"], 'Topic :: Utilities'],
python_requires=">=3.7" python_requires='>=3.9'
) )

View file

@ -3,10 +3,3 @@ and removes packages on Slackware based systems. It automatically
computes dependencies and figures out what things should occur computes dependencies and figures out what things should occur
to install packages. Slpkg makes it easier to maintain groups to install packages. Slpkg makes it easier to maintain groups
of machines without having to manually update. of machines without having to manually update.
Optional dependencies:
python3-pythondialog (for dialog box interface)
pygraphviz (for drawing dependencies diagram)
graph-easy (for drawing ascii dependencies diagram)
aria2 (alternative downloader)
httpie (alternative downloader)

View file

@ -8,11 +8,7 @@ config() {
fi fi
} }
CONFIGS="slpkg.conf repositories.conf blacklist slackware-mirrors default-repositories \ config etc/slpkg/slpkg.json.new
custom-repositories rlworkman.deps pkg_security"
for file in $CONFIGS; do
config etc/slpkg/${file}.new
done
if [ -x /usr/bin/update-desktop-database ]; then if [ -x /usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1

View file

@ -90,26 +90,18 @@ find -L . \
python3 setup.py install --root=$PKG python3 setup.py install --root=$PKG
mkdir -p $PKG/usr/sbin
cp bin/slpkg $PKG/usr/sbin/slpkg
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
# install configuration files # install configuration files
mkdir -p $PKG/etc/slpkg mkdir -p $PKG/etc/slpkg
CONFIGS="slpkg.conf repositories.conf blacklist slackware-mirrors \ install -D -m0644 conf/slpkg.json $PKG/etc/slpkg/slpkg.json.new
default-repositories custom-repositories rlworkman.deps pkg_security"
for file in $CONFIGS; do
install -D -m0644 conf/$file $PKG/etc/slpkg/${file}.new
done
# keep original configuration file for reset
cp -p conf/slpkg.conf $PKG/etc/slpkg/slpkg.conf.orig
find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README.rst ChangeLog.txt LICENSE ISSUES KNOWN_ISSUES REPOSITORIES.md \ cp -a README.rst ChangeLog.txt LICENSE requirements.txt $PKG/usr/doc/$PRGNAM-$VERSION
INSTALL.md requirements.txt $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
mkdir -p $PKG/install mkdir -p $PKG/install

View file

@ -1 +1 @@
# [ slpkg ] directory from main import Flags

View file

@ -1,255 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# __metadata__.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
# Slackware distribution branches
STABLE = "stable"
CURRENT = "current"
def remove_repositories(repositories, default_repositories):
"""Removes no default repositories
"""
for repo in repositories:
if repo in default_repositories:
yield repo
def update_repositories(repositories, conf_path):
"""Upadate with user custom repositories
"""
repo_file = f"{conf_path}custom-repositories"
if os.path.isfile(repo_file):
f = open(repo_file, "r")
repositories_list = f.read()
f.close()
for line in repositories_list.splitlines():
line = line.lstrip()
if line and not line.startswith("#"):
repositories.append(line.split()[0])
return repositories
def grab_sub_repo(repositories, repos):
"""Grabs SUB_REPOSITORY
"""
for i, repo in enumerate(repositories):
if repos in repo:
sub = repositories[i].replace(repos, "")
repositories[i] = repos
return sub
return ""
def select_slack_release(slack_rel):
"""Warning message if Slackware release not defined or
defined wrong
"""
if slack_rel not in [STABLE, CURRENT]:
return "FAULT"
return slack_rel
class MetaData:
__all__ = "slpkg"
__author__ = "dslackw"
__version_info__ = (4, 0, 2)
__version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"
__maintainer__ = "Dimitris Zlatanidis (dslackw)"
__homepage__ = "https://dslackw.gitlab.io/slpkg/"
# Default Slackware release
slack_rel = STABLE
# Configuration path
conf_path = f"/etc/{__all__}/"
# tmp paths
tmp = "/tmp/"
tmp_path = f"{tmp}{__all__}/"
# Default configuration values
_conf_slpkg = {
"RELEASE": STABLE,
"SLACKWARE_VERSION": "off",
"COMP_ARCH": "off",
"REPOSITORIES": ["slack", "sbo", "rlw", "alien",
"slacky", "conrad", "slonly",
"ktown{latest}", "multi", "slacke{18}",
"salix", "slackl", "rested", "msb{1.18}",
"csb", "connos", "mles{desktop}"],
"BUILD_PATH": "/tmp/slpkg/build/",
"SBOSRCARCH": "off",
"SBOSRCARCH_LINK": "http://slackware.uk/sbosrcarch/by-name/",
"PACKAGES": "/tmp/slpkg/packages/",
"PATCHES": "/tmp/slpkg/patches/",
"CHECKMD5": "on",
"DEL_ALL": "on",
"DEL_BUILD": "off",
"SBO_BUILD_LOG": "on",
"MAKEFLAGS": "off",
"DEFAULT_ANSWER": "n",
"REMOVE_DEPS_ANSWER": "n",
"SKIP_UNST": "n",
"RSL_DEPS": "on",
"DEL_DEPS": "off",
"USE_COLORS": "on",
"DOWNDER": "wget",
"DOWNDER_OPTIONS": "-c -N",
"SLACKPKG_LOG": "on",
"ONLY_INSTALLED": "off",
"EDITOR": "nano",
"NOT_DOWNGRADE": "off",
"HTTP_PROXY": "",
}
default_repositories = ["slack", "sbo", "rlw", "alien", "slacky", "conrad",
"slonly", "ktown", "multi", "slacke", "salix",
"slackl", "rested", "msb", "csb", "connos", "mles"]
# reads values from the configuration file
repositories = []
for files in ["slpkg.conf", "repositories.conf"]:
if os.path.isfile(f"{conf_path}{files}"):
f = open(f"{conf_path}{files}", "r")
conf = f.read()
f.close()
for line in conf.splitlines():
line = line.lstrip()
if line and not line.startswith("#"):
if files == "slpkg.conf":
_conf_slpkg[line.split("=")[0]] = line.split("=")[1]
elif files == "repositories.conf":
repositories.append(line)
# Sets values from the configuration file
slack_rel = _conf_slpkg["RELEASE"]
slackware_version = _conf_slpkg["SLACKWARE_VERSION"]
comp_arch = _conf_slpkg["COMP_ARCH"]
build_path = _conf_slpkg["BUILD_PATH"]
sbosrcarch = _conf_slpkg["SBOSRCARCH"]
sbosrcarch_link = _conf_slpkg["SBOSRCARCH_LINK"]
slpkg_tmp_packages = _conf_slpkg["PACKAGES"]
slpkg_tmp_patches = _conf_slpkg["PATCHES"]
checkmd5 = _conf_slpkg["CHECKMD5"]
del_all = _conf_slpkg["DEL_ALL"]
del_folder = _conf_slpkg["DEL_BUILD"]
sbo_build_log = _conf_slpkg["SBO_BUILD_LOG"]
makeflags = _conf_slpkg["MAKEFLAGS"]
default_answer = _conf_slpkg["DEFAULT_ANSWER"]
remove_deps_answer = _conf_slpkg["REMOVE_DEPS_ANSWER"]
skip_unst = _conf_slpkg["SKIP_UNST"]
rsl_deps = _conf_slpkg["RSL_DEPS"]
del_deps = _conf_slpkg["DEL_DEPS"]
use_colors = _conf_slpkg["USE_COLORS"]
downder = _conf_slpkg["DOWNDER"]
downder_options = _conf_slpkg["DOWNDER_OPTIONS"]
slackpkg_log = _conf_slpkg["SLACKPKG_LOG"]
only_installed = _conf_slpkg["ONLY_INSTALLED"]
editor = _conf_slpkg["EDITOR"]
not_downgrade = _conf_slpkg["NOT_DOWNGRADE"]
http_proxy = _conf_slpkg["HTTP_PROXY"]
# SBo downloading sources path
SBo_SOURCES = build_path + "_SOURCES/"
# Removes any gaps
repositories = [repo.strip() for repo in repositories]
# Checks Slackware release
slack_rel = select_slack_release(slack_rel)
# Grabs sub repositories
ktown_kde_repo = grab_sub_repo(repositories, "ktown")
slacke_sub_repo = grab_sub_repo(repositories, "slacke")
msb_sub_repo = grab_sub_repo(repositories, "msb")
mles_sub_repo = grab_sub_repo(repositories, "mles")
# removes no default repositories
repositories = list(remove_repositories(repositories,
default_repositories))
# adds custom repositories
update_repositories(repositories, conf_path)
color = {
"RED": "\x1b[31m",
"GREEN": "\x1b[32m",
"YELLOW": "\x1b[33m",
"CYAN": "\x1b[36m",
"GREY": "\x1b[38;5;247m",
"ENDC": "\x1b[0m"
}
if use_colors in ["off", "OFF"]:
color = {
"RED": "",
"GREEN": "",
"YELLOW": "",
"CYAN": "",
"GREY": "",
"ENDC": ""
}
CHECKSUMS_link = (f"https://gitlab.com/{__author__}/{__all__}/raw/"
"master/CHECKSUMS.md5")
# current path
try:
path = os.getcwd() + "/"
except OSError:
path = tmp_path
# library path
lib_path = "/var/lib/slpkg/"
# log path
log_path = "/var/log/slpkg/"
# packages log files path
pkg_path = "/var/log/packages/"
# slackpkg lib path
slackpkg_lib_path = "/var/lib/slackpkg/"
# database name
db = "database/database.slpkg"
# computer architecture
if comp_arch in ["off", "OFF"]:
arch = os.uname()[4]
else:
arch = comp_arch
# gets sbo OUTPUT enviroment variable
try:
output = os.environ["OUTPUT"]
except KeyError:
output = tmp
if not output.endswith("/"):
output += "/"

View file

@ -1,228 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# arguments.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.repolist import RepoList
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.slack.slack_version import slack_ver
def header():
"""help header message"""
print(f"slpkg - version {_meta_.__version__} | Slackware release: "
f"{_meta_.slack_rel} - {slack_ver()}\n")
def options():
"""Slpkg is a user-friendly package manager for Slackware installations
Usage: slpkg [COMMANDS|OPTIONS] {repository|package...}
_ _
___| |_ __ | | ____ _
/ __| | '_ \| |/ / _` |
\__ \ | |_) | < (_| |
|___/_| .__/|_|\_\__, |
|_| |___/
_Slackware package manager_______
Commands:
update, --repos=[...] Run this command to update all
the packages lists.
upgrade, --repos=[...] Delete and recreate all packages
lists.
repo-add [repository name] [URL] Add custom repository.
repo-remove [repository] Remove custom repository.
repo-enable Enable or disable default
repositories via dialog utility.
repo-list Print a list of all the
repositories.
repo-info [repository] Get information about a
repository.
update slpkg Upgrade the program directly from
repository.
health, --silent Health check installed packages.
deps-status, --tree, --graph=[type] Print dependencies status used by
packages or drawing dependencies
diagram.
new-config Manage .new configuration files.
clean-tmp Clean the tmp/ directory from
downloaded packages and sources.
Optional arguments:
-h | --help Print this help message and exit.
-v | --version Print program version and exit.
-a | --autobuild, [script] [source...] Auto build SBo packages.
If you have already downloaded the
script and the source code you can
build a new package with this
command.
-b | --blacklist, [package...] --add, Manage packages in the blacklist.
--remove, list Add or remove packages and print
the list. Each package is added
here will not be accessible by the
program.
-q | --queue, [package...] --add, Manage SBo packages in the queue.
--remove, list, build, install, Add or remove and print the list
build-install of packages. Build and then
install the packages from the
queue.
-g | --config, print, edit, reset Configuration file management.
Print, edit the configuration file
or reset in the default values.
-l | --list, [repository], --index, Print a list of all available
--installed, --name packages from repository, index or
print only packages installed on
the system.
-c | --check, [repository], --upgrade, Check for updated packages from
--rebuild --skip=[...], the repositories and upgrade or
--resolve-off, --checklist install with all dependencies.
-s | --sync, [repository] [package...], Sync packages. Install packages
--rebuild, --reinstall, directly from remote repositories
--case-ins, --patches with all dependencies.
-t | --tracking, [repository] [package], Tracking package dependencies and
--check-deps, --graph=[type], print package dependencies tree
--case-ins with highlight if packages is
installed. Also check if
dependencies used or drawing
dependencies diagram.
-p | --desc, [repository] [package], Print description of a package
--color=[] directly from the repository and
change color text.
-n | --network, [package], --checklist, View a standard of SBo page in
--case-ins terminal and manage multiple
options like reading, downloading,
building, installation, etc.
-F | --FIND, [package...], --case-ins Find packages from each enabled
repository and view results.
-f | --find, [package...], --case-ins, Find and print installed packages
--third-party reporting the size and the sum.
-i | --installpkg, [options] [package...] Installs single or multiple *.tgz
options=[--warn, --md5sum, --root, (or .tbz, .tlz, .txz) Slackware
--infobox, --menu, --terse, --ask, binary packages designed for use
--priority, --tagfile] with the Slackware Linux
distribution onto your system.
-u | --upgradepkg, [options] [package...] Upgrade single or multiple
options=[--dry-run, --install-new, Slackware binary packages from
--reinstall, --verbose] an older version to a newer one.
-r | --removepkg, [options] [package...], Removes a previously installed
--deps, --check-deps, --tag, Slackware binary packages,
--checklist, --third-party while writing a progress report
options=[-warn, -preserve, -copy, to the standard output.
-keep] Use only package name.
-d | --display, [package...] Display the contents of installed
packages and file list.
You can read more about slpkg from manpage or see examples from readme file.
Issues: https://gitlab.com/dslackw/slpkg/issues
Homepage: https://dslackw.gitlab.io/slpkg/
"""
header()
print(options.__doc__)
def usage(repo, stderr):
"""Usage: slpkg [COMMANDS|OPTIONS] {repository|package...}
Commands:
[update, --repos=[...]]
[upgrade, --repos=[...]]
[repo-add [repository name] [URL]]
[repo-remove [repository]]
[repo-enable]
[repo-list]
[repo-info [repository]]
[update [slpkg]]
[health, --silent]
[deps-status, --tree, --graph=[type]]
[new-config]
[clean-tmp]
Optional arguments:
[-h] [-v]
[-a [script] [sources...]]
[-b [package...] --add, --remove,
[list]]
[-q [package...] --add, --remove,
[list, build, install, build-install]]
[-g [print, edit, reset]]
[-l [repository], --index, --installed, --name]
[-c [repository], --upgrade, --rebuild, --skip=[...],
--resolve-off, --checklist]
[-s [repository] [package...], --rebuild, --reinstall,
--case-ins, --patches]
[-t [repository] [package], --check-deps, --graph=[type],
--case-ins]
[-p [repository] [package], --color=[]]
[-n [SBo package], --checklist, --case-ins]
[-F [package...], --case-ins]
[-f [package...], --case-ins, --third-party]
[-i [options] [package...]]
[-u [options] [package...]]
[-r [options] [package...], --deps, --check-deps, --tag,
--checklist, --third-party]
[-d [package...]]
"""
if repo and repo not in _meta_.repositories:
error_repo = ""
all_repos = RepoList().all_repos.keys()
del RepoList().all_repos
if repo in all_repos:
error_repo = (f"slpkg: Error: Repository '{repo}' is not activated"
"\n")
else:
error_repo = (f"slpkg: Error: Repository '{repo}' does not exist"
"\n")
raise SystemExit(f"\n{error_repo}")
print(usage.__doc__)
print("For more information try 'slpkg -h, --help' or view manpage\n")
if stderr == 1:
raise SystemExit(stderr)

View file

@ -1,89 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# auto_pkg.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.messages import Msg
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.pkg.manager import PackageManager
class AutoInstall:
"""Select the Slackware command to install packages
"""
def __init__(self, packages):
self.packages = packages
self.green = _meta_.color["GREEN"]
self.red = _meta_.color["RED"]
self.cyan = _meta_.color["CYAN"]
self.endc = _meta_.color["ENDC"]
self.msg = Msg()
self.commands = {
"i": "installpkg",
"u": "upgradepkg --install-new",
"r": "upgradepkg --reinstall"
}
def select(self):
"""Select Slackware command
"""
print("\nDetected Slackware binary package for installation:\n")
for pkg in self.packages:
print(" " + pkg.split("/")[-1])
print()
self.msg.template(78)
print("| Choose a Slackware command:")
self.msg.template(78)
for com in sorted(self.commands):
print(f"| {self.red}{com}{self.endc}) {self.green}"
f"{self.commands[com]}{self.endc}")
self.msg.template(78)
try:
self.choice = input(" > ")
except EOFError:
raise SystemExit("\n")
if self.choice in self.commands.keys():
print(f" \x1b[1A{self.cyan}{self.commands[self.choice]}"
f"{self.endc}", end="\n\n")
print(end="", flush=True)
self.execute()
def execute(self):
"""Executes Slackware command
"""
if self.choice in self.commands.keys():
if self.choice == "i":
PackageManager(self.packages).install("")
elif self.choice in ["u", "r"]:
PackageManager(self.packages).upgrade(
self.commands[self.choice][11:])

View file

@ -1 +0,0 @@
# [ binarys ] directory

View file

@ -1,78 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# check.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from pkg_resources import parse_version
from slpkg.messages import Msg
from slpkg.splitting import split_package
from slpkg.upgrade_checklist import choose_upg
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.pkg.find import find_package
from slpkg.binary.greps import repo_data
from slpkg.binary.repo_init import RepoInit
def pkg_upgrade(repo, skip, flag):
"""Checking packages for upgrade
"""
msg = Msg()
msg.checking()
PACKAGES_TXT = RepoInit(repo).fetch()[0]
pkgs_for_upgrade = []
# name = data[0]
# location = data[1]
# size = data[2]
# unsize = data[3]
data = repo_data(PACKAGES_TXT, repo, flag="")
for pkg in installed():
inst_pkg = split_package(pkg)
for name in data[0]:
if name: # this tips because some pkg_name is empty
repo_pkg = split_package(name[:-4])
if (repo_pkg[0] == inst_pkg[0] and
parse_version(repo_pkg[1]) > parse_version(inst_pkg[1]) and
repo_pkg[3] >= inst_pkg[3] and
inst_pkg[0] not in skip and
repo_pkg[1] != "blacklist"):
pkgs_for_upgrade.append(repo_pkg[0])
msg.done()
if "--checklist" in flag:
pkgs_for_upgrade = choose_upg(pkgs_for_upgrade)
return pkgs_for_upgrade
def installed():
"""Returns all installed packages
"""
return find_package("", _meta_.pkg_path)

View file

@ -1,70 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# dependency.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
from functools import lru_cache
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.binary.greps import Requires
class Dependencies:
"""Resolving binary dependencies
"""
def __init__(self, repo, black):
self.repo = repo
self.black = black
self.dep_results = []
self.meta = _meta_
def binary(self, name, flag):
"""Builds all dependencies of a package
"""
if self.meta.rsl_deps in ["on", "ON"] and "--resolve-off" not in flag:
sys.setrecursionlimit(10000)
dependencies = []
requires = Requires(name, self.repo).get_deps()
if requires:
for req in requires:
if req and req not in self.black:
dependencies.append(req)
self.deep_check(tuple(dependencies), tuple(flag))
return self.dep_results
else:
return []
@lru_cache
def deep_check(self, dependencies, flag):
"""Checking if dependencies are finnished
"""
if dependencies:
self.dep_results.append(dependencies)
[self.binary(dep, flag) for dep in dependencies]

View file

@ -1,284 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# greps.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from functools import lru_cache
from slpkg.utils import Utils
from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.slack.slack_version import slack_ver
def repo_data(PACKAGES_TXT, repo, flag):
"""Grabs data packages
"""
(name, location, size, unsize,
rname, rlocation, rsize, runsize) = ([] for i in range(8))
for line in PACKAGES_TXT.splitlines():
if line.startswith("PACKAGE NAME:"):
name.append(line[15:].strip())
if line.startswith("PACKAGE LOCATION:"):
location.append(line[21:].strip())
if line.startswith("PACKAGE SIZE (compressed):"):
size.append(line[28:-2].strip())
if line.startswith("PACKAGE SIZE (uncompressed):"):
unsize.append(line[30:-2].strip())
if repo == "slack" and "--upgrade" not in flag:
(rname,
rlocation,
rsize,
runsize
) = slack_filter(name, location, size, unsize, flag)
elif repo == "rlw":
(rname,
rlocation,
rsize,
runsize
) = rlw_filter(name, location, size, unsize)
elif repo == "alien":
(rname,
rlocation,
rsize,
runsize
) = alien_filter(name, location, size, unsize)
elif repo == "rested":
(rname,
rlocation,
rsize,
runsize
) = rested_filter(name, location, size, unsize)
elif repo == "ktown":
(rname,
rlocation,
rsize,
runsize
) = ktown_filter(name, location, size, unsize)
else:
rname, rlocation, rsize, runsize = name, location, size, unsize
return [rname, rlocation, rsize, runsize]
def slack_filter(name, location, size, unsize, flag):
"""Slackware filter seperate packages from patches/ directory
"""
(fname, flocation, fsize, funsize) = ([] for i in range(4))
if "--patches" not in flag:
for n, l, s, u in zip(name, location, size, unsize):
if f"_slack{slack_ver()}" not in n:
fname.append(n)
flocation.append(l)
fsize.append(s)
funsize.append(u)
if "--patches" in flag:
for n, l, s, u in zip(name, location, size, unsize):
if f"_slack{slack_ver()}" in n:
fname.append(n)
flocation.append(l)
fsize.append(s)
funsize.append(u)
return [fname, flocation, fsize, funsize]
def rlw_filter(name, location, size, unsize):
"""Filter rlw repository data
"""
arch = _meta_.arch
if arch.startswith("i") and arch.endswith("86"):
arch = "i486"
(fname, flocation, fsize, funsize) = ([] for i in range(4))
for n, l, s, u in zip(name, location, size, unsize):
loc = l.split("/")
if arch == loc[-1]:
fname.append(n)
flocation.append(l)
fsize.append(s)
funsize.append(u)
return [fname, flocation, fsize, funsize]
def alien_filter(name, location, size, unsize):
"""Fix to avoid packages include in slackbuilds folder
"""
(fname, flocation, fsize, funsize) = ([] for i in range(4))
for n, l, s, u in zip(name, location, size, unsize):
if "slackbuilds" != l:
fname.append(n)
flocation.append(l)
fsize.append(s)
funsize.append(u)
return [fname, flocation, fsize, funsize]
def rested_filter(name, location, size, unsize):
"""Filter Alien"s repository data
"""
ver = slack_ver()
if _meta_.slack_rel == "current":
ver = "current"
path_pkg = "pkg"
if _meta_.arch == "x86_64":
path_pkg = "pkg64"
(fname, flocation, fsize, funsize) = ([] for i in range(4))
for n, l, s, u in zip(name, location, size, unsize):
if path_pkg == l.split("/")[-2] and ver == l.split("/")[-1]:
fname.append(n)
flocation.append(l)
fsize.append(s)
funsize.append(u)
return [fname, flocation, fsize, funsize]
def ktown_filter(name, location, size, unsize):
"""Filter Alien"s ktown repository data
"""
ver = slack_ver()
if _meta_.slack_rel == "current":
ver = "current"
path_pkg = "x86"
if _meta_.arch == "x86_64":
path_pkg = _meta_.arch
(fname, flocation, fsize, funsize) = ([] for i in range(4))
for n, l, s, u in zip(name, location, size, unsize):
if (path_pkg in l and _meta_.ktown_kde_repo[1:-1] in l and
l.startswith(ver)):
fname.append(n)
flocation.append(l)
fsize.append(s)
funsize.append(u)
return [fname, flocation, fsize, funsize]
class Requires:
def __init__(self, name, repo):
self.name = name
self.repo = repo
def get_deps(self):
"""Grabs package requirements from repositories
"""
if self.repo == "rlw":
dependencies = {}
rlw_deps = Utils().read_file(_meta_.conf_path + "rlworkman.deps")
for line in rlw_deps.splitlines():
if line and not line.startswith("#"):
pkgs = line.split(":")
dependencies[pkgs[0]] = pkgs[1]
if self.name in dependencies.keys():
return dependencies[self.name].split()
else:
return ""
else:
PACKAGES_TXT = Utils().read_file(f"{_meta_.lib_path}"
f"{self.repo}_repo/PACKAGES.TXT")
for line in PACKAGES_TXT.splitlines():
if line.startswith("PACKAGE NAME:"):
pkg_name = split_package(line[14:].strip())[0]
if line.startswith("PACKAGE REQUIRED:"):
if pkg_name == self.name:
if line[18:].strip():
return self._req_fix(line)
@lru_cache
def _req_fix(self, line):
"""Fix slacky and salix requirements because many dependencies
splitting with "," and others with "|"
"""
deps = []
for dep in line[18:].strip().split(","):
dep = dep.split("|")
if self.repo == "slacky":
if len(dep) > 1:
for d in dep:
deps.append(d.split()[0])
dep = "".join(dep)
deps.append(dep.split()[0])
else:
if len(dep) > 1:
for d in dep:
deps.append(d)
deps.append(dep[0])
return deps

View file

@ -1,403 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# install.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from itertools import zip_longest
from pkg_resources import parse_version
from slpkg.utils import Utils
from slpkg.sizes import units
from slpkg.messages import Msg
from slpkg.checksum import check_md5
from slpkg.blacklist import BlackList
from slpkg.downloader import Download
from slpkg.log_deps import write_deps
from slpkg.grep_md5 import pkg_checksum
from slpkg.remove import delete_package
from slpkg.security import pkg_security
from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.pkg.find import find_package
from slpkg.pkg.manager import PackageManager
from slpkg.pkg.installed import GetFromInstalled
from slpkg.binary.greps import repo_data
from slpkg.binary.repo_init import RepoInit
from slpkg.binary.dependency import Dependencies
class BinaryInstall(BlackList, Utils):
"""Installs binaries packages with all dependencies from
repository
"""
def __init__(self, packages, repo, flag):
super().__init__()
self.packages = packages
pkg_security(packages)
self.repo = repo
self.flag = flag
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.version = self.meta.slack_rel
self.tmp_path = self.meta.slpkg_tmp_packages
self.dwn, self.dep_dwn = [], []
self.install, self.dep_install = [], []
self.comp_sum, self.dep_comp_sum = [], []
self.uncomp_sum, self.dep_uncomp_sum = [], []
self.dependencies = []
self.deps_dict = {}
self.answer = ""
self.msg.reading()
self.PACKAGES_TXT, self.mirror = RepoInit(self.repo).fetch()
self.data = repo_data(self.PACKAGES_TXT, self.repo, self.flag)
self.repo_pkg_names = []
for name in self.data[0]:
self.repo_pkg_names.append(split_package(name)[0])
self.blacklist = list(self.get_black())
self.matching = False
def start(self, is_upgrade):
"""Installs packages from official Slackware distribution
"""
self.case_insensitive()
# fix if packages is for upgrade
self.is_upgrade = is_upgrade
mas_sum = dep_sum = sums = 0, 0, 0, 0
self.msg.done()
self.dependencies = self.resolving_deps()
self.update_deps()
(self.dep_dwn, self.dep_install, self.dep_comp_sum,
self.dep_uncomp_sum) = self.store(self.dependencies)
self.clear_masters()
(self.dwn, self.install, self.comp_sum,
self.uncomp_sum) = self.store(self.packages)
if self.meta.rsl_deps in ["on", "ON"]:
self.msg.done()
if self.install:
if self.matching and [""] != self.packages:
self.msg.matching(self.packages)
else:
print("\nThe following packages will be automatically "
"installed or upgraded \nwith new version:\n")
self.top_view()
self.msg.upg_inst(self.is_upgrade)
mas_sum = self.views(self.install, self.comp_sum)
if self.dependencies:
print("Installing for dependencies:")
dep_sum = self.views(self.dep_install, self.dep_comp_sum)
# sums[0] --> total packages
# sums[1] --> reinstall
# sums[2] --> upgraded
# sums[3] --> uninstall
sums = [sum(s) for s in zip_longest(mas_sum, dep_sum)]
unit, size = units(self.comp_sum + self.dep_comp_sum,
self.uncomp_sum + self.dep_uncomp_sum)
if self.matching and [""] != self.packages:
print("\nMatching summary")
print("=" * 79)
raise SystemExit(f"Total {sums[0]} matching packages\n")
print("\nInstalling summary")
print("=" * 79)
print(f"{self.grey}Total {sums[0]} {self.msg.pkg(sums[0])}.")
print(f"{sums[3]} {self.msg.pkg(sums[3])} will be installed, "
f"{sums[2]} will be upgraded and "
f"{sums[1]} will be reinstalled.")
print(f"Need to get {size[0]} {unit[0]} of archives.")
print(f"After this process, {size[1]} {unit[1]} of additional "
f"disk space will be used.{self.endc}")
print()
self.if_all_installed()
if self.msg.answer() in ["y", "Y"]:
for inst, dwn in zip(self.dep_install + self.install,
self.dep_dwn + self.dwn):
if (self.meta.not_downgrade == "on" and
self.not_downgrade(inst) is True):
continue
if (not os.path.isfile(self.meta.pkg_path + inst[:-4]) or
"--reinstall" in self.flag):
Download(self.tmp_path, dwn.split(), self.repo).start()
else:
self.msg.template(78)
self.msg.pkg_found(inst)
self.msg.template(78)
self.dep_install = list(self.check_downloaded(
self.tmp_path, self.dep_install))
self.install = list(self.check_downloaded(
self.tmp_path, self.install))
ins, upg = self.install_packages()
self.msg.reference(ins, upg)
write_deps(self.deps_dict)
delete_package(self.tmp_path, self.dep_install + self.install)
else:
self.msg.not_found(self.is_upgrade)
raise SystemExit(1)
def if_all_installed(self):
"""Checks if all packages is already installed
"""
count_inst = 0
for inst in (self.dep_install + self.install):
if (os.path.isfile(self.meta.pkg_path + inst[:-4])):
count_inst += 1
if (count_inst == len(self.dep_install + self.install) and
"--reinstall" not in self.flag):
raise SystemExit()
def case_insensitive(self):
"""Matching packages distinguish between uppercase and
lowercase
"""
if "--case-ins" in self.flag:
data = list(self.package_name(self.PACKAGES_TXT))
data_dict = self.case_sensitive(data)
for pkg in self.packages:
index = self.packages.index(pkg)
for key, value in data_dict.items():
if key == pkg.lower():
self.packages[index] = value
def update_deps(self):
"""Updates dependencies dictionary with all package
"""
for dep in self.dependencies:
deps = self.dimensional_list(Dependencies(
self.repo, self.blacklist).binary(
dep, self.flag))
self.deps_dict[dep] = deps
def clear_masters(self):
"""Clear master packages if already exist in dependencies
or if added to install two or more times
"""
packages = []
for mas in self.remove_dbs(self.packages):
if mas not in self.dependencies:
packages.append(mas)
self.packages = packages
def install_packages(self):
"""Installs or upgrades packages
"""
installs, upgraded = [], []
for inst in (self.dep_install + self.install):
package = (self.tmp_path + inst).split()
pkg_ver = f"{split_package(inst)[0]}-{split_package(inst)[1]}"
self.checksums(inst)
if GetFromInstalled(split_package(inst)[0]).name():
print(f"[ {self.yellow}upgrading{self.endc} ] --> {inst}")
upgraded.append(pkg_ver)
if "--reinstall" in self.flag:
PackageManager(package).upgrade("--reinstall")
else:
PackageManager(package).upgrade("--install-new")
else:
print(f"[ {self.green}installing{self.endc} ] --> {inst}")
installs.append(pkg_ver)
PackageManager(package).upgrade("--install-new")
return [installs, upgraded]
def not_downgrade(self, package):
"""Don't downgrade packages if repository version is lower than
installed"""
name = split_package(package)[0]
rep_ver = split_package(package)[1]
ins_ver = GetFromInstalled(name).version()
if not ins_ver:
ins_ver = "0"
if parse_version(rep_ver) < parse_version(ins_ver):
self.msg.template(78)
print(f"| Package {name} does not downgrade, setting by user")
self.msg.template(78)
return True
def checksums(self, install):
"""Checksums before install
"""
check_md5(pkg_checksum(install, self.repo), self.tmp_path + install)
def resolving_deps(self):
"""Returns package dependencies
"""
requires = []
if self.meta.rsl_deps in ["on", "ON"]:
self.msg.resolving()
for dep in self.packages:
dependencies = []
dependencies = self.dimensional_list(Dependencies(
self.repo, self.blacklist).binary(dep, self.flag))
requires += list(self._fix_deps_repos(dependencies))
self.deps_dict[dep] = self.remove_dbs(requires)
return self.remove_dbs(requires)
def _fix_deps_repos(self, dependencies):
"""Fixes store deps include in the repository
"""
for dep in dependencies:
if dep in self.repo_pkg_names:
yield dep
def views(self, install, comp_sum):
"""Views packages
"""
pkg_sum = uni_sum = upg_sum = res_sum = 0
# fix repositories align
repo = self.repo + (" " * (6 - (len(self.repo))))
for pkg, comp in zip(install, comp_sum):
pkg_sum += 1
pkg_repo = split_package(pkg[:-4])
if find_package(pkg[:-4], self.meta.pkg_path):
if "--reinstall" in self.flag:
res_sum += 1
COLOR = self.meta.color["GREEN"]
elif pkg_repo[0] == GetFromInstalled(pkg_repo[0]).name():
COLOR = self.meta.color["YELLOW"]
upg_sum += 1
else:
COLOR = self.meta.color["RED"]
uni_sum += 1
ver = GetFromInstalled(pkg_repo[0]).version()
if ver:
ver = f"-{ver}"
print(f" {COLOR}{pkg_repo[0] + ver}{self.endc}"
f"{' ' * (23-len(pkg_repo[0] + ver))} {pkg_repo[1]}"
f"{' ' * (18-len(pkg_repo[1]))} {pkg_repo[2]}"
f"{' ' * (8-len(pkg_repo[2]))}{pkg_repo[3]}"
f"{' ' * (7-len(pkg_repo[3]))}{repo}{comp:>11}{' K'}")
return [pkg_sum, res_sum, upg_sum, uni_sum]
def top_view(self):
"""Prints packages status bar
"""
self.msg.template(78)
print(f"| Package{' ' * 17}New Version{' ' * 8}Arch{' ' * 4}"
f"Build{' ' * 2}Repos{' ' * 10}Size")
self.msg.template(78)
def store(self, packages):
"""Stores and returns packages for install
"""
dwn, install, comp_sum, uncomp_sum = ([] for i in range(4))
# name = data[0]
# location = data[1]
# size = data[2]
# unsize = data[3]
for pkg in packages:
for pk, loc, comp, uncomp in zip(self.data[0], self.data[1],
self.data[2], self.data[3]):
if (pk and pkg == split_package(pk)[0] and
pk not in install and
split_package(pk)[0] not in self.blacklist):
dwn.append(f"{self.mirror}{loc}/{pk}")
install.append(pk)
comp_sum.append(comp)
uncomp_sum.append(uncomp)
if not install:
for pkg in packages:
for pk, loc, comp, uncomp in zip(self.data[0], self.data[1],
self.data[2], self.data[3]):
name = split_package(pk)[0]
if (pk and pkg in name and name not in self.blacklist):
self.matching = True
dwn.append(f"{self.mirror}{loc}/{pk}")
install.append(pk)
comp_sum.append(comp)
uncomp_sum.append(uncomp)
dwn.reverse()
install.reverse()
comp_sum.reverse()
uncomp_sum.reverse()
return [dwn, install, comp_sum, uncomp_sum]

View file

@ -1,163 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# repo_init.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.utils import Utils
from slpkg.repositories import Repo
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.slack.mirrors import mirrors
from slpkg.slack.slack_version import slack_ver
class RepoInit(Utils):
"""Returns PACKAGES.TXT and mirror by repository
"""
def __init__(self, repo):
self.repo = repo
self.meta = _meta_
self.def_repo_dict = Repo().default_repository()
self.mirror = ""
def fetch(self):
if self.repo in self.meta.default_repositories:
getattr(self, f"_init_{self.repo}")()
else:
self._init_custom()
self.lib = self.meta.lib_path + f"{self.repo}_repo/PACKAGES.TXT"
PACKAGES_TXT = self.read_file(self.lib)
return PACKAGES_TXT, self.mirror
def _init_custom(self):
repo = Repo()
self.mirror = repo.custom_repository()[self.repo]
def _init_slack(self):
self.mirror = mirrors(name="", location="")
def _init_rlw(self):
self.mirror = f"{self.def_repo_dict}{slack_ver()}/"
def _init_alien(self):
ver = slack_ver()
arch = "x86"
if self.meta.arch == "x86_64":
arch = "x86_64"
if self.meta.slack_rel == "current":
ver = self.meta.slack_rel
self.mirror = f"{self.def_repo_dict['alien']}{ver}/{arch}/"
def _init_slacky(self):
arch = ""
if self.meta.arch == "x86_64":
arch = "64"
self.mirror = f"{self.def_repo_dict}slackware{arch}-{slack_ver()}/"
def _init_conrad(self):
self.mirror = self.def_repo_dict["conrad"]
def _init_slonly(self):
ver = slack_ver()
arch = f"{ver}-x86"
if self.meta.arch == "x86_64":
arch = f"{ver}-x86_64"
if self.meta.slack_rel == "current":
if self.meta.arch == "x86_64":
arch = f"{self.meta.slack_rel}-x86_64"
else:
arch = f"{self.meat.slack_rel}-x86"
self.mirror = f"{self.def_repo_dict['slonly']}{arch}/"
def _init_ktown(self):
self.mirror = self.def_repo_dict["ktown"]
def _init_multi(self):
ver = slack_ver()
if self.meta.slack_rel == "current":
ver = self.meta.slack_rel
self.mirror = self.def_repo_dict["multi"] + ver + "/"
def _init_slacke(self):
arch = ""
if self.meta.arch == "x86_64":
arch = "64"
self.mirror = (f"{self.def_repo_dict['slacke']}"
f"slacke{self.meta.slacke_sub_repo[1:-1]}/slackware"
f"{arch}-{slack_ver()}/")
def _init_salix(self):
arch = "i486"
if self.meta.arch == "x86_64":
arch = "x86_64"
self.mirror = f"{self.def_repo_dict['salix']}{arch}/{slack_ver()}/"
def _init_slackl(self):
arch = "i486"
if self.meta.arch == "x86_64":
arch = "x86_64"
self.mirror = f"{self.def_repo_dict['slackl']}{arch}/current/"
def _init_rested(self):
self.mirror = self.def_repo_dict["rested"]
def _init_msb(self):
arch = "x86"
if self.meta.arch == "x86_64":
arch = "x86_64"
self.mirror = (f"{self.def_repo_dict['msb']}{slack_ver()}/"
f"{self.meta.msb_sub_repo[1:-1]}/{arch}/")
def _init_csb(self):
arch = "x86"
if self.meta.arch == "x86_64":
arch = "x86_64"
self.mirror = f"{self.def_repo_dict['csb']}{slack_ver()}/{arch}"
def _init_connos(self):
arch = ""
if self.meta.arch == "x86_64":
arch = "64"
self.mirror = (f"{self.def_repo_dict['connos']}slack-n-free"
f"{arch}-{slack_ver()}/")
def _init_mles(self):
arch = "32"
if self.meta.arch == "x86_64":
arch = "64"
self.mirror = (f"{self.def_repo_dict['mles']}"
f"{self.meta.mles_sub_repo[1:-1]}-"
f"{slack_ver()}-{arch}bit/")

View file

@ -1,43 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# search.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.utils import Utils
from slpkg.blacklist import BlackList
from slpkg.__metadata__ import MetaData as _meta_
def search_pkg(name, repo):
"""Searching if the package exists in PACKAGES.TXT file
and return the name.
"""
utils = Utils()
black = BlackList()
text = utils.read_file(_meta_.lib_path + f"{repo}_repo/PACKAGES.TXT")
PACKAGES_TXT = list(utils.package_name(text))
blacklist = list(black.get_black())
if name in PACKAGES_TXT and name not in blacklist:
return name

View file

@ -1,115 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# blacklist.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from slpkg.utils import Utils
from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_
class BlackList(Utils):
"""Blacklist class to add, remove or list packages
in blacklist file."""
def __init__(self):
self.green = _meta_.color["GREEN"]
self.red = _meta_.color["RED"]
self.endc = _meta_.color["ENDC"]
self.blackfile = "/etc/slpkg/blacklist"
self.black_conf = ""
if os.path.isfile(self.blackfile):
self.black_conf = self.read_file(self.blackfile)
def get_black(self):
"""Return blacklist packages from /etc/slpkg/blacklist
configuration file."""
blacklist = list(self.black_filter())
installed = os.listdir("/var/log/packages/")
for black in blacklist:
if black.endswith("*"):
for inst in installed:
if inst.startswith(black[:-1]):
yield split_package(inst)[0]
else:
yield black
def black_filter(self):
"""Returns all the installed files that start
by the name
"""
for read in self.black_conf.splitlines():
read = read.lstrip()
if not read.startswith("#"):
yield read.replace("\n", "")
def black_listed(self):
"""Prints blacklist packages
"""
print("Packages in the blacklist:")
for black in list(self.black_filter()):
if black:
print(f"{self.green}{black}{self.endc}")
print()
def black_add(self, pkgs):
"""Adds blacklist packages if not exist
"""
blacklist = list(self.black_filter())
pkgs = set(pkgs)
print("Add packages in the blacklist:")
with open(self.blackfile, "a") as black_conf:
for pkg in pkgs:
if pkg not in blacklist:
print(f"{self.green}{pkg}{self.endc}")
black_conf.write(pkg + "\n")
print()
def black_remove(self, pkgs):
"""Removes packages from blacklist
"""
print("Remove packages from the blacklist:")
with open(self.blackfile, "w") as remove:
for line in self.black_conf.splitlines():
if line not in pkgs:
remove.write(line + "\n")
else:
print(f"{self.red}{line}{self.endc}")
print()

View file

@ -1,150 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# checks.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.messages import Msg
from slpkg.arguments import usage
from slpkg.init import Init
from slpkg.__metadata__ import MetaData as _meta_
class Updates:
"""Checking for news in ChangeLog.txt
"""
def __init__(self, repo):
self.repo = repo
self.meta = _meta_
self.green = _meta_.color["GREEN"]
self.endc = _meta_.color["ENDC"]
self.msg = Msg()
self.check = 2
self.st = ""
self.count_repo = 0
self.count_news = 0
self._init = Init(True)
self.all_repos = {
"slack": self._init.slack,
"sbo": self._init.sbo,
"rlw": self._init.rlw,
"alien": self._init.alien,
"slacky": self._init.slacky,
"conrad": self._init.conrad,
"slonly": self._init.slonly,
"ktown": self._init.ktown,
"multi": self._init.multi,
"slacke": self._init.slacke,
"salix": self._init.salix,
"slackl": self._init.slackl,
"rested": self._init.rested,
"msb": self._init.msb,
"csb": self._init.csb,
"connos": self._init.msb,
"mles": self._init.mles
}
def status_bar(self):
"""Top view bar status
"""
self.msg.template(78)
print("| Repository Status")
self.msg.template(78)
def run(self):
"""Run and check if new in ChangeLog.txt
"""
if (self.repo in self.meta.default_repositories and
self.repo in self.meta.repositories):
try:
self.check = self.all_repos[self.repo]()
except OSError:
usage(self.repo, 1)
elif self.repo in self.meta.repositories:
self.check = self._init.custom(self.repo)
else:
usage(self.repo, 1)
self.status_bar()
self.status()
self.print_status(self.repo)
self.summary()
def ALL(self):
"""Check ALL enabled repositories ChangeLogs
"""
self.status_bar()
for repo in self.meta.repositories:
if repo in self.meta.default_repositories:
try:
self.check = self.all_repos[repo]()
except OSError:
usage(self.repo, 1)
elif repo in self.meta.repositories:
self.check = self._init.custom(repo)
self.status()
self.print_status(repo)
self.summary()
def status(self):
"""Set messages
"""
self.count_repo += 1
if self.check == 1:
self.count_news += 1
self.st = f"{self.green}News in ChangeLog.txt{self.endc}"
elif self.check == 0:
self.st = "No changes in ChangeLog.txt"
def print_status(self, repo):
"""Print status
"""
print(f" {repo}{' ' * (19 - len(repo))}{self.st}")
def summary(self):
"""Print summary
"""
print("\nSummary")
print("=" * 79)
cmd = "All repositories are updated."
if self.count_repo == 1:
cmd = "Repository is updated."
if self.count_news > 0:
cmd = "Run the command 'slpkg update'."
print(f"From {self.count_repo} repositories need"
f" {self.count_news} updating. {cmd}", end="\n")

View file

@ -1,70 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# checksum.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.md5sum import md5
from slpkg.messages import Msg
from slpkg.__metadata__ import MetaData as _meta_
def check_md5(pkg_md5, src_file):
"""MD5 Checksum
"""
msg = Msg()
red = _meta_.color["RED"]
green = _meta_.color["GREEN"]
endc = _meta_.color["ENDC"]
if _meta_.checkmd5 in ["on", "ON"]:
print()
md5s = md5(src_file)
if pkg_md5 != md5s:
msg.template(78)
print(f"| MD5SUM check for {src_file.split('/')[-1]}"
f" [ {red}FAILED{endc} ]")
msg.template(78)
print(f"| Expected: {pkg_md5}")
print(f"| Found: {md5s}")
msg.template(78)
print()
if not msg.answer() in ["y", "Y"]:
raise SystemExit()
else:
msg.template(78)
print(f"| MD5SUM check for {src_file.split('/')[-1]}"
f" [ {green}PASSED{endc} ]")
msg.template(78)
print() # new line after pass checksum

View file

@ -1,52 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# clean.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import shutil
from slpkg.__metadata__ import MetaData as _meta_
def clean_tmp():
"""Deletes packages and sources from tmp/ directory
"""
tmps = [_meta_.tmp_path, # /tmp/slpkg/
_meta_.build_path, # /tmp/slpkg/build/
_meta_.slpkg_tmp_packages, # /tmp/slpkg/packages/
_meta_.slpkg_tmp_patches # /tmp/slpkg/patches/
]
# Delete a whole slpkg folder from the tmp directory
if os.path.exists(tmps[0]):
shutil.rmtree(tmps[0])
print(f"All packages and sources were deleted from: {tmps[0]}")
# Recreate the paths again
if not os.path.exists(tmps[0]):
for tmp in tmps:
os.mkdir(tmp)
print(f"Created directory: {tmp}")
print("Done!")

34
slpkg/clean_logs.py Normal file
View file

@ -0,0 +1,34 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from dataclasses import dataclass
from views.views import ViewMessage
from models.models import LogsDependencies
from models.models import session as Session
@dataclass
class CleanLogsDependencies:
flags: str
session: str = Session
@classmethod
def clean(cls):
deps = cls.session.query(
LogsDependencies.name, LogsDependencies.requires).all()
if deps:
print('The following logs will be removed:\n')
for dep in deps:
print(f'{dep[0]} -> Dependencies: {dep[1]}')
view = ViewMessage()
view.question(cls.flags)
cls.session.query(LogsDependencies).delete()
cls.session.commit()
else:
print('Nothing to clean.')

23
slpkg/cli_menu.py Normal file
View file

@ -0,0 +1,23 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from metadata import Metadata
def usage(status):
args = [f'Usage: {Metadata.proj_name} [OPTIONS] [packages]\n',
' Tool that interact with the SBo repository.\n',
'Options:',
' update Update the data packages.',
' build Build only the packages.',
' install Build and install the packages.',
' remove Remove installed packages.',
' clean-logs Purge logs of dependencies.',
' --yes Answer Yes to all questions.',
' --resolve-off Turns off dependency resolving.',
' -h, --help Show this message and exit.',
' -v, --version Print version and exit.\n',
'If you need more information try to use slpkg manpage.']
for opt in args:
print(opt)
raise SystemExit(status)

View file

@ -1,98 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# config.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import shutil
import filecmp
import subprocess
from slpkg.utils import Utils
from slpkg.__metadata__ import MetaData as _meta_
class Config(Utils):
"""Print or edit slpkg configuration file
"""
def __init__(self):
self.config_file = "/etc/slpkg/slpkg.conf"
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):
"""View slpkg config file
"""
conf_args = [
"RELEASE",
"SLACKWARE_VERSION",
"COMP_ARCH",
"BUILD_PATH",
"PACKAGES",
"PATCHES",
"CHECKMD5",
"DEL_ALL",
"DEL_BUILD",
"SBO_BUILD_LOG",
"MAKEFLAGS",
"DEFAULT_ANSWER",
"REMOVE_DEPS_ANSWER",
"SKIP_UNST",
"RSL_DEPS",
"DEL_DEPS",
"USE_COLORS",
"DOWNDER",
"DOWNDER_OPTIONS",
"SLACKPKG_LOG",
"ONLY_INSTALLED",
"EDITOR",
"NOT_DOWNGRADE",
"HTTP_PROXY",
]
read_conf = self.read_file(self.config_file)
for line in read_conf.splitlines():
if not line.startswith("#") and line.split("=")[0] in conf_args:
print(line)
else:
print(f"{self.cyan}{line}{self.endc}", end="\n")
def edit(self):
"""Edit configuration file
"""
subprocess.call(f"{self.meta.editor} {self.config_file}", shell=True)
def reset(self):
"""Reset slpkg.conf file with default values
"""
shutil.copy2(f"{self.config_file}.orig", self.config_file)
if filecmp.cmp(f"{self.config_file}.orig", self.config_file):
print(f"{self.green}The reset was done{self.endc}")
else:
print(f"{self.red}Reset failed{self.endc}")

63
slpkg/create_data.py Normal file
View file

@ -0,0 +1,63 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from dataclasses import dataclass
from metadata import Metadata
from models.models import SBoTable
from models.models import session as Session
@dataclass
class CreateData:
db_path: str = Metadata.db_path
sbo_txt: str = Metadata.sbo_txt
sbo_repo_path: str = Metadata.sbo_repo_path
session: str = Session
def insert_sbo_table(self):
sbo_tags = [
"SLACKBUILD NAME:",
"SLACKBUILD LOCATION:",
"SLACKBUILD FILES:",
"SLACKBUILD VERSION:",
"SLACKBUILD DOWNLOAD:",
"SLACKBUILD DOWNLOAD_x86_64:",
"SLACKBUILD MD5SUM:",
"SLACKBUILD MD5SUM_x86_64:",
"SLACKBUILD REQUIRES:",
"SLACKBUILD SHORT DESCRIPTION:"
]
sbo_file = self.read_file(f"{self.sbo_repo_path}/SLACKBUILDS.TXT")
cache = [] # init cache
print('Creating the database... ', end='', flush=True)
for i, line in enumerate(sbo_file, 1):
for s in sbo_tags:
if line.startswith(s):
line = line.replace(s, "").strip()
cache.append(line)
if (i % 11) == 0:
data = SBoTable(name=cache[0], location=cache[1].split('/')[1],
files=cache[2], version=cache[3],
download=cache[4], download64=cache[5],
md5sum=cache[6], md5sum64=cache[7],
requires=cache[8], short_description=cache[9])
self.session.add(data)
cache = [] # reset cache after 11 lines
print('Done')
self.session.commit()
def read_file(self, file):
with open(file, "r", encoding="utf-8") as f:
return f.readlines()

26
slpkg/dependencies.py Normal file
View file

@ -0,0 +1,26 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from queries import SBoQueries
from dataclasses import dataclass
@dataclass
class Requires:
''' Creates a list of dependencies with
the right order to install '''
name: str
def resolve(self) -> list:
requires = SBoQueries(self.name).requires()
for r in requires:
if r and r != "%README%":
sub = SBoQueries(r).requires()
for s in sub:
requires.append(s)
requires.reverse()
return list(dict.fromkeys(requires))

View file

@ -1,78 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# desc.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.utils import Utils
from slpkg.messages import Msg
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.sbo.greps import SBoGrep
class PkgDesc(Utils):
"""Prints package description from the repository
"""
def __init__(self, name, repo, paint):
self.name = name
self.repo = repo
self.paint = paint
self.meta = _meta_
self.msg = Msg()
self.lib = ""
self.color = {
"red": self.meta.color["RED"],
"green": self.meta.color["GREEN"],
"yellow": self.meta.color["YELLOW"],
"cyan": self.meta.color["CYAN"],
"grey": self.meta.color["GREY"],
"": ""
}[self.paint]
if self.repo in self.meta.repositories and self.repo != "sbo":
self.lib = f"{self.meta.lib_path}{self.repo}_repo/PACKAGES.TXT"
def view(self):
"""Prints package description by repository
"""
description, count = "", 0
if self.repo == "sbo":
description = SBoGrep(self.name).description()
else:
PACKAGES_TXT = self.read_file(self.lib)
for line in PACKAGES_TXT.splitlines():
if line.startswith(self.name + ":"):
description += f"{line[len(self.name) + 2:]}\n"
count += 1
if count == 11:
break
if description:
print(f"{self.color}{description}{self.meta.color['ENDC']}")
else:
self.msg.pkg_not_found("", self.name, "No matching", "")

View file

@ -1,109 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# dialog_box.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import os
class DialogUtil:
"""Creates dialog checklist
"""
def __init__(self, *args):
self.imp_dialog()
self.data = args[0]
self.text = args[1]
self.title = args[2]
self.backtitle = args[3]
self.status = args[4]
self.ununicode = []
self.tags = []
def imp_dialog(self):
try:
from dialog import Dialog
except ImportError as er:
raise SystemExit(er)
self.d = Dialog(dialog="dialog", autowidgetsize=True)
def checklist(self):
"""Runs dialog checklist
"""
choice = []
for item in self.data:
choice.append((item, "", self.status))
code, self.tags = self.d.checklist(
text=self.text, height=20, width=65, list_height=13,
choices=choice, title=self.title, backtitle=self.backtitle)
if code == "ok":
self.unicode_to_string()
return self.ununicode
if code in ["cancel", "esc"]:
self.exit()
def buildlist(self, enabled):
"""Runs dialog buildlist
"""
choice = []
for item in self.data:
choice.append((item, False))
for item in enabled:
choice.append((item, True))
items = [(tag, tag, sta) for (tag, sta) in choice]
code, self.tags = self.d.buildlist(
text=self.text, items=items, visit_items=True, item_help=False,
title=self.title)
if code == "ok":
self.unicode_to_string()
return self.ununicode
if code in ["cancel", "esc"]:
self.exit()
def exit(self):
"""Exits from dialog
"""
self.clear_screen()
raise SystemExit()
def clear_screen(self):
"""Clear screen
"""
os.system("clear")
def unicode_to_string(self):
"""Converts unicode in string
"""
for tag in self.tags:
self.ununicode.append(str(tag))

View file

@ -1,147 +1,16 @@
#!/usr/bin/python3 #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# downloader.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import tarfile
import subprocess import subprocess
from dataclasses import dataclass
from slpkg.utils import Utils from metadata import Metadata
from slpkg.messages import Msg
from slpkg.slack.slack_version import slack_ver
from slpkg.__metadata__ import MetaData as _meta_
class Download(Utils): @dataclass
"""Downloader manager. Slpkg use wget by default but support class Wget:
curl, aria2 and httpie wget_options: str = Metadata.wget_options
"""
def __init__(self, path, url, repo):
self.path = path
self.url = url
self.repo = repo
self.file_name = ""
self.meta = _meta_
self.green = _meta_.color["GREEN"]
self.red = _meta_.color["RED"]
self.endc = _meta_.color["ENDC"]
self.msg = Msg()
self.dir_prefix = ""
self.downder = self.meta.downder
self.downder_options = self.meta.downder_options
def start(self): def download(self, path: str, url: str):
"""Download files using wget or other downloaders. subprocess.call(f'wget {self.wget_options} --directory-prefix={path}'
Optional curl, aria2c and httpie f' {url}', shell=True)
"""
dwn_count = 1
self._directory_prefix()
for dwn in self.url:
self.file_name = self.fix_file_name(dwn.split("/")[-1])
if dwn.startswith("file:///"):
source_dir = dwn[7:-7].replace(slack_ver(), "")
self._make_tarfile(self.file_name, source_dir)
self._check_certificate()
print(f"\n[{dwn_count}/{len(self.url)}][ {self.green}"
f"Download{self.endc} ] --> {self.file_name}\n")
if self.downder in ["wget"]:
subprocess.call(f"{self.downder} {self.downder_options}"
f" {self.dir_prefix}{self.path} {dwn}",
shell=True)
if self.downder in ["aria2c"]:
subprocess.call(f"{self.downder} {self.downder_options}"
f" {self.dir_prefix}{self.path[:-1]} {dwn}",
shell=True)
elif self.downder in ["curl", "http"]:
subprocess.call(f"{self.downder} {self.downder_options}"
f" {self.path}{self.file_name} {dwn}",
shell=True)
self._check_if_downloaded()
dwn_count += 1
def _make_tarfile(self, output_filename, source_dir):
"""Creates .tar.gz file
"""
with tarfile.open(output_filename, "w:gz") as tar:
tar.add(source_dir, arcname=os.path.basename(source_dir))
def _directory_prefix(self):
"""Downloader options for specific directory
"""
if self.downder == "wget":
self.dir_prefix = "--directory-prefix="
elif self.downder == "aria2c":
self.dir_prefix = "--dir="
def _check_if_downloaded(self):
"""Checks if file downloaded
"""
if not os.path.isfile(self.path + self.file_name):
print()
self.msg.template(78)
print(f"| Download '{self.file_name}' file"
f" [ {self.red}FAILED{self.endc} ]")
self.msg.template(78)
print()
if not self.msg.answer() in ["y", "Y"]:
raise SystemExit()
def _check_certificate(self):
"""Checks for certificates options for wget
"""
if (self.file_name.startswith("jdk-") and self.repo == "sbo" and
self.downder == "wget"):
certificate = (' --no-check-certificate --header="Cookie: '
'oraclelicense=accept-securebackup-cookie"')
self.msg.template(78)
print(f"| '{certificate[:23].strip()}' need to go"
f" ahead downloading")
self.msg.template(78)
print()
self.downder_options += certificate
if not self.msg.answer() in ["y", "Y"]:
raise SystemExit()

View file

@ -1,56 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*
# file_size.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import urllib3
from slpkg.__metadata__ import MetaData as _meta_
class FileSize:
"""Checks local or remote file size
"""
def __init__(self, registry):
self.meta = _meta_
self.registry = registry
if self.meta.http_proxy:
self.http = urllib3.ProxyManager(self.meta.http_proxy)
else:
self.http = urllib3.PoolManager()
def server(self):
"""Returns the size of remote files
"""
try:
r = self.http.request("GET", self.registry)
return int(r.headers["Content-Length"])
except urllib3.exceptions.NewConnectionError:
return " "
def local(self):
"""Returns the size of local files
"""
return os.path.getsize(self.registry)

View file

@ -1,120 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# graph.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import subprocess
# class ImportErrorGraphEasy(Exception):
# def __init__(self, GraphEasyImportError):
# Exception.__init__(self, "graph-easy required")
# self.GraphEasyImportError = GraphEasyImportError
class Graph:
"""Drawing dependencies diagram
"""
def __init__(self, image):
self.image = image
self.file_format = [
".bmp", ".canon", ".cmap", ".cmapx", ".cmapx_np", ".dot",
".eps", ".fig", ".gd", ".gd2", ".gif", ".gtk", ".gv", ".ico",
".imap", ".imap_np", ".ismap", ".jpe", ".jpeg", ".jpg", ".pdf",
".pic", ".plain", ".plain-ext", ".png", ".pov", ".ps", ".ps2",
".svg", ".svgz", ".tif", ".tiff", ".tk", ".vml", ".vmlz",
".vrml", ".wbmp", ".x11", ".xdot", ".xlib"
]
def dependencies(self, deps_dict):
"""Generates graph file with dependencies map tree
"""
try:
import pygraphviz as pgv
except ImportError:
if (self.image == "ascii"
and not os.path.isfile("/usr/bin/graph-easy")):
print("Require 'grap_easy': "
"Install with 'slpkg -s sbo graph-easy'")
else:
raise SystemExit("Require 'pygraphviz: "
"Install with 'slpkg -s sbo pygraphviz'")
if self.image != "ascii":
self.check_file()
try:
G = pgv.AGraph(deps_dict)
G.layout(prog="fdp")
if self.image == "ascii":
G.write(f"{self.image}.dot")
self.graph_easy()
G.draw(self.image)
except IOError:
raise SystemExit(1)
if os.path.isfile(self.image):
print(f"Graph image file '{self.image}' created")
raise SystemExit()
def check_file(self):
"""Checks for file format and type
"""
try:
image_type = f".{self.image.split('.')[1]}"
if image_type not in self.file_format:
raise SystemExit(f"Format: '{self.image.split('.')[1]}' not "
f"recognized. Use one of them:\n"
f"{', '.join(self.file_format)}")
except IndexError:
raise SystemExit("slpkg: Error: Image file suffix missing")
def graph_easy(self):
"""Drawing ascii diagram. graph-easy perl module requires
"""
if not os.path.isfile("/usr/bin/graph-easy"):
print("Require 'graph-easy': Install with 'slpkg -s sbo"
" graph-easy'")
self.remove_dot()
raise SystemExit(1)
subprocess.call(f"graph-easy {self.image}.dot", shell=True)
self.remove_dot()
raise SystemExit(1)
def remove_dot(self):
"""Removes .dot files
"""
if os.path.isfile(f"{self.image}.dot"):
os.remove(f"{self.image}.dot")

View file

@ -1,56 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# grep_md5.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.slack.mirrors import mirrors
from slpkg.url_read import URL
from slpkg.__metadata__ import MetaData as _meta_
def pkg_checksum(binary, repo):
"""Returns checksum from CHECKSUMS.md5 file by repository
"""
md5 = "None"
if repo == "slack_patches" and _meta_.slack_rel == "stable":
CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "patches/")).get_request()
elif repo == "slack_patches" and _meta_.slack_rel == "current":
CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "")).get_request()
elif repo == "slpkg":
CHECKSUMS_md5 = URL(_meta_.CHECKSUMS_link).get_request()
else:
lib = f"{_meta_.lib_path}{repo}_repo/CHECKSUMS.md5"
f = open(lib, "r")
CHECKSUMS_md5 = f.read()
f.close()
for line in CHECKSUMS_md5.splitlines():
if line.endswith(f"/{binary}"):
md5 = line.split()[0]
return md5

View file

@ -1,120 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# health.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from slpkg.messages import Msg
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.pkg.find import find_package
class PackageHealth:
"""Health check for the installed packages
"""
def __init__(self, mode):
self.mode = mode
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.pkg_path = _meta_.pkg_path
self.installed = []
self.cn = 0
def packages(self):
"""Gets all installed packages from /var/log/packages/ path
"""
self.installed = find_package("", self.pkg_path)
def check(self, line, pkg):
line = line.replace("\n", "")
try:
if (not line.endswith("/") and
not line.endswith(".new") and
not line.startswith("dev/") and
not line.startswith("install/") and
"/incoming/" not in line):
if not os.path.isfile(r"/" + line):
self.cn += 1
print(f"Not installed: {self.red}/{line}{self.endc} --> {pkg}")
elif not self.mode:
print(line)
except IOError:
raise SystemExit("\n")
def test(self):
"""Starts testing each package and reading the file list
"""
self.packages()
self.cf = 0
for pkg in self.installed:
if os.path.isfile(f"{self.meta.pkg_path}{pkg}"):
self.lf = 0
with open(self.pkg_path + pkg, "r") as fopen:
for line in fopen:
if "\0" in line:
print(f"Null: {line}")
break
self.cf += 1 # count all files
self.lf += 1 # count each package files
if self.lf > 19:
self.check(line, pkg)
self.results()
def results(self):
"""Prints results
"""
print()
per = int(round((float(self.cf) / (self.cf + self.cn)) * 100))
if per > 90:
color = self.green
elif per < 90 and per > 60:
color = self.yellow
elif per < 60:
color = self.red
health = f"{color}{str(per)}%{self.endc}"
self.msg.template(78)
print(f"| Total files{' ' * 7}Not installed{' ' * 40}Health")
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)

View file

@ -1,940 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# init.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import shutil
from slpkg.utils import Utils
from slpkg.repositories import Repo
from slpkg.file_size import FileSize
from slpkg.downloader import Download
from slpkg.models.data import Database
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.slack.mirrors import mirrors
from slpkg.slack.slack_version import slack_ver
from slpkg.models.models import SBoTable, session
class Init(Utils):
"""Slpkg initialization starts all from here.
Creates local package lists and updates or upgrades these.
"""
def __init__(self, check):
self.check = check
self.meta = _meta_
self.arch = _meta_.arch
self.session = session
self.conf_path = self.meta.conf_path
self.log_path = self.meta.log_path
self.lib_path = self.meta.lib_path
self.tmp_path = self.meta.tmp_path
self.build_path = self.meta.build_path
self._SOURCES = self.meta.SBo_SOURCES
self.slpkg_tmp_packages = self.meta.slpkg_tmp_packages
self.slpkg_tmp_patches = self.meta.slpkg_tmp_patches
self.slack_ver = slack_ver()
self.def_repos_dict = Repo().default_repository()
self.constructing()
def constructing(self):
"""Creating the all necessary directories
"""
paths_basic = [
self.conf_path,
self.log_path,
self.lib_path,
self.tmp_path
]
paths_extra = [
self.build_path,
self._SOURCES,
self.slpkg_tmp_packages,
self.slpkg_tmp_patches
]
self.make_dir(paths_basic)
self.make_dirs(paths_extra)
def make_dir(self, path: list):
for p in path:
if not os.path.exists(p):
os.mkdir(p)
def make_dirs(self, path: list):
for p in path:
if not os.path.exists(p):
os.makedirs(p)
def custom(self, name):
"""Creating user custom repository local library
"""
repo = Repo().custom_repository()[name]
log = self.log_path + name + "/"
lib = self.lib_path + f"{name}_repo/"
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
PACKAGES_TXT = f"{repo}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{md5_file}"
ChangeLog_txt = f"{repo}{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, name)
self.down(lib, CHECKSUMS_MD5, name)
self.down(log, ChangeLog_txt, name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, name)
def slack(self):
"""Creating slack local libraries
"""
log = self.log_path + "slack/"
lib = self.lib_path + "slack_repo/"
repo_name = Init.slack.__name__
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
dirs = ["core/", "extra/", "patches/"]
self.make_dir([log, lib])
self.make_dir([f"{lib}{dirs[0]}",
f"{lib}{dirs[1]}",
f"{lib}{dirs[2]}"])
PACKAGES_TXT = mirrors(lib_file, "")
FILELIST_TXT = ""
CHECKSUMS_MD5 = mirrors(md5_file, "")
self.EXTRA = mirrors(lib_file, dirs[1])
self.EXT_CHECKSUMS = mirrors(md5_file, dirs[1])
self.PATCHES = mirrors(lib_file, dirs[2])
self.PAT_CHECKSUMS = mirrors(md5_file, dirs[2])
ChangeLog_txt = mirrors(log_file, "")
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib + dirs[0], PACKAGES_TXT, repo_name)
self.down(lib + dirs[0], CHECKSUMS_MD5, repo_name)
self.down(lib + dirs[1], self.EXTRA, repo_name)
self.down(lib + dirs[1], self.EXT_CHECKSUMS, repo_name)
self.down(lib + dirs[2], self.PATCHES, repo_name)
self.down(lib + dirs[2], self.PAT_CHECKSUMS, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
self.merge(lib, "PACKAGES.TXT", ["core/PACKAGES.TXT",
"extra/PACKAGES.TXT",
"patches/PACKAGES.TXT"])
self.merge(lib, "CHECKSUMS.md5", ["core/CHECKSUMS.md5",
"extra/CHECKSUMS.md5",
"patches/CHECKSUMS_md5"])
def sbo(self):
"""Creating sbo local library
"""
repo = self.def_repos_dict["sbo"]
log = self.log_path + "sbo/"
lib = self.lib_path + "sbo_repo/"
repo_name = Init.sbo.__name__
lib_file = "SLACKBUILDS.TXT"
# lst_file = ""
# md5_file = ""
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
SLACKBUILDS_TXT = f"{repo}{self.slack_ver}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = ""
ChangeLog_txt = f"{repo}{self.slack_ver}/{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, SLACKBUILDS_TXT, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, SLACKBUILDS_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
def rlw(self):
"""Creating rlw local library
"""
repo = self.def_repos_dict["rlw"]
log = self.log_path + "rlw/"
lib = self.lib_path + "rlw_repo/"
repo_name = Init.rlw.__name__
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
PACKAGES_TXT = f"{repo}{self.slack_ver}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{self.slack_ver}/{md5_file}"
ChangeLog_txt = f"{repo}{self.slack_ver}/{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
self.down(lib, CHECKSUMS_MD5, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
def alien(self):
"""Creating alien local library
"""
ar = "x86"
ver = self.slack_ver
repo = self.def_repos_dict["alien"]
log = self.log_path + "alien/"
lib = self.lib_path + "alien_repo/"
repo_name = Init.alien.__name__
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
if self.arch == "x86_64":
ar = self.arch
if self.meta.slack_rel == "current":
ver = self.meta.slack_rel
PACKAGES_TXT = f"{repo}/{ver}/{ar}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}/{ver}/{ar}/{md5_file}"
ChangeLog_txt = f"{repo}{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
self.down(lib, CHECKSUMS_MD5, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
def slacky(self):
"""Creating slacky.eu local library
"""
ar = ""
repo = self.def_repos_dict["slacky"]
log = self.log_path + "slacky/"
lib = self.lib_path + "slacky_repo/"
repo_name = Init.slacky.__name__
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
if self.arch == "x86_64":
ar = "64"
PACKAGES_TXT = f"{repo}slackware{ar}-{self.slack_ver}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}slackware{ar}-{self.slack_ver}/{md5_file}"
ChangeLog_txt = f"{repo}slackware{ar}-{self.slack_ver}/{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
self.down(lib, CHECKSUMS_MD5, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
def conrad(self):
"""Creating slackers local library
"""
repo = self.def_repos_dict["conrad"]
log = self.log_path + "conrad/"
lib = self.lib_path + "conrad_repo/"
repo_name = Init.conrad.__name__
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
PACKAGES_TXT = f"{repo}{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{md5_file}"
ChangeLog_txt = f"{repo}{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
self.down(lib, CHECKSUMS_MD5, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
def slonly(self):
"""Creating slackers local library
"""
ar = f"{self.slack_ver}-x86"
repo = self.def_repos_dict["slonly"]
log = self.log_path + "slonly/"
lib = self.lib_path + "slonly_repo/"
repo_name = Init.slonly.__name__
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
if self.arch == "x86_64":
ar = f"{self.slack_ver}-x86_64"
if self.meta.slack_rel == "current":
ar = f"{self.meta.slack_rel}-x86"
if self.meta.slack_rel == "current" and self.arch == "x86_64":
ar = f"{self.meta.slack_rel}-x86_64"
PACKAGES_TXT = f"{repo}{ar}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{ar}/{md5_file}"
ChangeLog_txt = f"{repo}{ar}/{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
self.down(lib, CHECKSUMS_MD5, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
def ktown(self):
"""Creating alien ktown local library
"""
repo = self.def_repos_dict["ktown"]
log = self.log_path + "ktown/"
lib = self.lib_path + "ktown_repo/"
repo_name = Init.ktown.__name__
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
PACKAGES_TXT = f"{repo}{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{md5_file}"
ChangeLog_txt = f"{repo}{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
self.down(lib, CHECKSUMS_MD5, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
def multi(self):
"""Creating alien multilib local library
"""
ver = self.slack_ver
repo = self.def_repos_dict["multi"]
log = self.log_path + "multi/"
lib = self.lib_path + "multi_repo/"
repo_name = Init.multi.__name__
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
if self.meta.slack_rel == "current":
ver = self.meta.slack_rel
PACKAGES_TXT = f"{repo}{ver}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{ver}/{md5_file}"
ChangeLog_txt = f"{repo}{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
self.down(lib, CHECKSUMS_MD5, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
def slacke(self):
"""Creating Slacke local library
"""
ar = ""
repo = self.def_repos_dict["slacke"]
log = self.log_path + "slacke/"
lib = self.lib_path + "slacke_repo/"
repo_name = Init.slacke.__name__
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
if self.arch == "x86_64":
ar = "64"
version = self.meta.slacke_sub_repo[1:-1]
PACKAGES_TXT = (f"{repo}slacke{version}/slackware{ar}-"
f"{self.slack_ver}/{lib_file}")
FILELIST_TXT = ""
CHECKSUMS_MD5 = (f"{repo}slacke{version}/slackware{ar}-"
f"{self.slack_ver}/{md5_file}")
ChangeLog_txt = (f"{repo}slacke{version}/slackware{ar}-"
f"{self.slack_ver}/{log_file}")
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
self.down(lib, CHECKSUMS_MD5, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
def salix(self):
"""Creating SalixOS local library
"""
ar = "i486"
repo = self.def_repos_dict["salix"]
log = self.log_path + "salix/"
lib = self.lib_path + "salix_repo/"
repo_name = Init.salix.__name__
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
if self.arch == "x86_64":
ar = "x86_64"
PACKAGES_TXT = f"{repo}{ar}/{self.slack_ver}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{ar}/{self.slack_ver}/{md5_file}"
ChangeLog_txt = f"{repo}{ar}/{self.slack_ver}/{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
self.down(lib, CHECKSUMS_MD5, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
def slackl(self):
"""Creating slackel.gr local library
"""
ar = "i486"
repo = self.def_repos_dict["slackl"]
log = self.log_path + "slackl/"
lib = self.lib_path + "slackl_repo/"
repo_name = Init.slackl.__name__
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
if self.arch == "x86_64":
ar = "x86_64"
PACKAGES_TXT = f"{repo}{ar}/current/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{ar}/current/{md5_file}"
ChangeLog_txt = f"{repo}{ar}/current/{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
self.down(lib, CHECKSUMS_MD5, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
def rested(self):
"""Creating alien restricted local library
"""
repo = self.def_repos_dict["rested"]
log = self.log_path + "rested/"
lib = self.lib_path + "rested_repo/"
repo_name = Init.rested.__name__
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
PACKAGES_TXT = f"{repo}{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{md5_file}"
ChangeLog_txt = f"{repo}{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
self.down(lib, CHECKSUMS_MD5, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
def msb(self):
"""Creating MATE local library
"""
ar = "x86"
ver_slack = self.slack_ver
repo = self.def_repos_dict["msb"]
log = self.log_path + "msb/"
lib = self.lib_path + "msb_repo/"
repo_name = Init.msb.__name__
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
if self.arch == "x86_64":
ar = "x86_64"
version = self.meta.msb_sub_repo[1:-1]
if self.meta.slack_rel == "current":
ver_slack = self.meta.slack_rel
PACKAGES_TXT = f"{repo}{ver_slack}/{version}/{ar}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{ver_slack}/{version}/{ar}/{md5_file}"
ChangeLog_txt = f"{repo}{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
self.down(lib, CHECKSUMS_MD5, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
def csb(self):
"""Creating Cinnamon local library
"""
ar = "x86"
ver_slack = self.slack_ver
repo = self.def_repos_dict["csb"]
log = self.log_path + "csb/"
lib = self.lib_path + "csb_repo/"
repo_name = Init.csb.__name__
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
if self.arch == "x86_64":
ar = "x86_64"
if self.meta.slack_rel == "current":
ver_slack = self.meta.slack_rel
PACKAGES_TXT = f"{repo}{ver_slack}/{ar}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{ver_slack}/{ar}/{md5_file}"
ChangeLog_txt = f"{repo}{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
self.down(lib, CHECKSUMS_MD5, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
def connos(self):
"""Creating connochaetos (slack-n-free) local library
"""
nickname = "slack-n-free"
ar = ""
repo = self.def_repos_dict["connos"]
log = self.log_path + "connos/"
lib = self.lib_path + "connos_repo/"
repo_name = Init.connos.__name__
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
if self.arch == "x86_64":
ar = "64"
PACKAGES_TXT = f"{repo}{nickname}{ar}-{self.slack_ver}/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{nickname}{ar}-{self.slack_ver}/{md5_file}"
ChangeLog_txt = f"{repo}{nickname}{ar}-{self.slack_ver}/{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
self.down(lib, CHECKSUMS_MD5, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
def mles(self):
"""Creating Microlinux local library
"""
ar = "32"
repo = self.def_repos_dict["mles"]
log = self.log_path + "mles/"
lib = self.lib_path + "mles_repo/"
repo_name = Init.mles.__name__
lib_file = "PACKAGES.TXT"
# lst_file = ""
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
self.make_dir([log, lib])
if self.arch == "x86_64":
ar = "64"
version = self.meta.mles_sub_repo[1:-1]
PACKAGES_TXT = f"{repo}{version}-{self.slack_ver}-{ar}bit/{lib_file}"
FILELIST_TXT = ""
CHECKSUMS_MD5 = f"{repo}{version}-{self.slack_ver}-{ar}bit/{md5_file}"
ChangeLog_txt = f"{repo}{version}-{self.slack_ver}-{ar}bit/{log_file}"
if self.check:
return self.checks_logs(log, ChangeLog_txt)
self.down(lib, PACKAGES_TXT, repo_name)
self.down(lib, CHECKSUMS_MD5, repo_name)
self.down(log, ChangeLog_txt, repo_name)
self.remote(log, ChangeLog_txt, lib, PACKAGES_TXT, CHECKSUMS_MD5,
FILELIST_TXT, repo_name)
def down(self, path, link, repo):
"""Downloads files
"""
filename = link.split("/")[-1]
if not os.path.isfile(path + filename):
Download(path, link.split(), repo).start()
def remote(self, *args):
"""Removes and recreates files
"""
log_path = args[0]
ChangeLog_txt = args[1]
lib_path = args[2]
PACKAGES_TXT = args[3]
CHECKSUMS_MD5 = args[4]
FILELIST_TXT = args[5]
repo = args[6]
if self.checks_logs(log_path, ChangeLog_txt):
# remove old files
self.file_remove(log_path, ChangeLog_txt.split("/")[-1])
self.file_remove(lib_path, PACKAGES_TXT.split("/")[-1])
self.file_remove(lib_path, CHECKSUMS_MD5.split("/")[-1])
self.file_remove(lib_path, FILELIST_TXT.split("/")[-1])
if repo == "slack":
dirs = ["core/", "extra/"]
for d in dirs:
self.file_remove(lib_path + d, "PACKAGES.TXT")
self.file_remove(lib_path + d, "CHECKSUMS.md5")
self.down(lib_path + "core/", PACKAGES_TXT, repo)
self.down(lib_path + "core/", CHECKSUMS_MD5, repo)
self.down(lib_path + "extra/", self.EXTRA, repo)
self.down(lib_path + "extra/", self.EXT_CHECKSUMS, repo)
# download new files
if repo != "slack":
self.down(lib_path, PACKAGES_TXT, repo)
self.down(lib_path, CHECKSUMS_MD5, repo)
self.down(lib_path, FILELIST_TXT, repo)
self.down(log_path, ChangeLog_txt, repo)
if repo == 'sbo':
self.session.query(SBoTable).delete() # delete all data
self.session.commit()
def merge(self, path, outfile, infiles):
"""Merging files
"""
code = "utf-8"
with open(path + outfile, 'w', encoding=code) as out_f:
for f in infiles:
if os.path.isfile(f"{path}{f}"):
# checking the encoding before read the file
code = self.check_encoding(path, f)
with open(path + f, "r", encoding=code) as in_f:
for line in in_f:
out_f.write(line)
def file_remove(self, path, filename):
"""Checks if filename exists and removes
"""
if os.path.isfile(path + filename):
os.remove(path + filename)
def checks_logs(self, log_path, url):
"""Checks ChangeLog.txt for changes
"""
local = ""
filename = url.split("/")[-1]
server = FileSize(url).server()
if os.path.isfile(log_path + filename):
local = FileSize(log_path + filename).local()
if server != local:
return True
return False
class Upgrade:
def __init__(self):
self.meta = _meta_
self.log_path = self.meta.log_path
self.lib_path = self.meta.lib_path
self.session = session
def run(self, repos):
"""Removing and creating the packages lists
"""
repositories = self.meta.repositories
# Replace the enabled repositories from user defined
if repos:
repositories = repos
for repo in repositories:
changelogs = f"{self.log_path}{repo}/ChangeLog.txt"
self.del_tables(repo)
if os.path.isfile(changelogs):
os.remove(changelogs)
if os.path.isdir(f"{self.lib_path}{repo}_repo/"):
for f in os.listdir(f"{self.lib_path}{repo}_repo/"):
files = f"{self.lib_path}{repo}_repo/{f}"
if os.path.isfile(files):
os.remove(files)
elif os.path.isdir(files):
shutil.rmtree(files)
update = Update()
update.run(repos)
def del_tables(self, repo):
if repo == 'sbo':
self.session.query(SBoTable).delete() # delete all data
self.session.commit()
class Update:
def __init__(self):
self.meta = _meta_
self.grey = _meta_.color["GREY"]
self.green = _meta_.color["GREEN"]
self.red = _meta_.color["RED"]
self.cyan = _meta_.color["CYAN"]
self.endc = _meta_.color["ENDC"]
self.done = f"{self.green}Done{self.endc}\n"
self.error = f"{self.red}Error{self.endc}\n"
self.session = session
def run(self, repos):
"""Updates repositories lists
"""
print("\nCheck and update repositories:\n")
default = self.meta.default_repositories
enabled = self.meta.repositories
custom = Repo().custom_repository()
# Replace the enabled repositories from user defined
if repos:
enabled = repos
for repo in enabled:
if check_for_local_repos(repo) is True:
continue
self.done_msg(repo)
if repo in default:
getattr(Init(False), repo)()
print(self.done, end="")
elif repo in custom:
Init(False).custom(repo)
print(self.done, end="")
else:
print(self.error, end="")
print() # new line at end
self.check_db()
raise SystemExit()
def check_db(self):
"""Checking if the table is empty
"""
db = Database()
if self.session.query(SBoTable).first() is None:
db.insert_sbo_table()
def done_msg(self, repo):
print(f"{self.grey}Checking repository "
f"[{self.cyan}{repo}{self.grey}] ... "
f"{self.endc}", end="", flush=True)
def check_exists_repositories(repo):
"""Checking if repositories exists by PACKAGES.TXT file
"""
pkg_list = "PACKAGES.TXT"
if repo == "sbo":
pkg_list = "SLACKBUILDS.TXT"
elif check_for_local_repos(repo) is True:
pkg_list = "PACKAGES.TXT"
if not os.path.isfile(f"{_meta_.lib_path}{repo}_repo/{pkg_list}"):
return False
def check_for_local_repos(repo):
"""Checks if repository is local
"""
repos_dict = Repo().default_repository()
if repo in repos_dict:
repo_url = repos_dict[repo]
if repo_url.startswith("file:///"):
return True

View file

@ -1,121 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# load.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from slpkg.utils import Utils
from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.pkg.find import find_package
def library(repo):
"""Loads packages from slpkg library and from local
"""
utils = Utils()
pkg_list, packages = [], ""
if repo == "sbo":
if (os.path.isfile(
f"{_meta_.lib_path}{repo}_repo/SLACKBUILDS.TXT")):
packages = utils.read_file(
f"{_meta_.lib_path}{repo}_repo/SLACKBUILDS.TXT")
else:
if (os.path.isfile(
f"{_meta_.lib_path}{repo}_repo/PACKAGES.TXT")):
packages = utils.read_file(
f"{_meta_.lib_path}{repo}_repo/PACKAGES.TXT")
for line in packages.splitlines():
if repo == "sbo":
if line.startswith("SLACKBUILD NAME: "):
pkg_list.append(line[17:].strip())
elif "local" not in repo:
if line.startswith("PACKAGE NAME: "):
pkg_list.append(line[15:].strip())
if repo == "local":
pkg_list = find_package("", _meta_.pkg_path)
return pkg_list
class Regex:
"""Graps packages with simple regex using asterisk *
with options: starts with string*
ends with *string
include *string*
"""
def __init__(self, pkgs):
self.pkgs = pkgs
def get(self):
lib, data = [], []
for pkg in self.pkgs.split(","):
pr = pkg.split(":") # priotity by repository
data = library(pr[0]) # load data
if len(pr) > 1:
for d in data:
if pr[1].startswith("*") and pr[1].endswith("*"):
if pr[1][1:-1] in d:
lib.append(self.add(pr[0], d))
elif pr[1].endswith("*"):
if d.startswith(pr[1][:-1]):
lib.append(self.add(pr[0], d))
elif pr[1].startswith("*"):
if d.endswith(pr[1][1:]):
lib.append(self.add(pr[0], d))
else:
lib.append(self.add(pr[0], d))
else:
lib += pkg.split()
return lib
def add(self, repo, pkg):
"""Splits packages by repository
"""
if repo == "sbo":
return pkg
else:
return split_package(pkg)[0]

View file

@ -1,52 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# log_deps.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.pkg.find import find_package
def write_deps(deps_dict):
"""Writes dependencies in a log file
into the directory `/var/log/slpkg/dep/`
"""
for name, dependencies in deps_dict.items():
if find_package(f"{name}-", _meta_.pkg_path):
dep_path = f"{_meta_.log_path}dep/"
if not os.path.exists(dep_path):
os.mkdir(dep_path)
if os.path.isfile(f"{dep_path}{name}"):
os.remove(f"{dep_path}{name}")
if len(dependencies) >= 1:
with open(f"{dep_path}{name}", "w") as f:
for dep in dependencies:
f.write(f"{dep}\n")

File diff suppressed because it is too large Load diff

View file

@ -1,37 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# md5sum.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import hashlib
def md5(source):
"""Return MD5 Checksum
"""
# fix passing char '+' from source
source = source.replace("%2B", "+")
with open(source, "rb") as file_to_check:
data = file_to_check.read()
return hashlib.md5(data).hexdigest()

View file

@ -1,141 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# messages.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import itertools
from slpkg.__metadata__ import MetaData as _meta_
class Msg:
"""Messages control
"""
def __init__(self):
self.meta = _meta_
self.green = _meta_.color["GREEN"]
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):
print(f"{bol}No such package {pkg}: {message}{eol}")
def pkg_found(self, prgnam):
print(f"| Package {prgnam} is already installed")
def pkg_installed(self, pkg):
print(f"| Package {pkg} installed")
def build_FAILED(self, prgnam):
self.template(78)
print(f"| Some error on the package {prgnam} "
f"[ {self.red}FAILED{self.endc} ]")
self.template(78)
print(f"| See the log file in '{self.cyan}"
f"/var/log/slpkg/sbo/build_logs{self.endc}' "
f"directory or read the README file")
self.template(78)
print() # new line at end
def template(self, max_len):
print("+" + "=" * max_len)
def checking(self):
print(f"{self.grey}Checking...{self.endc} ", end="", flush=True)
def reading(self):
print(f"{self.grey}Reading package lists...{self.endc} ",
end="", flush=True)
def resolving(self):
print(f"{self.grey}Resolving dependencies...{self.endc} ",
end="", flush=True)
def done(self):
print(f"\b{self.green}Done{self.endc}\n", end="")
def pkg(self, count):
message = "package"
if count > 1:
message = message + "s"
return message
def not_found(self, if_upgrade):
if if_upgrade:
print("\nNot found packages for upgrade\n")
else:
print("\nNot found packages for installation\n")
def upg_inst(self, if_upgrade):
if not if_upgrade:
print("Installing:")
else:
print("Upgrading:")
def answer(self):
if self.meta.default_answer in ["y", "Y"]:
answer = self.meta.default_answer
else:
try:
answer = input("Would you like to continue [y/N]? ")
except EOFError:
raise SystemExit("\n")
return answer
def security_pkg(self, pkg):
print()
self.template(78)
print(f"| {' ' * 27}{self.red}*** WARNING ***{self.endc}")
self.template(78)
print(f"| Before proceed with the package '{pkg}' will you must read\n"
f"| the README file. You can use the command "
f"'slpkg -n {pkg}'")
self.template(78)
print()
def reference(self, install, upgrade):
self.template(78)
print(f"| Total {len(install)} {self.pkg(len(install))} installed and "
f"{len(upgrade)} {self.pkg(len(upgrade))} upgraded")
self.template(78)
for installed, upgraded in itertools.zip_longest(install, upgrade):
if upgraded:
print(f"| Package {upgraded} upgraded successfully")
if installed:
print(f"| Package {installed} installed successfully")
self.template(78)
print()
def matching(self, packages):
print(f"\nNot found package with the name "
f"[ {self.cyan}{''.join(packages)}{self.endc} ]. "
"Matching packages:\nNOTE: Not dependencies are resolved\n")

93
slpkg/metadata.py Normal file
View file

@ -0,0 +1,93 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# import json
from dataclasses import dataclass
@dataclass
class Metadata:
# Project info
prog_name: str = 'slpkg'
version_info: tuple = (4, 1, 0)
version: str = '{0}.{1}.{2}'.format(*version_info)
license: str = 'MIT'
author: str = 'dslackw'
''' Default configurations. '''
# OS architecture by default
os_arch: str = 'x86_64'
# All necessary paths
tmp_path: str = '/tmp'
tmp_slpkg: str = f'{tmp_path}/{prog_name}'
build_path: str = f'/tmp/{prog_name}/build'
lib_path: str = f'/var/lib/{prog_name}'
log_path: str = f'/var/log/{prog_name}'
db_path: str = f'/var/lib/{prog_name}/database'
sbo_repo_path: str = f'/var/lib/{prog_name}/repository'
log_packages: str = '/var/log/packages'
# Database name
database: str = f'database.{prog_name}'
# Repository details
repo_version: str = '15.0'
sbo_url: str = f'http://slackbuilds.org/slackbuilds/{repo_version}'
sbo_txt: str = 'SLACKBUILDS.TXT'
tar_suffix: str = '.tar.gz'
pkg_suffix: str = '.tgz'
repo_tag: str = '_SBo'
# Slackware commands
installpkg: str = 'upgradepkg --install-new'
removepkg: str = 'removepkg'
# Other configs
colors: str = 'on'
wget_options = '-c -N'
@classmethod
def colour(cls):
color = {
'RED': '',
'GREEN': '',
'YELLOW': '',
'CYAN': '',
'GREY': '',
'ENDC': ''
}
if cls.colors in ['on', 'ON']:
color = {
'RED': '\x1b[31m',
'GREEN': '\x1b[32m',
'YELLOW': '\x1b[93m',
'CYAN': '\x1b[36m',
'GREY': '\x1b[38;5;247m',
'ENDC': '\x1b[0m'
}
return color
''' User configuration in /etc/slpkg/ folder. '''
# with open(f'/etc/{prog_name}/{prog_name}.json', 'r') as conf:
# config = json.load(conf)
# tmp_path: str = config['tmp_path']
# tmp_slpkg: str = config['tmp_slpkg']
# build_path: str = config['build_path']
# lib_path: str = config['lib_path']
# log_path: str = config['log_path']
# db_path: str = config['db_path']
# sbo_repo_path: str = config['sbo_repo_path']
# log_packages: str = config['log_packages']
# # Database name
# database: str = config['database']
# # Repository details
# repo_version: str = config['repo_version']
# sbo_url: str = config['sbo_url']
# sbo_txt: str = config['sbo_txt']
# tar_suffix: str = config['tar_suffix']
# pkg_suffix: str = config['pkg_suffix']
# repo_tag: str = config['repo_tag']
# # Slackware commands
# upgradepkg: str = config['upgradepkg']
# removepkg: str = config['removepkg']

View file

@ -1,84 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# data.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from progress.bar import Bar
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.models.models import SBoTable, session
class Database:
def __init__(self):
self.lib_path = _meta_.lib_path
self.session = session
def insert_sbo_table(self):
"""Grabbing data line by line and inserting them into the database
"""
sbo_tags = [
"SLACKBUILD NAME:",
"SLACKBUILD LOCATION:",
"SLACKBUILD FILES:",
"SLACKBUILD VERSION:",
"SLACKBUILD DOWNLOAD:",
"SLACKBUILD DOWNLOAD_x86_64:",
"SLACKBUILD MD5SUM:",
"SLACKBUILD MD5SUM_x86_64:",
"SLACKBUILD REQUIRES:",
"SLACKBUILD SHORT DESCRIPTION:"
]
sbo_file = self.open_file(f"{self.lib_path}sbo_repo/SLACKBUILDS.TXT")
bar = Bar("Creating sbo database", max=len(sbo_file),
suffix="%(percent)d%% - %(eta)ds")
cache = [] # init cache
for i, line in enumerate(sbo_file, 1):
for s in sbo_tags:
if line.startswith(s):
line = line.replace(s, "").strip()
cache.append(line)
if (i % 11) == 0:
data = SBoTable(name=cache[0], location=cache[1],
files=cache[2], version=cache[3],
download=cache[4], download64=cache[5],
md5sum=cache[6], md5sum64=cache[7],
requires=cache[8], short_description=cache[9])
self.session.add(data)
cache = [] # reset cache after 11 lines
bar.next()
bar.finish()
self.session.commit()
def open_file(self, file):
with open(file, "r", encoding="utf-8") as f:
return f.readlines()

View file

@ -1,58 +1,51 @@
#!/usr/bin/python3 #!/usr/bin/python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# models.py file is part of slpkg. from metadata import Metadata
from dataclasses import dataclass
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from sqlalchemy.orm import sessionmaker from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine, Column, Integer, Text from sqlalchemy import create_engine, Column, Integer, Text
from slpkg.__metadata__ import MetaData as _meta_
lib_path = _meta_.lib_path db_path = Metadata.db_path
db = _meta_.db database = Metadata.database
DATABASE_URI = f"sqlite:///{lib_path}{db}" DATABASE_URI = f"sqlite:///{db_path}/{database}"
engine = create_engine(DATABASE_URI) engine = create_engine(DATABASE_URI)
session = sessionmaker(engine)() session = sessionmaker(engine)()
Base = declarative_base() Base = declarative_base()
@dataclass
class SBoTable(Base): class SBoTable(Base):
''' The main table for the SBo repository. '''
__tablename__ = "sbotable" __tablename__ = "sbotable"
id = Column(Integer, primary_key=True) id: int = Column(Integer, primary_key=True)
name = Column(Text) name: str = Column(Text)
location = Column(Text) location: str = Column(Text)
files = Column(Text) files: str = Column(Text)
version = Column(Text) version: str = Column(Text)
download = Column(Text) download: str = Column(Text)
download64 = Column(Text) download64: str = Column(Text)
md5sum = Column(Text) md5sum: str = Column(Text)
md5sum64 = Column(Text) md5sum64: str = Column(Text)
requires = Column(Text) requires: str = Column(Text)
short_description = Column(Text) short_description: str = Column(Text)
@dataclass
class LogsDependencies(Base):
''' The table that stores the dependencies after installing a package. '''
__tablename__ = 'logsdependencies'
id: int = Column(Integer, primary_key=True)
name: str = Column(Text)
requires: str = Column(Text)
Base.metadata.create_all(engine) Base.metadata.create_all(engine)

View file

@ -1,271 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# new_config.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import shutil
import itertools
from slpkg.messages import Msg
from slpkg.utils import Utils
from slpkg.__metadata__ import MetaData as _meta_
class NewConfig(Utils):
"""Manages .new configuration files
"""
def __init__(self):
self.meta = _meta_
self.msg = Msg()
self.red = self.meta.color["RED"]
self.green = self.meta.color["GREEN"]
self.endc = self.meta.color["ENDC"]
self.br = ""
if self.meta.use_colors in ["off", "OFF"]:
self.br = ")"
self.etc = "/etc/"
self.news = []
def run(self):
"""prints .new configuration files
"""
self.find_new()
for n in self.news:
print(n)
print()
self.msg.template(78)
print(f"| Installed {len(self.news)} new configuration files:")
self.msg.template(78)
self.choices()
def find_new(self):
"""Finds all '.new' files from /etc/ folder
and subfolders
"""
print("Search for .new configuration files:\n")
for path, dirs, files in os.walk(self.etc):
del dirs # delete unsed
for f in files:
if f.endswith(".new"):
self.news.append(os.path.join(path, f))
if not self.news:
print(" No new configuration files\n")
raise SystemExit()
def choices(self):
"""Menu options for new configuration files
"""
print(f"| {self.red}K{self.endc}{self.br}eep the old and .new files, no changes")
print(f"| {self.red}O{self.endc}{self.br}verwrite all old configuration files with new ones")
print("| The old files will be saved with suffix .old")
print(f"| {self.red}R{self.endc}{self.br}emove all .new files")
print(f"| {self.red}P{self.endc}{self.br}rompt K, O, R, D, M option for each single file")
print(f"| {self.red}Q{self.endc}{self.br}uit from menu")
self.msg.template(78)
try:
choose = input("\nWhat would you like to do [K/O/R/P/Q]? ")
except EOFError:
raise SystemExit("\n")
print()
if choose in ("K", "k"):
self.keep()
elif choose in ("O", "o"):
self.overwrite_all()
elif choose in ("R", "r"):
self.remove_all()
elif choose in ("P", "p"):
self.prompt()
def overwrite_all(self):
"""Overwrites all .new files and keep
old with suffix .old
"""
for n in self.news:
self._overwrite(n)
def remove_all(self):
"""Removes all .new files
"""
for n in self.news:
self._remove(n)
print()
def prompt(self):
"""Select file
"""
self.msg.template(78)
print("| Choose what to do file by file:")
print("| {0}K{1}{2}eep, {3}O{4}{5}verwrite, {6}R{7}{8}emove, "
"{9}D{10}{11}iff, {12}M{13}{14}erge, {15}Q{16}{17}uit".format(
self.red, self.endc, self.br, self.red, self.endc, self.br,
self.red, self.endc, self.br, self.red, self.endc, self.br,
self.red, self.endc, self.br, self.red, self.endc, self.br))
self.msg.template(78)
print()
self.i = 0
try:
while self.i < len(self.news):
self.question(self.news[self.i])
self.i += 1
except EOFError:
raise SystemExit("\n")
def question(self, n):
"""Chooses what do to file by file
"""
print()
prompt_ask = input(f"{n} [K/O/R/D/M/Q]? ")
print()
if prompt_ask in ("K", "k"):
self.keep()
elif prompt_ask in ("O", "o"):
self._overwrite(n)
elif prompt_ask in ("R", "r"):
self._remove(n)
elif prompt_ask in ("D", "d"):
self.diff(n)
self.i -= 1
elif prompt_ask in ("M", "m"):
self.merge(n)
elif prompt_ask in ("Q", "q", "quit"):
self.quit()
def _remove(self, n):
"""Removes one single file
"""
if os.path.isfile(n):
os.remove(n)
if not os.path.isfile(n):
print(f"File '{n}' removed")
def _overwrite(self, n):
"""Overwrites old file with new and keep file with suffix .old
"""
if os.path.isfile(n[:-4]):
shutil.copy2(n[:-4], n[:-4] + ".old")
print("Old file {0} saved as {1}.old".format(
n[:-4].split("/")[-1], n[:-4].split("/")[-1]))
if os.path.isfile(n):
shutil.move(n, n[:-4])
print("New file {0} overwrite as {1}".format(
n.split("/")[-1], n[:-4].split("/")[-1]))
def keep(self):
pass
def diff(self, n):
"""Prints the differences between the two files
"""
if os.path.isfile(n[:-4]):
diff1 = self.read_file(n[:-4]).splitlines()
if os.path.isfile(n):
diff2 = self.read_file(n).splitlines()
lines, ln, c = [], 0, 0
for a, b in itertools.izip_longest(diff1, diff2):
ln += 1
if a != b:
for s1, s2 in itertools.izip_longest(str(a), str(b)):
c += 1
if s1 != s2:
break
print(f"@@ -{ln},{c} +{ln},{c} @@\n")
for line in lines[-3:]:
print(f"{line}")
if a is None:
a = ""
print(f"{self.red}-{self.endc}{a}")
if b is None:
b = ""
print(f"{self.green}+{self.endc}{b}")
lines = []
c = 0
else:
lines.append(a)
def merge(self, n):
"""Merges new file into old
"""
if os.path.isfile(n[:-4]):
old = self.read_file(n[:-4]).splitlines()
if os.path.isfile(n):
new = self.read_file(n).splitlines()
with open(n[:-4], "w") as out:
for l1, l2 in itertools.izip_longest(old, new):
if l1 is None:
l1 = ""
if l2 is None:
l2 = ""
if l1 != l2:
out.write(l2 + "\n")
else:
out.write(l1 + "\n")
print("The file {0} merged in file {1}".format(
n.split("/")[-1], n[:-4].split("/")[-1]))
def quit(self):
raise SystemExit()

View file

@ -1 +0,0 @@
# [ packages ] directory

View file

@ -1,229 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# build.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import re
import sys
import time
import shutil
import tarfile
import itertools
import subprocess
import multiprocessing
from slpkg.utils import Utils
from slpkg.messages import Msg
from slpkg.checksum import check_md5
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.sbo.greps import SBoGrep
class BuildPackage(Utils):
"""Builds SBo packages from source
"""
def __init__(self, script, sources, path, auto):
self.script = script
self.sources = sources
self._check_sources()
self.path = path
self.auto = auto
self.meta = _meta_
self.msg = Msg()
self._SOURCES = self.meta.SBo_SOURCES
self.prgnam = self.script[:-7]
self.log_file = f"build_{self.prgnam}_log"
self.sbo_logs = self.meta.log_path + "sbo/"
self.build_logs = self.sbo_logs + "build_logs/"
self.start_log_time = time.strftime("%H:%M:%S")
self.start_time = time.time()
if not os.path.exists(self.meta.log_path):
os.mkdir(self.meta.log_path)
if not os.path.exists(self.sbo_logs):
os.mkdir(self.sbo_logs)
if not os.path.exists(self.build_logs):
os.mkdir(self.build_logs)
def build(self):
"""Builds package from source and creates log
file in path /var/log/slpkg/sbo/build_logs/.
Also checks the md5sum calculation.
"""
try:
self._delete_dir()
try:
tar = tarfile.open(self.script)
except Exception as err:
raise SystemExit(err)
tar.extractall()
tar.close()
self._makeflags()
self._delete_sbo_tar_gz()
self._create_md5_dict()
if not self.auto:
os.chdir(self._SOURCES)
for src in self.sources:
if not os.path.isfile(src):
continue
# fix build sources with spaces
src = src.replace("%20", " ")
check_md5(self.sbo_md5[src], src)
# copy source and fix passing char '+' from file name
shutil.copy2(src, self.path + self.prgnam)
os.chdir(self.path + self.prgnam)
# change permissions
subprocess.call(f"chmod +x {self.prgnam}.SlackBuild", shell=True)
pass_var = self._pass_variable()
if self.meta.sbo_build_log in ["on", "ON"]:
if os.path.isfile(self.build_logs + self.log_file):
os.remove(self.build_logs + self.log_file)
# start log write
log_head(self.build_logs, self.log_file, self.start_log_time)
subprocess.Popen(f"{' '.join(pass_var)} ./{self.prgnam}.SlackBuild 2>&1 | tee -a "
f"{self.build_logs}{self.log_file}", shell=True, stdout=sys.stdout).communicate()
sum_time = build_time(self.start_time)
# write end in log file
log_end(self.build_logs, self.log_file, sum_time)
print(f"Total build time for the package {self.prgnam} : {sum_time}\n")
else:
subprocess.call(f"{' '.join(pass_var)} ./{self.prgnam}.SlackBuild", shell=True)
os.chdir(self.path)
except (KeyboardInterrupt, KeyError) as e:
print(e) # (OSError, IOError, KeyError):
self.msg.pkg_not_found("\n", self.prgnam, "Wrong file", "\n")
def _check_sources(self):
"""Fixes filenames with char +
"""
new_sources = []
for src in self.sources:
new_sources.append(self.fix_file_name(src))
self.sources = new_sources
def _create_md5_dict(self):
"""Creates md5 dictionary per source
"""
self.sbo_md5 = {}
md5_lists = SBoGrep(self.prgnam).checksum()
for src, md5 in itertools.zip_longest(self.sources, md5_lists):
self.sbo_md5[src] = md5
def _makeflags(self):
"""Sets variable MAKEFLAGS with the numbers of
processors
"""
if self.meta.makeflags in ["on", "ON"]:
cpus = multiprocessing.cpu_count()
os.environ["MAKEFLAGS"] = f"-j{cpus}"
def _pass_variable(self):
"""Returns enviroment variables
"""
pass_var = []
for var in os.environ.keys():
expVAR = var.split("_")
if expVAR[0] == self.prgnam.upper() and expVAR[1] != "PATH":
pass_var.append(f"{expVAR[1]}={os.environ[var]}")
return pass_var
def _delete_sbo_tar_gz(self):
"""Deletes slackbuild tar.gz file after untar
"""
if not self.auto and os.path.isfile(self.meta.build_path + self.script):
os.remove(self.meta.build_path + self.script)
def _delete_dir(self):
"""Deletes old folder if exists before start build
"""
if not self.auto and os.path.isdir(self.meta.build_path + self.prgnam):
shutil.rmtree(self.meta.build_path + self.prgnam)
def log_head(path, log_file, log_time):
"""Writes headers to log file
"""
with open(path + log_file, "w") as log:
log.write("#" * 79 + "\n\n")
log.write("File : " + log_file + "\n")
log.write("Path : " + path + "\n")
log.write("Date : " + time.strftime("%d/%m/%Y") + "\n")
log.write("Time : " + log_time + "\n\n")
log.write("#" * 79 + "\n\n")
def log_end(path, log_file, sum_time):
"""Appends END tag to a log file
"""
with open(path + log_file, "a") as log:
log.seek(2)
log.write("#" * 79 + "\n\n")
log.write("Time : " + time.strftime("%H:%M:%S") + "\n")
log.write(f"Total build time : {sum_time}\n")
log.write(" " * 38 + "E N D\n\n")
log.write("#" * 79 + "\n\n")
def build_time(start_time):
"""Calculates build time per package
"""
diff_time = round(time.time() - start_time, 2)
if diff_time <= 59.99:
sum_time = str(diff_time) + " Sec"
elif diff_time > 59.99 and diff_time <= 3599.99:
sum_time = round(diff_time / 60, 2)
sum_time_list = re.findall(r"\d+", str(sum_time))
sum_time = (f"{sum_time_list[0]} Min {sum_time_list[1]} Sec")
elif diff_time > 3599.99:
sum_time = round(diff_time / 3600, 2)
sum_time_list = re.findall(r"\d+", str(sum_time))
sum_time = (f"{sum_time_list[0]} Hours {sum_time_list[1]} Min")
return sum_time

View file

@ -1,52 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# find.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from slpkg.blacklist import BlackList
from slpkg.splitting import split_package
def searching(find_pkg, directory):
"""Find packages
"""
black = BlackList()
if os.path.isdir(directory):
installed = os.listdir(directory)
blacklist = list(black.get_black())
if os.path.exists(directory):
for pkg in installed:
if (not pkg.startswith(".") and pkg.startswith(find_pkg) and
split_package(pkg)[0] not in blacklist):
yield pkg
def find_package(pkg, path):
"""Generator allias
"""
return list(searching(pkg, path))

View file

@ -1,60 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*
# installed.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.pkg.find import find_package
from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_
class GetFromInstalled:
"""Finds and returns version and package name from
already installed packages
"""
def __init__(self, package):
self.package = package
self.meta = _meta_
self.files = find_package(f"{self.package}-", self.meta.pkg_path)
self.find = ""
for file in self.files:
if split_package(file)[0] == self.package:
self.find = file
def version(self):
"""Returns version from installed packages
"""
if self.find:
return split_package(self.find)[1]
return self.find
def name(self):
"""Returns installed package name
"""
if self.find:
return self.package
return self.find

View file

@ -1,712 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# manager.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import re
import subprocess
from slpkg.pkg.find import find_package
from slpkg.pkg.installed import GetFromInstalled
from slpkg.utils import Utils
from slpkg.messages import Msg
from slpkg.dialog_box import DialogUtil
from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.slack.slackware_repo import slackware_repository
class PackageManager(Utils):
"""Package manager class for install, upgrade,
reinstall, remove, find and display packages"""
def __init__(self, binary):
self.binary = binary
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.skip = []
self.size = 0
self.file_size = 0
self.unit = "Kb"
def install(self, flag):
"""Installs Slackware binary packages
"""
for pkg in self.binary:
try:
subprocess.call(f"installpkg {flag} {pkg}", shell=True)
check = pkg[:-4].split("/")[-1]
if os.path.isfile(self.meta.pkg_path + check):
print("Completed!\n")
else:
raise SystemExit(1)
except subprocess.CalledProcessError:
self._not_found("Can't install", self.binary, pkg)
raise SystemExit(1)
def upgrade(self, flag):
"""Upgrades Slackware binary packages with new
"""
for pkg in self.binary:
try:
subprocess.call(f"upgradepkg {flag} {pkg}", shell=True)
check = pkg[:-4].split("/")[-1]
if os.path.isfile(self.meta.pkg_path + check):
print("Completed!\n")
else:
raise SystemExit(1)
except subprocess.CalledProcessError:
self._not_found("Can't upgrade", self.binary, pkg)
raise SystemExit(1)
def _not_found(self, message, binary, pkg):
if len(binary) > 1:
bol = eol = ""
else:
bol = eol = "\n"
self.msg.pkg_not_found(bol, pkg, message, eol)
def remove(self, flag, extra):
"""Removes Slackware binary packages
"""
self.flag = flag
self.extra = extra
self.dep_path = self.meta.log_path + "dep/"
dependencies, rmv_list = [], []
self.removed = self._view_removed()
if not self.removed:
print() # new line at end
else:
msg = "package"
if len(self.removed) > 1:
msg = msg + "s"
try:
if self.meta.default_answer in ["y", "Y"]:
remove_pkg = self.meta.default_answer
else:
remove_pkg = input(
"\nAre you sure to remove {0} {1} [y/N]? ".format(
str(len(self.removed)), msg))
except EOFError:
raise SystemExit(1)
if remove_pkg in ["y", "Y"]:
self._check_if_used(self.binary)
for rmv in self.removed:
'''If package build and install with "slpkg -s sbo <package>"
then looks in the log file for dependencies "/var/log/slpkg/dep",
reads and removes all but remove only the package.
'''
if (os.path.isfile(self.dep_path + rmv) and
self.meta.del_deps in ["on", "ON"] or
os.path.isfile(self.dep_path + rmv) and
"--deps" in self.extra):
dependencies = self._view_deps(self.dep_path, rmv)
if dependencies and self._rmv_deps_answer() in ["y",
"Y"]:
rmv_list += self._rmv_deps(dependencies, rmv)
else:
rmv_list += self._rmv_pkg(rmv)
else:
rmv_list += self._rmv_pkg(rmv)
# Prints all removed packages
self._reference_rmvs(rmv_list)
def _rmv_deps_answer(self):
"""Removes dependencies answer
"""
if self.meta.remove_deps_answer in ["y", "Y"]:
remove_dep = self.meta.remove_deps_answer
else:
try:
remove_dep = input(
"\nRemove dependencies (maybe used by "
"other packages) [y/N]? ")
print()
except EOFError:
raise SystemExit("\n")
return remove_dep
def _get_removed(self):
"""Manages removed packages by extra options
"""
extra = self.extra
removed, packages, pkg = [], [], ""
if "--tag" in extra:
for pkg in find_package("", self.meta.pkg_path):
for tag in self.binary:
if pkg.endswith(tag):
removed.append(split_package(pkg)[0])
packages.append(pkg)
pkg = ""
extra = ""
elif "--third-party" in extra:
slack_packages, slack_names = slackware_repository()
slpkg_pkg = self.meta.__all__ + "-" + self.meta.__version__
binary = self.binary
for pkg in find_package("", self.meta.pkg_path):
slack_name = split_package(pkg)[0]
for tag in binary:
if (slack_name not in slack_names and
slpkg_pkg not in pkg and tag in pkg):
removed.append(split_package(pkg)[0])
packages.append(pkg)
pkg = ""
extra = ""
else:
for pkg in self.binary:
name = GetFromInstalled(pkg).name()
ver = GetFromInstalled(pkg).version()
package = find_package(f"{name}-{ver}-", self.meta.pkg_path)
if pkg and name == pkg:
removed.append(pkg)
packages.append(package[0])
if not removed:
self.msg.pkg_not_found("", pkg, "Can't remove", "\n")
raise SystemExit(1)
return removed, packages
def _view_removed(self):
"""Views packages before removed
"""
print("Packages with name matching [ {0}{1}{2} ]\n".format(
self.cyan, ", ".join(self.binary), self.endc))
removed, packages = self._get_removed()
if packages and "--checklist" in self.extra:
removed = []
text = "Press 'spacebar' to unchoose packages from the remove"
backtitle = f"{self.meta.__all__} {self.meta.__version__}"
status = True
pkgs = DialogUtil(packages, text, " Remove ", backtitle,
status).checklist()
if pkgs:
for rmv in pkgs:
removed.append(split_package(rmv)[0])
self.meta.default_answer = "y"
else:
for rmv, pkg in zip(removed, packages):
self._sizes(pkg)
print(f"[ {self.red}delete{self.endc} ] --> "
f"[ {self.file_size} ] - {pkg}")
self._calc_sizes()
self._remove_summary()
if "--third-party" in self.extra:
print()
self.msg.template(78)
print(f"| {' ' * 27}{self.red}*** WARNING ***{self.endc}")
print("| Before you use third-party option, be sure you have"
" updated the packages \n| lists. Run the command"
" 'slpkg update' and 'slpkg -c slack --upgrade'")
self.msg.template(78)
return removed
def _calc_sizes(self):
"""Package size calculation
"""
if self.size > 1024:
self.unit = "Mb"
self.size = (self.size / 1024)
if self.size > 1024:
self.unit = "Gb"
self.size = (self.size / 1024)
def _remove_summary(self):
"""Removed packge size summary
"""
if self.size > 0:
print("\nRemoved summary")
print("=" * 79)
print("{0}Size of removed packages {1} {2}.{3}".format(
self.grey, round(self.size, 2), self.unit, self.endc))
def _view_deps(self, path, package):
"""Views dependencies before remove
"""
self.size = 0
packages = []
dependencies = (self.read_file(path + package)).splitlines()
for dep in dependencies:
if GetFromInstalled(dep).name():
ver = GetFromInstalled(dep).version()
packages.append(f"{dep}-{ver}")
else:
dependencies.remove(dep)
if packages:
if "--checklist" in self.extra:
deps, dependencies = [], []
text = "Found dependencies for the package {0}".format(package)
backtitle = f"{self.meta.__all__} {self.meta.__version__}"
status = True
deps = DialogUtil(packages, text, " Remove ", backtitle,
status).checklist()
for d in deps:
dependencies.append("-".join(d.split("-")[:-1]))
self.meta.remove_deps_answer = "y"
else:
print() # new line at start
self.msg.template(78)
print(f"| Found dependencies for the package {package}:")
self.msg.template(78)
for pkg in packages:
find = find_package(f"{pkg}-", self.meta.pkg_path)
self._sizes(find[0])
print(f"| {self.red}{pkg}{self.endc}")
self.msg.template(78)
self._calc_sizes()
print("| {0}Size of removed dependencies {1} {2}{3}".format(
self.grey, round(self.size, 2), self.unit, self.endc))
self.msg.template(78)
return dependencies
def _removepkg(self, package):
"""removepkg Slackware command
"""
try:
subprocess.call(f"removepkg {self.flag} {package}", shell=True)
if os.path.isfile(self.dep_path + package):
os.remove(self.dep_path + package) # remove log
except subprocess.CalledProcessError as er:
raise SystemExit(er)
def _rmv_deps(self, dependencies, package):
"""Removes dependencies
"""
removes = []
dependencies.append(package)
self._check_if_used(dependencies)
for dep in dependencies:
if dep not in self.skip and GetFromInstalled(dep).name():
ver = GetFromInstalled(dep).version()
removes.append(f"{dep}-{ver}")
self._removepkg(dep)
return removes
def _rmv_pkg(self, package):
"""Removes one signle package
"""
removes = []
if GetFromInstalled(package).name() and package not in self.skip:
ver = GetFromInstalled(package).version()
removes.append(f"{package}-{ver}")
self._removepkg(package)
return removes
def _skip_remove(self):
"""Skip packages from remove
"""
if "--checklist" not in self.extra:
self.msg.template(78)
print("| Insert packages to exception remove:")
self.msg.template(78)
try:
self.skip = input(" > ").split()
except EOFError:
raise SystemExit("\n")
for s in self.skip:
if s in self.removed:
self.removed.remove(s)
def _check_if_used(self, removes):
"""Checks package if dependencies for another package
before removed"""
if "--check-deps" in self.extra:
package, dependency, pkg_dep = [], [], []
for pkg in find_package("", self.dep_path):
deps = self.read_file(self.dep_path + pkg)
for rmv in removes:
if GetFromInstalled(rmv).name() and rmv in deps.split():
pkg_dep.append(f"{rmv} is dependency of the "
f"package --> {pkg}")
package.append(pkg)
dependency.append(rmv)
if package:
if "--checklist" in self.extra:
text = ("Press 'spacebar' to choose packages for the"
" remove exception")
backtitle = f"{self.meta.__all__} {self.meta.__version__}"
status = False
choose = DialogUtil(pkg_dep, text, " !!! WARNING !!! ",
backtitle, status).checklist()
for pkg in choose:
self.skip.append(pkg.split()[0])
else:
self.msg.template(78)
print("| {0}{1}{2}".format(
self.red, " " * 30 + "!!! WARNING !!!", self.endc))
self.msg.template(78)
for p, d in zip(package, dependency):
print(f"| {self.yellow}{d}{self.endc} is dependency "
f"of the package --> {self.green}{p}{self.endc}")
self.msg.template(78)
self._skip_remove()
def _reference_rmvs(self, removes):
"""Prints all removed packages
"""
print()
self.msg.template(78)
msg_pkg = "package"
if len(removes) > 1:
msg_pkg = "packages"
print(f"| Total {len(removes)} {msg_pkg} removed")
self.msg.template(78)
for pkg in removes:
if not GetFromInstalled(pkg).name():
print(f"| Package {pkg} removed")
else:
print(f"| Package {pkg} not found")
self.msg.template(78)
print() # new line at end
def find(self, flag):
"""Finds installed Slackware packages
"""
matching, packages = 0, []
pkg_cache, match_cache = "", ""
slack_packages, slack_names = slackware_repository()
print("Packages with matching name [ {0}{1}{2} ]\n".format(
self.cyan, ", ".join(self.binary), self.endc))
for pkg in self.binary:
for match in find_package("", self.meta.pkg_path):
pkg_cache = pkg
match_cache = match
split_name = split_package(match)[0]
if "--case-ins" in flag:
pkg_cache = pkg.lower()
match_cache = match.lower()
if ("--third-party" in flag and not self.binary and
split_name not in slack_names):
packages.append(match)
if ("--third-party" in flag and pkg_cache in match_cache and
split_name not in slack_names):
packages.append(match)
if pkg_cache in match_cache and not flag:
packages.append(match)
if ("--case-ins" in flag and "--third-party" not in flag and
pkg_cache in match_cache):
packages.append(match)
for pkgs in packages:
matching += 1
self._sizes(pkgs)
print(f"[ {self.green}installed{self.endc} ] "
f"[ {self.file_size} ] - {pkgs}")
if matching == 0:
message = "Can't find"
self.msg.pkg_not_found("", ", ".join(self.binary), message, "\n")
raise SystemExit(1)
else:
self._calc_sizes()
print("\nFound summary")
print("=" * 79)
print("{0}Total found {1} matching packages.{2}".format(
self.grey, matching, self.endc))
print("{0}Size of installed packages {1} {2}.{3}\n".format(
self.grey, round(self.size, 2), self.unit, self.endc))
def _sizes(self, package):
"""Package size summary
"""
data = self.read_file(self.meta.pkg_path + package)
for line in data.splitlines():
if line.startswith("UNCOMPRESSED PACKAGE SIZE:"):
digit = float((''.join(re.findall(
r"[-+]?\d+[\.]?\d*[eE]?[-+]?\d*", line[26:]))))
self.file_size = line[26:].strip()
if "M" in line[26:]:
self.size += digit * 1024
else:
self.size += digit
break
def display(self):
"""Prints the Slackware packages contents
"""
for pkg in self.binary:
name = GetFromInstalled(pkg).name()
ver = GetFromInstalled(pkg).version()
find = find_package(f"{name}-{ver}-", self.meta.pkg_path)
if find:
package = self.read_file(
self.meta.pkg_path + "".join(find))
print(package)
else:
message = "Can't dislpay"
if len(self.binary) > 1:
bol = eol = ""
else:
bol = eol = "\n"
self.msg.pkg_not_found(bol, pkg, message, eol)
raise SystemExit(1)
def package_list(self, repo, name, INDEX, installed):
"""List with the installed packages
"""
tty_size = os.popen("stty size", "r").read().split()
row = int(tty_size[0]) - 2
try:
all_installed_names = []
index, page, pkg_list = 0, row, []
r = self.list_lib(repo)
pkg_list = self.list_greps(repo, r)[0]
all_installed_names = self.list_of_installed(repo, name)
print()
for pkg in sorted(pkg_list):
pkg = self._splitting_packages(pkg, repo, name)
if installed and repo:
if pkg in all_installed_names:
pkg = f"{self.green}{pkg}{self.endc}"
if INDEX:
index += 1
pkg = self.list_color_tag(pkg)
print(f"{self.grey}{index}:{self.endc} {pkg}")
if index == page:
read = input(f"\nPress {self.cyan}Enter{self.endc} to "
f"continue... ")
if read in ["Q", "q"]:
break
print() # new line after page
page += row
else:
print(pkg)
print() # new line at end
except (EOFError, KeyboardInterrupt, BrokenPipeError, IOError):
raise SystemExit(1)
def _splitting_packages(self, pkg, repo, name):
"""Returns package name from repositories
"""
if name and repo != "sbo":
pkg = split_package(pkg)[0]
elif not name and repo != "sbo":
pkg = pkg[:-4]
return pkg
def list_greps(self, repo, packages):
"""Grabs packages
"""
pkg_list, pkg_size = [], []
for line in packages.splitlines():
if repo == "sbo":
if line.startswith("SLACKBUILD NAME: "):
pkg_list.append(line[17:].strip())
pkg_size.append("0 K")
else:
if line.startswith("PACKAGE NAME: "):
pkg_list.append(line[15:].strip())
if line.startswith("PACKAGE SIZE (compressed): "):
pkg_size.append(line[26:].strip())
if repo == "alien" or repo == "ktown":
return alien_filter(pkg_list, pkg_size)
return pkg_list, pkg_size
def list_lib(self, repo):
"""Returns package lists
"""
packages = ""
if repo == "sbo":
if (os.path.isfile(
self.meta.lib_path + "sbo_repo/SLACKBUILDS.TXT")):
packages = self.read_file(f"{self.meta.lib_path}"
"sbo_repo/SLACKBUILDS.TXT")
else:
if (os.path.isfile(
self.meta.lib_path + f"{repo}_repo/PACKAGES.TXT")):
packages = self.read_file(f"{self.meta.lib_path}"
f"{repo}_repo/PACKAGES.TXT")
return packages
def list_color_tag(self, pkg):
"""Tag with colour installed packages
"""
name = GetFromInstalled(pkg).name()
find = f"{name}-"
if pkg.endswith(".txz") or pkg.endswith(".tgz"):
find = pkg[:-4]
if find_package(find, self.meta.pkg_path):
pkg = f"{self.green}{pkg}{self.endc}"
return pkg
def list_of_installed(self, repo, name):
"""Returns installed packages
"""
all_installed_names = []
all_installed_packages = find_package("", self.meta.pkg_path)
for inst in all_installed_packages:
if repo == "sbo" and inst.endswith("_SBo"):
name = split_package(inst)[0]
all_installed_names.append(name)
else:
if name:
all_installed_names.append(split_package(inst)[0])
else:
all_installed_names.append(inst)
return all_installed_names
def alien_filter(packages, sizes):
"""This filter avoids listing double packages from
alien repository
"""
cache, npkg, nsize = [], [], []
for p, s in zip(packages, sizes):
name = split_package(p)[0]
if name not in cache:
cache.append(name)
npkg.append(p)
nsize.append(s)
return npkg, nsize

View file

@ -1,96 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# pkg_find.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.messages import Msg
from slpkg.sbo.greps import SBoGrep
from slpkg.pkg.manager import PackageManager
from slpkg.__metadata__ import MetaData as _meta_
class FindFromRepos:
"""Finds packages from all enabled repositories
"""
def __init__(self):
self.cache = ""
self.p_cache = ""
self.find_cache = ""
self.count_pkg = 0
self.count_repo = 0
self.meta = _meta_
self.msg = Msg()
self.cyan = self.meta.color["CYAN"]
self.grey = self.meta.color["GREY"]
self.endc = self.meta.color["ENDC"]
def find(self, pkg, flag):
"""Starts to find packages and print
"""
print(f"Packages with name matching [ {self.cyan}"
f"{', '.join(pkg)}{self.endc} ]\n")
self.msg.template(78)
print(f"| Repository Package {' ' * 54}Size")
self.msg.template(78)
for repo in _meta_.repositories:
PACKAGES_TXT = PackageManager(pkg).list_lib(repo)
packages, sizes = PackageManager(pkg).list_greps(repo,
PACKAGES_TXT)
for find, size in zip(packages, sizes):
for p in pkg:
if "--case-ins" in flag:
self.p_cache = p.lower()
self.find_cache = find.lower()
else:
self.p_cache = p
self.find_cache = find
if self.p_cache in self.find_cache:
if self.cache != repo:
self.count_repo += 1
self.cache = repo
self.count_pkg += 1
ver = self.sbo_version(repo, find)
print(f" {self.cyan}{repo}{self.endc}"
f"{' ' * (11 - len(repo))}{find + ver} "
f"{' ' * (54 -len(find + ver))}{size:>11}")
print("\nFound summary")
print("=" * 79)
print(f"{self.grey}Total found {self.count_pkg} packages in "
f"{self.count_repo} repositories.{self.endc}\n")
def sbo_version(self, repo, find):
"""Adds version to SBo packages
"""
ver = ""
if repo == "sbo":
ver = f"-{SBoGrep(find).version()}"
return ver

90
slpkg/queries.py Normal file
View file

@ -0,0 +1,90 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from metadata import Metadata
from models.models import SBoTable
from models.models import session as Session
from dataclasses import dataclass
@dataclass()
class SBoQueries:
''' Queries class for the sbo repository. '''
name: str
session: str = Session
os_arch: str = Metadata.os_arch
def names(self):
return list(self._names_grabbing())
def slackbuild(self):
sbo = self.session.query(
SBoTable.name).filter(SBoTable.name == self.name).first()
return sbo
def location(self):
location = self.session.query(
SBoTable.location).filter(SBoTable.name == self.name).first()
return location[0]
def sources(self):
source, source64 = self.session.query(
SBoTable.download, SBoTable.download64).filter(
SBoTable.name == self.name).first()
return self._chose_arch(source, source64)
def requires(self):
requires = self.session.query(
SBoTable.requires).filter(
SBoTable.name == self.name).first()
return requires[0].split()
def version(self):
version = self.session.query(
SBoTable.version).filter(
SBoTable.name == self.name).first()
return version[0]
def checksum(self):
md5sum, md5sum64, = [], []
mds5, md5s64 = self.session.query(
SBoTable.md5sum, SBoTable.md5sum64).filter(
SBoTable.name == self.name).first()
if mds5:
md5sum.append(mds5)
if md5s64:
md5sum64.append(md5s64)
return self._chose_arch(md5sum, md5sum64)
def description(self):
desc = self.session.query(
SBoTable.short_description).filter(
SBoTable.name == self.name).first()
return desc[0]
def files(self):
files = self.session.query(
SBoTable.files).filter(
SBoTable.name == self.name).first()
return files[0]
def _chose_arch(self, arch, arch64):
if self.os_arch and arch64:
return arch64
return arch
def _names_grabbing(self):
names = self.session.query(SBoTable.name).all()
for n in names:
yield n[0]

View file

@ -1,45 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# remove.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import shutil
from slpkg.__metadata__ import MetaData as _meta_
def delete_package(path, packages):
"""Deletes downloaded packages
"""
if _meta_.del_all in ["on", "ON"]:
for pkg in packages:
os.remove(f"{path}{pkg}")
def delete_folder(folder):
"""Deletes folder with all files.
"""
if _meta_.del_folder in ["on", "ON"] and os.path.exists(folder):
shutil.rmtree(folder)

79
slpkg/remove_packages.py Normal file
View file

@ -0,0 +1,79 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import subprocess
from metadata import Metadata
from dataclasses import dataclass
from views.views import ViewMessage
from models.models import LogsDependencies
from models.models import session as Session
@dataclass
class RemovePackages:
''' Remove installed packages. '''
packages: str
flags: list
session: str = Session
log_packages: str = Metadata.log_packages
repo_tag: str = Metadata.repo_tag
removepkg: str = Metadata.removepkg
color: str = Metadata.colour
def remove(self):
''' Remove package with dependencies. '''
self.installed_packages = []
view = ViewMessage()
view.remove_packages()
for pkg in self.packages:
self.view_installed_packages(pkg)
self.dependencies = self.session.query(
LogsDependencies.requires).filter(
LogsDependencies.name == pkg).first()
if self.dependencies and '--resolve-off' not in self.flags:
print('\nDependencies:')
for dep in self.dependencies[0].split():
self.view_installed_packages(dep)
view.question(self.flags)
self.remove_packages()
self.delete_main_logs()
if self.dependencies and '--resolve-off' not in self.flags:
self.delete_deps_logs()
def remove_packages(self):
''' Run Slackware command to remove the packages. '''
for package in self.installed_packages:
command = f'{self.removepkg} {package}'
subprocess.call(command, shell=True)
def delete_main_logs(self):
''' Delete main packages from logs. '''
for pkg in self.packages:
self.session.query(LogsDependencies).filter(
LogsDependencies.name == pkg).delete()
self.session.commit()
def delete_deps_logs(self):
''' Delete depends packages from logs. '''
for pkg in self.dependencies[0].split():
self.session.query(LogsDependencies).filter(
LogsDependencies.name == pkg).delete()
self.session.commit()
def view_installed_packages(self, name):
''' View and creates list with packages for remove. '''
installed = os.listdir(self.log_packages)
color = self.color()
for package in installed:
if package.startswith(name) and self.repo_tag in package:
self.installed_packages.append(package)
print(f'[{color["RED"]} delete {color["ENDC"]}] -> {package}')

View file

@ -1,167 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# repoenable.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from slpkg.utils import Utils
from slpkg.messages import Msg
from slpkg.dialog_box import DialogUtil
from slpkg.__metadata__ import MetaData as _meta_
class RepoEnable(Utils):
"""Reads repositories.conf file and update with new enabled or
disabled repositories
"""
def __init__(self):
self.meta = _meta_
self.red = _meta_.color["RED"]
self.grey = _meta_.color["GREY"]
self.endc = _meta_.color["ENDC"]
self.msg = Msg()
self.tag = "[REPOSITORIES]"
self.tag_line = False
self.repositories_conf = "repositories.conf"
self.conf = self.read_file(f"{self.meta.conf_path}"
f"{self.repositories_conf}")
self.enabled = []
self.disabled = []
self.selected = []
def choose(self):
"""Choose repositories
"""
keys = """
Choose repositories at the right side for enable or to the
left side for disable.
Keys: SPACE select or deselect the highlighted repositories,
move it between the left and right lists
^ move the focus to the left list
$ move the focus to the right list
TAB move focus
ENTER press the focused button
Disabled <---------------- REPOSITORIES ----------------> Enabled"""
self.read_enabled()
self.read_disabled()
text, title, backtitle, status = keys, " Repositories ", "", False
self.selected = DialogUtil(self.disabled, text, title, backtitle,
status).buildlist(self.enabled)
if self.selected is not None:
self.update_repos()
else:
self.selected = self.enabled
self.clear_screen()
self.reference()
def read_enabled(self):
"""Reads enabled repositories
"""
for line in self.conf.splitlines():
line = line.lstrip()
if self.tag in line:
self.tag_line = True
if (line and self.tag_line and not line.startswith("#") and
self.tag not in line):
self.enabled.append(line)
self.tag_line = False
def read_disabled(self):
"""Reads disabled repositories
"""
for line in self.conf.splitlines():
line = line.lstrip()
if self.tag in line:
self.tag_line = True
if self.tag_line and line.startswith("#"):
line = "".join(line.split("#")).strip()
self.disabled.append(line)
self.tag_line = False
def update_repos(self):
"""Updates repositories.conf file with enabled or disabled
repositories
"""
with open(f"{self.meta.conf_path}"
f"{self.repositories_conf}", "w") as new_conf:
for line in self.conf.splitlines():
line = line.lstrip()
if self.tag in line:
self.tag_line = True
if self.tag_line and line.startswith("#"):
repo = "".join(line.split("#")).strip()
if repo in self.selected:
new_conf.write(line.replace(line, f"{repo}\n"))
continue
if (self.tag_line and not line.startswith("#") and
line != self.tag):
repo = line.strip()
if repo not in self.selected:
new_conf.write(line.replace(line, f"# {line}\n"))
continue
new_conf.write(f"{line}\n")
def clear_screen(self):
"""Clear screen
"""
os.system("clear")
def reference(self):
"""Reference enable repositories
"""
total_enabled = ", ".join(self.selected)
if len(total_enabled) < 1:
total_enabled = (f"{self.red}Are you crazy? This is a package "
f"manager for packages :p{self.endc}")
self.msg.template(78)
print("| Enabled repositories:")
self.msg.template(78)
print(f"| {total_enabled}")
self.msg.template(78)
print(f"{self.grey}Total {len(self.selected)}/"
f"{len(self.enabled + self.disabled)} "
f"repositories enabled.{self.endc}\n")

View file

@ -1,141 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# repoinfo.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from slpkg.sizes import units
from slpkg.utils import Utils
from slpkg.repositories import Repo
from slpkg.repolist import RepoList
from slpkg.__metadata__ import MetaData as _meta_
class RepoInfo(Utils):
"""Repository information
"""
def __init__(self):
self.green = _meta_.color["GREEN"]
self.red = _meta_.color["RED"]
self.endc = _meta_.color["ENDC"]
self.repo = Repo()
self.form = {
"Last updated:": "",
"Number of packages:": "",
"Repo id:": "",
"Default:": "",
"Repo url:": "",
"Status:": "",
"Total compressed packages:": "",
"Total uncompressed packages:": ""
}
self.meta = _meta_
self.all_repos = self.repo.default_repository()
self.all_repos["slack"] = self.repo.slack()
self.all_repos.update(self.repo.custom_repository())
del RepoList().all_repos
def view(self, repo):
"""Views repository information
"""
status = f"{self.red}disabled{self.endc}"
self.form["Status:"] = status
self.form["Default:"] = "no"
if repo in self.meta.default_repositories:
self.form["Default:"] = "yes"
if (repo in self.meta.repositories and
os.path.isfile(f"{self.meta.lib_path}"
f"{repo}_repo/PACKAGES.TXT")):
status = f"{self.green}enabled{self.endc}"
if repo != "sbo":
data = self.repository_data(repo)
size = units(data[1], data[2])
self.form["Repo id:"] = repo
self.form["Repo url:"] = self.all_repos[repo]
self.form["Total compressed packages:"] = f"{str(size[1][0])} {str(size[0][0])}"
self.form["Total uncompressed packages:"] = f"{str(size[1][1])} {str(size[0][1])}"
self.form["Number of packages:"] = data[0]
self.form["Status:"] = status
self.form["Last updated:"] = data[3]
elif (repo == "sbo" and os.path.isfile(
f"{self.meta.lib_path}{repo}_repo/SLACKBUILDS.TXT")):
status = f"{self.green}enabled{self.endc}"
sum_sbo_pkgs = 0
for line in (self.read_file(
f"{self.meta.lib_path}sbo_repo/SLACKBUILDS."
"TXT").splitlines()):
if line.startswith("SLACKBUILD NAME: "):
sum_sbo_pkgs += 1
changelog_txt = self.read_file(
f"{self.meta.log_path}sbo/ChangeLog.txt")
last_upd = changelog_txt.split("\n", 1)[0]
self.form["Repo id:"] = repo
self.form["Repo url:"] = self.all_repos[repo]
self.form["Total compressed packages:"] = ""
self.form["Total uncompressed packages:"] = ""
self.form["Number of packages:"] = sum_sbo_pkgs
self.form["Status:"] = status
self.form["Last updated:"] = last_upd
for key, value in sorted(self.form.items()):
print(f"{self.green}{key}{self.endc} {value}")
def repository_data(self, repo):
"""Graps data packages
"""
sum_pkgs, size, unsize, last_upd = 0, [], [], ""
f = f"{self.meta.lib_path}{repo}_repo/PACKAGES.TXT"
for line in self.read_file(f).splitlines():
if line.startswith("PACKAGES.TXT;"):
last_upd = line[14:].strip()
if line.startswith("PACKAGE NAME:"):
sum_pkgs += 1
if line.startswith("PACKAGE SIZE (compressed): "):
size.append(line[28:-2].strip())
if line.startswith("PACKAGE SIZE (uncompressed): "):
unsize.append(line[30:-2].strip())
if repo in ["salix", "slackl"]:
log = self.read_file(
f"{self.meta.log_path}{repo}/ChangeLog.txt")
last_upd = log.split("\n", 1)[0]
return [sum_pkgs, size, unsize, last_upd]

View file

@ -1,84 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# repolist.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.messages import Msg
from slpkg.repositories import Repo
from slpkg.__metadata__ import MetaData as _meta_
class RepoList:
"""List of repositories
"""
def __init__(self):
self.meta = _meta_
self.green = self.meta.color["GREEN"]
self.red = self.meta.color["RED"]
self.grey = self.meta.color["GREY"]
self.endc = self.meta.color["ENDC"]
self.msg = Msg()
self.all_repos = Repo().default_repository()
self.all_repos["slack"] = Repo().slack()
self.all_repos.update(Repo().custom_repository())
def repos(self):
"""View or enabled or disabled repositories
"""
def_cnt, cus_cnt = 0, 0
self.msg.template(78)
print("{0}{1}{2}{3}{4}{5}{6}".format(
"| Repo_id", " " * 2,
"Repo_URL", " " * 44,
"Default", " " * 3,
"Status"))
self.msg.template(78)
for repo_id, repo_URL in sorted(self.all_repos.items()):
status, COLOR = "disabled", self.red
default = "yes"
if len(repo_URL) > 49:
repo_URL = repo_URL[:48] + "~"
if repo_id in self.meta.repositories:
def_cnt += 1
status, COLOR = "enabled", self.green
if repo_id not in self.meta.default_repositories:
cus_cnt += 1
default = "no"
print(" {0}{1}{2}{3}{4}{5}{6}{7:>8}{8}".format(
repo_id, " " * (9 - len(repo_id)),
repo_URL, " " * (52 - len(repo_URL)),
default, " " * (8 - len(default)),
COLOR, status, self.endc))
print("\nRepositories summary")
print("=" * 79)
print(f"{self.grey}{def_cnt}/{len(self.all_repos)} enabled default "
f"repositories and {cus_cnt} custom.")
print("Edit the file '/etc/slpkg/repositories.conf' for enable "
"and disable default\nrepositories or run 'slpkg "
f"repo-enable' command.{self.endc}")

View file

@ -1,152 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# repositories.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from slpkg.utils import Utils
from slpkg.__metadata__ import MetaData as _meta_
class Repo(Utils):
"""Manages repositories configuration files
"""
def __init__(self):
self.meta = _meta_
self.DEFAULT_REPOS_NAMES = self.meta.default_repositories
self.custom_repo_file = "/etc/slpkg/custom-repositories"
self.default_repo_file = "/etc/slpkg/default-repositories"
self.custom_repositories_list = self.read_file(
self.custom_repo_file)
self.default_repositories_list = self.read_file(
self.default_repo_file)
self.default_repository()
def add(self, repo, url):
"""Writes custom repository name and url in a file
"""
repo_name = []
if not url.endswith("/"):
url += "/"
for line in self.custom_repositories_list.splitlines():
line = line.lstrip()
if line and not line.startswith("#"):
repo_name.append(line.split()[0])
if (repo in self.meta.repositories or repo in repo_name or
repo in self.meta.default_repositories):
raise SystemExit(f"\nRepository name '{repo}' exist, "
f"select different name.\n"
f"View all repositories with command 'slpkg "
f"repo-list'.\n")
elif len(repo) > 6:
raise SystemExit("\nslpkg: Error: Maximum repository name length "
"must be six (6) characters\n")
with open(self.custom_repo_file, "a") as repos:
new_line = f" {repo}{' ' * (10 - len(repo))}{url}\n"
repos.write(new_line)
print(f"\nRepository '{repo}' successfully added\n")
def remove(self, repo):
"""Removes custom repository
"""
rem_repo = False
with open(self.custom_repo_file, "w") as repos:
for line in self.custom_repositories_list.splitlines():
repo_name = line.split()[0]
if repo_name != repo:
repos.write(f"{line}\n")
else:
print(f"\nRepository '{repo}' successfully "
"removed\n")
rem_repo = True
if not rem_repo:
print(f"\nRepository '{repo}' doesn't exist\n")
def custom_repository(self):
"""Returns dictionary with repo name and url (used external)
"""
custom_dict_repo = {}
for line in self.custom_repositories_list.splitlines():
line = line.lstrip()
if not line.startswith("#"):
custom_dict_repo[line.split()[0]] = line.split()[1]
return custom_dict_repo
def default_repository(self):
"""Returns dictionary with default repo name and url
"""
default_dict_repo = {}
for line in self.default_repositories_list.splitlines():
line = line.lstrip()
if not line.startswith("#"):
if line.split()[0] in self.DEFAULT_REPOS_NAMES:
default_dict_repo[line.split()[0]] = line.split()[1]
else:
raise SystemExit(f"\nslpkg: Error: Repository name "
f"'{line.split()[0]}'"
f" is not default.\n "
f"Please check file: "
f"/etc/slpkg/default-repositories\n")
return default_dict_repo
def slack(self):
"""Official slackware repository
"""
default = "http://mirrors.slackware.com/slackware/"
if self.meta.arch.startswith("arm"):
default = "http://ftp.arm.slackware.com/slackwarearm/"
if os.path.isfile("/etc/slpkg/slackware-mirrors"):
mirrors = self.read_file(
f"{self.meta.conf_path}slackware-mirrors")
for line in mirrors.splitlines():
line = line.rstrip()
if not line.startswith("#") and line:
default = line.split()[-1]
if not default.endswith("/"):
default += "/"
return default

View file

@ -1 +0,0 @@
# [ slackbuilds ] directory

View file

@ -1,76 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# autobuild.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from slpkg.pkg.build import BuildPackage
from slpkg.sbo.greps import SBoGrep
class AutoBuild:
"""Autobuild package if sources and script is already
downloaded
"""
def __init__(self, script, sources, path):
self.script = script
self.sources = sources
self.prgnam = self.script[:-7]
self.path = path
self.sbo_sources = []
def run(self):
"""Builds package and fix ordelist per checksum
"""
self.files_exist()
self.info_file()
sources = self.sources
if len(sources) > 1 and self.sbo_sources != sources:
sources = self.sbo_sources
# If the list does not have the same order uses from .info
# order.
BuildPackage(self.script, sources, self.path, auto=True).build()
raise SystemExit()
def info_file(self):
"""Grabs sources from .info file and stores filename
"""
sources = SBoGrep(self.prgnam).source().split()
for source in sources:
self.sbo_sources.append(source.split("/")[-1])
def files_exist(self):
"""Check if SlackBuild archive.tar.gz and sources exist
"""
if not os.path.isfile(self.path + self.script):
raise SystemExit("\nslpkg: Error: SlackBuild archive.tar.gz "
"not found\n")
for src in self.sources:
if not os.path.isfile(self.path + src):
raise SystemExit(f"\nslpkg: Error: Source file '{src}' "
f"not found\n")

View file

@ -1,59 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# build_num.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import re
from slpkg.utils import Utils
from slpkg.url_read import URL
from slpkg.__metadata__ import MetaData as _meta_
class BuildNumber(Utils):
"""Gets build number from SlackBuild script
"""
def __init__(self, sbo_url, pkg):
self.sbo_url = sbo_url
self.pkg = pkg
self.meta = _meta_
def get(self):
num = "NO_BUILD"
if self.sbo_url:
SlackBuild = URL(f"{self.sbo_url}"
f"{self.pkg}.SlackBuild").get_request()
else:
SlackBuild = self.read_file(f"{self.meta.build_path}{self.pkg}/"
f"{self.pkg}.SlackBuild")
for line in SlackBuild.splitlines():
line = line.lstrip()
if line.startswith("BUILD="):
num = re.findall(r"\d+", line)
break
return "".join(num)

View file

@ -1,71 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# check.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from pkg_resources import parse_version
from slpkg.messages import Msg
from slpkg.blacklist import BlackList
from slpkg.splitting import split_package
from slpkg.upgrade_checklist import choose_upg
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.sbo.greps import SBoGrep
def sbo_upgrade(skip, flag):
"""Returns packages for upgrade
"""
msg = Msg()
black = BlackList()
msg.checking()
upgrade_names = []
data = SBoGrep(name="").names()
blacklist = list(black.get_black())
for pkg in sbo_list():
name = split_package(pkg)[0]
ver = split_package(pkg)[1]
if (name in data and name not in skip and name not in blacklist):
sbo_package = f"{name}-{SBoGrep(name).version()}"
package = f"{name}-{ver}"
if parse_version(sbo_package) > parse_version(package):
upgrade_names.append(name)
msg.done()
if "--checklist" in flag:
upgrade_names = choose_upg(upgrade_names)
return upgrade_names
def sbo_list():
"""Returns all SBo packages
"""
for pkg in os.listdir(_meta_.pkg_path):
if pkg.endswith("_SBo"):
yield pkg

View file

@ -1,32 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# download.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
class SBoLink:
"""Creates slackbuild tar.gz archive from url
"""
def __init__(self, sbo_url):
self.sbo_url = sbo_url
def tar_gz(self):
return f"{self.sbo_url[:-1]}.tar.gz"

View file

@ -1,75 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# dependency.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
from functools import lru_cache
from slpkg.blacklist import BlackList
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.sbo.greps import SBoGrep
class Requires(BlackList):
"""Resolving SBo dependencies
"""
def __init__(self, flag):
super().__init__()
self.flag = flag
self.meta = _meta_
self.SLACKBUILDS_TXT = SBoGrep(name="").names()
self.blacklist = list(self.get_black())
self.dep_results = []
@lru_cache
def sbo(self, name):
"""Builds all dependencies of a package
"""
if (self.meta.rsl_deps in ["on", "ON"] and
"--resolve-off" not in self.flag):
sys.setrecursionlimit(10000)
dependencies = []
requires = SBoGrep(name).requires()
if requires:
for req in requires:
# avoids adding %README% as dependency and if
# requires in the blacklist
if "%README%" not in req and req not in self.blacklist:
dependencies.append(req)
self.deep_check(tuple(dependencies))
return self.dep_results
else:
return []
@lru_cache
def deep_check(self, dependencies):
"""Checking if dependencies are finished
"""
if dependencies:
self.dep_results.append(dependencies)
[self.sbo(dep) for dep in dependencies]

View file

@ -1,117 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# greps.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.models.models import SBoTable, session
class SBoGrep:
"""Grabs data from sbo database
"""
def __init__(self, name):
self.name = name
self.meta = _meta_
self.arch64 = "x86_64"
self.session = session
def names(self):
"""Alias method convert generator and return
a list
"""
return list(self._names_grabbing())
def source(self):
"""Grabs sources downloads links
"""
source, source64 = self.session.query(
SBoTable.download, SBoTable.download64).filter(
SBoTable.name == self.name).first()
return self._sorting_arch(source, source64)
def requires(self):
"""Grabs package requirements
"""
requires = self.session.query(
SBoTable.requires).filter(
SBoTable.name == self.name).first()
return requires[0].split()
def version(self):
"""Grabs package version
"""
version = self.session.query(
SBoTable.version).filter(
SBoTable.name == self.name).first()
return version[0]
def checksum(self):
"""Grabs checksum string
"""
md5sum, md5sum64, = [], []
mds5, md5s64 = self.session.query(
SBoTable.md5sum, SBoTable.md5sum64).filter(
SBoTable.name == self.name).first()
if mds5:
md5sum.append(mds5)
if md5s64:
md5sum64.append(md5s64)
return self._sorting_arch(md5sum, md5sum64)
def description(self):
"""Grabs package description
"""
desc = self.session.query(
SBoTable.short_description).filter(
SBoTable.name == self.name).first()
return desc[0]
def files(self):
"""Grabs files
"""
files = self.session.query(
SBoTable.files).filter(
SBoTable.name == self.name).first()
return files[0]
def _names_grabbing(self):
"""Generator that collecting all packages names
"""
names = self.session.query(SBoTable.name).all()
for n in names:
yield n[0]
def _sorting_arch(self, arch, arch64):
"""Returns sources by arch
"""
if self.meta.arch == self.arch64 and arch64:
return arch64
return arch

View file

@ -1,418 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# network.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import pydoc
from slpkg.utils import Utils
from slpkg.messages import Msg
from slpkg.blacklist import BlackList
from slpkg.downloader import Download
from slpkg.remove import delete_folder
from slpkg.dialog_box import DialogUtil
from slpkg.security import pkg_security
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.pkg.find import find_package
from slpkg.pkg.build import BuildPackage
from slpkg.pkg.manager import PackageManager
from slpkg.sbo.read import ReadSBo
from slpkg.sbo.greps import SBoGrep
from slpkg.sbo.sbo_arch import SBoArch
from slpkg.sbo.compressed import SBoLink
from slpkg.sbo.search import sbo_search_pkg
from slpkg.sbo.slack_find import slack_package
from slpkg.slack.slack_version import slack_ver
class SBoNetwork(BlackList, Utils):
"""View SBo site in the terminal and also read, build or
install packages
"""
def __init__(self, name, flag):
super().__init__()
self.name = name
self.flag = flag
self.meta = _meta_
self.msg = Msg()
self.data = SBoGrep(name="").names()
self.check_pkg_exist()
self.arch = SBoArch().get()
self.comp_tar = ".tar.gz"
self.choice = ""
self.FAULT = ""
self.green = self.meta.color["GREEN"]
self.red = self.meta.color["RED"]
self.yellow = self.meta.color["YELLOW"]
self.cyan = self.meta.color["CYAN"]
self.grey = self.meta.color["GREY"]
self.endc = self.meta.color["ENDC"]
self.build_folder = self.meta.build_path
self._SOURCES = self.meta.SBo_SOURCES
self.msg.reading()
self.case_insensitive()
if "--checklist" in self.flag:
self.with_checklist()
grep = SBoGrep(self.name)
self.sbo_files = grep.files()
self.sbo_url = sbo_search_pkg(self.name)
if self.sbo_url:
self.sbo_desc = grep.description()[len(self.name) + 2:-1]
self.source_dwn = grep.source().split()
self.sbo_req = grep.requires()
self.sbo_dwn = SBoLink(self.sbo_url).tar_gz()
self.sbo_version = grep.version()
self.dwn_srcs = self.sbo_dwn.split() + self.source_dwn
if "--checklist" not in self.flag or not self.sbo_url and self.name:
self.msg.done()
def check_pkg_exist(self):
if self.name not in self.data:
self.msg.pkg_not_found("\n", self.name, "can't find", "\n")
raise SystemExit(1)
def view(self):
"""View SlackBuild package, read or install them
from slackbuilds.org
"""
if self.sbo_url and self.name not in self.get_black():
self.prgnam = f"{self.name}-{self.sbo_version}"
self.view_sbo()
while True:
self.read_choice()
choice = {
"r": self.choice_README,
"R": self.choice_README,
"s": self.choice_SlackBuild,
"S": self.choice_SlackBuild,
"f": self.choice_info,
"F": self.choice_info,
"o": self.choice_doinst,
"O": self.choice_doinst,
"d": self.choice_download,
"D": self.choice_download,
"download": self.choice_download,
"b": self.choice_build,
"B": self.choice_build,
"build": self.choice_build,
"i": self.choice_install,
"I": self.choice_install,
"install": self.choice_install,
"c": self.choice_clear_screen,
"C": self.choice_clear_screen,
"clear": self.choice_clear_screen,
"q": self.choice_quit,
"quit": self.choice_quit,
"Q": self.choice_quit
}
try:
choice[self.choice]()
except KeyError:
pass
else:
self.msg.pkg_not_found("\n", self.name, "Can't view", "\n")
raise SystemExit(1)
def case_insensitive(self):
"""Matching packages distinguish between uppercase and
lowercase
"""
if "--case-ins" in self.flag:
data_dict = self.case_sensitive(self.data)
for key, value in data_dict.items():
if key == self.name.lower():
self.name = value
def read_choice(self):
"""Return choice
"""
commands = {
"r": "README",
"R": "README",
"s": f"{self.name}.SlackBuild",
"S": f"{self.name}.SlackBuild",
"f": f"{self.name}.info",
"F": f"{self.name}.info",
"o": "doinst.sh",
"O": "doinst.sh",
"d": "download",
"D": "download",
"download": "download",
"b": "build",
"B": "build",
"build": "build",
"i": "install",
"I": "install",
"install": "install",
"c": "clear",
"C": "clear",
"clear": "clear",
"q": "quit",
"quit": "quit",
"Q": "quit"
}
try:
message = " Choose an option > "
self.choice = input(f"{self.grey}{message}{self.endc}")
except EOFError:
raise SystemExit('\n')
try:
print("{0}\x1b[1A{1}{2}{3}\n".format(
" " * len(message), self.cyan, commands[self.choice],
self.endc), end="")
print(end="", flush=True)
except KeyError:
pass
def choice_README(self):
"""View README file
"""
README = ReadSBo(self.sbo_url).readme("README")
fill = self.fill_pager(README)
self.pager(README + fill)
def choice_SlackBuild(self):
"""View .SlackBuild file
"""
SlackBuild = ReadSBo(self.sbo_url).slackbuild(self.name, ".SlackBuild")
fill = self.fill_pager(SlackBuild)
self.pager(SlackBuild + fill)
def choice_info(self):
"""View .info file
"""
info = ReadSBo(self.sbo_url).info(self.name, ".info")
fill = self.fill_pager(info)
self.pager(info + fill)
def choice_doinst(self):
"""View doinst.sh file
"""
if "doinst.sh" in self.sbo_files.split():
doinst_sh = ReadSBo(self.sbo_url).doinst("doinst.sh")
fill = self.fill_pager(doinst_sh)
self.pager(doinst_sh + fill)
def choice_download(self):
"""Download script.tar.gz and sources
"""
Download(path="", url=self.dwn_srcs, repo="sbo").start()
raise SystemExit()
def choice_build(self):
"""Build package
"""
self.build()
delete_folder(self.build_folder)
raise SystemExit()
def choice_install(self):
"""Download, build and install the package
"""
pkg_security([self.name])
if not find_package(self.prgnam, self.meta.pkg_path):
self.build()
self.install()
delete_folder(self.build_folder)
raise SystemExit()
else:
self.msg.template(78)
self.msg.pkg_found(self.prgnam)
self.msg.template(78)
raise SystemExit()
def choice_clear_screen(self):
"""Clear screen
"""
os.system("clear")
self.view()
def choice_quit(self):
"""Quit from choices
"""
raise SystemExit()
def view_sbo(self):
"""View slackbuild.org
"""
sbo_url = self.sbo_url.replace("/slackbuilds/", "/repository/")
br1, br2, fix_sp = "", "", " "
if self.meta.use_colors in ["off", "OFF"]:
br1 = "("
br2 = ")"
fix_sp = ""
print() # new line at start
self.msg.template(78)
print(f"| {' ' * 28}{self.grey}SlackBuilds Repository{self.endc}")
self.msg.template(78)
print(f"| {slack_ver()} > {sbo_url.split('/')[-3].title()} > {self.cyan}{self.name}{self.endc}")
self.msg.template(78)
print(f"| {self.green}Package url{self.endc}: {sbo_url}")
self.msg.template(78)
print(f"| {self.green}Description: {self.endc}{self.sbo_desc}")
print(f"| {self.green}SlackBuild: {self.endc}{self.sbo_dwn.split('/')[-1]}")
print(f"| {self.green}Sources: {self.endc}{', '.join([src.split('/')[-1] for src in self.source_dwn])}")
print(f"| {self.yellow}Requirements: {self.endc}{', '.join(self.sbo_req)}")
self.msg.template(78)
print(f"| {self.red}R{self.endc}{br2}EADME View the README file")
print(f"| {self.red}S{self.endc}{br2}lackBuild View the .SlackBuild file")
print(f"| In{br1}{self.red}f{self.endc}{br2}o{fix_sp} View the .info file")
if "doinst.sh" in self.sbo_files.split():
print(f"| D{br1}{self.red}o{self.endc}{br2}inst.sh{fix_sp} View the doinst.sh file")
print(f"| {self.red}D{self.endc}{br2}ownload Download this package")
print(f"| {self.red}B{self.endc}{br2}uild Download and build")
print(f"| {self.red}I{self.endc}{br2}nstall Download/Build/Install")
print(f"| {self.red}C{self.endc}{br2}lear Clear screen")
print(f"| {self.red}Q{self.endc}{br2}uit Quit")
self.msg.template(78)
def with_checklist(self):
"""Using dialog and checklist option
"""
data = []
if not self.name:
data = self.data
else:
for name in self.data:
if self.name in name:
data.append(name)
if data:
text = "Press 'spacebar' to choose SlackBuild for view"
title = " SlackBuilds.org "
backtitle = f"{_meta_.__all__} {_meta_.__version__}"
status = False
pkg = DialogUtil(data, text, title, backtitle, status).checklist()
if pkg and len(pkg) > 1:
os.system("clear")
raise SystemExit("\nslpkg: Error: Choose only one package\n")
if pkg is None:
raise SystemExit(1)
self.name = "".join(pkg)
os.system("clear")
def pager(self, text):
"""Read text
"""
pydoc.pager(text)
def fill_pager(self, page):
"""Fixes pager spaces
"""
tty_size = os.popen("stty size", "r").read().split()
rows = int(tty_size[0]) - 1
lines = sum(1 for line in page.splitlines())
diff = rows - lines
fill = "\n" * diff
if diff > 0:
return fill
else:
return ""
def error_uns(self):
"""Checks if the package supported by an arch
before proceeding to install
"""
self.FAULT = ""
UNST = ["UNSUPPORTED", "UNTESTED"]
if "".join(self.source_dwn) in UNST:
self.FAULT = "".join(self.source_dwn)
def build(self):
"""Builds slackware package
"""
pkg_security([self.name])
self.error_uns()
if self.FAULT:
print()
self.msg.template(78)
print(f"| Package {self.prgnam} {self.red} {self.FAULT} "
f"{self.endc}")
self.msg.template(78)
else:
sources = []
if not os.path.exists(self.meta.build_path):
os.makedirs(self.meta.build_path)
if not os.path.exists(self._SOURCES):
os.makedirs(self._SOURCES)
os.chdir(self.meta.build_path)
Download(self.meta.build_path, self.sbo_dwn.split(),
repo="sbo").start()
Download(self._SOURCES, self.source_dwn, repo="sbo").start()
script = self.sbo_dwn.split("/")[-1]
for src in self.source_dwn:
sources.append(src.split("/")[-1])
BuildPackage(script, sources, self.meta.build_path,
auto=False).build()
slack_package(self.prgnam) # check if build
def install(self):
"""Installs SBo package found in /tmp directory.
"""
binary = slack_package(self.prgnam)
print(f"[ {self.green}Installing{self.endc} ] --> {self.name}")
PackageManager(binary).upgrade(flag="--install-new")

View file

@ -1,202 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# queue.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from collections import OrderedDict
from slpkg.utils import Utils
from slpkg.downloader import Download
from slpkg.__metadata__ import MetaData as _meta_
from slpkg.pkg.find import find_package
from slpkg.pkg.build import BuildPackage
from slpkg.pkg.manager import PackageManager
from slpkg.sbo.greps import SBoGrep
from slpkg.sbo.compressed import SBoLink
from slpkg.sbo.search import sbo_search_pkg
from slpkg.sbo.slack_find import slack_package
class QueuePkgs(Utils):
"""Manages SBo packages, add or removes for building or
installation
"""
def __init__(self):
self.meta = _meta_
self.green = _meta_.color["GREEN"]
self.red = _meta_.color["RED"]
self.endc = _meta_.color["ENDC"]
self.queue = self.meta.lib_path + "queue/"
self.queue_list = self.queue + "queue_list"
self._SOURCES = self.meta.SBo_SOURCES
self.touch()
def touch(self):
"""Creating the directories and the queue file
"""
queue_file = [
"# In this file, you can create a list of\n",
"# packages you want to build or install.\n",
"#\n"]
if not os.path.exists(self.meta.lib_path):
os.mkdir(self.meta.lib_path)
if not os.path.exists(self.queue):
os.mkdir(self.queue)
if not os.path.isfile(self.queue_list):
with open(self.queue_list, "w") as queue:
for line in queue_file:
queue.write(line)
self.queued = self.read_file(self.queue_list)
def packages(self):
"""Returns queue list from /var/lib/queue/queue_list
file.
"""
for read in self.queued.splitlines():
read = read.lstrip()
if not read.startswith("#"):
yield read.replace("\n", "")
def listed(self):
"""Prints packages from queue
"""
print("Packages in the queue:")
for pkg in self.packages():
print(f"{self.green}{pkg}{self.endc}")
print()
def add(self, pkgs):
"""Adds packages in queue if not exist
"""
queue_list = list(self.packages())
pkgs = list(OrderedDict.fromkeys(pkgs))
print("Add packages in the queue:")
with open(self.queue_list, "a") as queue:
for pkg in pkgs:
find = sbo_search_pkg(pkg)
if pkg not in queue_list and find is not None:
print(f"{self.green}{pkg}{self.endc}")
queue.write(pkg + "\n")
else:
print(f"{self.red}{pkg}{self.endc}")
print()
def remove(self, pkgs):
"""Removes packages from the queue
"""
print("Remove packages from the queue:")
with open(self.queue_list, "w") as queue:
for line in self.queued.splitlines():
if line not in pkgs:
queue.write(line + "\n")
else:
print(f"{self.red}{line}{self.endc}")
print()
def build(self):
"""Builds packages from the queue
"""
sources = []
packages = list(self.packages())
if packages:
for pkg in packages:
if pkg not in SBoGrep(pkg).names():
raise SystemExit(f"\nPackage '{pkg}' was not found in "
f"the SBo repository\n")
if not os.path.exists(self.meta.build_path):
os.mkdir(self.meta.build_path)
if not os.path.exists(self._SOURCES):
os.mkdir(self._SOURCES)
sbo_url = sbo_search_pkg(pkg)
sbo_dwn = SBoLink(sbo_url).tar_gz()
source_dwn = SBoGrep(pkg).source().split()
os.chdir(self.meta.build_path)
script = sbo_dwn.split("/")[-1]
Download(self.meta.build_path, sbo_dwn.split(),
repo="sbo").start()
for src in source_dwn:
Download(self._SOURCES, src.split(), repo="sbo").start()
sources.append(src.split("/")[-1])
BuildPackage(script, sources, self.meta.build_path,
auto=False).build()
else:
raise SystemExit("\nPackages not found in the queue for "
"building\n")
def install(self):
"""Installs packages from the queue
"""
packages = list(self.packages())
if packages:
print() # new line at start
for pkg in packages:
ver = SBoGrep(pkg).version()
prgnam = f"{pkg}-{ver}"
if find_package(prgnam, self.meta.output):
binary = slack_package(prgnam)
PackageManager(binary).upgrade(flag="--install-new")
else:
print(f"\nPackage {prgnam} not found in the "
f"{self.meta.output} for installation\n")
else:
raise SystemExit("\nPackages not found in the queue for "
"installation\n")

View file

@ -1,52 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# read.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.url_read import URL
class ReadSBo:
"""Read SBo files from urls
"""
def __init__(self, sbo_url):
self.sbo_url = sbo_url
def readme(self, sbo_readme):
"""Read SlackBuild README file
"""
return URL(self.sbo_url + sbo_readme).get_request()
def info(self, name, sbo_file):
"""Read info file
"""
return URL(self.sbo_url + name + sbo_file).get_request()
def slackbuild(self, name, sbo_file):
"""Read SlackBuild file
"""
return URL(self.sbo_url + name + sbo_file).get_request()
def doinst(self, doinst_sh):
"""Read SlackBuild doinst.sh
"""
return URL(self.sbo_url + doinst_sh).get_request()

View file

@ -1,47 +0,0 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# sbo_arch.py file is part of slpkg.
# Copyright 2014-2022 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Slpkg is a user-friendly package manager for Slackware installations
# https://gitlab.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.__metadata__ import MetaData as _meta_
class SBoArch:
"""Manage computer architecture for sbo repository
"""
def __init__(self):
self.meta = _meta_
self.arch = self.meta.arch
# Architectures
self.x86 = "i586"
self.arm = "arm"
def get(self):
"""Return sbo arch
"""
if self.arch.startswith("i") and self.arch.endswith("86"):
self.arch = self.x86
elif self.meta.arch.startswith("arm"):
self.arch = self.arm
return self.arch

Some files were not shown because too many files have changed in this diff Show more