mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
updated for version 2.0.5
This commit is contained in:
parent
1551573cbb
commit
311f1a0a36
44 changed files with 1240 additions and 445 deletions
12
CHANGELOG
12
CHANGELOG
|
@ -1,3 +1,15 @@
|
|||
Version 2.0.5
|
||||
18-11-2014
|
||||
|
||||
[Feature] - Add /etc/slpkg.conf file.
|
||||
- Move "--current" switch in /etc/slpkg.conf file.
|
||||
- Add local PACKAGES.TXT for Slackware repository.
|
||||
- Add options to view package description.
|
||||
- Add all repositories in tracking dependencies options '-t'.
|
||||
- Add configuration file managment
|
||||
|
||||
[Updated] - Bugfix upgrading binary packages.
|
||||
|
||||
Version 2.0.4
|
||||
07-11-2014
|
||||
|
||||
|
|
2
PKG-INFO
2
PKG-INFO
|
@ -1,6 +1,6 @@
|
|||
Metadata-Version: 1.1
|
||||
Name: slpkg
|
||||
Version: 2.0.4
|
||||
Version: 2.0.5
|
||||
Author: dslackw
|
||||
Author-email: d zlatanidis at gmail com
|
||||
Maintainer: dslackw
|
||||
|
|
79
README.rst
79
README.rst
|
@ -11,9 +11,9 @@
|
|||
|
||||
Latest Release:
|
||||
|
||||
- Version: 2.0.4
|
||||
- Version: 2.0.5
|
||||
- `Package <https://sourceforge.net/projects/slpkg/files/slpkg/binary/>`_
|
||||
- `Source <https://github.com/dslackw/slpkg/archive/v2.0.4.tar.gz>`_
|
||||
- `Source <https://github.com/dslackw/slpkg/archive/v2.0.5.tar.gz>`_
|
||||
- `CHANGELOG <https://github.com/dslackw/slpkg/blob/master/CHANGELOG>`_
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png
|
||||
|
@ -102,8 +102,8 @@ Untar the archive and run install.sh script:
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
$ tar xvf slpkg-2.0.4.tar.gz
|
||||
$ cd slpkg-2.0.4
|
||||
$ tar xvf slpkg-2.0.5.tar.gz
|
||||
$ cd slpkg-2.0.5
|
||||
$ ./install.sh
|
||||
|
||||
Using `pip <https://pip.pypa.io/en/latest/>`_ :
|
||||
|
@ -120,6 +120,11 @@ Using Slackware command:
|
|||
|
||||
Download binary package from `SourceForge <https://sourceforge.net/projects/slpkg/>`_
|
||||
|
||||
Slackware Current
|
||||
-----------------
|
||||
|
||||
For Slackware 'current' users must change the variable VERSION in /etc/slpkg.conf file.
|
||||
|
||||
Command Line Tool Usage
|
||||
-----------------------
|
||||
|
||||
|
@ -130,30 +135,26 @@ Command Line Tool Usage
|
|||
Optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-v, --version print version and exit
|
||||
-a, script [source...] auto build packages
|
||||
-a, script.tar.gz [source...] auto build SBo packages
|
||||
-b, --list, [package...] --add, --remove add, remove packages in blacklist
|
||||
-q, --list, [package...] --add, --remove add, remove packages in queue
|
||||
--build, --install, --build-install build or install from queue
|
||||
-l, <repository>, all, noarch list of installed packages
|
||||
-c, <repository> --upgrade --current check for updated packages
|
||||
-s, <repository> <package> --current download, build & install
|
||||
-f, <package> find installed packages
|
||||
-t, <package> tracking dependencies from SBo
|
||||
-n, <package> view packages from SBo
|
||||
-q, --list, [package...] --add, --remove add, remove SBo packages in queue
|
||||
--build, --install, --build-install build or install packages from queue
|
||||
-g, --config, --config=[editor] configuration file management
|
||||
-l, [repository], all, noarch list of installed packages
|
||||
-c, [repository] --upgrade check for updated packages
|
||||
-s, [repository] [package] download, build & install
|
||||
-t, [repository] [package] tracking dependencies
|
||||
-p, [repository] [package] --color=[] print package description
|
||||
-f, [package] find installed packages
|
||||
-n, [package] view packages from SBo
|
||||
-i, [package...] install binary packages
|
||||
-u, [package...] upgrade binary packages
|
||||
-o, [package...] reinstall binary packages
|
||||
-r, [package...] remove binary packages
|
||||
-d, [package...] display the contents
|
||||
|
||||
Note: '-q' options is working only for SBo repository
|
||||
|
||||
Repositories:
|
||||
Slackware = slack '--current'
|
||||
Alien = alien '--current'
|
||||
SlackBuilds = sbo
|
||||
Slacky = slacky
|
||||
Robby's = rlw
|
||||
|
||||
Repositories: <slack, sbo, alien, slacky, rlw>
|
||||
Colors = [red, green, yellow, cyan, grey]
|
||||
|
||||
Slpkg Examples
|
||||
--------------
|
||||
|
@ -210,12 +211,11 @@ build and install with all dependencies :
|
|||
0 installed package and 4 uninstalled packages.
|
||||
|
||||
|
||||
Find packages from `Slackware official mirrors <http://mirrors.slackware.com/>`_
|
||||
download and install (use '--current' to switch in current repository):
|
||||
Install packages from `Slackware official mirrors <http://mirrors.slackware.com/>`_ :
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ slpkg -s slack mozilla (add '--current' to switch in current version)
|
||||
$ slpkg -s slack mozilla
|
||||
|
||||
Packages with name matching [ mozilla ]
|
||||
Reading package lists ..............................Done
|
||||
|
@ -242,7 +242,7 @@ and also displays installed packages:
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
$ slpkg -t brasero
|
||||
$ slpkg -t sbo brasero
|
||||
Reading package lists ......Done
|
||||
|
||||
+=========================
|
||||
|
@ -261,7 +261,7 @@ and also displays installed packages:
|
|||
|
|
||||
+--5 libunique
|
||||
|
||||
Check if your packages is up to date from slackbuilds.org:
|
||||
Check if your packages is up to date:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
@ -290,11 +290,11 @@ Check if your packages is up to date from slackbuilds.org:
|
|||
Would you like to upgrade [Y/n]?
|
||||
|
||||
Check if your distribution is up to date from `Slackware official mirrors
|
||||
<http://mirrors.slackware.com/>`_ (use '--current' to switch in current repository):
|
||||
<http://mirrors.slackware.com/>`_ :
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ slpkg -c slack --upgrade (add '--current' to switch in current version)
|
||||
$ slpkg -c slack --upgrade
|
||||
Reading package lists .......Done
|
||||
|
||||
These packages need upgrading:
|
||||
|
@ -553,7 +553,7 @@ Remove packages:
|
|||
+==============================================================================
|
||||
|
||||
Remove packages with all dependencies:
|
||||
(presupposes facility with the option 'slpkg -s sbo <package>)
|
||||
(presupposes facility with the option 'slpkg -s <repository> <package>)
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
@ -652,6 +652,25 @@ Add packages in blacklist file manually from
|
|||
live555
|
||||
faac
|
||||
|
||||
|
||||
Print package description:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ slpkg -p alien vlc
|
||||
|
||||
vlc (multimedia player for various audio and video formats)
|
||||
|
||||
VLC media player is a highly portable multimedia player for various
|
||||
audio and video formats (MPEG-1, MPEG-2, MPEG-4, DivX, mp3, ogg, ...)
|
||||
as well as DVDs, VCDs, and various streaming protocols.
|
||||
It can also be used as a server to stream in unicast or multicast in
|
||||
IPv4 or IPv6 on a high-bandwidth network.
|
||||
|
||||
|
||||
vlc home: http://www.videolan.org/vlc/
|
||||
|
||||
|
||||
Man page it is available for full support:
|
||||
|
||||
.. code-block:: bash
|
||||
|
|
15
TESTING
Normal file
15
TESTING
Normal file
|
@ -0,0 +1,15 @@
|
|||
Slpkg testing log:
|
||||
|
||||
The majority of trials have been made in an environment Slackware x86_64 and x86 stable version
|
||||
14.1.
|
||||
Is logical tests are always to be latest versions of the distribution.
|
||||
Slpkg are supported version 'current' but it is minimal tests have been done on this release.
|
||||
|
||||
|
||||
TEST:
|
||||
|
||||
Distribution : Slackware Linux
|
||||
Release : 14.1
|
||||
Version : stable
|
||||
Arch : x86, x86_64
|
||||
|
48
conf/slpkg.conf
Normal file
48
conf/slpkg.conf
Normal file
|
@ -0,0 +1,48 @@
|
|||
# Configuration file for slpkg
|
||||
|
||||
# slpkg.conf file is part of slpkg.
|
||||
|
||||
# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
||||
# All rights reserved.
|
||||
|
||||
# Utility for easy management packages in Slackware
|
||||
|
||||
# https://github.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/>.
|
||||
|
||||
# Slackware version 'stable' or 'current'.
|
||||
VERSION=stable
|
||||
|
||||
# Build directory for repository slackbuilds.org. In this directory
|
||||
# downloaded sources and scripts for building.
|
||||
BUILD=/tmp/slpkg/build/
|
||||
|
||||
# If SBO_CHECK_MD5 is 'on' the system will check all downloaded
|
||||
# sources from SBo repository.
|
||||
SBO_CHECK_MD5=on
|
||||
|
||||
# Download directory for others repositories that use binaries files
|
||||
# for installation.
|
||||
PACKAGES=/tmp/slpkg/packages/
|
||||
|
||||
# Download directory for Slackware patches file.
|
||||
PATCHES=/tmp/slpkg/patches/
|
||||
|
||||
# Delete all downloaded files if DEL_ALL is 'on'.
|
||||
DEL_ALL=on
|
||||
|
||||
# Delete build directory after each process if DEL_BUILD is 'on'.
|
||||
DEL_BUILD=off
|
||||
|
||||
# Keep build log file if SBO_BUILD_LOG is 'on'.
|
||||
SBO_BUILD_LOG=on
|
|
@ -21,7 +21,7 @@
|
|||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
PRGNAM=slpkg
|
||||
VERSION=${VERSION:-2.0.4}
|
||||
VERSION=${VERSION:-2.0.5}
|
||||
TAG=${TAG:-_dsw}
|
||||
|
||||
cd ..
|
||||
|
|
156
man/slpkg.8
156
man/slpkg.8
|
@ -15,14 +15,17 @@
|
|||
.SH NAME
|
||||
slpkg - Utility for easy management packages in Slackware
|
||||
.SH SYNOPSIS
|
||||
\fBUsage: slpkg [-h] [-v] [-a script [sources...]]
|
||||
\fBUsage: slpkg [-h] [-v] [-a script.tar.gz [sources...]]
|
||||
[-b --list, --add, --remove [...]]
|
||||
[-q --list, [...] --add, --remove]
|
||||
[-q --build, --install, --build-install]
|
||||
[-l all, sbo, slack, noarch]
|
||||
[-c <repository> --upgrade --current]
|
||||
[-s <repository> <package> --current]
|
||||
[-f] [-t] [-n] [-i [...]] [-u [...]]
|
||||
[ --build, --install, --build-install]
|
||||
[-g --config, --config=[editor]]
|
||||
[-l [repository], all, noarch]
|
||||
[-c [repository] --upgrade]
|
||||
[-s [repository] [package][
|
||||
[-t [repository] [package]]
|
||||
[-p [repository] [package] --color=]
|
||||
[-f] [-n] [-i [...]] [-u [...]]
|
||||
[-o [...]] [-r [...]] [-d [...]]\fp
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
@ -30,35 +33,32 @@ slpkg - Utility for easy management packages in Slackware
|
|||
.PP
|
||||
It's a quick and easy way to manage your packages in slackware to a command.
|
||||
.SH EXAMPLES
|
||||
\fBUtility for easy management packages in Slackware
|
||||
\fB
|
||||
Utility for easy management packages in Slackware
|
||||
|
||||
Optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-v, --version print version and exit
|
||||
-a, script [source...] auto build packages
|
||||
-b, --list, [package...] --add, --remove add, remove packages in blacklist
|
||||
-q, --list, [package...] --add, --remove add, remove packages in queue
|
||||
--build, --install, --build-install build or install from queue
|
||||
-l, <repository>, all, noarch list of installed packages
|
||||
-c, <repository> --upgrade --current check for updated packages
|
||||
-s, <repository> <package> --current download, build & install
|
||||
-f, <package> find installed packages
|
||||
-t, <package> tracking dependencies from SBo
|
||||
-n, <package> view packages from SBo
|
||||
-i, [package...] install binary packages
|
||||
-u, [package...] upgrade binary packages
|
||||
-o, [package...] reinstall binary packages
|
||||
-r, [package...] remove binary packages
|
||||
-d, [package...] display the contents
|
||||
Optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-v, --version print version and exit
|
||||
-a, script.tar.gz [source...] auto build SBo packages
|
||||
-b, --list, [package...] --add, --remove add, remove packages in blacklist
|
||||
-q, --list, [package...] --add, --remove add, remove SBo packages in queue
|
||||
--build, --install, --build-install build or install packages from queue
|
||||
-g, --config, --config=<editor> configuration file management
|
||||
-l, [repository], all, noarch list of installed packages
|
||||
-c, [repository] --upgrade check for updated packages
|
||||
-s, [repository] [package] download, build & install
|
||||
-t, [repository] [package] tracking dependencies
|
||||
-p, [repository] [package] --color=[] print package description
|
||||
-f, [package] find installed packages
|
||||
-n, [package] view packages from SBo
|
||||
-i, [package...] install binary packages
|
||||
-u, [package...] upgrade binary packages
|
||||
-o, [package...] reinstall binary packages
|
||||
-r, [package...] remove binary packages
|
||||
-d, [package...] display the contents
|
||||
|
||||
Note: '-q' options is working only for SBo repository
|
||||
|
||||
Repositories:
|
||||
Slackware = slack '--current'
|
||||
Alien = alien '--current'
|
||||
SlackBuilds = sbo
|
||||
Slacky = slacky
|
||||
Robby's = rlw\fP
|
||||
Repositories: <slack, sbo, alien, slacky, rlw>
|
||||
Colors = [red, green, yellow, cyan, grey]\fP
|
||||
|
||||
.SH GLOBAL OPTIONS
|
||||
.TP
|
||||
|
@ -67,59 +67,77 @@ Print the version of program and exit.
|
|||
.SH COMMANDS
|
||||
.PP
|
||||
The following commands are available.
|
||||
.SS -a script source extra
|
||||
|
||||
.SS -a, auto build packages
|
||||
\fBslpkg\fP \fB-a\fP <\fIscript\fP> <\fIsources\fP>
|
||||
.PP
|
||||
With this argument, build slackware package from source quickly and easy.
|
||||
.SS -b , --list <packages> -- add --remove
|
||||
|
||||
.SS -b , add, remove, view packages in blacklist
|
||||
\fBslpkg\fP \fB-b\fP \fB--list\fP <\fIpackages\fP> \fB--add\fP \fB--remove\fP
|
||||
.PP
|
||||
List, add or remove packages from blacklist file. The settings here affect
|
||||
all repositories.
|
||||
.SS -q , --list <packages> --add, --remove, --build, --install, --build-install
|
||||
|
||||
.SS -q , add, remove, view packages in queue
|
||||
\fBslpkg\fP \fB-q\fP \fB--list\fP <\fIpackages\fP> \fB--add\fP \fB--remove\fP
|
||||
.TP
|
||||
\fBslpkg\fP \fB-q\fP \fB--build\fP \fB--install\fP \fB--build-install\fP
|
||||
.PP
|
||||
List, add, or remove sbo packages from queue. If you want to remove all the packages
|
||||
from the list 'slpkg -q all --remove'. (these arguments only working for the sbo repository)
|
||||
.PP
|
||||
\fBslpkg\fP \fB-q\fP \fB--build\fP \fB--install\fP \fB--build-install\fP
|
||||
.PP
|
||||
Build or install or build and install packages are queued.
|
||||
.SS -l all, sbo, slack, noarch
|
||||
\fBslpkg\fP \fB-l\fP \fIall\fP \fIsbo\fP \fIslack\fP \fInoarch\fP
|
||||
|
||||
.SS -g , configuration file management
|
||||
\fBslpkg\fP \fB--config\fP \fB--config=[editor]\fP
|
||||
.PP
|
||||
Four display options list, sbo, slack, noarch and all packages
|
||||
items that are installed on the system.
|
||||
.SS -c , <repository> check if your packages is up to date
|
||||
\fBslpkg\fP \fB-c\fP <\fIrepository\fP> \fI--upgrade\fP \fB--current\fP
|
||||
Print configuration file or edit with editor.
|
||||
|
||||
.SS -l , list of installed packages per repository
|
||||
\fBslpkg\fP \fB-l\fP <\fIrepository\fP> \fIall\fP \fInoarch\fP
|
||||
.PP
|
||||
Check your packages from Slackware official mirrors or from
|
||||
slackbuilds.org is up to date. Use '--current' to switch in current repository.
|
||||
.SS -s , <repository> download, build and install package with all dependencies
|
||||
\fBslpkg\fP \fB-s\fP <\fIrepository\fP> <\fIname of package\fP> \fB--current\fP
|
||||
List of installed packages per repository or all.
|
||||
|
||||
.SS -c , check if your packages is up to date
|
||||
\fBslpkg\fP \fB-c\fP <\fIrepository\fP> \fI--upgrade\f
|
||||
.PP
|
||||
Installs or upgrade packages from the repository slackbuilds.org automatically resolving all
|
||||
Check your packages is up to date.
|
||||
|
||||
.SS -s , download, build and install package with all dependencies
|
||||
\fBslpkg\fP \fB-s\fP <\fIrepository\fP> <\fIname of package\fP>
|
||||
.PP
|
||||
Installs or upgrade packages from the repositories with automatically resolving all
|
||||
dependencies of the package. Also installs the official distribution Slackware
|
||||
packages. Use '--current' to install packages from Slackware current repository.
|
||||
packages.
|
||||
|
||||
.SS -t , tracking dependencies
|
||||
\fBslpkg\fP \fB-t\fP <\fIrepository\fP> <\fIname of package\fP>
|
||||
.PP
|
||||
Tracking all dependencies of that package.
|
||||
The sequence shown is that you must follow to correctly install package.
|
||||
|
||||
.SS -p , print packages description
|
||||
\fBslpkg\fP \fB-p\fP <\fIrepository\fP> <\fIname of package\fP>
|
||||
.PP
|
||||
Print package description
|
||||
|
||||
.SS -f find packages
|
||||
\fBslpkg\fP \fB-f\fP <\fIname of package\fP>
|
||||
.PP
|
||||
Find installed packages with view total file size.
|
||||
.SS -t , tracking dependencies
|
||||
\fBslpkg\fP \fB-t\fP <\fIname of package\fP>
|
||||
.PP
|
||||
Tracking all dependencies of that package.
|
||||
The sequence shown is that you must follow to correctly install package.
|
||||
|
||||
.SS -n , find packages from SBo repositority
|
||||
\fBslpkg\fP \fB-n\fP <\fIname of package\fP>
|
||||
.PP
|
||||
With this method you can find the SBo script that interests you through
|
||||
the network. (www.slackbuilds.org)
|
||||
|
||||
.SS -i , install binary packages
|
||||
\fBslpkg\fP \fB-i\fP <\fIpackages.t?z\fP>
|
||||
.PP
|
||||
Installs single binary packages designed for use with the
|
||||
Slackware Linux distribution into your system.
|
||||
|
||||
.SS -u , install-upgrade packages with new
|
||||
\fBslpkg\fP \fB-u\fP <\fIpackages.t?z\fP>
|
||||
.PP
|
||||
|
@ -127,6 +145,7 @@ 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. 'Requires root privileges'
|
||||
(like slackware command upgradepkg --install-new)
|
||||
|
||||
.SS -o , reinstall binary packages
|
||||
\fBslpkg\fP \fB-o\fP <\fIpackages.t?z\fP>
|
||||
.PP
|
||||
|
@ -134,6 +153,7 @@ Upgradepkg usually skips packages if the exact same package
|
|||
(matching name, version, arch, and build number) is already
|
||||
installed on the system.'Requires root privileges' (like
|
||||
slackware command upgradepkg --reinstall)
|
||||
|
||||
.SS -r , remove packages
|
||||
\fBslpkg\fP \fB-r\fP <\fIname of packages\fP>
|
||||
.PP
|
||||
|
@ -145,16 +165,37 @@ packages with command 'slpkg -s sbo <package>' then write a file
|
|||
in /var/log/slpkg/dep/ with all dependencies and it allows you
|
||||
can remove them all together. 'Requires root
|
||||
privileges' (like slackware command removepkg)
|
||||
|
||||
.SS -d , display contents
|
||||
\fBslpkg\fP \fB-d\fP <\fIname of packages\fP>
|
||||
.PP
|
||||
Display the contents of the package 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 FILES
|
||||
|
||||
/etc/slpkg/slpkg.conf
|
||||
General configuration of slpkg
|
||||
|
||||
/etc/slpkg/blacklist
|
||||
List of packages to skip
|
||||
|
||||
/var/log/slpkg
|
||||
ChangeLog.txt repositories files
|
||||
SlackBuilds logs and dependencies files
|
||||
|
||||
/var/lib/slpkg
|
||||
PACKAGES.TXT files and SLACKBUILDS.TXT file
|
||||
|
||||
/tmp/slpkg
|
||||
Slpkg temponary donwloaded files and build packages
|
||||
|
||||
.SH AUTHOR
|
||||
Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
||||
.SH HOMEPAGE
|
||||
|
@ -163,4 +204,5 @@ https://github.com/dslackw/slpkg
|
|||
Copyright \(co 2014 Dimitris Zlatanidis
|
||||
|
||||
.SH SEE ALSO
|
||||
installpkg(8), upgradepkg(8), removepkg(8), pkgtool(8), slackpkg(8)
|
||||
installpkg(8), upgradepkg(8), removepkg(8), pkgtool(8), slackpkg(8), explodepkg(8),
|
||||
makepkg(8).
|
||||
|
|
10
setup.py
10
setup.py
|
@ -79,9 +79,17 @@ if "install" in sys.argv:
|
|||
f_in.close()
|
||||
shutil.copy2(gzip_man, man_path)
|
||||
os.chmod(man_path, int("444", 8))
|
||||
|
||||
conf_path = "/etc/slpkg/"
|
||||
conf_file = "conf/slpkg.conf"
|
||||
black_file = "conf/blacklist"
|
||||
if not os.path.exists(conf_path):
|
||||
os.system("mkdir -p {0}".format(conf_path))
|
||||
# slpkg.conf file
|
||||
if not os.isfile(conf_path + conf_file):
|
||||
print("Installing slpkg configuration file")
|
||||
shutil.copy2(conf_file, conf_path)
|
||||
# blacklist file
|
||||
if not os.isfile(conf_path + black_file):
|
||||
print("Installing blacklist configuration file")
|
||||
black_file = "conf/blacklist"
|
||||
shutil.copy2(black_file, conf_path)
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
config() {
|
||||
NEW="$1"
|
||||
OLD="$(dirname $NEW)/$(basename $NEW .new)"
|
||||
if [ ! -r $OLD ]; then
|
||||
mv $NEW $OLD
|
||||
elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
|
||||
rm $NEW
|
||||
fi
|
||||
}
|
||||
|
||||
config /etc/slpkg/slpkg.conf.new
|
||||
|
||||
if [ -x /usr/bin/update-desktop-database ]; then
|
||||
/usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
|
||||
fi
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
PRGNAM=slpkg
|
||||
VERSION=${VERSION:-2.0.4}
|
||||
VERSION=${VERSION:-2.0.5}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_dsw}
|
||||
|
||||
|
@ -69,7 +69,7 @@ find -L . \
|
|||
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
||||
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
||||
|
||||
# avoid install man page and blacklist over setup.py
|
||||
# avoid install man page and slpkg.conf, blacklist over setup.py
|
||||
sed -i 's/if "install"/if ""/' setup.py
|
||||
|
||||
python setup.py install --root=$PKG
|
||||
|
@ -77,19 +77,24 @@ python setup.py install --root=$PKG
|
|||
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
|
||||
|
||||
mkdir -p $PKG/etc/slpkg
|
||||
# check if blacklist file if already exist in /etc/slpkg
|
||||
if [ ! -f "/etc/$PRGNAM/blacklist" ]; then
|
||||
mkdir -p $PKG/etc/$PRGNAM
|
||||
install -D -m0644 conf/blacklist $PKG/etc/$PRGNAM/blacklist
|
||||
fi
|
||||
|
||||
# install configuration file
|
||||
mkdir -p $PKG/etc/slpkg
|
||||
install -D -m0644 conf/slpkg.conf $PKG/etc/slpkg/slpkg.conf.new
|
||||
|
||||
# install man page
|
||||
mkdir -p $PKG/usr/man/man8
|
||||
gzip -9 man/$PRGNAM.8
|
||||
install -D -m0644 man/$PRGNAM.8.gz $PKG/usr/man/man8/$PRGNAM.8.gz
|
||||
|
||||
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cp -a README.rst CHANGELOG LICENSE CONTRIBUTING ISSUES $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cp -a README.rst CHANGELOG LICENSE TESTING ISSUES $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
||||
|
||||
mkdir -p $PKG/install
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
PRGNAM="slpkg"
|
||||
VERSION="2.0.4"
|
||||
VERSION="2.0.5"
|
||||
HOMEPAGE="https://github.com/dslackw/slpkg"
|
||||
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v2.0.4.tar.gz"
|
||||
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v2.0.5.tar.gz"
|
||||
MD5SUM=""
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
|
|
|
@ -22,38 +22,93 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import getpass
|
||||
|
||||
from config import config_file
|
||||
from messages import s_user
|
||||
|
||||
__all__ = "slpkg"
|
||||
__author__ = "dslackw"
|
||||
__version_info__ = (2, 0, 4)
|
||||
__version_info__ = (2, 0, 5)
|
||||
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
||||
__license__ = "GNU General Public License v3 (GPLv3)"
|
||||
__email__ = "d.zlatanidis@gmail.com"
|
||||
|
||||
''' file spacer '''
|
||||
s_user(getpass.getuser())
|
||||
|
||||
# temponary path
|
||||
tmp = "/tmp/"
|
||||
|
||||
if not os.path.exists("/etc/slpkg/"):
|
||||
os.mkdir("/etc/slpkg/")
|
||||
|
||||
if not os.path.isfile("/etc/slpkg/slpkg.conf"):
|
||||
with open("/etc/slpkg/slpkg.conf", "w") as conf:
|
||||
for line in config_file():
|
||||
conf.write(line)
|
||||
conf.close()
|
||||
|
||||
f = open("/etc/slpkg/slpkg.conf", "r")
|
||||
conf = f.read()
|
||||
f.close()
|
||||
|
||||
# Default configuration values
|
||||
slack_rel = "stable"
|
||||
build_path = "/tmp/slpkg/build/"
|
||||
slpkg_tmp_packages = tmp + "slpkg/packages/"
|
||||
slpkg_tmp_patches = tmp + "slpkg/patches/"
|
||||
del_all = "on"
|
||||
sbo_check_md5 = "on"
|
||||
del_build = "off"
|
||||
sbo_build_log = "on"
|
||||
|
||||
for line in conf.splitlines():
|
||||
line = line.lstrip()
|
||||
if line.startswith("VERSION"):
|
||||
slack_rel = line[8:].strip()
|
||||
if not slack_rel:
|
||||
slack_rel = "stable"
|
||||
if line.startswith("BUILD"):
|
||||
build_path = line[6:].strip()
|
||||
if line.startswith("PACKAGES"):
|
||||
slpkg_tmp_packages = line[9:].strip()
|
||||
if line.startswith("PATCHES"):
|
||||
slpkg_tmp_patches = line[8:].strip()
|
||||
if line.startswith("DEL_ALL"):
|
||||
del_all = line[8:].strip()
|
||||
if line.startswith("DEL_BUILD"):
|
||||
del_build = line[10:].strip()
|
||||
if line.startswith("SBO_CHECK_MD5"):
|
||||
sbo_check_md5 = line[14:].strip()
|
||||
if line.startswith("SBO_BUILD_LOG"):
|
||||
sbo_build_log = line[14:].strip()
|
||||
|
||||
# repositories
|
||||
repositories = [
|
||||
"sbo",
|
||||
"slack",
|
||||
"rlw",
|
||||
"alien",
|
||||
"slacky"
|
||||
]
|
||||
|
||||
# file spacer
|
||||
sp = "-"
|
||||
|
||||
''' current path '''
|
||||
# current path
|
||||
path = os.getcwd() + "/"
|
||||
|
||||
''' build path '''
|
||||
build_path = path + "slpkg_Build/"
|
||||
|
||||
''' library path '''
|
||||
# library path
|
||||
lib_path = "/var/lib/slpkg/"
|
||||
|
||||
''' log path '''
|
||||
# log path
|
||||
log_path = "/var/log/slpkg/"
|
||||
|
||||
''' temponary path '''
|
||||
tmp = "/tmp/"
|
||||
slpkg_tmp = tmp + "slpkg/"
|
||||
|
||||
''' packages log files path '''
|
||||
# packages log files path
|
||||
pkg_path = "/var/log/packages/"
|
||||
|
||||
''' blacklist conf path '''
|
||||
# blacklist conf path
|
||||
bls_path = "/etc/slpkg/"
|
||||
|
||||
''' computer architecture '''
|
||||
# computer architecture
|
||||
arch = os.uname()[4]
|
||||
|
|
|
@ -27,40 +27,37 @@ from __metadata__ import __version__
|
|||
|
||||
def options():
|
||||
arguments = [
|
||||
"slpkg - version {0}\n".format(__version__),
|
||||
"\nslpkg - version {0}\n".format(__version__),
|
||||
"Utility for easy management packages in Slackware\n",
|
||||
"Optional arguments:",
|
||||
" -h, --help show this help message " +
|
||||
"and exit",
|
||||
" -v, --version print version and exit",
|
||||
" -a, script [source...] auto build packages",
|
||||
" -a, script.tar.gz [source...] auto build SBo packages",
|
||||
" -b, --list, [package...] --add, --remove add, remove packages in " +
|
||||
"blacklist",
|
||||
" -q, --list, [package...] --add, --remove add, remove packages in " +
|
||||
"queue",
|
||||
" --build, --install, --build-install build or install from " +
|
||||
"queue",
|
||||
" -l, <repository>, all, noarch list of installed " +
|
||||
" -q, --list, [package...] --add, --remove add, remove SBo packages "
|
||||
"in queue",
|
||||
" --build, --install, --build-install build or install packages "
|
||||
"from queue",
|
||||
" -g, --config, --config=[editor] configuration file " +
|
||||
"management",
|
||||
" -l, [repository], all, noarch list of installed " +
|
||||
"packages",
|
||||
" -c, <repository> --upgrade --current check for updated " +
|
||||
" -c, [repository] --upgrade check for updated " +
|
||||
"packages",
|
||||
" -s, <repository> <package> --current download, build & install",
|
||||
" -f, <package> find installed packages",
|
||||
" -t, <package> tracking dependencies " +
|
||||
"from SBo",
|
||||
" -n, <package> view packages from SBo",
|
||||
" -s, [repository] [package] download, build & install",
|
||||
" -t, [repository] [package] tracking dependencies",
|
||||
" -p, [repository] [package] --color=[] print package description",
|
||||
" -f, [package] find installed packages",
|
||||
" -n, [package] view packages from SBo",
|
||||
" -i, [package...] install binary packages",
|
||||
" -u, [package...] upgrade binary packages",
|
||||
" -o, [package...] reinstall binary packages",
|
||||
" -r, [package...] remove binary packages",
|
||||
" -d, [package...] display the contents\n",
|
||||
"Note: '-q' options is working only for SBo repository\n",
|
||||
"Repositories:",
|
||||
" Slackware = slack '--current'",
|
||||
" Alien = alien '--current'",
|
||||
" SlackBuilds = sbo",
|
||||
" Slacky = slacky",
|
||||
" Robby's = rlw\n"
|
||||
"Repositories: <slack, sbo, alien, slacky, rlw>",
|
||||
"Colors = [red, green, yellow, cyan, grey]\n",
|
||||
]
|
||||
for opt in arguments:
|
||||
print(opt)
|
||||
|
@ -69,14 +66,17 @@ def options():
|
|||
def usage():
|
||||
view = [
|
||||
"slpkg - version {0}\n".format(__version__),
|
||||
"Usage: slpkg [-h] [-v] [-a script [sources...]]",
|
||||
"Usage: slpkg [-h] [-v] [-a script.tar.gz [sources...]]",
|
||||
" [-b --list, [...] --add, --remove]",
|
||||
" [-q --list, [...] --add, --remove]",
|
||||
" [-q --build, --install, --build-install]",
|
||||
" [-l all, sbo, slack, noarch]",
|
||||
" [-c <repository> --upgrade --current]",
|
||||
" [-s <repository> <package> --current]",
|
||||
" [-f] [-t] [-n] [-i [...]] [-u [...]]",
|
||||
" [ --build, --install, --build-install]",
|
||||
" [-g --config, --config=[editor]]",
|
||||
" [-l [repository], all, noarch]",
|
||||
" [-c [repository] --upgrade]",
|
||||
" [-s [repository] [package]",
|
||||
" [-t [repository] [package]",
|
||||
" [-p [repository] [package] --color=[]]",
|
||||
" [-f] [-n] [-i [...]] [-u [...]]",
|
||||
" [-o [...]] [-r [...]] [-d [...]]\n",
|
||||
"For more information try 'slpkg --help'\n"
|
||||
]
|
||||
|
|
|
@ -24,7 +24,11 @@
|
|||
import os
|
||||
|
||||
from __metadata__ import bls_path
|
||||
from colors import RED, GREEN, ENDC
|
||||
from colors import (
|
||||
RED,
|
||||
GREEN,
|
||||
ENDC
|
||||
)
|
||||
|
||||
|
||||
class BlackList(object):
|
||||
|
@ -109,7 +113,7 @@ class BlackList(object):
|
|||
print("{0}{1}{2}".format(GREEN, black, ENDC))
|
||||
self.quit = True
|
||||
if self.quit:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
|
||||
def add(self, pkgs):
|
||||
'''
|
||||
|
@ -126,7 +130,7 @@ class BlackList(object):
|
|||
self.quit = True
|
||||
black_conf.close()
|
||||
if self.quit:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
|
||||
def remove(self, pkgs):
|
||||
'''
|
||||
|
@ -142,4 +146,4 @@ class BlackList(object):
|
|||
self.quit = True
|
||||
remove.close()
|
||||
if self.quit:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
|
|
133
slpkg/config.py
Executable file
133
slpkg/config.py
Executable file
|
@ -0,0 +1,133 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# config.py file is part of slpkg.
|
||||
|
||||
# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
||||
# All rights reserved.
|
||||
|
||||
# Utility for easy management packages in Slackware
|
||||
|
||||
# https://github.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
|
||||
|
||||
from colors import (
|
||||
CYAN,
|
||||
ENDC
|
||||
)
|
||||
|
||||
|
||||
def config_file():
|
||||
slpkg_conf = [
|
||||
"# Configuration file for slpkg\n",
|
||||
"\n",
|
||||
"# slpkg.conf file is part of slpkg.\n",
|
||||
"\n",
|
||||
"# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>\n",
|
||||
"# All rights reserved.\n",
|
||||
"\n",
|
||||
"# Utility for easy management packages in Slackware\n",
|
||||
"\n",
|
||||
"# https://github.com/dslackw/slpkg\n",
|
||||
"\n",
|
||||
"# Slpkg is free software: you can redistribute it and/or modify\n",
|
||||
"# it under the terms of the GNU General Public License as published " +
|
||||
"by\n",
|
||||
"# the Free Software Foundation, either version 3 of the License, or\n",
|
||||
"# (at your option) any later version.\n",
|
||||
"# This program is distributed in the hope that it will be useful,\n",
|
||||
"# but WITHOUT ANY WARRANTY; without even the implied warranty of\n",
|
||||
"# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n",
|
||||
"# GNU General Public License for more details.\n",
|
||||
"# You should have received a copy of the GNU General Public License\n",
|
||||
"# along with this program. If not, see <http://www.gnu.org/licenses/" +
|
||||
">.\n",
|
||||
"\n",
|
||||
"# Slackware version 'stable' or 'current'.\n",
|
||||
"VERSION=stable\n",
|
||||
"\n",
|
||||
"# Build directory for repository slackbuilds.org. In this directory\n",
|
||||
"# downloaded sources and scripts for building.\n",
|
||||
"BUILD=/tmp/slpkg/build/\n",
|
||||
"\n",
|
||||
"# If SBO_CHECK_MD5 is 'on' the system will check all downloaded\n",
|
||||
"# sources from SBo repository.\n",
|
||||
"SBO_CHECK_MD5=on\n",
|
||||
"\n",
|
||||
"# Download directory for others repositories that use binaries files" +
|
||||
"\n",
|
||||
"# for installation.\n",
|
||||
"PACKAGES=/tmp/slpkg/packages/\n",
|
||||
"\n",
|
||||
"# Download directory for Slackware patches file.\n",
|
||||
"PATCHES=/tmp/slpkg/patches/\n",
|
||||
"\n",
|
||||
"# Delete all downloaded files if DEL_ALL is 'on'.\n",
|
||||
"DEL_ALL=on\n",
|
||||
"\n",
|
||||
"# Delete build directory after each process if DEL_BUILD is 'on'.\n",
|
||||
"DEL_BUILD=off\n",
|
||||
"\n",
|
||||
"# Keep build log file if SBO_BUILD_LOG is 'on'.\n",
|
||||
"SBO_BUILD_LOG=on\n"
|
||||
]
|
||||
|
||||
if not os.path.exists("/etc/slpkg"):
|
||||
os.mkdir("/etc/slpkg")
|
||||
if not os.path.isfile("/etc/slpkg/slpkg.conf"):
|
||||
with open("/etc/slpkg/slpkg.conf", "w") as conf:
|
||||
for line in slpkg_conf:
|
||||
conf.write(line)
|
||||
conf.close()
|
||||
return slpkg_conf
|
||||
|
||||
|
||||
class Config(object):
|
||||
|
||||
def __init__(self):
|
||||
self.config_file = "/etc/slpkg/slpkg.conf"
|
||||
|
||||
def view(self):
|
||||
'''
|
||||
View slpkg config file
|
||||
'''
|
||||
print("") # new line at start
|
||||
conf_args = [
|
||||
'VERSION',
|
||||
'BUILD',
|
||||
'SBO_CHECK_MD5',
|
||||
'PACKAGES',
|
||||
'PATCHES',
|
||||
'DEL_ALL',
|
||||
'DEL_BUILD',
|
||||
'SBO_BUILD_LOG'
|
||||
]
|
||||
f = open(self.config_file, "r")
|
||||
read_conf = f.read()
|
||||
f.close()
|
||||
for line in read_conf.splitlines():
|
||||
if not line.startswith("#") and line.split("=")[0] in conf_args:
|
||||
print(line)
|
||||
else:
|
||||
print("{0}{1}{2}".format(CYAN, line, ENDC))
|
||||
print("") # new line at end
|
||||
|
||||
def edit(self, editor):
|
||||
'''
|
||||
Edit configuration file
|
||||
'''
|
||||
subprocess.call("{0} {1}".format(editor, self.config_file),
|
||||
shell=True)
|
107
slpkg/desc.py
Executable file
107
slpkg/desc.py
Executable file
|
@ -0,0 +1,107 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# desc.py file is part of slpkg.
|
||||
|
||||
# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
||||
# All rights reserved.
|
||||
|
||||
# Utility for easy management packages in Slackware
|
||||
|
||||
# https://github.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 init import Initialization
|
||||
from messages import pkg_not_found
|
||||
from colors import (
|
||||
RED,
|
||||
GREEN,
|
||||
YELLOW,
|
||||
CYAN,
|
||||
GREY,
|
||||
ENDC
|
||||
)
|
||||
from __metadata__ import (
|
||||
pkg_path,
|
||||
lib_path,
|
||||
repositories
|
||||
)
|
||||
|
||||
from pkg.find import find_package
|
||||
|
||||
|
||||
class PkgDesc(object):
|
||||
|
||||
def __init__(self, name, repo, color):
|
||||
self.name = name
|
||||
self.repo = repo
|
||||
self.color = color
|
||||
self.COLOR = ""
|
||||
self.lib = ""
|
||||
init_repos = {
|
||||
'sbo': Initialization().sbo,
|
||||
'slack': Initialization().slack,
|
||||
'rlw': Initialization().rlw,
|
||||
'alien': Initialization().alien,
|
||||
'slacky': Initialization().slacky
|
||||
}
|
||||
init_repos[self.repo]()
|
||||
color_text = {
|
||||
'red': RED,
|
||||
'green': GREEN,
|
||||
'yellow': YELLOW,
|
||||
'cyan': CYAN,
|
||||
'grey': GREY,
|
||||
'': ''
|
||||
}
|
||||
self.COLOR = color_text[self.color]
|
||||
if self.repo in repositories:
|
||||
repos = {
|
||||
'sbo': 'sbo_repo/SLACKBUILDS.TXT',
|
||||
'slack': 'slack_repo/PACKAGES.TXT',
|
||||
'rlw': 'rlw_repo/PACKAGES.TXT',
|
||||
'alien': 'alien_repo/PACKAGES.TXT',
|
||||
'slacky': 'slacky_repo/PACKAGES.TXT'
|
||||
}
|
||||
self.lib = lib_path + repos[self.repo]
|
||||
|
||||
def view(self):
|
||||
end, n, count = ":", 1, 0
|
||||
find = "".join(find_package(self.name + '-', pkg_path))
|
||||
if self.repo == "sbo" and find.endswith("_SBo"):
|
||||
self.lib = pkg_path + find
|
||||
elif self.repo == "sbo" and not find:
|
||||
sbo_name = self.name
|
||||
self.name = "SLACKBUILD SHORT DESCRIPTION: "
|
||||
end = sbo_name + " ("
|
||||
n = 0
|
||||
f = open(self.lib, "r")
|
||||
PACKAGES_TXT = f.read()
|
||||
f.close()
|
||||
print("") # new line at start
|
||||
for line in PACKAGES_TXT.splitlines():
|
||||
if line.startswith(self.name + end):
|
||||
print("{0}{1}{2}".format(self.COLOR,
|
||||
line[len(self.name) + n:].strip(),
|
||||
ENDC))
|
||||
count += 1
|
||||
if count == 11:
|
||||
break
|
||||
if count == 0:
|
||||
if self.repo == "sbo":
|
||||
pkg_not_found("", sbo_name, "No matching", "\n")
|
||||
else:
|
||||
pkg_not_found("", self.name, "No matching", "\n")
|
||||
if self.repo == "sbo" and count > 0:
|
||||
print("") # new line at end
|
|
@ -24,7 +24,10 @@
|
|||
import sys
|
||||
import subprocess
|
||||
|
||||
from colors import GREEN, ENDC
|
||||
from colors import (
|
||||
GREEN,
|
||||
ENDC
|
||||
)
|
||||
|
||||
|
||||
class Download(object):
|
||||
|
|
|
@ -43,7 +43,7 @@ class FileSize(object):
|
|||
print("\nError: connection refused\n")
|
||||
sys.exit()
|
||||
except KeyboardInterrupt:
|
||||
print # new line at cancel
|
||||
print("") # new line at cancel
|
||||
sys.exit()
|
||||
|
||||
def local(self):
|
||||
|
|
|
@ -27,18 +27,58 @@ import sys
|
|||
from url_read import URL
|
||||
from repositories import Repo
|
||||
from file_size import FileSize
|
||||
from __metadata__ import log_path, lib_path
|
||||
from __metadata__ import (
|
||||
log_path,
|
||||
lib_path,
|
||||
slack_rel,
|
||||
build_path,
|
||||
slpkg_tmp_packages,
|
||||
slpkg_tmp_patches
|
||||
)
|
||||
|
||||
from slack.mirrors import mirrors
|
||||
from slack.slack_version import slack_ver
|
||||
|
||||
|
||||
class Initialization(object):
|
||||
|
||||
def __init__(self):
|
||||
if not os.path.exists("/etc/slpkg/"):
|
||||
os.mkdir("/etc/slpkg/")
|
||||
if not os.path.exists(log_path):
|
||||
os.mkdir(log_path)
|
||||
if not os.path.exists(lib_path):
|
||||
os.mkdir(lib_path)
|
||||
if not os.path.exists("/tmp/slpkg/"):
|
||||
os.mkdir("/tmp/slpkg/")
|
||||
if not os.path.exists(build_path):
|
||||
os.mkdir(build_path)
|
||||
if not os.path.exists(slpkg_tmp_packages):
|
||||
os.mkdir(slpkg_tmp_packages)
|
||||
if not os.path.exists(slpkg_tmp_patches):
|
||||
os.mkdir(slpkg_tmp_patches)
|
||||
|
||||
def slack(self):
|
||||
'''
|
||||
Creating slack local libraries
|
||||
'''
|
||||
log = log_path + "slack/"
|
||||
lib = lib_path + "slack_repo/"
|
||||
lib_file = "PACKAGES.TXT"
|
||||
log_file = "ChangeLog.txt"
|
||||
version = slack_rel
|
||||
if not os.path.exists(log):
|
||||
os.mkdir(log)
|
||||
if not os.path.exists(lib):
|
||||
os.mkdir(lib)
|
||||
packages = mirrors(lib_file, "", version)
|
||||
extra = mirrors(lib_file, "extra/", version)
|
||||
pasture = mirrors(lib_file, "pasture/", version)
|
||||
packages_txt = ("{0} {1} {2}".format(packages, extra, pasture))
|
||||
changelog_txt = mirrors(log_file, "", version)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt)
|
||||
|
||||
def sbo(self):
|
||||
'''
|
||||
|
@ -127,11 +167,13 @@ class Initialization(object):
|
|||
'''
|
||||
Write files in /var/lib/slpkg/?_repo directory
|
||||
'''
|
||||
PACKAGES_TXT = ""
|
||||
if not os.path.isfile(path + files):
|
||||
print("\nslpkg ...initialization")
|
||||
sys.stdout.write(files + " read ...")
|
||||
sys.stdout.flush()
|
||||
PACKAGES_TXT = URL(file_url).reading()
|
||||
for fu in file_url.split():
|
||||
PACKAGES_TXT += URL(fu).reading()
|
||||
sys.stdout.write("Done\n")
|
||||
with open("{0}{1}".format(path, files), "w") as f:
|
||||
f.write(PACKAGES_TXT)
|
||||
|
@ -147,6 +189,7 @@ class Initialization(object):
|
|||
If the two files differ in size delete and replaced with new.
|
||||
We take the size of ChangeLog.txt from the server and locally
|
||||
'''
|
||||
PACKAGES_TXT = ""
|
||||
server = FileSize(args[2]).server()
|
||||
local = FileSize(args[0] + args[1]).local()
|
||||
if server != local:
|
||||
|
@ -156,7 +199,8 @@ class Initialization(object):
|
|||
print("slpkg ...initialization")
|
||||
sys.stdout.write("Files re-created ...")
|
||||
sys.stdout.flush()
|
||||
PACKAGES_TXT = URL(args[5]).reading()
|
||||
for fu in args[5].split():
|
||||
PACKAGES_TXT += URL(fu).reading()
|
||||
CHANGELOG_TXT = URL(args[2]).reading()
|
||||
with open("{0}{1}".format(args[3], args[4]), "w") as f:
|
||||
f.write(PACKAGES_TXT)
|
||||
|
|
133
slpkg/main.py
133
slpkg/main.py
|
@ -24,19 +24,25 @@
|
|||
import sys
|
||||
import getpass
|
||||
|
||||
from desc import PkgDesc
|
||||
from config import Config
|
||||
from queue import QueuePkgs
|
||||
from messages import s_user
|
||||
from __metadata__ import path
|
||||
from tracking import track_dep
|
||||
from blacklist import BlackList
|
||||
from version import prog_version
|
||||
from arguments import options, usage
|
||||
from __metadata__ import (
|
||||
path,
|
||||
repositories,
|
||||
slack_rel
|
||||
)
|
||||
|
||||
from pkg.build import BuildPackage
|
||||
from pkg.manager import PackageManager
|
||||
|
||||
from sbo.check import SBoCheck
|
||||
from sbo.views import SBoNetwork
|
||||
from sbo.tracking import track_dep
|
||||
from sbo.slackbuild import SBoInstall
|
||||
|
||||
from slack.install import Slack
|
||||
|
@ -45,15 +51,51 @@ from others.check import OthersUpgrade
|
|||
from others.install import OthersInstall
|
||||
|
||||
|
||||
class Case(object):
|
||||
|
||||
def __init__(self, package):
|
||||
self.package = package
|
||||
self.release = slack_rel
|
||||
|
||||
def sbo_install(self):
|
||||
SBoInstall(self.package).start()
|
||||
|
||||
def slack_install(self):
|
||||
Slack(self.package, self.release).start()
|
||||
|
||||
def rlw_install(self):
|
||||
OthersInstall(self.package, "rlw", self.release).start()
|
||||
|
||||
def alien_install(self):
|
||||
OthersInstall(self.package, "alien", self.release).start()
|
||||
|
||||
def slacky_install(self):
|
||||
OthersInstall(self.package, "slacky", self.release).start()
|
||||
|
||||
def sbo_upgrade(self):
|
||||
SBoCheck().start()
|
||||
|
||||
def slack_upgrade(self):
|
||||
Patches(self.release).start()
|
||||
|
||||
def rlw_upgrade(self):
|
||||
OthersUpgrade("rlw", self.release).start()
|
||||
|
||||
def alien_upgrade(self):
|
||||
OthersUpgrade("alien", self.release).start()
|
||||
|
||||
def slacky_upgrade(self):
|
||||
OthersUpgrade("slacky", self.release).start()
|
||||
|
||||
|
||||
def main():
|
||||
# root privileges required
|
||||
|
||||
# repositories = ["sbo", "slack", "rlw", "alien", "slacky"]
|
||||
s_user(getpass.getuser())
|
||||
args = sys.argv
|
||||
args.pop(0)
|
||||
repository = ["sbo", "slack", "rlw", "alien", "slacky"]
|
||||
blacklist = BlackList()
|
||||
queue = QueuePkgs()
|
||||
|
||||
if len(args) == 0:
|
||||
usage()
|
||||
elif (len(args) == 1 and args[0] == "-h" or
|
||||
|
@ -65,54 +107,40 @@ def main():
|
|||
elif len(args) == 3 and args[0] == "-a":
|
||||
BuildPackage(args[1], args[2:], path).build()
|
||||
elif len(args) == 2 and args[0] == "-l":
|
||||
pkg_list = ["all", "noarch"] + repository
|
||||
pkg_list = ["all", "noarch"] + repositories
|
||||
if args[1] in pkg_list:
|
||||
PackageManager(None).list(args[1])
|
||||
else:
|
||||
usage()
|
||||
elif len(args) == 3 and args[0] == "-c":
|
||||
if args[1] == repository[0] and args[2] == "--upgrade":
|
||||
SBoCheck().start()
|
||||
elif args[1] == repository[1] and args[2] == "--upgrade":
|
||||
version = "stable"
|
||||
Patches(version).start()
|
||||
elif args[1] == repository[2] and args[2] == "--upgrade":
|
||||
OthersUpgrade(repository[2], "").start()
|
||||
elif args[1] == repository[3] and args[2] == "--upgrade":
|
||||
OthersUpgrade(repository[3], "").start()
|
||||
elif args[1] == repository[4] and args[2] == "--upgrade":
|
||||
OthersUpgrade(repository[4], "").start()
|
||||
else:
|
||||
usage()
|
||||
elif len(args) == 4 and args[0] == "-c":
|
||||
if args[1] == repository[1] and args[3] == "--current":
|
||||
Patches("current").start()
|
||||
elif args[1] == repository[3] and args[3] == "--current":
|
||||
OthersUpgrade(repository[3], "current").start()
|
||||
elif len(args) == 3 and args[0] == "-c" and args[2] == "--upgrade":
|
||||
pkg = Case("")
|
||||
upgrade = {
|
||||
"sbo": pkg.sbo_upgrade,
|
||||
"slack": pkg.slack_upgrade,
|
||||
"rlw": pkg.rlw_upgrade,
|
||||
"alien": pkg.alien_upgrade,
|
||||
"slacky": pkg.slacky_upgrade
|
||||
}
|
||||
if args[1] in repositories:
|
||||
upgrade[args[1]]()
|
||||
else:
|
||||
usage()
|
||||
elif len(args) == 3 and args[0] == "-s":
|
||||
if args[1] == repository[0]:
|
||||
SBoInstall(args[2]).start()
|
||||
elif args[1] == repository[1]:
|
||||
Slack(args[2], "stable").start()
|
||||
elif args[1] == repository[2]:
|
||||
OthersInstall(args[2], repository[2], "").start()
|
||||
elif args[1] == repository[3]:
|
||||
OthersInstall(args[2], repository[3], "").start()
|
||||
elif args[1] == repository[4]:
|
||||
OthersInstall(args[2], repository[4], "").start()
|
||||
pkg = Case(args[2])
|
||||
if args[1] in repositories:
|
||||
install = {
|
||||
"sbo": pkg.sbo_install,
|
||||
"slack": pkg.slack_install,
|
||||
"rlw": pkg.rlw_install,
|
||||
"alien": pkg.alien_install,
|
||||
"slacky": pkg.slacky_install
|
||||
}
|
||||
install[args[1]]()
|
||||
else:
|
||||
usage()
|
||||
elif len(args) == 4 and args[0] == "-s":
|
||||
if args[1] == repository[1] and args[3] == "--current":
|
||||
Slack(args[2], "current").start()
|
||||
elif args[1] == repository[3] and args[3] == "--current":
|
||||
OthersInstall(args[2], repository[3], "current").start()
|
||||
else:
|
||||
usage()
|
||||
elif len(args) == 2 and args[0] == "-t":
|
||||
track_dep(args[1])
|
||||
elif len(args) == 3 and args[0] == "-t" and args[1] in ["sbo", "alien",
|
||||
"rlw", "slacky"]:
|
||||
track_dep(args[2], args[1])
|
||||
elif len(args) == 2 and args[0] == "-n":
|
||||
SBoNetwork(args[1]).view()
|
||||
elif len(args) == 2 and args[0] == "-b" and args[1] == "--list":
|
||||
|
@ -144,8 +172,25 @@ def main():
|
|||
PackageManager(args[1:]).remove()
|
||||
elif len(args) > 1 and args[0] == "-f":
|
||||
PackageManager(args[1:]).find()
|
||||
elif len(args) == 3 and args[0] == "-p" and args[1] in repositories:
|
||||
PkgDesc(args[2], args[1], "").view()
|
||||
elif len(args) == 4 and args[0] == "-p" and args[3].startswith("--color="):
|
||||
colors = ['red', 'green', 'yellow', 'cyan', 'grey']
|
||||
tag = args[3][len("--color="):]
|
||||
if args[1] in repositories and tag in colors:
|
||||
PkgDesc(args[2], args[1], tag).view()
|
||||
else:
|
||||
usage()
|
||||
elif len(args) > 1 and args[0] == "-d":
|
||||
PackageManager(args[1:]).display()
|
||||
elif len(args) == 2 and args[0] == "-g" and args[1].startswith("--config"):
|
||||
editor = args[1][len("--config="):]
|
||||
if args[1] == "--config":
|
||||
Config().view()
|
||||
elif editor:
|
||||
Config().edit(editor)
|
||||
else:
|
||||
usage()
|
||||
else:
|
||||
usage()
|
||||
|
||||
|
|
|
@ -22,7 +22,12 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
from colors import RED, CYAN, ENDC
|
||||
|
||||
from colors import (
|
||||
RED,
|
||||
CYAN,
|
||||
ENDC
|
||||
)
|
||||
|
||||
|
||||
def pkg_not_found(bol, pkg, message, eol):
|
||||
|
|
|
@ -30,9 +30,16 @@ from slpkg.messages import template
|
|||
from slpkg.blacklist import BlackList
|
||||
from slpkg.init import Initialization
|
||||
from slpkg.splitting import split_package
|
||||
from slpkg.colors import YELLOW, GREY, ENDC
|
||||
from slpkg.__metadata__ import slpkg_tmp, pkg_path, lib_path
|
||||
|
||||
from slpkg.colors import (
|
||||
YELLOW,
|
||||
GREY,
|
||||
ENDC
|
||||
)
|
||||
from slpkg.__metadata__ import (
|
||||
pkg_path,
|
||||
lib_path,
|
||||
slpkg_tmp_packages
|
||||
)
|
||||
|
||||
from slpkg.pkg.manager import PackageManager
|
||||
|
||||
|
@ -48,7 +55,7 @@ class OthersUpgrade(object):
|
|||
def __init__(self, repo, version):
|
||||
self.repo = repo
|
||||
self.version = version
|
||||
self.tmp_path = slpkg_tmp + "packages/"
|
||||
self.tmp_path = slpkg_tmp_packages
|
||||
self.repo_init()
|
||||
repos = Repo()
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
||||
|
@ -78,10 +85,6 @@ class OthersUpgrade(object):
|
|||
'''
|
||||
Initialization repository if only use
|
||||
'''
|
||||
if not os.path.exists(slpkg_tmp):
|
||||
os.mkdir(slpkg_tmp)
|
||||
if not os.path.exists(self.tmp_path):
|
||||
os.mkdir(self.tmp_path)
|
||||
repository = {
|
||||
'rlw': Initialization().rlw,
|
||||
'alien': Initialization().alien,
|
||||
|
@ -96,12 +99,12 @@ class OthersUpgrade(object):
|
|||
try:
|
||||
dwn_links, upgrade_all, comp_sum, uncomp_sum = self.store()
|
||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
||||
print # new line at start
|
||||
print("") # new line at start
|
||||
if upgrade_all:
|
||||
template(78)
|
||||
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
|
||||
"| Package", " " * 17,
|
||||
"Version", " " * 12,
|
||||
"New version", " " * 8,
|
||||
"Arch", " " * 4,
|
||||
"Build", " " * 2,
|
||||
"Repos", " " * 10,
|
||||
|
@ -123,12 +126,13 @@ class OthersUpgrade(object):
|
|||
if read in ['Y', 'y']:
|
||||
upgrade_all.reverse()
|
||||
packages_dwn(self.tmp_path, dwn_links)
|
||||
upgrade(upgrade_all)
|
||||
upgrade(self.tmp_path, upgrade_all)
|
||||
delete(self.tmp_path, upgrade_all)
|
||||
else:
|
||||
print("There are no packages for upgrade\n")
|
||||
print("No new updates in the repository '{0}'\n".format(
|
||||
self.repo))
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
|
||||
def store(self):
|
||||
|
@ -209,10 +213,11 @@ def msgs(upgrade_all):
|
|||
return msg_pkg
|
||||
|
||||
|
||||
def upgrade(upgrade_all):
|
||||
def upgrade(tmp_path, upgrade_all):
|
||||
'''
|
||||
Install or upgrade packages
|
||||
'''
|
||||
for pkg in upgrade_all:
|
||||
package = (tmp_path + pkg).split()
|
||||
print("[ {0}upgrading{1} ] --> {2}".format(YELLOW, ENDC, pkg[:-4]))
|
||||
PackageManager(pkg).upgrade()
|
||||
PackageManager(package).upgrade()
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
|
||||
import sys
|
||||
|
||||
from slpkg.colors import GREY, ENDC
|
||||
from slpkg.toolbar import status
|
||||
|
||||
from greps import repo_requires
|
||||
from greps import Requires
|
||||
|
||||
dep_results = []
|
||||
|
||||
|
@ -36,18 +36,19 @@ def dependencies_pkg(name, repo):
|
|||
'''
|
||||
try:
|
||||
dependencies = []
|
||||
requires = repo_requires(name, repo)
|
||||
requires = Requires(name, repo).get_deps()
|
||||
toolbar_width, index = 2, 0
|
||||
if requires:
|
||||
for req in requires:
|
||||
index += 1
|
||||
toolbar_width = status(index, toolbar_width, 1)
|
||||
if req:
|
||||
dependencies.append(req)
|
||||
if dependencies:
|
||||
dep_results.append(dependencies)
|
||||
for dep in dependencies:
|
||||
sys.stdout.write("{0}.{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
dependencies_pkg(dep, repo)
|
||||
return dep_results
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
|
|
|
@ -29,6 +29,8 @@ from slpkg.splitting import split_package
|
|||
|
||||
from slpkg.slack.slack_version import slack_ver
|
||||
|
||||
len_deps = 0
|
||||
|
||||
|
||||
def repo_data(PACKAGES_TXT, step, repo, version):
|
||||
'''
|
||||
|
@ -103,21 +105,87 @@ def alien_filter(name, location, size, unsize, version):
|
|||
return [fname, flocation, fsize, funsize]
|
||||
|
||||
|
||||
def repo_requires(name, repo):
|
||||
'''
|
||||
Grap package requirements from alien repository
|
||||
'''
|
||||
lib = {
|
||||
'alien': lib_path + "alien_repo/PACKAGES.TXT",
|
||||
'slacky': lib_path + "slacky_repo/PACKAGES.TXT"
|
||||
}
|
||||
f = open(lib[repo], "r")
|
||||
PACKAGES_TXT = f.read()
|
||||
f.close()
|
||||
for line in PACKAGES_TXT.splitlines():
|
||||
if line.startswith("PACKAGE NAME: "):
|
||||
pkg = line[14:].strip()
|
||||
pkg_name = split_package(pkg)[0]
|
||||
if line.startswith("PACKAGE REQUIRED: "):
|
||||
if pkg_name == name:
|
||||
return line[18:].strip().split(",")
|
||||
class Requires(object):
|
||||
|
||||
def __init__(self, name, repo):
|
||||
self.name = name
|
||||
self.repo = repo
|
||||
lib = lib_path + "slack_repo/PACKAGES.TXT"
|
||||
f = open(lib, "r")
|
||||
self.SLACK_PACKAGES_TXT = f.read()
|
||||
f.close()
|
||||
|
||||
def get_deps(self):
|
||||
'''
|
||||
Grap package requirements from repositories
|
||||
'''
|
||||
if self.repo in ["alien", "slacky"]:
|
||||
lib = {
|
||||
'alien': lib_path + "alien_repo/PACKAGES.TXT",
|
||||
'slacky': lib_path + "slacky_repo/PACKAGES.TXT"
|
||||
}
|
||||
f = open(lib[self.repo], "r")
|
||||
PACKAGES_TXT = f.read()
|
||||
f.close()
|
||||
for line in PACKAGES_TXT.splitlines():
|
||||
if line.startswith("PACKAGE NAME: "):
|
||||
pkg = line[14:].strip()
|
||||
pkg_name = split_package(pkg)[0]
|
||||
if line.startswith("PACKAGE REQUIRED: "):
|
||||
if pkg_name == self.name:
|
||||
if line[17:].strip():
|
||||
if self.repo == "slacky":
|
||||
return self.slacky_req_fix(line)
|
||||
|
||||
else:
|
||||
return line[18:].strip().split(",")
|
||||
elif self.repo == "rlw":
|
||||
# Robby's repository dependencies as shown in the central page
|
||||
# http://rlworkman.net/pkgs/
|
||||
dependencies = {
|
||||
"abiword": "wv",
|
||||
"claws-mail": "libetpan bogofilter html2ps",
|
||||
"inkscape": "gtkmm atkmm pangomm cairomm mm-common libsigc++ "
|
||||
"libwpg lxml gsl numpy BeautifulSoup",
|
||||
"texlive": "libsigsegv texi2html",
|
||||
"xfburn": "libburn libisofs"
|
||||
}
|
||||
if self.name in dependencies.keys():
|
||||
return dependencies[self.name].split()
|
||||
else:
|
||||
return ""
|
||||
|
||||
def slacky_req_fix(self, line):
|
||||
'''
|
||||
Fix slacky requirements because many dependencies splitting
|
||||
with ',' and others with '|'
|
||||
'''
|
||||
slacky_deps = []
|
||||
for dep in line[18:].strip().split(","):
|
||||
dep = dep.split("|")
|
||||
if len(dep) > 1:
|
||||
for d in dep:
|
||||
slacky_deps.append(d.split()[0])
|
||||
dep = "".join(dep)
|
||||
slacky_deps.append(dep.split()[0])
|
||||
slacky_deps = self.remove_slack_deps(slacky_deps)
|
||||
return slacky_deps
|
||||
|
||||
def remove_slack_deps(self, dependencies):
|
||||
'''
|
||||
Because the repository slacky mentioned packages and dependencies
|
||||
that exist in the distribution Slackware, this feature is intended
|
||||
to remove them and return only those needed.
|
||||
'''
|
||||
global len_deps
|
||||
name, slacky_deps = [], []
|
||||
index, toolbar_width, step = 0, 700, (len_deps * 500)
|
||||
for line in self.SLACK_PACKAGES_TXT.splitlines():
|
||||
index += 1
|
||||
toolbar_width = status(index, toolbar_width, step)
|
||||
if line.startswith("PACKAGE NAME:"):
|
||||
name.append("-".join(line[15:].split("-")[:-3]))
|
||||
for deps in dependencies:
|
||||
if deps not in name:
|
||||
slacky_deps.append(deps)
|
||||
return slacky_deps
|
||||
|
|
|
@ -29,10 +29,24 @@ from slpkg.repositories import Repo
|
|||
from slpkg.init import Initialization
|
||||
from slpkg.blacklist import BlackList
|
||||
from slpkg.splitting import split_package
|
||||
from slpkg.messages import pkg_not_found, template
|
||||
from slpkg.colors import RED, GREEN, CYAN, YELLOW, GREY, ENDC
|
||||
from slpkg.__metadata__ import slpkg_tmp, pkg_path, lib_path, log_path
|
||||
|
||||
from slpkg.messages import (
|
||||
pkg_not_found,
|
||||
template
|
||||
)
|
||||
from slpkg.colors import (
|
||||
RED,
|
||||
GREEN,
|
||||
CYAN,
|
||||
YELLOW,
|
||||
GREY,
|
||||
ENDC
|
||||
)
|
||||
from slpkg.__metadata__ import (
|
||||
pkg_path,
|
||||
lib_path,
|
||||
log_path,
|
||||
slpkg_tmp_packages
|
||||
)
|
||||
|
||||
from slpkg.pkg.find import find_package
|
||||
from slpkg.pkg.manager import PackageManager
|
||||
|
@ -51,7 +65,7 @@ class OthersInstall(object):
|
|||
self.package = package
|
||||
self.repo = repo
|
||||
self.version = version
|
||||
self.tmp_path = slpkg_tmp + "packages/"
|
||||
self.tmp_path = slpkg_tmp_packages
|
||||
self.repo_init()
|
||||
repos = Repo()
|
||||
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
||||
|
@ -84,10 +98,10 @@ class OthersInstall(object):
|
|||
'''
|
||||
Initialization repository if only use
|
||||
'''
|
||||
if not os.path.exists(slpkg_tmp):
|
||||
os.mkdir(slpkg_tmp)
|
||||
if not os.path.exists(self.tmp_path):
|
||||
os.mkdir(self.tmp_path)
|
||||
# initialization Slackware repository needed to compare
|
||||
# slacky dependencies
|
||||
if not os.path.isfile(lib_path + "slack_repo/PACKAGES.TXT"):
|
||||
Initialization().slack()
|
||||
repository = {
|
||||
"rlw": Initialization().rlw,
|
||||
"alien": Initialization().alien,
|
||||
|
@ -104,7 +118,7 @@ class OthersInstall(object):
|
|||
(dwn_links, install_all, comp_sum, uncomp_sum,
|
||||
matching) = self.store(dependencies)
|
||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
||||
print # new line at start
|
||||
print("") # new line at start
|
||||
if install_all:
|
||||
template(78)
|
||||
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
|
||||
|
@ -153,7 +167,7 @@ class OthersInstall(object):
|
|||
else:
|
||||
pkg_not_found("", self.package, "No matching", "\n")
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
|
||||
def store(self, deps):
|
||||
|
@ -172,7 +186,7 @@ class OthersInstall(object):
|
|||
for pkg in deps:
|
||||
for name, loc, comp, uncomp in zip(data[0], data[1], data[2],
|
||||
data[3]):
|
||||
if name.startswith(pkg) and pkg not in black:
|
||||
if name.startswith(pkg + "-") and pkg not in black:
|
||||
# store downloads packages by repo
|
||||
dwn.append("{0}{1}/{2}".format(self.mirror, loc, name))
|
||||
install.append(name)
|
||||
|
@ -182,7 +196,7 @@ class OthersInstall(object):
|
|||
for name, loc, comp, uncomp in zip(data[0], data[1], data[2],
|
||||
data[3]):
|
||||
package = "".join(deps)
|
||||
if package in name and package not in BlackList().packages():
|
||||
if package in name and package not in black:
|
||||
# store downloads packages by repo
|
||||
dwn.append("{0}{1}/{2}".format(self.mirror, loc, name))
|
||||
install.append(name)
|
||||
|
@ -227,7 +241,7 @@ def views(install_all, comp_sum, repository, dependencies):
|
|||
" " * (8-len(pkg_split[2])), pkg_split[3],
|
||||
" " * (7-len(pkg_split[3])), repository,
|
||||
comp, " K"))
|
||||
if len(dependencies) > 1 and count == 0:
|
||||
if len(dependencies) > 1 and len(install_all) > 1 and count == 0:
|
||||
print("Installing for dependencies:")
|
||||
count += 1
|
||||
return [pkg_sum, upg_sum, uni_sum]
|
||||
|
@ -263,18 +277,18 @@ def install(tmp_path, install_all):
|
|||
PackageManager(package).upgrade()
|
||||
|
||||
|
||||
def repo_deps(name, repo):
|
||||
def resolving_deps(name, repo):
|
||||
'''
|
||||
Return package dependencies
|
||||
'''
|
||||
deps = dependencies_pkg(name, repo)
|
||||
requires, dependencies = [], []
|
||||
sys.stdout.write("{0}Resolving dependencies ...{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
deps = dependencies_pkg(name, repo)
|
||||
requires.append(name)
|
||||
# Create one list for all packages
|
||||
for pkg in deps:
|
||||
requires += pkg
|
||||
if repo == "slacky":
|
||||
requires = slacky_req_check(name, requires)
|
||||
requires.reverse()
|
||||
# Remove double dependencies
|
||||
for duplicate in requires:
|
||||
|
@ -283,59 +297,6 @@ def repo_deps(name, repo):
|
|||
return dependencies
|
||||
|
||||
|
||||
def rlw_deps(name):
|
||||
'''
|
||||
Robby's repository dependencies as shown in the central page
|
||||
http://rlworkman.net/pkgs/
|
||||
'''
|
||||
dependencies = {
|
||||
"abiword": "wv",
|
||||
"claws-mail": "libetpan bogofilter html2ps",
|
||||
"inkscape": "gtkmm atkmm pangomm cairomm mm-common libsigc++ libwpg" +
|
||||
"lxml gsl numpy BeautifulSoup",
|
||||
"texlive": "libsigsegv texi2html",
|
||||
"xfburn": "libburn libisofs"
|
||||
}
|
||||
if name in dependencies.keys():
|
||||
return dependencies[name]
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def resolving_deps(name, repo):
|
||||
'''
|
||||
Return dependencies for one package from
|
||||
alien repository
|
||||
'''
|
||||
dependencies = []
|
||||
sys.stdout.write("{0}Resolving dependencies ...{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
if repo == "alien" or repo == "slacky":
|
||||
dependencies = repo_deps(name, repo)
|
||||
elif repo == "rlw":
|
||||
dependencies = rlw_deps(name).split()
|
||||
dependencies.append(name)
|
||||
return dependencies
|
||||
|
||||
|
||||
def slacky_req_check(name, requires):
|
||||
'''
|
||||
Checks if the requirement is installed or if it is
|
||||
smaller version
|
||||
'''
|
||||
new = []
|
||||
for req in requires[1:]:
|
||||
split_req = req.split() # split requirements
|
||||
req_name = split_req[0] # store name
|
||||
installed = find_package(req_name + "-", pkg_path)
|
||||
if not installed:
|
||||
new.append(req_name)
|
||||
requires = []
|
||||
requires.append(name)
|
||||
requires += new
|
||||
return requires
|
||||
|
||||
|
||||
def write_deps(dependencies):
|
||||
'''
|
||||
Write dependencies in a log file
|
||||
|
|
52
slpkg/others/search.py
Executable file
52
slpkg/others/search.py
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# search.py file is part of slpkg.
|
||||
|
||||
# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
||||
# All rights reserved.
|
||||
|
||||
# Utility for easy management packages in Slackware
|
||||
|
||||
# https://github.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 slpkg.blacklist import BlackList
|
||||
from slpkg.__metadata__ import lib_path
|
||||
from slpkg.splitting import split_package
|
||||
|
||||
|
||||
def search_pkg(name, repo):
|
||||
'''
|
||||
Search if package exists in PACKAGES.TXT file
|
||||
and return the name.
|
||||
'''
|
||||
try:
|
||||
blacklist = BlackList().packages()
|
||||
repo_dir = {
|
||||
"rlw": "rlw_repo/PACKAGES.TXT",
|
||||
"alien": "alien_repo/PACKAGES.TXT",
|
||||
"slacky": "slacky_repo/PACKAGES.TXT"
|
||||
}
|
||||
with open(lib_path + repo_dir[repo], "r") as PACKAGES_TXT:
|
||||
for line in PACKAGES_TXT:
|
||||
if line.startswith("PACKAGE NAME: "):
|
||||
pkg_name = split_package(line[15:])[0].strip()
|
||||
if name == pkg_name and name not in blacklist:
|
||||
PACKAGES_TXT.close()
|
||||
return pkg_name
|
||||
except KeyboardInterrupt:
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
|
@ -30,9 +30,20 @@ import tarfile
|
|||
import subprocess
|
||||
|
||||
from slpkg.checksum import md5sum
|
||||
from slpkg.__metadata__ import log_path
|
||||
from slpkg.colors import RED, GREEN, ENDC
|
||||
from slpkg.messages import pkg_not_found, template
|
||||
from slpkg.colors import (
|
||||
RED,
|
||||
GREEN,
|
||||
ENDC
|
||||
)
|
||||
from slpkg.messages import (
|
||||
pkg_not_found,
|
||||
template
|
||||
)
|
||||
from slpkg.__metadata__ import (
|
||||
log_path,
|
||||
sbo_build_log,
|
||||
sbo_check_md5
|
||||
)
|
||||
|
||||
from slpkg.sbo.greps import SBoGrep
|
||||
|
||||
|
@ -55,8 +66,6 @@ class BuildPackage(object):
|
|||
os.mkdir(self.sbo_logs)
|
||||
if not os.path.exists(self.build_logs):
|
||||
os.mkdir(self.build_logs)
|
||||
if os.path.isfile(self.build_logs + self.log_file):
|
||||
os.remove(self.build_logs + self.log_file)
|
||||
|
||||
def build(self):
|
||||
'''
|
||||
|
@ -72,27 +81,34 @@ class BuildPackage(object):
|
|||
for src, sbo_md5 in zip(self.sources, sbo_md5_list):
|
||||
# fix build sources with spaces
|
||||
src = src.replace("%20", " ")
|
||||
check_md5(sbo_md5, src)
|
||||
if sbo_check_md5 == "on":
|
||||
check_md5(sbo_md5, src)
|
||||
shutil.copy2(src, self.prgnam)
|
||||
os.chdir(self.path + self.prgnam)
|
||||
# change permissions
|
||||
subprocess.call("chmod +x {0}.SlackBuild".format(self.prgnam),
|
||||
shell=True)
|
||||
# start log write
|
||||
log_head(self.build_logs, self.log_file, self.start_log_time)
|
||||
subprocess.Popen("./{0}.SlackBuild 2>&1 | tee -a {1}{2}".format(
|
||||
self.prgnam, 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)
|
||||
if sbo_build_log == "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("./{0}.SlackBuild 2>&1 | tee -a {1}{2}".format(
|
||||
self.prgnam, 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("Total build time for package {0} : {1}\n".format(
|
||||
self.prgnam, sum_time))
|
||||
else:
|
||||
subprocess.call("./{0}.SlackBuild".format(self.prgnam,
|
||||
shell=True))
|
||||
os.chdir(self.path)
|
||||
print("Total build time for package {0} : {1}\n".format(self.prgnam,
|
||||
sum_time))
|
||||
except (OSError, IOError):
|
||||
pkg_not_found("\n", self.prgnam, "Wrong file", "\n")
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
|
||||
|
||||
|
@ -118,7 +134,7 @@ def check_md5(sbo_md5, src):
|
|||
print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format(src, GREEN,
|
||||
ENDC))
|
||||
template(78)
|
||||
print # new line after pass checksum
|
||||
print("") # new line after pass checksum
|
||||
|
||||
|
||||
def log_head(path, log_file, log_time):
|
||||
|
|
|
@ -25,9 +25,22 @@ import os
|
|||
import sys
|
||||
import subprocess
|
||||
|
||||
from slpkg.messages import pkg_not_found, template
|
||||
from slpkg.colors import RED, GREEN, CYAN, GREY, ENDC
|
||||
from slpkg.__metadata__ import pkg_path, sp, log_path
|
||||
from slpkg.messages import (
|
||||
pkg_not_found,
|
||||
template
|
||||
)
|
||||
from slpkg.colors import (
|
||||
RED,
|
||||
GREEN,
|
||||
CYAN,
|
||||
GREY,
|
||||
ENDC
|
||||
)
|
||||
from slpkg.__metadata__ import (
|
||||
pkg_path,
|
||||
sp,
|
||||
log_path
|
||||
)
|
||||
|
||||
from find import find_package
|
||||
|
||||
|
@ -70,9 +83,8 @@ class PackageManager(object):
|
|||
'''
|
||||
for pkg in self.binary:
|
||||
try:
|
||||
print(
|
||||
subprocess.check_output("upgradepkg --reinstall {0}".format(
|
||||
pkg), shell=True))
|
||||
print(subprocess.check_output(
|
||||
"upgradepkg --reinstall {0}".format(pkg), shell=True))
|
||||
print("Completed!\n")
|
||||
except subprocess.CalledProcessError:
|
||||
self.not_found("Can't reinstall", self.binary, pkg)
|
||||
|
@ -93,7 +105,7 @@ class PackageManager(object):
|
|||
dependencies, rmv_list = [], []
|
||||
removed = self.view_removed(self.binary)
|
||||
if not removed:
|
||||
print # new line at end
|
||||
print("") # new line at end
|
||||
else:
|
||||
msg = "package"
|
||||
if len(removed) > 1:
|
||||
|
@ -103,7 +115,7 @@ class PackageManager(object):
|
|||
"\nAre you sure to remove {0} {1} [Y/n]? ".format(
|
||||
str(len(removed)), msg))
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
if remove_pkg in ['y', 'Y']:
|
||||
for rmv in removed:
|
||||
|
@ -117,7 +129,7 @@ class PackageManager(object):
|
|||
"\nRemove dependencies (maybe used by other "
|
||||
"packages) [Y/n]? ")
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
if remove_dep in ['y', 'Y']:
|
||||
rmv_list += self.rmv_deps(self.binary,
|
||||
|
@ -157,7 +169,7 @@ class PackageManager(object):
|
|||
with open(path + package, "r") as f:
|
||||
dependencies = f.read().split()
|
||||
f.close()
|
||||
print # new line at start
|
||||
print("") # new line at start
|
||||
template(78)
|
||||
print("| Found dependencies for package {0}:".format(package))
|
||||
template(78)
|
||||
|
@ -205,7 +217,7 @@ class PackageManager(object):
|
|||
else:
|
||||
print("| Package {0} not found".format(pkg))
|
||||
template(78)
|
||||
print # new line at end
|
||||
print("") # new line at end
|
||||
|
||||
def find(self):
|
||||
'''
|
||||
|
@ -253,7 +265,7 @@ class PackageManager(object):
|
|||
with open(pkg_path + "".join(find), "r") as package:
|
||||
for line in package:
|
||||
print(line).strip()
|
||||
print # new line per file
|
||||
print("") # new line per file
|
||||
else:
|
||||
message = "Can't dislpay"
|
||||
if len(self.binary) > 1:
|
||||
|
@ -292,9 +304,9 @@ class PackageManager(object):
|
|||
"continue... ".format(CYAN, ENDC))
|
||||
if read in ['Q', 'q']:
|
||||
break
|
||||
print # new line after page
|
||||
print("") # new line after page
|
||||
page += row
|
||||
print # new line at end
|
||||
print("") # new line at end
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
|
|
|
@ -24,8 +24,16 @@
|
|||
import os
|
||||
|
||||
from downloader import Download
|
||||
from colors import GREEN, RED, ENDC
|
||||
from __metadata__ import lib_path, build_path, tmp
|
||||
from colors import (
|
||||
GREEN,
|
||||
RED,
|
||||
ENDC
|
||||
)
|
||||
from __metadata__ import (
|
||||
lib_path,
|
||||
build_path,
|
||||
tmp
|
||||
)
|
||||
|
||||
from sbo.greps import SBoGrep
|
||||
from pkg.find import find_package
|
||||
|
@ -85,7 +93,7 @@ class QueuePkgs(object):
|
|||
print("{0}{1}{2}".format(GREEN, pkg, ENDC))
|
||||
self.quit = True
|
||||
if self.quit:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
|
||||
def add(self, pkgs):
|
||||
'''
|
||||
|
@ -106,7 +114,7 @@ class QueuePkgs(object):
|
|||
self.quit = True
|
||||
queue.close()
|
||||
if self.quit:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
|
||||
def remove(self, pkgs):
|
||||
'''
|
||||
|
@ -124,7 +132,7 @@ class QueuePkgs(object):
|
|||
self.quit = True
|
||||
queue.close()
|
||||
if self.quit:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
|
||||
def build(self):
|
||||
'''
|
||||
|
@ -155,7 +163,7 @@ class QueuePkgs(object):
|
|||
'''
|
||||
packages = self.packages()
|
||||
if packages:
|
||||
print # new line at start
|
||||
print("") # new line at start
|
||||
for pkg in packages:
|
||||
# check if package exist in /tmp
|
||||
find = find_package(pkg, tmp)
|
||||
|
|
|
@ -32,11 +32,26 @@ from slpkg.toolbar import status
|
|||
from slpkg.init import Initialization
|
||||
from slpkg.downloader import Download
|
||||
from slpkg.splitting import split_package
|
||||
from slpkg.messages import template, build_FAILED
|
||||
from slpkg.colors import RED, GREEN, GREY, YELLOW, ENDC
|
||||
from slpkg.__metadata__ import tmp, pkg_path, build_path, sp
|
||||
from slpkg.messages import (
|
||||
template,
|
||||
build_FAILED
|
||||
)
|
||||
from slpkg.colors import (
|
||||
RED,
|
||||
GREEN,
|
||||
GREY,
|
||||
YELLOW,
|
||||
ENDC
|
||||
)
|
||||
from slpkg.__metadata__ import (
|
||||
tmp,
|
||||
pkg_path,
|
||||
build_path,
|
||||
sp
|
||||
)
|
||||
|
||||
from greps import SBoGrep
|
||||
from remove import delete
|
||||
from compressed import SBoLink
|
||||
from search import sbo_search_pkg
|
||||
from dependency import sbo_dependencies_pkg
|
||||
|
@ -46,9 +61,9 @@ class SBoCheck(object):
|
|||
|
||||
def __init__(self):
|
||||
self.done = "{0}Done{1}\n".format(GREY, ENDC)
|
||||
Initialization().sbo()
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
Initialization().sbo()
|
||||
self.installed = []
|
||||
self.index, self.toolbar_width = 0, 3
|
||||
|
||||
|
@ -84,7 +99,6 @@ class SBoCheck(object):
|
|||
count, msg = view_packages(data[1], data[2], data[3])
|
||||
read = raw_input("Would you like to upgrade [Y/n]? ")
|
||||
if read in ['y', 'Y']:
|
||||
create_build_path()
|
||||
os.chdir(build_path)
|
||||
for name, version in zip(data[0], data[2]):
|
||||
prgnam = ("{0}-{1}".format(name, version))
|
||||
|
@ -116,6 +130,7 @@ class SBoCheck(object):
|
|||
PackageManager(binary).upgrade()
|
||||
reference(data[0], data[1], data[2], count[0], count[1],
|
||||
msg[0], msg[1], self.installed)
|
||||
delete(build_path)
|
||||
else:
|
||||
print("\nTotal {0} SBo packages are up to date\n".format(
|
||||
len(self.sbo_list())))
|
||||
|
@ -123,7 +138,7 @@ class SBoCheck(object):
|
|||
sys.stdout.write(self.done)
|
||||
print("\nNo SBo packages found\n")
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
|
||||
def sbo_list(self):
|
||||
|
@ -281,14 +296,6 @@ def view_packages(package_for_upgrade, upgrade_version, upgrade_arch):
|
|||
return [count_installed, count_upgraded], [msg_ins, msg_upg]
|
||||
|
||||
|
||||
def create_build_path():
|
||||
'''
|
||||
Create build directory if not exists
|
||||
'''
|
||||
if not os.path.exists(build_path):
|
||||
os.mkdir(build_path)
|
||||
|
||||
|
||||
def dwn_sources(sources):
|
||||
'''
|
||||
Download sources and return filenames
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
import sys
|
||||
|
||||
from slpkg.colors import GREY, ENDC
|
||||
from slpkg.toolbar import status
|
||||
from slpkg.blacklist import BlackList
|
||||
|
||||
from greps import SBoGrep
|
||||
|
@ -39,8 +39,11 @@ def sbo_dependencies_pkg(name):
|
|||
dependencies = []
|
||||
blacklist = BlackList().packages()
|
||||
requires = SBoGrep(name).requires()
|
||||
toolbar_width, index = 2, 0
|
||||
if requires:
|
||||
for req in requires:
|
||||
index += 1
|
||||
toolbar_width = status(index, toolbar_width, 1)
|
||||
# avoid to add %README% as dependency and
|
||||
# if require in blacklist
|
||||
if "%README%" not in req and req not in blacklist:
|
||||
|
@ -48,10 +51,8 @@ def sbo_dependencies_pkg(name):
|
|||
if dependencies:
|
||||
dep_results.append(dependencies)
|
||||
for dep in dependencies:
|
||||
sys.stdout.write("{0}.{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
sbo_dependencies_pkg(dep)
|
||||
return dep_results
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
|
|
|
@ -21,7 +21,10 @@
|
|||
# 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 arch, lib_path
|
||||
from slpkg.__metadata__ import (
|
||||
arch,
|
||||
lib_path
|
||||
)
|
||||
|
||||
|
||||
class SBoGrep(object):
|
||||
|
|
34
slpkg/sbo/remove.py
Executable file
34
slpkg/sbo/remove.py
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# remove.py file is part of slpkg.
|
||||
|
||||
# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
||||
# All rights reserved.
|
||||
|
||||
# Utility for easy management packages in Slackware
|
||||
|
||||
# https://github.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
|
||||
|
||||
from slpkg.__metadata__ import del_build
|
||||
|
||||
|
||||
def delete(build_folder):
|
||||
'''
|
||||
Delete build directory and all its contents.
|
||||
'''
|
||||
if del_build == "on":
|
||||
shutil.rmtree(build_folder)
|
|
@ -48,5 +48,5 @@ def sbo_search_pkg(name):
|
|||
SLACKBUILDS_TXT.close()
|
||||
return (sbo_url + line[23:].strip() + "/")
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
|
|
|
@ -28,18 +28,35 @@ from slpkg.toolbar import status
|
|||
from slpkg.init import Initialization
|
||||
from slpkg.downloader import Download
|
||||
from slpkg.splitting import split_package
|
||||
from slpkg.__metadata__ import (tmp, pkg_path, build_path,
|
||||
log_path, lib_path, sp)
|
||||
|
||||
from slpkg.colors import RED, GREEN, GREY, YELLOW, CYAN, ENDC
|
||||
from slpkg.messages import (pkg_found, template, build_FAILED,
|
||||
pkg_not_found)
|
||||
from slpkg.__metadata__ import (
|
||||
tmp,
|
||||
pkg_path,
|
||||
build_path,
|
||||
log_path,
|
||||
lib_path,
|
||||
sp
|
||||
)
|
||||
from slpkg.colors import (
|
||||
RED,
|
||||
GREEN,
|
||||
GREY,
|
||||
YELLOW,
|
||||
CYAN,
|
||||
ENDC
|
||||
)
|
||||
from slpkg.messages import (
|
||||
pkg_found,
|
||||
template,
|
||||
build_FAILED,
|
||||
pkg_not_found
|
||||
)
|
||||
|
||||
from slpkg.pkg.find import find_package
|
||||
from slpkg.pkg.build import BuildPackage
|
||||
from slpkg.pkg.manager import PackageManager
|
||||
|
||||
from greps import SBoGrep
|
||||
from remove import delete
|
||||
from compressed import SBoLink
|
||||
from search import sbo_search_pkg
|
||||
from dependency import sbo_dependencies_pkg
|
||||
|
@ -49,9 +66,9 @@ class SBoInstall(object):
|
|||
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
Initialization().sbo()
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
Initialization().sbo()
|
||||
self.UNST = ["UNSUPPORTED", "UNTESTED"]
|
||||
self.dependencies_list = sbo_dependencies_pkg(name)
|
||||
|
||||
|
@ -64,12 +81,12 @@ class SBoInstall(object):
|
|||
try:
|
||||
if self.dependencies_list or sbo_search_pkg(self.name) is not None:
|
||||
dependencies = self.remove_dbs()
|
||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
||||
# sbo versions = idata[0]
|
||||
# package arch = idata[1]
|
||||
# package sum = idata[2]
|
||||
# sources = idata[3]
|
||||
idata = installing_data(dependencies, self.UNST)
|
||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
||||
# count upgraded = cnt[0]
|
||||
# count installed = cnt[1]
|
||||
(PKG_COLOR, count) = pkg_colors_tag(self.name, idata[0], 0, 0)
|
||||
|
@ -110,6 +127,7 @@ class SBoInstall(object):
|
|||
reference(count[1], msg[0], count[0], msg[1],
|
||||
b_ins[0], b_ins[2], b_ins[1])
|
||||
write_deps(dependencies)
|
||||
delete(build_path)
|
||||
else:
|
||||
count_installed = count_uninstalled = 0
|
||||
# sbo matching = mdata[0]
|
||||
|
@ -143,7 +161,7 @@ class SBoInstall(object):
|
|||
else:
|
||||
pkg_not_found("\n", self.name, "No matching", "\n")
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
|
||||
def one_for_all(self):
|
||||
|
@ -176,7 +194,12 @@ def installing_data(dependencies, support):
|
|||
'''
|
||||
package_sum = 0
|
||||
sbo_versions, package_arch = [], []
|
||||
sys.stdout.write("{0}Resolving dependencies ...{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
toolbar_width, index = 2, 0
|
||||
for pkg in dependencies:
|
||||
index += 1
|
||||
toolbar_width = status(index, toolbar_width, 1)
|
||||
version = SBoGrep(pkg).version()
|
||||
sbo_versions.append(version)
|
||||
sources = SBoGrep(pkg).source()
|
||||
|
@ -184,6 +207,7 @@ def installing_data(dependencies, support):
|
|||
sbo_package = ("{0}-{1}".format(pkg, version))
|
||||
if find_package(sbo_package, pkg_path):
|
||||
package_sum += 1
|
||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
||||
return [sbo_versions, package_arch, package_sum, sources]
|
||||
|
||||
|
||||
|
@ -277,14 +301,6 @@ def arch_support(source, support, package_sum, dependencies):
|
|||
return read
|
||||
|
||||
|
||||
def create_build_path():
|
||||
'''
|
||||
Create build directory if not exists
|
||||
'''
|
||||
if not os.path.exists(build_path):
|
||||
os.mkdir(build_path)
|
||||
|
||||
|
||||
def dwn_sources(sources):
|
||||
'''
|
||||
Download sources and return filenames
|
||||
|
@ -315,7 +331,6 @@ def build_install(dependencies, sbo_versions):
|
|||
tag 2 or 3 will fit most
|
||||
'''
|
||||
installs, upgraded, versions = [], [], []
|
||||
create_build_path()
|
||||
os.chdir(build_path)
|
||||
for pkg, ver in zip(dependencies, sbo_versions):
|
||||
prgnam = ("{0}-{1}".format(pkg, ver))
|
||||
|
|
|
@ -27,16 +27,33 @@ import pydoc
|
|||
|
||||
from slpkg.init import Initialization
|
||||
from slpkg.downloader import Download
|
||||
from slpkg.__metadata__ import tmp, build_path, pkg_path, sp
|
||||
from slpkg.colors import RED, GREEN, GREY, CYAN, YELLOW, ENDC
|
||||
from slpkg.messages import (pkg_found, pkg_not_found, template,
|
||||
build_FAILED)
|
||||
from slpkg.__metadata__ import (
|
||||
tmp,
|
||||
build_path,
|
||||
pkg_path,
|
||||
sp
|
||||
)
|
||||
from slpkg.colors import (
|
||||
RED,
|
||||
GREEN,
|
||||
GREY,
|
||||
CYAN,
|
||||
YELLOW,
|
||||
ENDC
|
||||
)
|
||||
from slpkg.messages import (
|
||||
pkg_found,
|
||||
pkg_not_found,
|
||||
template,
|
||||
build_FAILED
|
||||
)
|
||||
|
||||
from slpkg.pkg.find import find_package
|
||||
from slpkg.pkg.build import BuildPackage
|
||||
from slpkg.pkg.manager import PackageManager
|
||||
|
||||
from read import Read
|
||||
from remove import delete
|
||||
from greps import SBoGrep
|
||||
from compressed import SBoLink
|
||||
from search import sbo_search_pkg
|
||||
|
@ -46,16 +63,17 @@ class SBoNetwork(object):
|
|||
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
Initialization().sbo()
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
Initialization().sbo()
|
||||
grep = SBoGrep(self.name)
|
||||
self.sbo_url = sbo_search_pkg(self.name)
|
||||
self.sbo_desc = grep.description()[len(self.name) + 2:-1]
|
||||
self.sbo_req = grep.requires()
|
||||
self.source_dwn = grep.source().split()
|
||||
self.sbo_dwn = SBoLink(self.sbo_url).tar_gz()
|
||||
self.sbo_version = grep.version()
|
||||
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.space = ("\n" * 50)
|
||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
||||
|
||||
|
@ -92,11 +110,13 @@ class SBoNetwork(object):
|
|||
pydoc.pager(SlackBuild + fill)
|
||||
elif choice in ['B', 'b']:
|
||||
self.build(FAULT)
|
||||
delete(build_path)
|
||||
break
|
||||
elif choice in ['I', 'i']:
|
||||
if not find_package(prgnam + sp, pkg_path):
|
||||
self.build(FAULT)
|
||||
self.install(prgnam)
|
||||
delete(build_path)
|
||||
break
|
||||
else:
|
||||
template(78)
|
||||
|
@ -113,7 +133,7 @@ class SBoNetwork(object):
|
|||
'''
|
||||
View slackbuild.org
|
||||
'''
|
||||
print # new line at start
|
||||
print("") # new line at start
|
||||
template(78)
|
||||
print("| {0}Package {1}{2}{3} --> {4}".format(GREEN, CYAN, args[0],
|
||||
GREEN, ENDC + args[1]))
|
||||
|
@ -160,7 +180,7 @@ class SBoNetwork(object):
|
|||
try:
|
||||
choice = raw_input(" {0}Choose an option: {1}".format(GREY, ENDC))
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
return choice
|
||||
|
||||
|
@ -188,8 +208,6 @@ class SBoNetwork(object):
|
|||
if FAULT:
|
||||
print("\n{0}The package {1} {2}\n".format(RED, FAULT, ENDC))
|
||||
sys.exit()
|
||||
if not os.path.exists(build_path):
|
||||
os.mkdir(build_path)
|
||||
sources = []
|
||||
os.chdir(build_path)
|
||||
Download(build_path, self.sbo_dwn).start()
|
||||
|
|
|
@ -33,9 +33,9 @@ def slack_data(PACKAGES_TXT, step):
|
|||
for line in PACKAGES_TXT.splitlines():
|
||||
index += 1
|
||||
toolbar_width = status(index, toolbar_width, step)
|
||||
if line.startswith("PACKAGE NAME"):
|
||||
if line.startswith("PACKAGE NAME:"):
|
||||
name.append(line[15:].strip())
|
||||
if line.startswith("PACKAGE LOCATION"):
|
||||
if line.startswith("PACKAGE LOCATION:"):
|
||||
location.append(line[21:].strip())
|
||||
if line.startswith("PACKAGE SIZE (compressed): "):
|
||||
size.append(line[28:-2].strip())
|
||||
|
|
|
@ -25,12 +25,26 @@ import os
|
|||
import sys
|
||||
|
||||
from slpkg.sizes import units
|
||||
from slpkg.url_read import URL
|
||||
from slpkg.blacklist import BlackList
|
||||
from slpkg.init import Initialization
|
||||
from slpkg.splitting import split_package
|
||||
from slpkg.messages import pkg_not_found, template
|
||||
from slpkg.__metadata__ import slpkg_tmp, pkg_path
|
||||
from slpkg.colors import RED, GREEN, CYAN, YELLOW, GREY, ENDC
|
||||
from slpkg.messages import (
|
||||
pkg_not_found,
|
||||
template
|
||||
)
|
||||
from slpkg.colors import (
|
||||
RED,
|
||||
GREEN,
|
||||
CYAN,
|
||||
YELLOW,
|
||||
GREY,
|
||||
ENDC
|
||||
)
|
||||
from slpkg.__metadata__ import (
|
||||
pkg_path,
|
||||
lib_path,
|
||||
slpkg_tmp_packages
|
||||
)
|
||||
|
||||
from slpkg.pkg.find import find_package
|
||||
from slpkg.pkg.manager import PackageManager
|
||||
|
@ -46,20 +60,17 @@ class Slack(object):
|
|||
def __init__(self, slack_pkg, version):
|
||||
self.slack_pkg = slack_pkg
|
||||
self.version = version
|
||||
self.tmp_path = slpkg_tmp + "packages/"
|
||||
self.tmp_path = slpkg_tmp_packages
|
||||
Initialization().slack()
|
||||
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
||||
CYAN, self.slack_pkg, ENDC))
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
if not os.path.exists(slpkg_tmp):
|
||||
os.mkdir(slpkg_tmp)
|
||||
if not os.path.exists(self.tmp_path):
|
||||
os.mkdir(self.tmp_path)
|
||||
PACKAGES = URL(mirrors("PACKAGES.TXT", "", self.version)).reading()
|
||||
EXTRA = URL(mirrors("PACKAGES.TXT", "extra/", self.version)).reading()
|
||||
PASTURE = URL(mirrors("PACKAGES.TXT", "pasture/",
|
||||
self.version)).reading()
|
||||
self.PACKAGES_TXT = PACKAGES + EXTRA + PASTURE
|
||||
Initialization().slack()
|
||||
lib = lib_path + "slack_repo/PACKAGES.TXT"
|
||||
f = open(lib, "r")
|
||||
self.PACKAGES_TXT = f.read()
|
||||
f.close()
|
||||
|
||||
def start(self):
|
||||
'''
|
||||
|
@ -101,7 +112,7 @@ class Slack(object):
|
|||
else:
|
||||
pkg_not_found("", self.slack_pkg, "No matching", "\n")
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
|
||||
def store(self):
|
||||
|
|
|
@ -30,8 +30,15 @@ from slpkg.url_read import URL
|
|||
from slpkg.messages import template
|
||||
from slpkg.blacklist import BlackList
|
||||
from slpkg.splitting import split_package
|
||||
from slpkg.colors import GREY, YELLOW, ENDC
|
||||
from slpkg.__metadata__ import pkg_path, slpkg_tmp
|
||||
from slpkg.colors import (
|
||||
GREY,
|
||||
YELLOW,
|
||||
ENDC
|
||||
)
|
||||
from slpkg.__metadata__ import (
|
||||
pkg_path,
|
||||
slpkg_tmp_patches
|
||||
)
|
||||
|
||||
from slpkg.pkg.manager import PackageManager
|
||||
|
||||
|
@ -46,13 +53,9 @@ class Patches(object):
|
|||
|
||||
def __init__(self, version):
|
||||
self.version = version
|
||||
self.patch_path = slpkg_tmp + "patches/"
|
||||
self.patch_path = slpkg_tmp_patches
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
if not os.path.exists(slpkg_tmp):
|
||||
os.mkdir(slpkg_tmp)
|
||||
if not os.path.exists(self.patch_path):
|
||||
os.mkdir(self.patch_path)
|
||||
if version == "stable":
|
||||
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "patches/",
|
||||
version)).reading()
|
||||
|
@ -104,7 +107,7 @@ class Patches(object):
|
|||
print("\nSlackware{0} '{1}' v{2} distribution is up to "
|
||||
"date\n".format(slack_arch, self.version, slack_ver()))
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
|
||||
def store(self):
|
||||
|
|
|
@ -23,23 +23,14 @@
|
|||
|
||||
import os
|
||||
|
||||
from slpkg.__metadata__ import del_all
|
||||
|
||||
|
||||
def delete(path, packages):
|
||||
'''
|
||||
Remove downloaded packages
|
||||
'''
|
||||
read = raw_input("Removal downloaded packages [Y/n]? ")
|
||||
if read in ['y', 'Y']:
|
||||
if del_all == "on":
|
||||
for pkg in packages:
|
||||
os.remove(path + pkg)
|
||||
os.remove(path + pkg + ".asc")
|
||||
is_empty(path)
|
||||
else:
|
||||
is_empty(path)
|
||||
|
||||
|
||||
def is_empty(path):
|
||||
if not os.listdir(path):
|
||||
print("Packages removed")
|
||||
else:
|
||||
print("\nThere are packages in direcrory {0}\n".format(path))
|
||||
|
|
|
@ -24,7 +24,10 @@
|
|||
import sys
|
||||
import time
|
||||
|
||||
from colors import GREY, ENDC
|
||||
from colors import (
|
||||
GREY,
|
||||
ENDC
|
||||
)
|
||||
|
||||
|
||||
def status(index, width, step):
|
||||
|
|
|
@ -23,30 +23,55 @@
|
|||
|
||||
import sys
|
||||
|
||||
from slpkg.messages import template
|
||||
from slpkg.init import Initialization
|
||||
from slpkg.__metadata__ import pkg_path, sp
|
||||
from slpkg.colors import RED, GREEN, GREY, YELLOW, CYAN, ENDC
|
||||
from messages import template
|
||||
from init import Initialization
|
||||
from __metadata__ import (
|
||||
pkg_path,
|
||||
sp
|
||||
)
|
||||
from colors import (
|
||||
RED,
|
||||
GREEN,
|
||||
GREY,
|
||||
YELLOW,
|
||||
CYAN,
|
||||
ENDC
|
||||
)
|
||||
|
||||
from slpkg.pkg.find import find_package
|
||||
from pkg.find import find_package
|
||||
|
||||
from search import sbo_search_pkg
|
||||
from dependency import sbo_dependencies_pkg
|
||||
from sbo.search import sbo_search_pkg
|
||||
from sbo.dependency import sbo_dependencies_pkg
|
||||
|
||||
from others.search import search_pkg
|
||||
from others.dependency import dependencies_pkg
|
||||
|
||||
|
||||
def track_dep(name):
|
||||
def track_dep(name, repo):
|
||||
'''
|
||||
View tree of dependencies and also
|
||||
highlight packages with color green
|
||||
if allready installed and color red
|
||||
if not installed.
|
||||
'''
|
||||
init_repos = {
|
||||
'sbo': Initialization().sbo,
|
||||
'slack': Initialization().slack,
|
||||
'rlw': Initialization().rlw,
|
||||
'alien': Initialization().alien,
|
||||
'slacky': Initialization().slacky
|
||||
}
|
||||
init_repos[repo]()
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
Initialization().sbo()
|
||||
dependencies_list = sbo_dependencies_pkg(name)
|
||||
if repo == "sbo":
|
||||
dependencies_list = sbo_dependencies_pkg(name)
|
||||
find_pkg = sbo_search_pkg(name)
|
||||
else:
|
||||
dependencies_list = dependencies_pkg(name, repo)
|
||||
find_pkg = search_pkg(name, repo)
|
||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
||||
if sbo_search_pkg(name):
|
||||
if find_pkg:
|
||||
requires, dependencies = [], []
|
||||
# Create one list for all packages
|
||||
for pkg in dependencies_list:
|
||||
|
@ -59,7 +84,7 @@ def track_dep(name):
|
|||
if dependencies == []:
|
||||
dependencies = ["No dependencies"]
|
||||
pkg_len = len(name) + 24
|
||||
print # new line at start
|
||||
print("") # new line at start
|
||||
template(pkg_len)
|
||||
print("| Package {0}{1}{2} dependencies :".format(CYAN, name, ENDC))
|
||||
template(pkg_len)
|
||||
|
@ -75,6 +100,6 @@ def track_dep(name):
|
|||
else:
|
||||
print(" |")
|
||||
print(" {0}{1}: {2}{3}{4}".format("+--", index, RED, pkg, ENDC))
|
||||
print # new line at end
|
||||
print("") # new line at end
|
||||
else:
|
||||
print("\nNo package was found to match\n")
|
|
@ -38,8 +38,8 @@ class URL(object):
|
|||
f = urllib2.urlopen(self.link)
|
||||
return f.read()
|
||||
except urllib2.URLError:
|
||||
print ("\nslpkg: error: connection refused\n")
|
||||
print("\nslpkg: error: connection refused\n")
|
||||
sys.exit()
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
|
|
|
@ -21,7 +21,11 @@
|
|||
# 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 __metadata__ import __version__, __license__, __email__
|
||||
from __metadata__ import (
|
||||
__version__,
|
||||
__license__,
|
||||
__email__
|
||||
)
|
||||
|
||||
|
||||
def prog_version():
|
||||
|
|
Loading…
Add table
Reference in a new issue