updated for version 2.2.1

This commit is contained in:
Dimitris Zlatanidis 2015-02-10 22:08:21 +02:00
parent 7d49aabe9a
commit d566046de9
45 changed files with 0 additions and 3142 deletions

View file

@ -1,4 +1,3 @@
<<<<<<< HEAD
Version 2.2.1
6-2-2015
@ -13,8 +12,6 @@ Version 2.2.1
- Update option '-f' view installed packages.
- Update option '-l' view installed packages.
=======
>>>>>>> master
Version 2.2.0
08-1-2015

View file

@ -11,8 +11,4 @@ tail +13 CHECKSUMS.md5 | md5sum -c --quiet - | less
MD5 message digest Filename
74d79364aef2717c00eae3a37c0e7479 ./slpkg-2.1.5.tar.gz
<<<<<<< HEAD
b37d59524be1ce9ef1c4e13e91ceb763 ./slpkg-2.2.0.tar.gz
=======
f260b370dd9b5835e688061cb39287fe ./slpkg-2.2.0.tar.gz
>>>>>>> master

View file

@ -1,10 +1,6 @@
Metadata-Version: 1.1
Name: slpkg
<<<<<<< HEAD
Version: 2.1.x-dev
=======
Version: 2.2.0
>>>>>>> master
Author: dslackw
Author-email: d zlatanidis at gmail com
Maintainer: dslackw

View file

@ -11,15 +11,9 @@
Latest Release:
<<<<<<< HEAD
- Version: 2.2.1
- `Package <https://sourceforge.net/projects/slpkg/files/slpkg/binary/>`_
- `Source <https://github.com/dslackw/slpkg/archive/v2.2.1.tar.gz>`_
=======
- Version: 2.2.0
- `Package <https://sourceforge.net/projects/slpkg/files/slpkg/binary/>`_
- `Source <https://github.com/dslackw/slpkg/archive/v2.2.0.tar.gz>`_
>>>>>>> master
- `CHANGELOG <https://github.com/dslackw/slpkg/blob/master/CHANGELOG>`_
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png
@ -108,7 +102,6 @@ More features come ...
:target: https://github.com/dslackw/slpkg
<<<<<<< HEAD
Usage
-----
@ -137,8 +130,6 @@ Slpkg are supported version 'current' but it is minimal tests have been done on
release.
=======
>>>>>>> master
Features
--------
@ -167,11 +158,7 @@ Tutorial
--------
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png
<<<<<<< HEAD
:target: https://asciinema.org/a/16251
=======
:target: https://asciinema.org/a/14145
>>>>>>> master
Installation
@ -181,13 +168,8 @@ Untar the archive and run install.sh script:
.. code-block:: bash
<<<<<<< HEAD
$ tar xvf slpkg-2.2.1.tar.gz
$ cd slpkg-2.2.1
=======
$ tar xvf slpkg-2.2.0.tar.gz
$ cd slpkg-2.2.0
>>>>>>> master
$ ./install.sh
From SourceForge:
@ -209,26 +191,6 @@ In each slpkg upgrade should track the configuration files in the file '/etc/slp
new updates.
<<<<<<< HEAD
=======
Configuration files
-------------------
.. code-block:: bash
/etc/slpkg/slpkg.conf
General configuration of slpkg
/etc/slpkg/blacklist
List of packages to skip
/etc/slpkg/slackware-mirrors
List of Slackware Mirrors
/etc/slpkg/custom-repositories
List of custom repositories
>>>>>>> master
Slackware Current
-----------------
@ -239,18 +201,6 @@ For Slackware 'current' users must change the variable VERSION in '/etc/slpkg.co
$ slpkg -g --config=nano
<<<<<<< HEAD
=======
Testing
-------
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.
>>>>>>> master
Slackware Mirrors
-----------------
@ -259,7 +209,6 @@ to find the nearest one. If however for some reason this troublesome
please edit the file in '/etc/slpkg/slackware-mirrors'.
<<<<<<< HEAD
Configuration files
-------------------
@ -276,23 +225,6 @@ Configuration files
/etc/slpkg/custom-repositories
List of custom repositories
=======
Usage
-----
Need to run '# slpkg update' for the first time to synchronize the list of packages,
also every time you add a repository.
To add or remove repositories must edit the file '/etc/slpkg/slpkg.conf'.
Also it is good to update the list of packages by running the command '# slpkg update'
before proceeding to any installation or upgrade a new package.
Issues
------
Please report any bugs in `ISSUES <https://github.com/dslackw/slpkg/issues>`_
>>>>>>> master
Command Line Tool Usage
@ -300,11 +232,7 @@ Command Line Tool Usage
.. code-block:: bash
<<<<<<< HEAD
Slpkg is a user-friendly package manager for Slackware installations
=======
Utility for easy management packages in Slackware
>>>>>>> master
Commands:
update update all package lists
@ -323,17 +251,10 @@ Command Line Tool Usage
-q, --list, [package...] --add, --remove add, remove SBo packages in queue
-q, --build, --install, --build-install build, install packages from queue
-g, --config, --config=[editor] configuration file management
<<<<<<< HEAD
-l, [repository], --index, --installed list of repositories packages
-c, [repository] --upgrade check for updated packages
-s, [repository] [package...] download, build & install packages
-t, [repository] [package] package tracking dependencies
=======
-l, [repository], all list of installed packages
-c, [repository] --upgrade check for updated packages
-s, [repository] [package] download, build & install
-t, [repository] [package] tracking dependencies
>>>>>>> master
-p, [repository] [package], --color=[] print package description
-n, [package] view SBo packages through network
-f, [package...] find installed packages
@ -342,23 +263,14 @@ Command Line Tool Usage
-o, [package...] reinstall binary packages
-r, [package...] remove binary packages
-d, [package...] display the contents
<<<<<<< HEAD
=======
>>>>>>> master
Slpkg Examples
--------------
<<<<<<< HEAD
If you use slpkg for the first time will have to create
and update the package list. This command must be executed to update the
package lists:
=======
If you use slpkg for the first time will have to create
and update the package lists:
>>>>>>> master
.. code-block:: bash
@ -431,17 +343,11 @@ View information about the repositories:
Total uncompressed packages: 36.31 Gb
<<<<<<< HEAD
Installing packages from the repositories (supporting multi packages):
=======
Find packages from repository download,
build and install with all dependencies :
>>>>>>> master
.. code-block:: bash
$ slpkg -s sbo brasero
<<<<<<< HEAD
Reading package lists .....Done
Resolving dependencies ....Done
@ -474,55 +380,6 @@ build and install with all dependencies :
$ slpkg -s sbo brasero pylint bitfighter
Reading package lists ..........Done
Resolving dependencies ......Done
=======
Reading package lists ......Done
The following packages will be automatically installed or upgraded
with new version:
+==============================================================================
| Package Version Arch Repository
+==============================================================================
Installing:
brasero 3.11.3 x86_64 SBo
Installing for dependencies:
orc 0.4.19 x86_64 SBo
gstreamer1 1.2.2 x86_64 SBo
gst1-plugins-base 1.2.2 x86_64 SBo
gst1-plugins-bad 1.2.2 x86_64 SBo
libunique 1.1.6 x86_64 SBo
Installing summary
===============================================================================
Total 6 packages.
6 packages will be installed, 0 allready installed and 0 package
will be upgraded.
Would you like to continue [Y/n]? y
$ slpkg -s sbo fmpeg
Reading package lists ....Done
Packages with name matching [ fmpeg ]
+==============================================================================
| Package Version Arch Repository
+==============================================================================
Matching:
ffmpegthumbnailer 2.0.8 x86_64 SBo
ffmpeg 2.1.5 x86_64 SBo
ffmpeg2theora 0.29 x86_64 SBo
gst-ffmpeg 0.10.13 x86_64 SBo
Installing summary
===============================================================================
Total found 4 matching packages.
0 installed package and 4 uninstalled packages.
Install Slackware official packages:
>>>>>>> master
The following packages will be automatically installed or upgraded
with new version:
@ -603,7 +460,6 @@ Install Slackware official packages:
Reading package lists .........Done
Resolving dependencies .......Done
<<<<<<< HEAD
The following packages will be automatically installed or upgraded
with new version:
@ -661,27 +517,6 @@ Build packages and passing variables to the script:
$ slpkg -n ffmpeg
or
=======
Packages with name matching [ mozilla ]
Reading package lists ..............................Done
+==============================================================================
| Package Version Arch Build Repos Size
+==============================================================================
Installing:
mozilla-firefox 24.1.0esr x86_64 1 Slack 23524 K
mozilla-nss 3.15.2 x86_64 2 Slack 1592 K
mozilla-thunderbird 24.1.0 x86_64 1 Slack 24208 K
Installing summary
===============================================================================
Total 3 packages.
0 package will be installed, 3 will be upgraded and 0 will be resettled.
Need to get 48.17 Mb of archives.
After this process, 125.75 Mb of additional disk space will be used.
Would you like to continue [Y/n]?
>>>>>>> master
$ slpkg -a ffmpeg.tar.gz ffmpeg-2.1.5.tar.bz2
@ -710,16 +545,12 @@ and also displays installed packages:
|
+--5 libunique
<<<<<<< HEAD
=======
>>>>>>> master
Check if your packages is up to date:
.. code-block:: bash
$ slpkg -c sbo --upgrade
<<<<<<< HEAD
Checking ...................Done
Reading package lists ......Done
Resolving dependencies ...Done
@ -764,36 +595,9 @@ Check if your packages is up to date:
0 package will be installed, 1 will be upgraded and 0 will be reinstalled.
Need to get 1.53 Mb of archives.
After this process, 14.55 Mb of additional disk space will be used.
=======
Reading package lists ...Done
These packages need upgrading:
+==============================================================================
| Package New version Arch Repository
+==============================================================================
Upgrading:
six-1.7.1 1.7.3 x86_64 SBo
pysetuptools-3.4 3.6 x86_64 SBo
Jinja2-2.7.0 2.7.2 x86_64 SBo
pysed-0.3.0 0.3.1 x86_64 SBo
Pafy-0.3.56 0.3.58 x86_64 SBo
MarkupSafe-0.21 0.23 x86_64 SBo
pip-1.5.3 1.5.6 x86_64 SBo
colored-1.1.1 1.1.4 x86_64 SBo
Installing summary
===============================================================================
Total 8 packages will be upgraded and 0 package will be installed.
Would you like to continue [Y/n]?
Check if your Slackware distribution is up to date:
>>>>>>> master
Would you like to continue [Y/n]?
<<<<<<< HEAD
Check if your Slackware distribution is up to date.
This option works independently of the others i.e not need before updating the list of
@ -821,27 +625,6 @@ why always you can have updated your system:
Need to get 13.58 Mb of archives.
After this process, 76.10 Mb of additional disk space will be used.
=======
$ slpkg -c slack --upgrade
Reading package lists .......Done
These packages need upgrading:
+==============================================================================
| Package Version Arch Build Repos Size
+==============================================================================
Upgrading:
dhcpcd-6.0.5 6.0.5 x86_64 3 Slack 92 K
samba-4.1.0 4.1.11 x86_64 1 Slack 9928 K
xscreensaver-5.22 5.29 x86_64 1 Slack 3896 K
Installing summary
===============================================================================
Total 3 package will be upgrading.
Need to get 13.58 Mb of archives.
After this process, 76.10 Mb of additional disk space will be used.
>>>>>>> master
Would you like to continue [Y/n]?
View complete slackbuilds.org site in your terminal.
@ -870,10 +653,7 @@ Read fies, download, build or install:
Choose an option: _
<<<<<<< HEAD
=======
>>>>>>> master
Auto tool to build package:
.. code-block:: bash
@ -954,12 +734,8 @@ Auto tool to build package:
Total build time for package termcolor : 1 Sec
<<<<<<< HEAD
Upgrade, install packages like Slackware command '# upgradepkg --install-new':
=======
Upgrade, install package:
>>>>>>> master
.. code-block:: bash
@ -1012,7 +788,6 @@ Find installed packages:
[ installed ] - apr-util-1.5.3-x86_64-1_slack14.1
[ installed ] - xf86dgaproto-2.1-noarch-1
[ installed ] - xineramaproto-1.2.1-noarch-1
<<<<<<< HEAD
Total found 4 matcing packages
Size of installed packages 1.61 Mb
@ -1039,11 +814,6 @@ Find installed packages:
Total found 1 matching packages.
Size of installed packages 1.8 Mb.
=======
Total found 4 matcing packages
Size of installed packages 1.61 Mb
>>>>>>> master
Display the contents of the packages:
@ -1131,10 +901,7 @@ Remove packages:
| Package: termcolor removed
+==============================================================================
<<<<<<< HEAD
=======
>>>>>>> master
Remove packages with all dependencies:
(presupposes facility with the option 'slpkg -s <repository> <package>)
@ -1171,7 +938,6 @@ Remove packages with all dependencies:
| Package werkzeug removed
+==============================================================================
<<<<<<< HEAD
Use list from file foo.pkg like:
$ cat foo.pkg
@ -1190,9 +956,6 @@ Remove packages with all dependencies:
[ delete ] --> pylint-1.3.1-x86_64-1_SBo
Are you sure to remove 1 package [Y/n]?
=======
>>>>>>> master
Build and install packages that have added to the queue:
@ -1228,10 +991,7 @@ Build and install packages that have added to the queue:
$ slpkg -q --build-install (build and install)
<<<<<<< HEAD
=======
>>>>>>> master
Add packages in blacklist file manually from
/etc/slpkg/blacklist or with the following options:
@ -1287,7 +1047,6 @@ Man page it is available for full support:
Donate
<<<<<<< HEAD
------
If you feel satisfied with this project and want to thank me go
to `Slackware <https://store.slackware.com/cgi-bin/store/slackdonation>`_ and make a donation or visit the `store <https://store.slackware.com/cgi-bin/store>`_.
@ -1299,8 +1058,3 @@ Copyright
- Copyright © Dimitris Zlatanidis
- Slackware® is a Registered Trademark of Slackware Linux, Inc.
- Linux is a Registered Trademark of Linus Torvalds.
=======
--------
If you feel satisfied with this project and want to thank me go
to `Slackware <https://store.slackware.com/cgi-bin/store/slackdonation>`_ and make a donation or visit the `store <https://store.slackware.com/cgi-bin/store>`_.
>>>>>>> master

View file

@ -21,13 +21,6 @@ dependencies not included in the repository. This can be checked if you run the
'slpkg -t slackr <package>'. (Example: noticed that the package 'digikam' indicate
dependence 'ffmpeg' but that is not available from the repository itself).
<<<<<<< HEAD
=======
Slackonly (slonly) repository contains no dependencies on file PACKAGES.TXT and this makes
it difficult to automatically resolve dependencies and in the file PACKAGES.TXT and some
lines with 'PACKAGE NAME:' there is no package so 'slpkg' can not find package.
>>>>>>> master
Studioware (studio), Alien's ktown (ktown), Alien's multilib (multi), Slacke E17 and E18
and Alien's restricted repository has no reference dependencies.

View file

@ -33,11 +33,7 @@ REPOSITORIES=slack,sbo
# Build directory for repository slackbuilds.org. In this directory
# downloaded sources and scripts for building.
<<<<<<< HEAD
BUILD_PATH=/tmp/slpkg/build/
=======
BUILD=/tmp/slpkg/build/
>>>>>>> master
# If SBO_CHECK_MD5 is 'on' the system will check all downloaded
# sources.
@ -79,8 +75,4 @@ DEL_DEPS=off
USE_COLORS=on
# Wget [OPTION]. Pass wget options. Default is '-c -N'.
<<<<<<< HEAD
WGET_OPTIONS=-c -N
=======
WGET_OPTION=-c -N
>>>>>>> master

View file

@ -21,11 +21,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=slpkg
<<<<<<< HEAD
VERSION=${VERSION:-2.2.1}
=======
VERSION=${VERSION:-2.2.0}
>>>>>>> master
TAG=${TAG:-_dsw}
# Installation script.

View file

@ -26,15 +26,9 @@ Usage: slpkg Commands:
[-q --list, [...] --add, --remove]
[-q --build, --install, --build-install]
[-g --config, --config=[editor]]
<<<<<<< HEAD
[-l [repository], --index, --installed]
[-c [repository] --upgrade]
[-s [repository] [package...]
=======
[-l all, official, non-official, --index]
[-c [repository] --upgrade]
[-s [repository] [package]
>>>>>>> master
[-t [repository] [package]
[-p [repository] [package], --color=[]]
[-n] [-f [...]] [-i [...]] [-u [...]]
@ -52,13 +46,8 @@ Commands:
re-create recreate package lists
repo-add [repository name] [URL] add custom repository
repo-remove [repository] remove custom repository
<<<<<<< HEAD
repo-list list all repositories
repo-info [repository] repository information
=======
repolist list all repositories
repoinfo [repository] repository information
>>>>>>> master
update slpkg check and update slpkg
Optional arguments:
@ -69,17 +58,10 @@ Optional arguments:
-q, --list, [package...] --add, --remove add, remove SBo packages in queue
-q, --build, --install, --build-install build, install packages from queue
-g, --config, --config=<editor> configuration file management
<<<<<<< HEAD
-l, [repository], --index, --installed list of repositories packages
-c, [repository] --upgrade check for updated packages
-s, [repository] [package...] download, build & install packages
-t, [repository] [package] package tracking dependencies
=======
-l, all, official, non-official, --index list of installed packages
-c, [repository] --upgrade check for updated packages
-s, [repository] [package] download, build & install
-t, [repository] [package] tracking dependencies
>>>>>>> master
-p, [repository] [package], --color=[] print package description
-n, [package] view SBo packages through network
-f, [package...] find installed packages
@ -89,7 +71,6 @@ Optional arguments:
-r, [package...] remove binary packages
-d, [package...] display the contents
<<<<<<< HEAD
.SH PACKAGE FILE
Instead of [package...] you can create file with the suffix '.pkg' which was to
@ -112,8 +93,6 @@ contain the packages you want to work like:
# slpkg -r foo.pkg
=======
>>>>>>> master
.SH DEFAULT REPOSITORIES
slackware.com = 'slack'
SlackBuilds.org = 'sbo'
@ -188,23 +167,16 @@ You can check for new versions and update slpkg itself.
\fBslpkg\fP \fB-a\fP <\fIscript\fP> <\fIsources\fP>
.PP
With this argument, build slackware package from source quickly and easy.
<<<<<<< HEAD
If you want to pass variables to the script exported as:
# export SLPKG_FFMPEG_X264=yes SLPKG_FFMPEG_LAME=yes
.SS -b , add, remove, view packages in blacklist
\fBslpkg\fP \fB-b\fP \fB--list\fP, <\fIpackages\fP> \fB--add\fP, \fB--remove\fP
=======
.SS -b , add, remove, view packages in blacklist
\fBslpkg\fP \fB-b\fP \fB--list\fP <\fIpackages\fP> \fB--add\fP \fB--remove\fP
>>>>>>> master
.PP
List, add or remove packages from blacklist file. The settings here affect
all repositories.
.SS -q , add, remove, view packages in queue
<<<<<<< HEAD
\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
@ -239,39 +211,6 @@ and why always you can have updated your system.
Installs or upgrade packages from the repositories with automatically resolving all
dependencies of the package. Sometimes to install a package have to pass part of the
version of the package as 'slpkg -s alien ffmpeg-2.4.3'.
=======
\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)
Build or install or build and install packages are queued.
.SS -g , configuration file management
\fBslpkg\fP \fB--config\fP \fB--config=[editor]\fP
.PP
Print configuration file or edit with editor.
.SS -l , list of installed packages
\fBslpkg\fP \fB-l\fP <\fIall\fP> \fIofficial\fP \fInon-official\fP \fI--index\fP
.PP
List of installed packages by category official or non-official. The repository 'slack' must
be enabled to work properly 'official' and 'non-official' lists.
.SS -c , check if your packages is up to date
\fBslpkg\fP \fB-c\fP <\fIrepository\fP> \fI--upgrade\f
.PP
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. Sometimes to install a package have to pass part of the version of the
package as 'slpkg -s alien ffmpeg-2.4.3'.
>>>>>>> master
.SS -t , tracking dependencies
\fBslpkg\fP \fB-t\fP <\fIrepository\fP> <\fIname of package\fP>
@ -280,7 +219,6 @@ Tracking all dependencies of that package.
The sequence shown is that you must follow to correctly install package.
.SS -p , print packages description
<<<<<<< HEAD
\fBslpkg\fP \fB-p\fP <\fIrepository\fP> <\fIname of package\fP>, \fI--color=\fP
.PP
Print package description with color. Available colors: red, green, yellow, cyan, grey
@ -296,22 +234,6 @@ Example you can view all installed sbo packages like '# slpkg -f _SBo'.
.PP
View complete slackbuilds.org site in your terminal. Read fies, download,
build or install.
=======
\fBslpkg\fP \fB-p\fP <\fIrepository\fP> <\fIname of package\fP> \fI--color=\fP
.PP
Print package description with color. Available colors: red, green, yellow, cyan, grey
.SS -f find packages
\fBslpkg\fP \fB-f\fP <\fIname of packages\fP>
.PP
Find installed packages with view total file size.
.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)
>>>>>>> master
.SS -i , install binary packages
\fBslpkg\fP \fB-i\fP <\fIpackages.t?z\fP>

View file

@ -1,11 +1,6 @@
# Python 2.7+
# GNU wget
<<<<<<< HEAD
# GNU coreutils
# Slackware x86
# Slackware x86_64
=======
# Slackware 32 x86
# Slackware 64 x86_64
>>>>>>> master
# Slackware current

View file

@ -26,15 +26,7 @@ import sys
import gzip
import shutil
<<<<<<< HEAD
from slpkg.__metadata__ import MetaData as _m
=======
from slpkg.__metadata__ import (
__version__,
__email__,
__author__
)
>>>>>>> master
from slpkg.md5sum import md5
@ -46,7 +38,6 @@ except ImportError:
setup(
name="slpkg",
packages=["slpkg", "slpkg/sbo", "slpkg/pkg", "slpkg/slack",
<<<<<<< HEAD
"slpkg/binary"],
scripts=["bin/slpkg"],
version=_m.__version__,
@ -55,16 +46,6 @@ setup(
"view", "slackpkg", "tool", "build"],
author=_m.__author__,
author_email=_m.__email__,
=======
"slpkg/others"],
scripts=["bin/slpkg"],
version=__version__,
description="Python tool to manage Slackware packages",
keywords=["slackware", "slpkg", "upgrade", "install", "remove",
"view", "slackpkg", "tool", "build"],
author=__author__,
author_email=__email__,
>>>>>>> master
url="https://github.com/dslackw/slpkg",
package_data={"": ["LICENSE", "README.rst", "CHANGELOG"]},
classifiers=[
@ -101,17 +82,12 @@ if "install" in sys.argv:
shutil.copy2(gzip_man, man_path)
os.chmod(man_path, int("444", 8))
<<<<<<< HEAD
=======
conf_path = "/etc/slpkg/"
>>>>>>> master
conf_file = [
'conf/slpkg.conf',
'conf/blacklist',
'conf/slackware-mirrors',
'conf/custom-repositories'
]
<<<<<<< HEAD
if not os.path.exists(_m.conf_path):
os.system("mkdir -p {0}".format(_m.conf_path))
shutil.copy2(conf_file[0], _m.conf_path + conf_file[0])
@ -125,17 +101,3 @@ if "install" in sys.argv:
shutil.copy2(conf, _m.conf_path + filename + ".new")
else:
shutil.copy2(conf, _m.conf_path)
=======
if not os.path.exists(conf_path):
os.system("mkdir -p {0}".format(conf_path))
for conf in conf_file:
filename = conf.split("/")[-1]
print("Installing '{0}' file".format(filename))
if os.path.isfile(conf_path + filename):
old = md5(conf_path + filename)
new = md5(conf)
if old != new:
shutil.copy2(conf, conf_path + filename + ".new")
else:
shutil.copy2(conf, conf_path)
>>>>>>> master

View file

@ -8,11 +8,7 @@ config() {
fi
}
<<<<<<< HEAD
CONFIGS="blacklist slackware-mirrors custom-repositories"
=======
CONFIGS="slpkg.conf blacklist slackware-mirrors custom-repositories"
>>>>>>> master
for file in $CONFIGS; do
config etc/slpkg/${file}.new
done

View file

@ -23,11 +23,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=slpkg
<<<<<<< HEAD
VERSION=${VERSION:-2.2.1}
=======
VERSION=${VERSION:-2.2.0}
>>>>>>> master
BUILD=${BUILD:-1}
TAG=${TAG:-_dsw}
@ -83,12 +79,8 @@ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | gr
mkdir -p $PKG/etc/slpkg
# install configurations files
<<<<<<< HEAD
install -D -m0644 conf/${PRGNAM}.conf $PKG/etc/slpkg/${PRGNAM}.conf
CONFIGS="blacklist slackware-mirrors custom-repositories"
=======
CONFIGS="slpkg.conf blacklist slackware-mirrors custom-repositories"
>>>>>>> master
for file in $CONFIGS; do
install -D -m0644 conf/$file $PKG/etc/slpkg/${file}.new
done

View file

@ -1,5 +1 @@
<<<<<<< HEAD
# [ slpkg ] directory
=======
from main import *
>>>>>>> master

View file

@ -23,7 +23,6 @@
import os
<<<<<<< HEAD
def remove_repositories(repositories, default_repositories):
'''
@ -37,45 +36,6 @@ def remove_repositories(repositories, default_repositories):
def update_repositories(repositories, conf_path):
=======
__all__ = "slpkg"
__author__ = "dslackw"
__version_info__ = (2, 2, 0)
__version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"
# Default configuration values
slack_rel = "stable"
# Configuration path
conf_path = "/etc/{0}/".format(__all__)
repositories = [
'slack',
'sbo',
'rlw',
'alien',
'slacky',
'studio',
'slackr',
'slonly',
'ktown{latest}',
'multi',
'slacke{18}',
'salix',
'slackl',
'rested'
]
default_repositories = repositories[8] = 'ktown'
default_repositories = repositories[10] = 'slacke'
default_repositories = repositories
def update_repositories(repositories):
>>>>>>> master
'''
Upadate with user custom repositories
'''
@ -85,15 +45,9 @@ def update_repositories(repositories):
repositories_list = f.read()
f.close()
for line in repositories_list.splitlines():
<<<<<<< HEAD
line = line.lstrip()
if line and not line.startswith("#"):
repositories.append(line.split()[0])
=======
line = line.lstrip()
if line and not line.startswith("#"):
repositories.append(line.split()[0])
>>>>>>> master
return repositories
@ -120,7 +74,6 @@ def slacke_repo(repositories):
repositories[i] = 'slacke'
return sub
<<<<<<< HEAD
class MetaData(object):
@ -267,104 +220,3 @@ class MetaData(object):
output = tmp
if not output.endswith('/'):
output = output + '/'
=======
tmp = "/tmp/"
tmp_path = "{0}{1}/".format(tmp, __all__)
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"
default_answer = "n"
remove_deps_answer = "n"
skip_unst = "n"
del_deps = "on"
use_colors = "on"
wget_option = '-c -N'
if os.path.isfile("/etc/slpkg/slpkg.conf"):
f = open("/etc/slpkg/slpkg.conf", "r")
conf = f.read()
f.close()
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("REPOSITORIES"):
repositories = line[13:].strip().split(",")
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()
if line.startswith("DEFAULT_ANSWER"):
default_answer = line[15:].strip()
if line.startswith("REMOVE_DEPS_ANSWER"):
remove_deps_answer = line[19:].strip()
if line.startswith("SKIP_UNST"):
skip_unst = line[10:].strip()
if line.startswith("DEL_DEPS"):
del_deps = line[9:].strip()
if line.startswith("USE_COLORS"):
use_colors = line[11:].strip()
if line.startswith("WGET_OPTION"):
wget_option = line[12:].strip()
ktown_kde_repo = ktown_repo(repositories)
slacke_sub_repo = slacke_repo(repositories)
update_repositories(repositories)
color = {
'RED': '\x1b[31m',
'GREEN': '\x1b[32m',
'YELLOW': '\x1b[33m',
'CYAN': '\x1b[36m',
'GREY': '\x1b[38;5;247m',
'ENDC': '\x1b[0m'
}
if use_colors == "off":
color = {
'RED': '',
'GREEN': '',
'YELLOW': '',
'CYAN': '',
'GREY': '',
'ENDC': ''
}
CHECKSUMS_link = ("https://raw.githubusercontent.com/{0}/{1}/"
"master/CHECKSUMS.md5".format(__author__, __all__))
# file spacer
sp = "-"
# current path
path = os.getcwd() + "/"
# library path
lib_path = "/var/lib/slpkg/"
# log path
log_path = "/var/log/slpkg/"
# packages log files path
pkg_path = "/var/log/packages/"
# computer architecture
arch = os.uname()[4]
>>>>>>> master

View file

@ -24,23 +24,12 @@
import sys
from repolist import RepoList
<<<<<<< HEAD
from __metadata__ import MetaData as _m
=======
from __metadata__ import (
__version__,
repositories
)
>>>>>>> master
def options():
arguments = [
<<<<<<< HEAD
"\nslpkg - version {0}\n".format(_m.__version__),
=======
"\nslpkg - version {0}\n".format(__version__),
>>>>>>> master
"Slpkg is a user-friendly package manager for Slackware "
"installations\n",
"Commands:",
@ -65,7 +54,6 @@ def options():
"from queue",
" -g, --config, --config=[editor] configuration file "
"management",
<<<<<<< HEAD
" -l, [repository], --index, --installed list of repositories "
"packages",
" -c, [repository] --upgrade check for updated "
@ -74,14 +62,6 @@ def options():
"packages",
" -t, [repository] [package] package tracking "
"dependencies",
=======
" -l, all, official, non-official, --index list of installed "
"packages",
" -c, [repository] --upgrade check for updated "
"packages",
" -s, [repository] [package] download, build & install",
" -t, [repository] [package] tracking dependencies",
>>>>>>> master
" -p, [repository] [package], --color=[] print package description",
" -n, [package] view SBo packages "
"through network",
@ -99,11 +79,7 @@ def options():
def usage(repo):
error_repo = ""
<<<<<<< HEAD
if repo and repo not in _m.repositories:
=======
if repo and repo not in repositories:
>>>>>>> master
all_repos = RepoList().all_repos
del RepoList().all_repos
if repo in all_repos:
@ -113,11 +89,7 @@ def usage(repo):
error_repo = ("slpkg: error: repository '{0}' does not exist"
"\n".format(repo))
view = [
<<<<<<< HEAD
"slpkg - version {0}\n".format(_m.__version__),
=======
"slpkg - version {0}\n".format(__version__),
>>>>>>> master
"Usage: slpkg Commands:",
" [update] [re-create] [repo-add [repository name] [URL]]",
" [repo-remove [repository]] [repo-list]",
@ -128,15 +100,9 @@ def usage(repo):
" [-q --list, [...] --add, --remove]",
" [-q --build, --install, --build-install]",
" [-g --config, --config=[editor]]",
<<<<<<< HEAD
" [-l [repository], --index, --installed]",
" [-c [repository] --upgrade]",
" [-s [repository] [package...]",
=======
" [-l all, official, non-official, --index]",
" [-c [repository] --upgrade]",
" [-s [repository] [package]",
>>>>>>> master
" [-t [repository] [package]",
" [-p [repository] [package], --color=[]]",
" [-n] [-f [...]] [-i [...]] [-u [...]]",

View file

@ -21,12 +21,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
<<<<<<< HEAD
from utils import Utils
from __metadata__ import MetaData as _m
=======
from __metadata__ import color
>>>>>>> master
class BlackList(object):
@ -37,13 +33,7 @@ class BlackList(object):
def __init__(self):
self.quit = False
self.blackfile = "/etc/slpkg/blacklist"
<<<<<<< HEAD
self.black_conf = Utils().read_file(self.blackfile)
=======
f = open(self.blackfile, "r")
self.black_conf = f.read()
f.close()
>>>>>>> master
def packages(self):
'''
@ -64,12 +54,8 @@ class BlackList(object):
print("\nPackages in blacklist:\n")
for black in self.packages():
if black:
<<<<<<< HEAD
print("{0}{1}{2}".format(_m.color['GREEN'], black,
_m.color['ENDC']))
=======
print("{0}{1}{2}".format(color['GREEN'], black, color['ENDC']))
>>>>>>> master
self.quit = True
if self.quit:
print("") # new line at exit
@ -84,13 +70,8 @@ class BlackList(object):
with open(self.blackfile, "a") as black_conf:
for pkg in pkgs:
if pkg not in blacklist:
<<<<<<< HEAD
print("{0}{1}{2}".format(_m.color['GREEN'], pkg,
_m.color['ENDC']))
=======
print("{0}{1}{2}".format(color['GREEN'], pkg,
color['ENDC']))
>>>>>>> master
black_conf.write(pkg + "\n")
self.quit = True
black_conf.close()
@ -107,12 +88,8 @@ class BlackList(object):
if line not in pkgs:
remove.write(line + "\n")
else:
<<<<<<< HEAD
print("{0}{1}{2}".format(_m.color['RED'], line,
_m.color['ENDC']))
=======
print("{0}{1}{2}".format(color['RED'], line, color['ENDC']))
>>>>>>> master
self.quit = True
remove.close()
if self.quit:

View file

@ -24,23 +24,14 @@
import sys
from md5sum import md5
<<<<<<< HEAD
from messages import Msg
from __metadata__ import MetaData as _m
=======
from messages import template
from __metadata__ import (
color,
default_answer
)
>>>>>>> master
def check_md5(pkg_md5, src_file):
'''
MD5 Checksum
'''
<<<<<<< HEAD
print('')
md5s = md5(src_file)
if pkg_md5 != md5s:
@ -60,28 +51,3 @@ def check_md5(pkg_md5, src_file):
src_file.split("/")[-1], _m.color['GREEN'], _m.color['ENDC']))
Msg().template(78)
print('') # new line after pass checksum
=======
md5s = md5(src_file)
if pkg_md5 != md5s:
template(78)
print("| MD5SUM check for {0} [ {1}FAILED{2} ]".format(
src_file.split("/")[-1], color['RED'], color['ENDC']))
template(78)
print("| Expected: {0}".format(md5s))
print("| Found: {0}".format(pkg_md5))
template(78)
if default_answer == "y":
answer = default_answer
else:
answer = raw_input("Would you like to continue [Y/n]? ")
if answer in ['y', 'Y']:
print("") # new line after answer
else:
sys.exit(0)
else:
template(78)
print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format(
src_file.split("/")[-1], color['GREEN'], color['ENDC']))
template(78)
print("") # new line after pass checksum
>>>>>>> master

View file

@ -23,12 +23,8 @@
import subprocess
<<<<<<< HEAD
from utils import Utils
from __metadata__ import MetaData as _m
=======
from __metadata__ import color
>>>>>>> master
class Config(object):
@ -44,11 +40,7 @@ class Config(object):
conf_args = [
'VERSION',
'REPOSITORIES',
<<<<<<< HEAD
'BUILD_PATH',
=======
'BUILD',
>>>>>>> master
'SBO_CHECK_MD5',
'PACKAGES',
'PATCHES',
@ -60,27 +52,15 @@ class Config(object):
'SKIP_UNST',
'DEL_DEPS',
'USE_COLORS',
<<<<<<< HEAD
'WGET_OPTIONS'
]
read_conf = Utils().read_file(self.config_file)
=======
'WGET_OPTION'
]
f = open(self.config_file, "r")
read_conf = f.read()
f.close()
>>>>>>> master
for line in read_conf.splitlines():
if not line.startswith("#") and line.split("=")[0] in conf_args:
print(line)
else:
<<<<<<< HEAD
print("{0}{1}{2}".format(_m.color['CYAN'], line,
_m.color['ENDC']))
=======
print("{0}{1}{2}".format(color['CYAN'], line, color['ENDC']))
>>>>>>> master
print("") # new line at end
def edit(self, editor):

View file

@ -22,18 +22,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
<<<<<<< HEAD
from utils import Utils
from messages import Msg
from __metadata__ import MetaData as _m
=======
from messages import pkg_not_found
from __metadata__ import (
lib_path,
repositories,
color,
)
>>>>>>> master
class PkgDesc(object):
@ -45,7 +36,6 @@ class PkgDesc(object):
self.COLOR = ""
self.lib = ""
color_text = {
<<<<<<< HEAD
'red': _m.color['RED'],
'green': _m.color['GREEN'],
'yellow': _m.color['YELLOW'],
@ -62,34 +52,13 @@ class PkgDesc(object):
def view(self):
PACKAGES_TXT = Utils().read_file(self.lib)
=======
'red': color['RED'],
'green': color['GREEN'],
'yellow': color['YELLOW'],
'cyan': color['CYAN'],
'grey': color['GREY'],
'': ''
}
self.COLOR = color_text[self.paint]
if self.repo in repositories:
self.lib = lib_path + '{0}_repo/PACKAGES.TXT'.format(self.repo)
def view(self):
f = open(self.lib, "r")
PACKAGES_TXT = f.read()
f.close()
>>>>>>> master
print("") # new line at start
count = 0
if self.repo != "sbo":
for line in PACKAGES_TXT.splitlines():
if line.startswith(self.name + ":"):
print(self.COLOR + line[len(self.name) + 1:] +
<<<<<<< HEAD
_m.color['ENDC'])
=======
color['ENDC'])
>>>>>>> master
count += 1
if count == 11:
break
@ -98,14 +67,8 @@ class PkgDesc(object):
if (line.startswith("SLACKBUILD SHORT DESCRIPTION: "
+ self.name + " (")):
count += 1
<<<<<<< HEAD
print(self.COLOR + line[31:] + _m.color['ENDC'])
if count == 0:
Msg().pkg_not_found("", self.name, "No matching", "\n")
=======
print(self.COLOR + line[31:] + color['ENDC'])
if count == 0:
pkg_not_found("", self.name, "No matching", "\n")
>>>>>>> master
else:
print("") # new line at end

View file

@ -21,22 +21,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
<<<<<<< HEAD
import os
import sys
import subprocess
from messages import Msg
from __metadata__ import MetaData as _m
=======
import sys
import subprocess
from __metadata__ import (
color,
wget_option
)
>>>>>>> master
class Download(object):
@ -44,15 +34,11 @@ class Download(object):
def __init__(self, path, url):
self.path = path
self.url = url
<<<<<<< HEAD
self.wget_options = _m.wget_options
=======
>>>>>>> master
def start(self):
'''
Download files usign wget.
<<<<<<< HEAD
'''
for dwn in self.url:
self.file_name = dwn.split("/")[-1]
@ -77,19 +63,3 @@ class Download(object):
print('')
if not Msg().answer() in ['y', 'Y']:
sys.exit(0)
=======
Check if file already download and skip or continue
download if before stoped.
'''
for dwn in self.url:
file_name = dwn.split("/")[-1]
print("\n[ {0}Download{1} ] -->{1} {2}\n".format(color['GREEN'],
color['ENDC'],
file_name))
try:
subprocess.call("wget {0} --directory-prefix={1} {2}".format(
wget_option, self.path, dwn), shell=True)
except KeyboardInterrupt:
print # new line at cancel
sys.exit(0)
>>>>>>> master

View file

@ -24,15 +24,7 @@
from slack.mirrors import mirrors
from url_read import URL
<<<<<<< HEAD
from __metadata__ import MetaData as _m
=======
from __metadata__ import (
CHECKSUMS_link,
lib_path,
slack_rel
)
>>>>>>> master
def pkg_checksum(binary, repo):
@ -40,7 +32,6 @@ def pkg_checksum(binary, repo):
Return checksum from CHECKSUMS.md5 file by repository
'''
md5 = "None"
<<<<<<< HEAD
if repo == "slack_patches" and _m.slack_rel == "stable":
CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "patches/")).reading()
elif repo == "slack_patches" and _m.slack_rel == "current":
@ -49,24 +40,10 @@ def pkg_checksum(binary, repo):
CHECKSUMS_md5 = URL(_m.CHECKSUMS_link).reading()
else:
lib = '{0}{1}_repo/CHECKSUMS.md5'.format(_m.lib_path, repo)
=======
if repo == "slack_patches" and slack_rel == "stable":
CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "patches/")).reading()
elif repo == "slack_patches" and slack_rel == "current":
CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "")).reading()
elif repo == "slpkg":
CHECKSUMS_md5 = URL(CHECKSUMS_link).reading()
else:
lib = '{0}{1}_repo/CHECKSUMS.md5'.format(lib_path, repo)
>>>>>>> master
f = open(lib, "r")
CHECKSUMS_md5 = f.read()
f.close()
for line in CHECKSUMS_md5.splitlines():
<<<<<<< HEAD
if line.split('/')[-1] == binary:
=======
if line.endswith(binary):
>>>>>>> master
md5 = line.split()[0]
return md5

View file

@ -28,23 +28,7 @@ from url_read import URL
from toolbar import status
from repositories import Repo
from file_size import FileSize
<<<<<<< HEAD
from __metadata__ import MetaData as _m
=======
from __metadata__ import (
color,
log_path,
lib_path,
tmp_path,
conf_path,
build_path,
repositories,
slpkg_tmp_packages,
slpkg_tmp_patches,
slacke_sub_repo,
default_repositories
)
>>>>>>> master
from slack.mirrors import mirrors
from slack.slack_version import slack_ver
@ -53,7 +37,6 @@ from slack.slack_version import slack_ver
class Initialization(object):
def __init__(self):
<<<<<<< HEAD
self.conf_path = _m.conf_path
self.log_path = _m.log_path
self.lib_path = _m.lib_path
@ -75,39 +58,16 @@ class Initialization(object):
os.makedirs(self.slpkg_tmp_packages)
if not os.path.exists(self.slpkg_tmp_patches):
os.makedirs(self.slpkg_tmp_patches)
=======
if not os.path.exists(conf_path):
os.mkdir(conf_path)
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_path):
os.mkdir(tmp_path)
if not os.path.exists(build_path):
os.makedirs(build_path)
if not os.path.exists(slpkg_tmp_packages):
os.makedirs(slpkg_tmp_packages)
if not os.path.exists(slpkg_tmp_patches):
os.makedirs(slpkg_tmp_patches)
>>>>>>> master
def custom(self, name):
'''
Creating user select repository local library
'''
repo = Repo().custom_repository()[name]
<<<<<<< HEAD
log = self.log_path + name + "/"
lib = self.lib_path + "{0}_repo/".format(name)
lib_file = "PACKAGES.TXT"
# lst_file = ""
=======
log = log_path + name + "/"
lib = lib_path + "{0}_repo/".format(name)
lib_file = "PACKAGES.TXT"
lst_file = ""
>>>>>>> master
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
@ -115,39 +75,23 @@ class Initialization(object):
if not os.path.exists(lib):
os.mkdir(lib)
packages_txt = "{0}{1}".format(repo, lib_file)
<<<<<<< HEAD
# filelist_txt = ""
=======
filelist_txt = ""
>>>>>>> master
checksums_md5 = "{0}{1}".format(repo, md5_file)
changelog_txt = "{0}{1}".format(repo, log_file)
self.write(lib, lib_file, packages_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file,
<<<<<<< HEAD
packages_txt, md5_file, checksums_md5, '', '')
=======
packages_txt, md5_file, checksums_md5, lst_file,
filelist_txt)
>>>>>>> master
def slack(self):
'''
Creating slack local libraries
'''
<<<<<<< HEAD
log = self.log_path + "slack/"
lib = self.lib_path + "slack_repo/"
lib_file = "PACKAGES.TXT"
# lst_file = ""
=======
log = log_path + "slack/"
lib = lib_path + "slack_repo/"
lib_file = "PACKAGES.TXT"
lst_file = ""
>>>>>>> master
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
@ -155,51 +99,29 @@ class Initialization(object):
if not os.path.exists(lib):
os.mkdir(lib)
packages = mirrors(lib_file, "")
<<<<<<< HEAD
# filelist_txt = ""
=======
filelist_txt = ""
>>>>>>> master
pkg_checksums = mirrors(md5_file, "")
extra = mirrors(lib_file, "extra/")
ext_checksums = mirrors(md5_file, "extra/")
pasture = mirrors(lib_file, "pasture/")
pas_checksums = mirrors(md5_file, "pasture/")
<<<<<<< HEAD
packages_txt = ("{0} {1} {2}".format(packages, extra, pasture))
checksums_md5 = ("{0} {1} {2}".format(pkg_checksums, ext_checksums,
pas_checksums))
=======
patches_txt = mirrors(lib_file, "patches/")
patches_md5 = mirrors(md5_file, "patches/")
packages_txt = ("{0} {1} {2} {3}".format(packages, extra, pasture,
patches_txt))
checksums_md5 = ("{0} {1} {2} {3}".format(pkg_checksums, ext_checksums,
pas_checksums, patches_md5))
>>>>>>> master
changelog_txt = mirrors(log_file, "")
self.write(lib, lib_file, packages_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
<<<<<<< HEAD
md5_file, checksums_md5, '', '')
=======
md5_file, checksums_md5, lst_file, filelist_txt)
>>>>>>> master
def sbo(self):
'''
Creating sbo local library
'''
repo = Repo().sbo()
<<<<<<< HEAD
log = self.log_path + "sbo/"
lib = self.lib_path + "sbo_repo/"
=======
log = log_path + "sbo/"
lib = lib_path + "sbo_repo/"
>>>>>>> master
lib_file = "SLACKBUILDS.TXT"
lst_file = ""
md5_file = ""
@ -222,17 +144,10 @@ class Initialization(object):
Creating rlw local library
'''
repo = Repo().rlw()
<<<<<<< HEAD
log = self.log_path + "rlw/"
lib = self.lib_path + "rlw_repo/"
lib_file = "PACKAGES.TXT"
# lst_file = ""
=======
log = log_path + "rlw/"
lib = lib_path + "rlw_repo/"
lib_file = "PACKAGES.TXT"
lst_file = ""
>>>>>>> master
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
@ -240,39 +155,24 @@ class Initialization(object):
if not os.path.exists(lib):
os.mkdir(lib)
packages_txt = "{0}{1}/{2}".format(repo, slack_ver(), lib_file)
<<<<<<< HEAD
# filelist_txt = ""
=======
filelist_txt = ""
>>>>>>> master
checksums_md5 = "{0}{1}/{2}".format(repo, slack_ver(), md5_file)
changelog_txt = "{0}{1}/{2}".format(repo, slack_ver(), log_file)
self.write(lib, lib_file, packages_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
<<<<<<< HEAD
md5_file, checksums_md5, '', '')
=======
md5_file, checksums_md5, lst_file, filelist_txt)
>>>>>>> master
def alien(self):
'''
Creating alien local library
'''
repo = Repo().alien()
<<<<<<< HEAD
log = self.log_path + "alien/"
lib = self.lib_path + "alien_repo/"
lib_file = "PACKAGES.TXT"
# lst_file = ""
=======
log = log_path + "alien/"
lib = lib_path + "alien_repo/"
lib_file = "PACKAGES.TXT"
lst_file = ""
>>>>>>> master
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
@ -280,22 +180,14 @@ class Initialization(object):
if not os.path.exists(lib):
os.mkdir(lib)
packages_txt = "{0}{1}".format(repo, lib_file)
<<<<<<< HEAD
# filelist_txt = ""
=======
filelist_txt = ""
>>>>>>> master
checksums_md5 = "{0}{1}".format(repo, md5_file)
changelog_txt = "{0}{1}".format(repo, log_file)
self.write(lib, lib_file, packages_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
<<<<<<< HEAD
md5_file, checksums_md5, '', '')
=======
md5_file, checksums_md5, lst_file, filelist_txt)
>>>>>>> master
def slacky(self):
'''
@ -304,17 +196,10 @@ class Initialization(object):
ar = ""
arch = os.uname()[4]
repo = Repo().slacky()
<<<<<<< HEAD
log = self.log_path + "slacky/"
lib = self.lib_path + "slacky_repo/"
lib_file = "PACKAGES.TXT"
# lst_file = ""
=======
log = log_path + "slacky/"
lib = lib_path + "slacky_repo/"
lib_file = "PACKAGES.TXT"
lst_file = ""
>>>>>>> master
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
@ -325,11 +210,7 @@ class Initialization(object):
ar = "64"
packages_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
lib_file)
<<<<<<< HEAD
# filelist_txt = ""
=======
filelist_txt = ""
>>>>>>> master
checksums_md5 = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
md5_file)
@ -339,11 +220,7 @@ class Initialization(object):
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
<<<<<<< HEAD
md5_file, checksums_md5, '', '')
=======
md5_file, checksums_md5, lst_file, filelist_txt)
>>>>>>> master
def studio(self):
'''
@ -352,17 +229,10 @@ class Initialization(object):
ar = ""
arch = os.uname()[4]
repo = Repo().studioware()
<<<<<<< HEAD
log = self.log_path + "studio/"
lib = self.lib_path + "studio_repo/"
lib_file = "PACKAGES.TXT"
# lst_file = ""
=======
log = log_path + "studio/"
lib = lib_path + "studio_repo/"
lib_file = "PACKAGES.TXT"
lst_file = ""
>>>>>>> master
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
@ -373,11 +243,7 @@ class Initialization(object):
ar = "64"
packages_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
lib_file)
<<<<<<< HEAD
# filelist_txt = ""
=======
filelist_txt = ""
>>>>>>> master
checksums_md5 = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
md5_file)
changelog_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
@ -386,24 +252,15 @@ class Initialization(object):
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
<<<<<<< HEAD
md5_file, checksums_md5, '', '')
=======
md5_file, checksums_md5, lst_file, filelist_txt)
>>>>>>> master
def slackr(self):
'''
Creating slackers local library
'''
repo = Repo().slackers()
<<<<<<< HEAD
log = self.log_path + "slackr/"
lib = self.lib_path + "slackr_repo/"
=======
log = log_path + "slackr/"
lib = lib_path + "slackr_repo/"
>>>>>>> master
lib_file = "PACKAGES.TXT"
lst_file = "FILELIST.TXT"
md5_file = "CHECKSUMS.md5"
@ -430,17 +287,10 @@ class Initialization(object):
ar = "{0}-x86".format(slack_ver())
arch = os.uname()[4]
repo = Repo().slackonly()
<<<<<<< HEAD
log = self.log_path + "slonly/"
lib = self.lib_path + "slonly_repo/"
lib_file = "PACKAGES.TXT"
# lst_file = "FILELIST.TXT"
=======
log = log_path + "slonly/"
lib = lib_path + "slonly_repo/"
lib_file = "PACKAGES.TXT"
lst_file = "FILELIST.TXT"
>>>>>>> master
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
@ -450,45 +300,26 @@ class Initialization(object):
if arch == "x86_64":
ar = "{0}-x86_64".format(slack_ver())
packages_txt = "{0}{1}/{2}".format(repo, ar, lib_file)
<<<<<<< HEAD
# filelist_txt = "{0}{1}/{2}".format(repo, ar, lst_file)
=======
filelist_txt = "{0}{1}/{2}".format(repo, ar, lst_file)
>>>>>>> master
checksums_md5 = "{0}{1}/{2}".format(repo, ar, md5_file)
# ChangeLog.txt file available only for x86 arch
changelog_txt = "{0}{1}-x86/{2}".format(repo, slack_ver(), log_file)
self.write(lib, lib_file, packages_txt)
<<<<<<< HEAD
# self.write(lib, lst_file, filelist_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
md5_file, checksums_md5, '', '')
=======
self.write(lib, lst_file, filelist_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
md5_file, checksums_md5, lst_file, filelist_txt)
>>>>>>> master
def ktown(self):
'''
Creating alien ktown local library
'''
repo = Repo().ktown()
<<<<<<< HEAD
log = self.log_path + "ktown/"
lib = self.lib_path + "ktown_repo/"
lib_file = "PACKAGES.TXT"
# lst_file = ""
=======
log = log_path + "ktown/"
lib = lib_path + "ktown_repo/"
lib_file = "PACKAGES.TXT"
lst_file = ""
>>>>>>> master
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
@ -496,39 +327,24 @@ class Initialization(object):
if not os.path.exists(lib):
os.mkdir(lib)
packages_txt = "{0}{1}".format(repo, lib_file)
<<<<<<< HEAD
# filelist_txt = ""
=======
filelist_txt = ""
>>>>>>> master
checksums_md5 = "{0}{1}".format(repo, md5_file)
changelog_txt = "{0}{1}".format(repo, log_file)
self.write(lib, lib_file, packages_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
<<<<<<< HEAD
md5_file, checksums_md5, '', '')
=======
md5_file, checksums_md5, lst_file, filelist_txt)
>>>>>>> master
def multi(self):
'''
Creating alien multilib local library
'''
repo = Repo().multi()
<<<<<<< HEAD
log = self.log_path + "multi/"
lib = self.lib_path + "multi_repo/"
lib_file = "PACKAGES.TXT"
# lst_file = ""
=======
log = log_path + "multi/"
lib = lib_path + "multi_repo/"
lib_file = "PACKAGES.TXT"
lst_file = ""
>>>>>>> master
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
@ -536,22 +352,14 @@ class Initialization(object):
if not os.path.exists(lib):
os.mkdir(lib)
packages_txt = "{0}{1}".format(repo, lib_file)
<<<<<<< HEAD
# filelist_txt = ""
=======
filelist_txt = ""
>>>>>>> master
checksums_md5 = "{0}{1}".format(repo, md5_file)
changelog_txt = "{0}{1}".format(repo, log_file)
self.write(lib, lib_file, packages_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
<<<<<<< HEAD
md5_file, checksums_md5, '', '')
=======
md5_file, checksums_md5, lst_file, filelist_txt)
>>>>>>> master
def slacke(self):
'''
@ -560,17 +368,10 @@ class Initialization(object):
ar = ""
arch = os.uname()[4]
repo = Repo().slacke()
<<<<<<< HEAD
log = self.log_path + "slacke/"
lib = self.lib_path + "slacke_repo/"
lib_file = "PACKAGES.TXT"
# lst_file = ""
=======
log = log_path + "slacke/"
lib = lib_path + "slacke_repo/"
lib_file = "PACKAGES.TXT"
lst_file = ""
>>>>>>> master
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
@ -582,30 +383,17 @@ class Initialization(object):
elif arch == "arm":
ar = "arm"
packages_txt = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
<<<<<<< HEAD
repo, _m.slacke_sub_repo[1:-1], ar, slack_ver(), lib_file)
# filelist_txt = ""
checksums_md5 = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
repo, _m.slacke_sub_repo[1:-1], ar, slack_ver(), md5_file)
changelog_txt = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
repo, _m.slacke_sub_repo[1:-1], ar, slack_ver(), log_file)
=======
repo, slacke_sub_repo[1:-1], ar, slack_ver(), lib_file)
filelist_txt = ""
checksums_md5 = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
repo, slacke_sub_repo[1:-1], ar, slack_ver(), md5_file)
changelog_txt = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
repo, slacke_sub_repo[1:-1], ar, slack_ver(), log_file)
>>>>>>> master
self.write(lib, lib_file, packages_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
<<<<<<< HEAD
md5_file, checksums_md5, '', '')
=======
md5_file, checksums_md5, lst_file, filelist_txt)
>>>>>>> master
def salix(self):
'''
@ -614,17 +402,10 @@ class Initialization(object):
ar = "i486"
arch = os.uname()[4]
repo = Repo().salix()
<<<<<<< HEAD
log = self.log_path + "salix/"
lib = self.lib_path + "salix_repo/"
lib_file = "PACKAGES.TXT"
# lst_file = ""
=======
log = log_path + "salix/"
lib = lib_path + "salix_repo/"
lib_file = "PACKAGES.TXT"
lst_file = ""
>>>>>>> master
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
@ -634,22 +415,14 @@ class Initialization(object):
if arch == "x86_64":
ar = "x86_64"
packages_txt = "{0}{1}/{2}/{3}".format(repo, ar, slack_ver(), lib_file)
<<<<<<< HEAD
# filelist_txt = ""
=======
filelist_txt = ""
>>>>>>> master
checksums_md5 = "{0}{1}/{2}/{3}".format(repo, ar, slack_ver(), md5_file)
changelog_txt = "{0}{1}/{2}/{3}".format(repo, ar, slack_ver(), log_file)
self.write(lib, lib_file, packages_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
<<<<<<< HEAD
md5_file, checksums_md5, '', '')
=======
md5_file, checksums_md5, lst_file, filelist_txt)
>>>>>>> master
def slackl(self):
'''
@ -658,17 +431,10 @@ class Initialization(object):
ar = "i486"
arch = os.uname()[4]
repo = Repo().slackel()
<<<<<<< HEAD
log = self.log_path + "slackl/"
lib = self.lib_path + "slackl_repo/"
lib_file = "PACKAGES.TXT"
# lst_file = ""
=======
log = log_path + "slackl/"
lib = lib_path + "slackl_repo/"
lib_file = "PACKAGES.TXT"
lst_file = ""
>>>>>>> master
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
@ -678,18 +444,13 @@ class Initialization(object):
if arch == "x86_64":
ar = "x86_64"
packages_txt = "{0}{1}/current/{2}".format(repo, ar, lib_file)
<<<<<<< HEAD
# filelist_txt = ""
=======
filelist_txt = ""
>>>>>>> master
checksums_md5 = "{0}{1}/current/{2}".format(repo, ar, md5_file)
changelog_txt = "{0}{1}/current/{2}".format(repo, ar, log_file)
self.write(lib, lib_file, packages_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
<<<<<<< HEAD
md5_file, checksums_md5, '', '')
def rested(self):
@ -701,19 +462,6 @@ class Initialization(object):
lib = self.lib_path + "rested_repo/"
lib_file = "PACKAGES.TXT"
# lst_file = ""
=======
md5_file, checksums_md5, lst_file, filelist_txt)
def rested(self):
'''
Creating alien local library
'''
repo = Repo().restricted()
log = log_path + "rested/"
lib = lib_path + "rested_repo/"
lib_file = "PACKAGES.TXT"
lst_file = ""
>>>>>>> master
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
@ -721,18 +469,13 @@ class Initialization(object):
if not os.path.exists(lib):
os.mkdir(lib)
packages_txt = "{0}{1}".format(repo, lib_file)
<<<<<<< HEAD
# filelist_txt = ""
=======
filelist_txt = ""
>>>>>>> master
checksums_md5 = "{0}{1}".format(repo, md5_file)
changelog_txt = "{0}{1}".format(repo, log_file)
self.write(lib, lib_file, packages_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
<<<<<<< HEAD
md5_file, checksums_md5, '', '')
def write_file(self, path, archive, contents_txt):
@ -748,12 +491,6 @@ class Initialization(object):
f.close()
def write(self, path, data_file, file_url):
=======
md5_file, checksums_md5, lst_file, filelist_txt)
@staticmethod
def write(path, data_file, file_url):
>>>>>>> master
'''
Write repositories files in /var/lib/slpkg
and /var/log/slpkg
@ -762,7 +499,6 @@ class Initialization(object):
if not os.path.isfile(path + data_file):
for fu in file_url.split():
FILE_TXT += URL(fu).reading()
<<<<<<< HEAD
self.write_file(path, data_file, FILE_TXT)
def remote(self, *args):
@ -777,38 +513,11 @@ class Initialization(object):
args[7] = checksums_md5 URL
args[8] = lst_file
args[9] = filelist_txt URL
=======
with open("{0}{1}".format(path, data_file), "w") as f:
toolbar_width, index = 2, 0
for line in FILE_TXT.splitlines():
index += 1
toolbar_width = status(index, toolbar_width, 700)
f.write(line + "\n")
f.close()
@staticmethod
def remote(*args):
'''
args[0] = log
args[1] = log_file
args[2] = changelog_txt
args[3] = lib
args[4] = lib_file
args[5] = packages_txt
args[6] = md5_file
args[7] = checksums_md5
args[8] = lst_file
args[9] = filelist_txt
>>>>>>> master
We take the size of ChangeLog.txt from the server and locally.
If the two files differ in size delete and replace all files with new.
'''
PACKAGES_TXT = ""
<<<<<<< HEAD
=======
toolbar_width, index = 2, 0
>>>>>>> master
server = FileSize(args[2]).server()
local = FileSize(args[0] + args[1]).local()
if server != local:
@ -822,7 +531,6 @@ class Initialization(object):
# remove FILELIST.TXT
if args[8]:
os.remove("{0}{1}".format(args[3], args[8]))
<<<<<<< HEAD
# read PACKAGES_TXT URL's
for fu in args[5].split():
PACKAGES_TXT += URL(fu).reading()
@ -840,51 +548,12 @@ class Initialization(object):
if args[8]:
FILELIST_TXT = URL(args[9]).reading()
self.write_file(args[3], args[8], FILELIST_TXT)
=======
# read URL's
for fu in args[5].split():
PACKAGES_TXT += URL(fu).reading()
CHANGELOG_TXT = URL(args[2]).reading()
# create CHECKSUMS.md5 file
if args[6]:
CHECKSUMS_md5 = URL(args[7]).reading()
with open("{0}{1}".format(args[3], args[6]), "w") as f:
for line in CHECKSUMS_md5.splitlines():
index += 1
toolbar_width = status(index, toolbar_width, 700)
f.write(line + "\n")
f.close()
# create PACKAGES.txt file
with open("{0}{1}".format(args[3], args[4]), "w") as f:
for line in PACKAGES_TXT.splitlines():
index += 1
toolbar_width = status(index, toolbar_width, 700)
f.write(line + "\n")
f.close()
# create ChangeLog.txt file
with open("{0}{1}".format(args[0], args[1]), "w") as f:
for line in CHANGELOG_TXT.splitlines():
index += 1
toolbar_width = status(index, toolbar_width, 700)
f.write(line + "\n")
f.close()
# create FILELIST.TXT file
if args[8]:
FILELIST_TXT = URL(args[9]).reading()
with open("{0}{1}".format(args[3], args[8]), "w") as f:
for line in FILELIST_TXT.splitlines():
index += 1
toolbar_width = status(index, toolbar_width, 700)
f.write(line + "\n")
f.close()
>>>>>>> master
def re_create(self):
'''
Remove all package lists with changelog and checksums files
and create lists again
'''
<<<<<<< HEAD
for repo in _m.repositories:
changelogs = '{0}{1}{2}'.format(self.log_path, repo,
'/ChangeLog.txt')
@ -895,16 +564,6 @@ class Initialization(object):
files = '{0}{1}_repo/{2}'.format(self.lib_path, repo, f)
if os.path.isfile(files):
os.remove(files)
=======
for repo in repositories:
changelogs = '{0}{1}{2}'.format(log_path, repo, '/ChangeLog.txt')
if os.path.isfile(changelogs):
os.remove(changelogs)
for f in os.listdir(lib_path + '{0}_repo/'.format(repo)):
packages = '{0}{1}_repo/{2}'.format(lib_path, repo, f)
if os.path.isfile(packages):
os.remove(packages)
>>>>>>> master
Update().repository()
@ -918,7 +577,6 @@ class Update(object):
Update all repositories lists
'''
print("\nCheck and update repositories:\n")
<<<<<<< HEAD
for repo in _m.repositories:
sys.stdout.write("{0}Update repository {1} ...{2}".format(
_m.color['GREY'], repo, _m.color['ENDC']))
@ -929,18 +587,6 @@ class Update(object):
Initialization().custom(repo)
sys.stdout.write("{0}Done{1}\n".format(_m.color['GREY'],
_m.color['ENDC']))
=======
for repo in repositories:
sys.stdout.write("{0}Update repository {1} ...{2}".format(
color['GREY'], repo, color['ENDC']))
sys.stdout.flush()
if repo in default_repositories:
exec('{0}.{1}()'.format(self._init, repo))
else:
Initialization().custom(repo)
sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
color['ENDC']))
>>>>>>> master
print("") # new line at end
sys.exit(0)
@ -951,19 +597,11 @@ def check_exists_repositories():
'''
update = False
pkg_list = "PACKAGES.TXT"
<<<<<<< HEAD
for repo in _m.repositories:
pkg_list = "PACKAGES.TXT"
if repo == "sbo":
pkg_list = "SLACKBUILDS.TXT"
if not os.path.isfile("{0}{1}{2}".format(_m.lib_path, repo,
=======
for repo in repositories:
pkg_list = "PACKAGES.TXT"
if repo == "sbo":
pkg_list = "SLACKBUILDS.TXT"
if not os.path.isfile("{0}{1}{2}".format(lib_path, repo,
>>>>>>> master
"_repo/{0}".format(pkg_list))):
update = True
if update:

View file

@ -24,18 +24,11 @@
import sys
import getpass
<<<<<<< HEAD
from utils import Utils
from messages import Msg
from desc import PkgDesc
from config import Config
from queue import QueuePkgs
=======
from desc import PkgDesc
from config import Config
from queue import QueuePkgs
from messages import s_user
>>>>>>> master
from repoinfo import RepoInfo
from repolist import RepoList
from repositories import Repo
@ -45,28 +38,15 @@ from version import prog_version
from arguments import options, usage
from slpkg_update import it_self_update
from init import (
<<<<<<< HEAD
Update,
Initialization,
check_exists_repositories
)
from __metadata__ import MetaData as _m
=======
Initialization,
Update,
check_exists_repositories
)
from __metadata__ import (
path,
repositories,
slack_rel
)
>>>>>>> master
from pkg.build import BuildPackage
from pkg.manager import PackageManager
<<<<<<< HEAD
from sbo.check import sbo_upgrade
from sbo.views import SBoNetwork
from sbo.slackbuild import SBoInstall
@ -419,195 +399,4 @@ def main():
if __name__ == '__main__':
=======
from sbo.check import SBoCheck
from sbo.views import SBoNetwork
from sbo.slackbuild import SBoInstall
from slack.install import Slack
from slack.patches import Patches
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).start()
def others_install(self, repo):
OthersInstall(self.package, repo, slack_rel).start()
def sbo_upgrade(self):
SBoCheck().start()
def slack_upgrade(self):
Patches(self.release).start()
def others_upgrade(self, repo):
OthersUpgrade(repo, self.release).start()
def main():
s_user(getpass.getuser())
args = sys.argv
args.pop(0)
blacklist = BlackList()
queue = QueuePkgs()
# all_args = [
# 'update', 're-create', 'repo-add', 'repo-remove',
# 'repo-list', 'repo-info',
# '-h', '--help', '-v', '-a', '-b',
# '-q', '-g', '-l', '-c', '-s', '-t', '-p', '-f',
# '-n', '-i', '-u', '-o', '-r', '-d'
# ]
without_repos = [
'-h', '--help', '-v', '-a', '-b',
'-q', '-g', '-f', '-n', '-i', '-u',
'-o', '-r', '-d'
]
if len(args) == 1 and args[0] == "update":
Update().repository()
if len(args) == 2 and args[0] == "update" and args[1] == "slpkg":
it_self_update()
if len(args) == 1 and args[0] == "repo-list":
RepoList().repos()
if len(args) == 0:
usage('')
elif (len(args) == 1 and args[0] == "-h" or
args[0] == "--help" and args[1:] == []):
options()
if (len(args) == 1 and args[0] == "-v" or
args[0] == "--version" and args[1:] == []):
prog_version()
if len(args) == 3 and args[0] == "repo-add":
Repo().add(args[1], args[2])
if len(args) == 2 and args[0] == "repo-remove":
Repo().remove(args[1])
# checking if repositories exists
check_exists_repositories()
if len(args) == 1 and args[0] == "re-create":
Initialization().re_create()
if (len(args) == 2 and args[0] == "repo-info" and
args[1] in RepoList().all_repos):
del RepoList().all_repos
RepoInfo().view(args[1])
elif (len(args) == 2 and args[0] == "repo-info" and
args[1] not in RepoList().all_repos):
usage(args[1])
if len(args) == 3 and args[0] == "-a":
BuildPackage(args[1], args[2:], path).build()
elif len(args) == 2 and args[0] == "-l":
if args[1] in ['all', 'official', 'non-official']:
PackageManager(None).list(args[1], False)
else:
usage('')
elif len(args) == 3 and args[0] == "-l" and args[2] == '--index':
if args[1] in ['all', 'official', 'non-official']:
PackageManager(None).list(args[1], True)
else:
usage('')
elif len(args) == 3 and args[0] == "-c" and args[2] == "--upgrade":
if args[1] in repositories and args[1] not in ['slack', 'sbo']:
Case('').others_upgrade(args[1])
elif args[1] in ['slack', 'sbo']:
upgrade = {
'sbo': Case(args[2]).sbo_upgrade,
'slack': Case(args[2]).slack_upgrade
}
upgrade[args[1]]()
else:
usage(args[1])
elif len(args) == 3 and args[0] == "-s":
if args[1] in repositories and args[1] not in ['slack', 'sbo']:
Case(args[2]).others_install(args[1])
elif args[1] in ['slack', 'sbo']:
install = {
'sbo': Case(args[2]).sbo_install,
'slack': Case(args[2]).slack_install
}
install[args[1]]()
else:
usage(args[1])
elif (len(args) == 3 and args[0] == "-t" and args[1] in repositories):
track_dep(args[2], args[1])
elif len(args) == 2 and args[0] == "-n" and "sbo" in repositories:
SBoNetwork(args[1]).view()
elif len(args) == 2 and args[0] == "-b" and args[1] == "--list":
blacklist.listed()
elif len(args) > 2 and args[0] == "-b" and args[-1] == "--add":
blacklist.add(args[1:-1])
elif len(args) > 2 and args[0] == "-b" and args[-1] == "--remove":
blacklist.remove(args[1:-1])
elif len(args) == 2 and args[0] == "-q" and args[1] == "--list":
queue.listed()
elif len(args) > 2 and args[0] == "-q" and args[-1] == "--add":
queue.add(args[1:-1])
elif len(args) > 2 and args[0] == "-q" and args[-1] == "--remove":
queue.remove(args[1:-1])
elif len(args) == 2 and args[0] == "-q" and args[1] == "--build":
queue.build()
elif len(args) == 2 and args[0] == "-q" and args[1] == "--install":
queue.install()
elif len(args) == 2 and args[0] == "-q" and args[1] == "--build-install":
queue.build()
queue.install()
elif len(args) > 1 and args[0] == "-i":
PackageManager(args[1:]).install()
elif len(args) > 1 and args[0] == "-u":
PackageManager(args[1:]).upgrade()
elif len(args) > 1 and args[0] == "-o":
PackageManager(args[1:]).reinstall()
elif len(args) > 1 and args[0] == "-r":
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(args[1])
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:
if len(args) > 1 and args[0] not in without_repos:
usage(args[1])
else:
usage('')
if __name__ == "__main__":
>>>>>>> master
main()

View file

@ -23,7 +23,6 @@
import sys
<<<<<<< HEAD
from __metadata__ import MetaData as _m
from slpkg.pkg.find import find_package
@ -167,58 +166,3 @@ class Msg(object):
else:
print("| Package {0} NOT installed".format(name))
self.template(78)
=======
from __metadata__ import color
def pkg_not_found(bol, pkg, message, eol):
'''
Print message when package not found
'''
print("{0}No such package {1}: {2}{3}".format(bol, pkg, message, eol))
def pkg_found(pkg, version):
'''
Print message when package found
'''
print("| Package {0}-{1} is already installed".format(pkg, version))
def pkg_installed(pkg):
'''
Print message when package installed
'''
print("| Package {0} installed".format(pkg))
def s_user(user):
'''
Check for root user
'''
if user != "root":
print("\nslpkg: error: must have root privileges\n")
sys.exit(0)
def build_FAILED(sbo_url, prgnam):
'''
Print error message if build failed
'''
template(78)
print("| Build package {0} [ {1}FAILED{2} ]".format(prgnam, color['RED'],
color['ENDC']))
template(78)
print("| See log file in '{0}/var/log/slpkg/sbo/build_logs{1}' directory"
"or read README file:".format(color['CYAN'], color['ENDC']))
print("| {0}{1}".format(sbo_url, "README"))
template(78)
print # new line at end
def template(max_len):
'''
Print template
'''
print("+" + "=" * max_len)
>>>>>>> master

View file

@ -29,19 +29,9 @@ import shutil
import tarfile
import subprocess
<<<<<<< HEAD
from slpkg.messages import Msg
from slpkg.checksum import check_md5
from slpkg.__metadata__ import MetaData as _m
=======
from slpkg.checksum import check_md5
from slpkg.messages import pkg_not_found
from slpkg.__metadata__ import (
log_path,
sbo_build_log,
sbo_check_md5
)
>>>>>>> master
from slpkg.sbo.greps import SBoGrep
@ -54,21 +44,12 @@ class BuildPackage(object):
self.path = path
self.prgnam = self.script[:-7]
self.log_file = "build_{0}_log".format(self.prgnam)
<<<<<<< HEAD
self.sbo_logs = _m.log_path + "sbo/"
self.build_logs = self.sbo_logs + "build_logs/"
self.start_log_time = time.strftime("%H:%M:%S")
self.start_time = time.time()
if not os.path.exists(_m.log_path):
os.mkdir(_m.log_path)
=======
self.sbo_logs = log_path + "sbo/"
self.build_logs = self.sbo_logs + "build_logs/"
self.start_log_time = time.strftime("%H:%M:%S")
self.start_time = time.time()
if not os.path.exists(log_path):
os.mkdir(log_path)
>>>>>>> master
if not os.path.exists(self.sbo_logs):
os.mkdir(self.sbo_logs)
if not os.path.exists(self.build_logs):
@ -88,62 +69,39 @@ class BuildPackage(object):
for src, sbo_md5 in zip(self.sources, sbo_md5_list):
# fix build sources with spaces
src = src.replace("%20", " ")
<<<<<<< HEAD
if _m.sbo_check_md5 == "on":
=======
if sbo_check_md5 == "on":
>>>>>>> master
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)
<<<<<<< HEAD
pass_var = self._pass_variable()
if _m.sbo_build_log == "on":
=======
if sbo_build_log == "on":
>>>>>>> master
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)
<<<<<<< HEAD
subprocess.Popen("{0} ./{1}.SlackBuild 2>&1 | tee -a "
"{2}{3}".format(' '.join(pass_var),
self.prgnam, self.build_logs,
self.log_file), shell=True,
stdout=sys.stdout).communicate()
=======
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()
>>>>>>> master
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:
<<<<<<< HEAD
subprocess.call("{0} ./{1}.SlackBuild".format(
' '.join(pass_var), self.prgnam, shell=True))
os.chdir(self.path)
except (OSError, IOError):
Msg().pkg_not_found("\n", self.prgnam, "Wrong file", "\n")
=======
subprocess.call("./{0}.SlackBuild".format(self.prgnam,
shell=True))
os.chdir(self.path)
except (OSError, IOError):
pkg_not_found("\n", self.prgnam, "Wrong file", "\n")
>>>>>>> master
except KeyboardInterrupt:
print("") # new line at exit
sys.exit(0)
<<<<<<< HEAD
def _pass_variable(self):
'''
Return enviroment variables
@ -155,8 +113,6 @@ class BuildPackage(object):
var.split('_')[1], os.environ[var]))
return pass_var
=======
>>>>>>> master
def log_head(path, log_file, log_time):
'''

View file

@ -25,7 +25,6 @@ import os
import sys
import subprocess
<<<<<<< HEAD
from slpkg.utils import Utils
from slpkg.messages import Msg
from slpkg.__metadata__ import MetaData as _m
@ -67,58 +66,6 @@ class PackageManager(object):
except subprocess.CalledProcessError:
self._not_found("Can't upgrade", self.binary, pkg)
=======
from slpkg.messages import (
pkg_not_found,
template
)
from slpkg.__metadata__ import (
lib_path,
pkg_path,
sp,
log_path,
default_answer,
remove_deps_answer,
del_deps,
color
)
from slpkg.pkg.find import find_package
class PackageManager(object):
'''
Package manager class for install, upgrade,
reinstall, remove, find and display packages.
'''
def __init__(self, binary):
self.binary = binary
def install(self):
'''
Install Slackware binary packages
'''
for pkg in self.binary:
try:
print(subprocess.check_output("installpkg {0}".format(
pkg), shell=True))
print("Completed!\n")
except subprocess.CalledProcessError:
self.not_found("Can't install", self.binary, pkg)
def upgrade(self):
'''
Upgrade Slackware binary packages
'''
for pkg in self.binary:
try:
print(subprocess.check_output("upgradepkg --install-new "
"{0}".format(pkg), shell=True))
print("Completed!\n")
except subprocess.CalledProcessError:
self.not_found("Can't upgrade", self.binary, pkg)
>>>>>>> master
def reinstall(self):
'''
Reinstall Slackware binary packages
@ -129,39 +76,22 @@ class PackageManager(object):
"upgradepkg --reinstall {0}".format(pkg), shell=True))
print("Completed!\n")
except subprocess.CalledProcessError:
<<<<<<< HEAD
self._not_found("Can't reinstall", self.binary, pkg)
def _not_found(self, message, binary, pkg):
=======
self.not_found("Can't reinstall", self.binary, pkg)
@staticmethod
def not_found(message, binary, pkg):
>>>>>>> master
if len(binary) > 1:
bol = eol = ""
else:
bol = eol = "\n"
<<<<<<< HEAD
Msg().pkg_not_found(bol, pkg, message, eol)
=======
pkg_not_found(bol, pkg, message, eol)
>>>>>>> master
def remove(self):
'''
Remove Slackware binary packages
'''
<<<<<<< HEAD
dep_path = _m.log_path + "dep/"
dependencies, rmv_list = [], []
removed = self._view_removed()
=======
dep_path = log_path + "dep/"
dependencies, rmv_list = [], []
removed = self.view_removed(self.binary)
>>>>>>> master
if not removed:
print("") # new line at end
else:
@ -169,13 +99,8 @@ class PackageManager(object):
if len(removed) > 1:
msg = msg + "s"
try:
<<<<<<< HEAD
if _m.default_answer == "y":
remove_pkg = _m.default_answer
=======
if default_answer == "y":
remove_pkg = default_answer
>>>>>>> master
else:
remove_pkg = raw_input(
"\nAre you sure to remove {0} {1} [Y/n]? ".format(
@ -188,7 +113,6 @@ class PackageManager(object):
# If package build and install with 'slpkg -s sbo <package>'
# then look log file for dependencies in /var/log/slpkg/dep,
# read and remove all else remove only the package.
<<<<<<< HEAD
if os.path.isfile(dep_path + rmv) and _m.del_deps == "on":
dependencies = self._view_deps(dep_path, rmv)
if self._rmv_deps_answer() in ['y', 'Y']:
@ -220,40 +144,11 @@ class PackageManager(object):
return remove_dep
def _view_removed(self):
=======
if os.path.isfile(dep_path + rmv) and del_deps == "on":
dependencies = self.view_deps(dep_path, rmv)
try:
if remove_deps_answer == "y":
remove_dep = remove_deps_answer
else:
remove_dep = raw_input(
"\nRemove dependencies (maybe used by "
"other packages) [Y/n]? ")
except KeyboardInterrupt:
print("") # new line at exit
sys.exit(0)
if remove_dep in ['y', 'Y']:
rmv_list += self.rmv_deps(self.binary,
dependencies,
dep_path, rmv)
else:
rmv_list += self.rmv_pkg(rmv)
os.remove(dep_path + rmv)
else:
rmv_list += self.rmv_pkg(rmv)
# Prints all removed packages
self.reference_rmvs(rmv_list)
@staticmethod
def view_removed(binary):
>>>>>>> master
'''
View packages before removed
'''
removed = []
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
<<<<<<< HEAD
_m.color['CYAN'], ", ".join(self.binary), _m.color['ENDC']))
for pkg in self.binary:
pkgs = find_package(pkg + _m.sp, _m.pkg_path)
@ -281,78 +176,29 @@ class PackageManager(object):
return dependencies
def _rmv_deps(self, binary, dependencies, path, package):
=======
color['CYAN'], ", ".join(binary), color['ENDC']))
for pkg in binary:
pkgs = find_package(pkg + sp, pkg_path)
if pkgs:
print("[ {0}delete{1} ] --> {2}".format(
color['RED'], color['ENDC'],
"\n ".join(pkgs)))
removed.append(pkg)
else:
pkg_not_found("", pkg, "Can't remove", "")
return removed
@staticmethod
def view_deps(path, package):
'''
View dependencies for before remove
'''
with open(path + package, "r") as f:
dependencies = f.read().split()
f.close()
print("") # new line at start
template(78)
print("| Found dependencies for package {0}:".format(package))
template(78)
for dep in dependencies:
print("| {0}{1}{2}".format(color['RED'], dep, color['ENDC']))
template(78)
return dependencies
@staticmethod
def rmv_deps(binary, dependencies, path, package):
>>>>>>> master
'''
Remove dependencies
'''
removes = []
<<<<<<< HEAD
deps = dependencies.split()
deps.append(''.join(binary))
for dep in deps:
if find_package(dep + _m.sp, _m.pkg_path):
=======
dependencies += binary
for dep in dependencies:
if find_package(dep + sp, pkg_path):
>>>>>>> master
print(subprocess.check_output("removepkg {0}".format(dep),
shell=True))
removes.append(dep)
os.remove(path + package)
return removes
<<<<<<< HEAD
def _rmv_pkg(self, package):
'''
Remove one signle package
'''
if find_package(package + _m.sp, _m.pkg_path):
=======
@staticmethod
def rmv_pkg(package):
'''
Remove one signle package
'''
if find_package(package + sp, pkg_path):
>>>>>>> master
print(subprocess.check_output("removepkg {0}".format(package),
shell=True))
return package.split()
<<<<<<< HEAD
def _reference_rmvs(self, removes):
'''
Prints all removed packages
@ -366,22 +212,6 @@ class PackageManager(object):
else:
print("| Package {0} not found".format(pkg))
Msg().template(78)
=======
@staticmethod
def reference_rmvs(removes):
'''
Prints all removed packages
'''
template(78)
print("| Total {0} packages removed".format(len(removes)))
template(78)
for pkg in removes:
if not find_package(pkg + sp, pkg_path):
print("| Package {0} removed".format(pkg))
else:
print("| Package {0} not found".format(pkg))
template(78)
>>>>>>> master
print("") # new line at end
def find(self):
@ -390,7 +220,6 @@ class PackageManager(object):
'''
matching = size = 0
print("\nPackages with matching name [ {0}{1}{2} ]\n".format(
<<<<<<< HEAD
_m.color['CYAN'], ', '.join(self.binary), _m.color['ENDC']))
for pkg in self.binary:
for match in find_package('', _m.pkg_path):
@ -399,18 +228,6 @@ class PackageManager(object):
print("[ {0}installed{1} ] - {2}".format(
_m.color['GREEN'], _m.color['ENDC'], match))
data = Utils().read_file(_m.pkg_path + match)
=======
color['CYAN'], ', '.join(self.binary), color['ENDC']))
for pkg in self.binary:
for match in find_package(pkg, pkg_path):
if pkg in match:
matching += 1
print("[ {0}installed{1} ] - {2}".format(
color['GREEN'], color['ENDC'], match))
with open(pkg_path + match, "r") as f:
data = f.read()
f.close()
>>>>>>> master
for line in data.splitlines():
if line.startswith("UNCOMPRESSED PACKAGE SIZE:"):
if "M" in line[26:]:
@ -420,69 +237,42 @@ class PackageManager(object):
break
if matching == 0:
message = "Can't find"
<<<<<<< HEAD
Msg().pkg_not_found("", self.binary, message, "\n")
else:
print("\n{0}Total found {1} matching packages.{2}".format(
_m.color['GREY'], matching, _m.color['ENDC']))
=======
pkg_not_found("", pkg, message, "\n")
else:
print("\n{0}Total found {1} matching packages.{2}".format(
color['GREY'], matching, color['ENDC']))
>>>>>>> master
unit = "Kb"
if size > 1024:
unit = "Mb"
size = (size / 1024)
print("{0}Size of installed packages {1} {2}.{3}\n".format(
<<<<<<< HEAD
_m.color['GREY'], round(size, 2), unit, _m.color['ENDC']))
=======
color['GREY'], round(size, 2), unit, color['ENDC']))
>>>>>>> master
def display(self):
'''
Print the Slackware packages contents
'''
for pkg in self.binary:
<<<<<<< HEAD
find = find_package(pkg + _m.sp, _m.pkg_path)
if find:
package = Utils().read_file(_m.pkg_path + "".join(find))
for line in package.splitlines():
print(line).strip()
print("") # new line per file
=======
find = find_package(pkg + sp, pkg_path)
if find:
with open(pkg_path + "".join(find), "r") as package:
for line in package:
print(line).strip()
print("") # new line per file
>>>>>>> master
else:
message = "Can't dislpay"
if len(self.binary) > 1:
bol = eol = ""
else:
bol = eol = "\n"
<<<<<<< HEAD
Msg().pkg_not_found(bol, pkg, message, eol)
def list(self, repo, INDEX, installed):
=======
pkg_not_found(bol, pkg, message, eol)
def list(self, pattern, INDEX):
>>>>>>> master
'''
List with the installed packages
'''
tty_size = os.popen('stty size', 'r').read().split()
row = int(tty_size[0]) - 2
<<<<<<< HEAD
try:
index, page, pkg_list = 0, row, []
r = self._list_lib(repo)
@ -500,54 +290,20 @@ class PackageManager(object):
"continue... ".format(
_m.color['CYAN'],
_m.color['ENDC']))
=======
pkg_list = []
try:
index, page, official, r = 0, row, [], ''
if os.path.isfile(lib_path + 'slack_repo/PACKAGES.TXT'):
f = open(lib_path + 'slack_repo/PACKAGES.TXT', 'r')
r = f.read()
f.close()
for line in r.splitlines():
if line.startswith("PACKAGE NAME: "):
official.append(line[15:-4].strip())
for pkg in find_package("", pkg_path):
if pattern == 'all':
pkg_list.append(pkg)
elif pattern == 'official' and pkg in official:
pkg_list.append(pkg)
elif pattern == 'non-official' and pkg not in official:
pkg_list.append(pkg)
for pkg in sorted(pkg_list):
if INDEX:
index += 1
print("{0}{1}:{2} {3}".format(color['GREY'], index,
color['ENDC'], pkg))
if index == page:
read = raw_input("\nPress {0}Enter{1} to "
"continue... ".format(color['CYAN'],
color['ENDC']))
>>>>>>> master
if read in ['Q', 'q']:
break
print("") # new line after page
page += row
<<<<<<< HEAD
elif installed:
if self._list_of_installed(pkg):
print('{0}{1}{2}'.format(_m.color['GREEN'], pkg,
_m.color['ENDC']))
else:
print(pkg)
=======
else:
print pkg
>>>>>>> master
print("") # new line at end
except KeyboardInterrupt:
print("") # new line at exit
sys.exit(0)
<<<<<<< HEAD
def _list_greps(self, repo, packages):
'''
@ -608,5 +364,3 @@ class PackageManager(object):
find = pkg[:-4]
if find_package(find, _m.pkg_path):
return pkg
=======
>>>>>>> master

View file

@ -24,19 +24,9 @@
import os
from collections import OrderedDict
<<<<<<< HEAD
from utils import Utils
from downloader import Download
from __metadata__ import MetaData as _m
=======
from downloader import Download
from __metadata__ import (
lib_path,
build_path,
color,
tmp
)
>>>>>>> master
from sbo.greps import SBoGrep
from pkg.find import find_package
@ -58,17 +48,10 @@ class QueuePkgs(object):
"#\n"
]
self.quit = False
<<<<<<< HEAD
self.queue = _m.lib_path + "queue/"
self.queue_list = self.queue + "queue_list"
if not os.path.exists(_m.lib_path):
os.mkdir(_m.lib_path)
=======
self.queue = lib_path + "queue/"
self.queue_list = self.queue + "queue_list"
if not os.path.exists(lib_path):
os.mkdir(lib_path)
>>>>>>> master
if not os.path.exists(self.queue):
os.mkdir(self.queue)
if not os.path.isfile(self.queue_list):
@ -76,14 +59,7 @@ class QueuePkgs(object):
for line in queue_file:
queue.write(line)
queue.close()
<<<<<<< HEAD
self.queued = Utils().read_file(self.queue_list)
=======
f = open(self.queue_list, "r")
self.queued = f.read()
f.close()
>>>>>>> master
def packages(self):
'''
@ -104,12 +80,8 @@ class QueuePkgs(object):
print("\nPackages in queue:\n")
for pkg in self.packages():
if pkg:
<<<<<<< HEAD
print("{0}{1}{2}".format(_m.color['GREEN'], pkg,
_m.color['ENDC']))
=======
print("{0}{1}{2}".format(color['GREEN'], pkg, color['ENDC']))
>>>>>>> master
self.quit = True
if self.quit:
print("") # new line at exit
@ -125,7 +97,6 @@ class QueuePkgs(object):
for pkg in pkgs:
find = sbo_search_pkg(pkg)
if pkg not in queue_list and find is not None:
<<<<<<< HEAD
print("{0}{1}{2}".format(_m.color['GREEN'], pkg,
_m.color['ENDC']))
queue.write(pkg + "\n")
@ -133,14 +104,6 @@ class QueuePkgs(object):
else:
print("{0}{1}{2}".format(_m.color['RED'], pkg,
_m.color['ENDC']))
=======
print("{0}{1}{2}".format(color['GREEN'], pkg,
color['ENDC']))
queue.write(pkg + "\n")
self.quit = True
else:
print("{0}{1}{2}".format(color['RED'], pkg, color['ENDC']))
>>>>>>> master
self.quit = True
queue.close()
if self.quit:
@ -158,12 +121,8 @@ class QueuePkgs(object):
if line not in pkgs:
queue.write(line + "\n")
else:
<<<<<<< HEAD
print("{0}{1}{2}".format(_m.color['RED'], line,
_m.color['ENDC']))
=======
print("{0}{1}{2}".format(color['RED'], line, color['ENDC']))
>>>>>>> master
self.quit = True
queue.close()
if self.quit:
@ -176,18 +135,12 @@ class QueuePkgs(object):
packages = self.packages()
if packages:
for pkg in packages:
<<<<<<< HEAD
if not os.path.exists(_m.build_path):
os.mkdir(_m.build_path)
=======
if not os.path.exists(build_path):
os.mkdir(build_path)
>>>>>>> master
sbo_url = sbo_search_pkg(pkg)
sbo_dwn = SBoLink(sbo_url).tar_gz()
source_dwn = SBoGrep(pkg).source().split()
sources = []
<<<<<<< HEAD
os.chdir(_m.build_path)
script = sbo_dwn.split("/")[-1]
Download(_m.build_path, sbo_dwn.split()).start()
@ -195,15 +148,6 @@ class QueuePkgs(object):
Download(_m.build_path, src.split()).start()
sources.append(src.split("/")[-1])
BuildPackage(script, sources, _m.build_path).build()
=======
os.chdir(build_path)
script = sbo_dwn.split("/")[-1]
Download(build_path, sbo_dwn.split()).start()
for src in source_dwn:
Download(build_path, src.split()).start()
sources.append(src.split("/")[-1])
BuildPackage(script, sources, build_path).build()
>>>>>>> master
else:
print("\nPackages not found in the queue for building\n")
@ -216,21 +160,13 @@ class QueuePkgs(object):
print("") # new line at start
for pkg in packages:
# check if package exist in /tmp
<<<<<<< HEAD
find = find_package(pkg, _m.tmp)
=======
find = find_package(pkg, tmp)
>>>>>>> master
try:
find = max(find)
except ValueError:
print("Package '{0}' not found in /tmp\n".format(pkg))
if pkg in find:
<<<<<<< HEAD
binary = "{0}{1}".format(_m.tmp, find)
=======
binary = "{0}{1}".format(tmp, find)
>>>>>>> master
PackageManager(binary.split()).install()
else:
print("\nPackages not found in the queue for installation\n")

View file

@ -23,21 +23,13 @@
import os
<<<<<<< HEAD:slpkg/remove.py
from __metadata__ import MetaData as _m
=======
from __metadata__ import del_all
>>>>>>> master:slpkg/remove.py
def delete(path, packages):
'''
Remove downloaded packages
'''
<<<<<<< HEAD:slpkg/remove.py
if _m.del_all == "on":
=======
if del_all == "on":
>>>>>>> master:slpkg/remove.py
for pkg in packages:
os.remove(path + pkg)

View file

@ -24,24 +24,11 @@
import os
import sys
<<<<<<< HEAD
from sizes import units
from utils import Utils
from repositories import Repo
from repolist import RepoList
from __metadata__ import MetaData as _m
=======
from repositories import Repo
from sizes import units
from repolist import RepoList
from __metadata__ import (
default_repositories,
lib_path,
log_path,
repositories,
color
)
>>>>>>> master
class RepoInfo(object):
@ -57,10 +44,6 @@ class RepoInfo(object):
'Total compressed packages:': '',
'Total uncompressed packages:': ''
}
<<<<<<< HEAD
=======
>>>>>>> master
self.all_repos = RepoList().all_repos
self.all_repos.update(Repo().custom_repository())
del RepoList().all_repos
@ -69,7 +52,6 @@ class RepoInfo(object):
'''
View repository information
'''
<<<<<<< HEAD
status = '{0}disabled{1}'.format(_m.color['RED'], _m.color['ENDC'])
self.form['Status:'] = status
self.form['Default:'] = 'no'
@ -79,17 +61,6 @@ class RepoInfo(object):
os.path.isfile(_m.lib_path + '{0}_repo/PACKAGES.TXT'.format(
repo))):
status = '{0}enabled{1}'.format(_m.color['GREEN'], _m.color['ENDC'])
=======
status = '{0}disabled{1}'.format(color['RED'], color['ENDC'])
self.form['Status:'] = status
self.form['Default:'] = 'no'
if repo in default_repositories:
self.form['Default:'] = 'yes'
if (repo in repositories and
os.path.isfile(lib_path + '{0}_repo/PACKAGES.TXT'.format(
repo))):
status = '{0}enabled{1}'.format(color['GREEN'], color['ENDC'])
>>>>>>> master
if repo != 'sbo':
data = self.repository_data(repo)
size = units(data[1], data[2])
@ -102,7 +73,6 @@ class RepoInfo(object):
self.form['Number of packages:'] = data[0]
self.form['Status:'] = status
self.form['Last updated:'] = data[3]
<<<<<<< HEAD
elif (repo == 'sbo' and os.path.isfile(_m.lib_path + '{0}_repo/'
'SLACKBUILDS.TXT'.format(repo))):
status = '{0}enabled{1}'.format(_m.color['GREEN'], _m.color['ENDC'])
@ -113,17 +83,6 @@ class RepoInfo(object):
sum_sbo_pkgs += 1
changelog_txt = Utils().read_file(_m.log_path + 'sbo/ChangeLog.txt')
last_upd = changelog_txt.split('\n', 1)[0]
=======
elif (repo == 'sbo' and os.path.isfile(lib_path + '{0}_repo/'
'SLACKBUILDS.TXT'.format(repo))):
status = '{0}enabled{1}'.format(color['GREEN'], color['ENDC'])
sum_sbo_pkgs = 0
for line in open(lib_path + 'sbo_repo/SLACKBUILDS.TXT', 'r'):
if line.startswith('SLACKBUILD NAME: '):
sum_sbo_pkgs += 1
with open(log_path + 'sbo/ChangeLog.txt', 'r') as changelog_txt:
last_upd = changelog_txt.readline().replace('\n', '')
>>>>>>> master
self.form['Repo id:'] = repo
self.form['Repo url:'] = self.all_repos[repo]
self.form['Total compressed packages:'] = ''
@ -133,11 +92,7 @@ class RepoInfo(object):
self.form['Last updated:'] = last_upd
print('')
for key, value in sorted(self.form.iteritems()):
<<<<<<< HEAD
print _m.color['GREY'] + key + _m.color['ENDC'], value
=======
print color['GREY'] + key + color['ENDC'], value
>>>>>>> master
print('')
sys.exit(0)
@ -146,12 +101,8 @@ class RepoInfo(object):
Grap data packages
'''
sum_pkgs, size, unsize, last_upd = 0, [], [], ''
<<<<<<< HEAD
for line in (Utils().read_file(
_m.lib_path + repo + '_repo/PACKAGES.TXT').splitlines()):
=======
for line in open(lib_path + repo + '_repo/PACKAGES.TXT', 'r'):
>>>>>>> master
if line.startswith('PACKAGES.TXT;'):
last_upd = line[14:].strip()
if line.startswith('PACKAGE NAME:'):
@ -161,12 +112,7 @@ class RepoInfo(object):
if line.startswith('PACKAGE SIZE (uncompressed): '):
unsize.append(line[30:-2].strip())
if repo in ['salix', 'slackl']:
<<<<<<< HEAD
log = Utils().read_file(_m.log_path + '{0}/ChangeLog.txt'.format(
repo))
last_upd = log.split('\n', 1)[0]
=======
with open(log_path + '{0}/ChangeLog.txt'.format(repo), 'r') as log:
last_upd = log.readline().replace('\n', '')
>>>>>>> master
return [sum_pkgs, size, unsize, last_upd]

View file

@ -24,7 +24,6 @@
import sys
<<<<<<< HEAD
from messages import Msg
from repositories import Repo
from __metadata__ import MetaData as _m
@ -34,18 +33,6 @@ class RepoList(object):
'''
List of repositories
'''
=======
from repositories import Repo
from messages import template
from __metadata__ import (
default_repositories,
repositories,
color
)
class RepoList(object):
>>>>>>> master
def __init__(self):
self.all_repos = {
@ -71,17 +58,12 @@ class RepoList(object):
View or enabled or disabled repositories
'''
print('')
<<<<<<< HEAD
Msg().template(78)
=======
template(78)
>>>>>>> master
print('{0}{1}{2}{3}{4}{5}{6}'.format(
'| Repo id', ' ' * 2,
'Repo URL', ' ' * 44,
'Default', ' ' * 3,
'Status'))
<<<<<<< HEAD
Msg().template(78)
for repo_id, repo_URL in sorted(self.all_repos.iteritems()):
status, COLOR = 'disabled', _m.color['RED']
@ -91,27 +73,12 @@ class RepoList(object):
if repo_id in _m.repositories:
status, COLOR = 'enabled', _m.color['GREEN']
if repo_id not in _m.default_repositories:
=======
template(78)
for repo_id, repo_URL in sorted(self.all_repos.iteritems()):
status, COLOR = 'disabled', color['RED']
default = 'yes'
if len(repo_URL) > 49:
repo_URL = repo_URL[:48] + '~'
if repo_id in repositories:
status, COLOR = 'enabled', color['GREEN']
if repo_id not in default_repositories:
>>>>>>> master
default = 'no'
print(' {0}{1}{2}{3}{4}{5}{6}{7:>8}{8}'.format(
repo_id, ' ' * (9 - len(repo_id)),
repo_URL, ' ' * (52 - len(repo_URL)),
default, ' ' * (8 - len(default)),
<<<<<<< HEAD
COLOR, status, _m.color['ENDC']))
=======
COLOR, status, color['ENDC']))
>>>>>>> master
print("\nFor enable or disable default repositories edit "
"'/etc/slpkg/slpkg.conf' file\n")
sys.exit(0)

View file

@ -25,28 +25,15 @@
import os
import sys
<<<<<<< HEAD
from utils import Utils
from __metadata__ import MetaData as _m
=======
from __metadata__ import (
default_repositories,
repositories
)
>>>>>>> master
class Repo(object):
def __init__(self):
self.repo_file = "/etc/slpkg/custom-repositories"
<<<<<<< HEAD
self.repositories_list = Utils().read_file(self.repo_file)
=======
f = open(self.repo_file, "r")
self.repositories_list = f.read()
f.close()
>>>>>>> master
def add(self, repo, url):
'''
@ -59,13 +46,8 @@ class Repo(object):
line = line.lstrip()
if line and not line.startswith("#"):
repo_name.append(line.split()[0])
<<<<<<< HEAD
if (repo in _m.repositories or repo in repo_name or
repo in _m.default_repositories):
=======
if (repo in repositories or repo in repo_name or
repo in default_repositories):
>>>>>>> master
print("\nRepository name '{0}' exist, select different name.\n"
"View all repositories with command 'repo-list'.\n".format(
repo))
@ -120,13 +102,7 @@ class Repo(object):
'''
default = "http://mirrors.slackware.com/slackware/"
if os.path.isfile("/etc/slpkg/slackware-mirrors"):
<<<<<<< HEAD
mirrors = Utils().read_file(_m.conf_path + 'slackware-mirrors')
=======
with open("/etc/slpkg/slackware-mirrors", "r") as slacks:
mirrors = slacks.read()
slacks.close()
>>>>>>> master
for line in mirrors.splitlines():
line = line.rstrip()
if not line.startswith("#") and line:

View file

@ -21,7 +21,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
<<<<<<< HEAD
import os
import sys
@ -70,320 +69,3 @@ def sbo_list():
if pkg.endswith("_SBo"):
sbo_packages.append(pkg)
return sbo_packages
=======
import os
import sys
from slpkg.pkg.find import find_package
from slpkg.pkg.build import BuildPackage
from slpkg.pkg.manager import PackageManager
from slpkg.toolbar import status
from slpkg.downloader import Download
from slpkg.splitting import split_package
from slpkg.messages import (
template,
build_FAILED
)
from slpkg.__metadata__ import (
tmp,
pkg_path,
build_path,
default_answer,
color,
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
class SBoCheck(object):
def __init__(self):
self.done = "{0}Done{1}\n".format(color['GREY'], color['ENDC'])
sys.stdout.write("{0}Reading package lists ...{1}".format(
color['GREY'], color['ENDC']))
sys.stdout.flush()
self.installed = []
self.index, self.toolbar_width = 0, 3
def start(self):
'''
Upgrade all slackbuilds packages from slackbuilds.org
repository.
NOTE: This functions check packages by version not by build
tag because build tag not reported the SLACKBUILDS.TXT file,
but install the package with maximum build tag if find the
some version in /tmp directory.
'''
try:
if self.sbo_list():
upg_name = self.exists()
sys.stdout.write(self.done)
data = []
if upg_name:
sys.stdout.write("{0}Resolving dependencies ...{1}".format(
color['GREY'], color['ENDC']))
sys.stdout.flush()
# upgrade name = data[0]
# package for upgrade = data[1]
# upgrade version = data[2]
# upgrade arch = data[3]
data = store(order_list(upg_name))
sys.stdout.write(self.done)
if data:
# count installed = count[0]
# count upgraded = count[1]
# message install = msg[0]
# message upgrade = msg[1]
count, msg = view_packages(data[1], data[2], data[3])
if default_answer == "y":
answer = default_answer
else:
answer = raw_input("Would you like to continue [Y/n]? ")
if answer in ['y', 'Y']:
os.chdir(build_path)
for name, version in zip(data[0], data[2]):
prgnam = ("{0}-{1}".format(name, version))
sbo_url = sbo_search_pkg(name)
sbo_dwn = SBoLink(sbo_url).tar_gz()
src_dwn = SBoGrep(name).source().split()
script = sbo_dwn.split("/")[-1]
dwn_srcs = sbo_dwn.split() + src_dwn
Download(build_path, dwn_srcs).start()
sources = filenames(src_dwn)
BuildPackage(script, sources, build_path).build()
# Searches the package name and version in /tmp to
# install.If find two or more packages e.g. to build
# tag 2 or 3 will fit most.
binary_list = search_in_tmp(prgnam)
try:
binary = (tmp + max(binary_list)).split()
except ValueError:
build_FAILED(sbo_url, prgnam)
sys.exit(0)
if find_package(name + sp, pkg_path):
print("[ {0}Upgrading{1} ] --> {2}".format(
color['YELLOW'], color['ENDC'], name))
else:
print("[ {0}Installing{1} ] --> {2}".format(
color['GREEN'], color['ENDC'], name))
# Use this list to pick out what
# packages will be installed
self.installed.append(name)
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())))
else:
sys.stdout.write(self.done)
print("\nNo SBo packages found\n")
except KeyboardInterrupt:
print("") # new line at exit
sys.exit(0)
def sbo_list(self):
'''
Return all SBo packages
'''
sbo_packages = []
for pkg in os.listdir(pkg_path):
if pkg.endswith("_SBo"):
sbo_packages.append(pkg)
return sbo_packages
def exists(self):
'''
Search packages if exists in the repository
and it gets to avoidable modified packages
from the user with the tag _SBo
'''
upgrade_names = []
for pkg in self.sbo_list():
self.index += 1
self.toolbar_width = status(self.index, self.toolbar_width, 4)
name = split_package(pkg)[0]
if sbo_search_pkg(name):
sbo_package = ("{0}-{1}".format(name, SBoGrep(name).version()))
package = ("{0}-{1}".format(name, split_package(pkg)[1]))
if sbo_package > package:
upgrade_names.append(name)
return upgrade_names
def deps(upgrade_names):
'''
Of the packages found to need upgrading,
stored in a series such as reading from the
file .info.
'''
for upg in upgrade_names:
dependencies = sbo_dependencies_pkg(upg)
return dependencies
def one_for_all(upgrade_names):
'''
Because there are dependencies that depend on other
dependencies are created lists into other lists.
Thus creating this loop create one-dimensional list.
'''
requires = []
dependencies = deps(upgrade_names)
for dep in dependencies:
requires += dep
# Inverting the list brings the
# dependencies in order to be installed.
requires.reverse()
return requires
def remove_dbs(upgrade_names):
'''
Many packages use the same dependencies, in this loop
creates a new list by removing duplicate dependencies but
without spoiling the line must be installed.
'''
dependencies = []
requires = one_for_all(upgrade_names)
for duplicate in requires:
if duplicate not in dependencies:
dependencies.append(duplicate)
return dependencies
def order_list(upgrade_names):
'''
Last and after the list is created with the correct number
of dependencies that must be installed, and add the particular
packages that need to be upgraded if they are not already on
the list in end to list.
'''
dependencies = remove_dbs(upgrade_names)
for upg in upgrade_names:
if upg not in dependencies:
dependencies.append(upg)
return dependencies
def store(dependencies):
'''
In the end last a check of the packages that are on the list
are already installed.
'''
(upgrade_name,
package_for_upgrade,
upgrade_version,
upgrade_arch
) = ([] for i in range(4))
for pkg in dependencies:
ver = SBoGrep(pkg).version()
prgnam = ("{0}-{1}".format(pkg, ver))
# if package not installed
# take version from repository
pkg_version = ver
arch = os.uname()[4]
if arch.startswith("i") and arch.endswith("86"):
arch = "i486"
if find_package(prgnam, pkg_path) == []:
for sbo in os.listdir(pkg_path):
if (sbo.startswith(pkg + sp) and
sbo.endswith("_SBo")):
# search if packages installed
# if yes grab package name and version
pkg_version = split_package(sbo)[1]
upgrade_name.append(pkg)
package_for_upgrade.append("{0}-{1}".format(pkg, pkg_version))
upgrade_version.append(ver)
upgrade_arch.append(arch)
return [upgrade_name, package_for_upgrade, upgrade_version, upgrade_arch]
def view_packages(package_for_upgrade, upgrade_version, upgrade_arch):
'''
View packages for upgrade
'''
print("\nThese packages need upgrading:\n")
template(78)
print("{0}{1}{2}{3}{4}{5}{6}".format(
"| Package", " " * 30, "New version", " " * 6,
"Arch", " " * 9, "Repository"))
template(78)
print("Upgrading:")
count_upgraded = count_installed = 0
for upg, ver, arch in zip(package_for_upgrade, upgrade_version,
upgrade_arch):
if find_package(upg[:-len(ver)], pkg_path):
COLOR = color['YELLOW']
count_upgraded += 1
else:
COLOR = color['RED']
count_installed += 1
print(" {0}{1}{2}{3} {4}{5}{6} {7}{8}{9}{10}".format(
COLOR, upg, color['ENDC'], " " * (37-len(upg)), color['GREEN'],
ver, color['ENDC'], " " * (16-len(ver)), arch,
" " * (13-len(arch)), "SBo"))
msg_upg = "package"
msg_ins = msg_upg
if count_upgraded > 1:
msg_upg = msg_upg + "s"
if count_installed > 1:
msg_ins = msg_ins + "s"
print("\nInstalling summary")
print("=" * 79)
print("{0}Total {1} {2} will be upgraded and {3} {4} will be "
"installed.{5}\n".format(color['GREY'], count_upgraded, msg_upg,
count_installed, msg_ins, color['ENDC']))
return [count_installed, count_upgraded], [msg_ins, msg_upg]
def filenames(sources):
'''
Download sources and return filenames
'''
filename = []
for src in sources:
filename.append(src.split("/")[-1])
return filename
def search_in_tmp(prgnam):
'''
Search for binarys packages in /tmp directory
'''
binary = []
for search in find_package(prgnam, tmp):
if "_SBo" in search:
binary.append(search)
return binary
def reference(*args):
# reference(data[0], data[1], data[2], count[0], count[1],
# msg[0], msg[1], installed)
'''
Print results
'''
if len(args[1]) > 1:
template(78)
print("| Total {0} {1} upgraded and {2} {3} "
"installed".format(args[4], args[6],
args[3], args[5]))
template(78)
for pkg, upg, ver in zip(args[1], args[0], args[2]):
upgraded = ("{0}-{1}".format(upg, ver))
if find_package(upgraded, pkg_path):
if upg in args[7]:
print("| Package {0} installed".format(pkg))
else:
print("| Package {0} upgraded with new "
"package {1}-{2}".format(pkg, upg, ver))
template(78)
>>>>>>> master

View file

@ -28,7 +28,6 @@ from slpkg.blacklist import BlackList
from greps import SBoGrep
<<<<<<< HEAD
class Requires(object):
@ -61,33 +60,3 @@ class Requires(object):
except KeyboardInterrupt:
print("") # new line at exit
sys.exit(0)
=======
dep_results = []
def sbo_dependencies_pkg(name):
'''
Build all dependencies of a package
'''
try:
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:
dependencies.append(req)
if dependencies:
dep_results.append(dependencies)
for dep in dependencies:
sbo_dependencies_pkg(dep)
return dep_results
except KeyboardInterrupt:
print("") # new line at exit
sys.exit(0)
>>>>>>> master

View file

@ -21,16 +21,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
<<<<<<< HEAD
from slpkg.utils import Utils
from slpkg.__metadata__ import MetaData as _m
=======
from slpkg.__metadata__ import (
arch,
lib_path,
skip_unst
)
>>>>>>> master
class SBoGrep(object):
@ -48,30 +40,16 @@ class SBoGrep(object):
self.line_md5 = "SLACKBUILD MD5SUM: "
self.line_md5_64 = "SLACKBUILD MD5SUM_{0}: ".format(arch64)
self.line_des = "SLACKBUILD SHORT DESCRIPTION: "
<<<<<<< HEAD
self.sbo_txt = _m.lib_path + "sbo_repo/SLACKBUILDS.TXT"
self.answer = ['y', 'Y']
self.unst = ['UNSUPPORTED', 'UNTESTED']
self.SLACKBUILDS_TXT = Utils().read_file(self.sbo_txt)
=======
self.sbo_txt = lib_path + "sbo_repo/SLACKBUILDS.TXT"
self.answer = ['y', 'Y']
self.unst = ['UNSUPPORTED', 'UNTESTED']
# open an read SLACKBUILDS.TXT file
f = open(self.sbo_txt, "r")
self.SLACKBUILDS_TXT = f.read()
f.close()
>>>>>>> master
def source(self):
'''
Grab sources downloads links
'''
<<<<<<< HEAD
source, source64, = '', ''
=======
source, source64, src, = "", "", ""
>>>>>>> master
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
sbo_name = line[17:].strip()
@ -81,7 +59,6 @@ class SBoGrep(object):
if line.startswith(self.line_down_64):
if sbo_name == self.name and line[28:].strip():
source64 = line[28:]
<<<<<<< HEAD
return self._select_source_arch(source, source64)
def _select_source_arch(self, source, source64):
@ -111,33 +88,6 @@ class SBoGrep(object):
if sbo_name == self.name:
return line[21:].strip().split()
=======
if arch == "x86_64":
if source64:
src = source64
else:
src = source
if skip_unst in self.answer and source64 in self.unst:
src = source
else:
if source:
src = source
if skip_unst in self.answer and source in self.unst:
src = source64
return src
def requires(self):
'''
Grab package requirements
'''
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
sbo_name = line[17:].strip()
if line.startswith(self.line_req):
if sbo_name == self.name:
return line[21:].strip().split()
>>>>>>> master
def version(self):
'''
Grab package version
@ -153,11 +103,7 @@ class SBoGrep(object):
'''
Grab checksum string
'''
<<<<<<< HEAD
md5sum, md5sum64, = [], []
=======
md5sum, md5sum64, md5 = [], [], []
>>>>>>> master
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
sbo_name = line[17:].strip()
@ -167,33 +113,21 @@ class SBoGrep(object):
if line.startswith(self.line_md5):
if sbo_name == self.name and line[19:].strip():
md5sum = line[19:].strip().split()
<<<<<<< HEAD
return self._select_md5sum_arch(md5sum, md5sum64)
def _select_md5sum_arch(self, md5sum, md5sum64):
md5 = ''
if _m.arch == "x86_64":
=======
if arch == "x86_64":
>>>>>>> master
if md5sum64:
md5 = md5sum64
else:
md5 = md5sum
<<<<<<< HEAD
if _m.skip_unst in self.answer:
=======
if skip_unst in self.answer:
>>>>>>> master
md5 = md5sum
else:
if md5sum:
md5 = md5sum
<<<<<<< HEAD
if _m.skip_unst in self.answer and not md5sum:
=======
if skip_unst in self.answer and not md5sum:
>>>>>>> master
md5 = md5sum64
return md5

View file

@ -23,20 +23,12 @@
import shutil
<<<<<<< HEAD:slpkg/sbo/remove.py
from slpkg.__metadata__ import MetaData as _m
=======
from slpkg.__metadata__ import del_build
>>>>>>> master:slpkg/sbo/remove.py
def delete(build_folder):
'''
Delete build directory and all its contents.
'''
<<<<<<< HEAD:slpkg/sbo/remove.py
if _m.del_build == "on":
=======
if del_build == "on":
>>>>>>> master:slpkg/sbo/remove.py
shutil.rmtree(build_folder)

View file

@ -23,16 +23,10 @@
import sys
<<<<<<< HEAD
from slpkg.utils import Utils
from slpkg.repositories import Repo
from slpkg.blacklist import BlackList
from slpkg.__metadata__ import MetaData as _m
=======
from slpkg.repositories import Repo
from slpkg.blacklist import BlackList
from slpkg.__metadata__ import lib_path
>>>>>>> master
from slpkg.slack.slack_version import slack_ver
@ -45,7 +39,6 @@ def sbo_search_pkg(name):
repo = Repo().sbo()
blacklist = BlackList().packages()
sbo_url = "{0}{1}/".format(repo, slack_ver())
<<<<<<< HEAD
SLACKBUILDS_TXT = Utils().read_file(
_m.lib_path + "sbo_repo/SLACKBUILDS.TXT")
for line in SLACKBUILDS_TXT.splitlines():
@ -53,17 +46,6 @@ def sbo_search_pkg(name):
sbo_name = (line[23:].split("/")[-1].replace("\n", "")).strip()
if name == sbo_name and name not in blacklist:
return (sbo_url + line[23:].strip() + "/")
=======
with open(lib_path + "sbo_repo/SLACKBUILDS.TXT",
"r") as SLACKBUILDS_TXT:
for line in SLACKBUILDS_TXT:
if line.startswith("SLACKBUILD LOCATION"):
sbo_name = (line[23:].split("/")[-1].replace("\n",
"")).strip()
if name == sbo_name and name not in blacklist:
SLACKBUILDS_TXT.close()
return (sbo_url + line[23:].strip() + "/")
>>>>>>> master
except KeyboardInterrupt:
print("") # new line at exit
sys.exit(0)

View file

@ -24,7 +24,6 @@
import os
import sys
<<<<<<< HEAD
from slpkg.utils import Utils
from slpkg.messages import Msg
@ -44,42 +43,10 @@ from remove import delete
from compressed import SBoLink
from dependency import Requires
from search import sbo_search_pkg
=======
from slpkg.toolbar import status
from slpkg.downloader import Download
from slpkg.splitting import split_package
from slpkg.__metadata__ import (
tmp,
pkg_path,
build_path,
log_path,
lib_path,
default_answer,
color,
sp
)
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
>>>>>>> master
class SBoInstall(object):
<<<<<<< HEAD
def __init__(self, slackbuilds):
self.slackbuilds = slackbuilds
self.unst = ["UNSUPPORTED", "UNTESTED"]
@ -159,112 +126,10 @@ class SBoInstall(object):
self._continue_to_install()
else:
Msg().not_found(if_upgrade)
=======
def __init__(self, name):
self.name = name
sys.stdout.write("{0}Reading package lists ...{1}".format(
color['GREY'], color['ENDC']))
sys.stdout.flush()
self.UNST = ["UNSUPPORTED", "UNTESTED"]
self.dependencies_list = sbo_dependencies_pkg(name)
def start(self):
'''
Download, build and install or upgrade packages
with all dependencies if version is greater than
that established.
'''
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(color['GREY'],
color['ENDC']))
# sbo versions = idata[0]
# package arch = idata[1]
# package sum = idata[2]
# sources = idata[3]
idata = installing_data(dependencies, self.UNST)
# count upgraded = cnt[0]
# count installed = cnt[1]
(PKG_COLOR, count) = pkg_colors_tag(self.name, idata[0], 0, 0)
print("\nThe following packages will be automatically "
"installed or upgraded")
print("with new version:\n")
top_view()
print("Installing:")
ARCH_COLOR = arch_colors_tag(self.UNST, idata[1])
view_packages(PKG_COLOR, self.name, idata[0][-1], ARCH_COLOR,
idata[1][-1])
if len(dependencies) > 1:
print("Installing for dependencies:")
for dep, ver, dep_arch in zip(dependencies[:-1],
idata[0][:-1], idata[1][:-1]):
(DEP_COLOR, count) = pkg_colors_tag(dep, ver, count[0],
count[1])
ARCH_COLOR = arch_colors_tag(self.UNST, dep)
view_packages(DEP_COLOR, dep, ver, ARCH_COLOR, dep_arch)
# insstall message = msg[0]
# upgraded message = msg[1]
# total message = msg[2]
msg = msgs(dependencies, count[1], count[0])
print("\nInstalling summary")
print("=" * 79)
print("{0}Total {1} {2}.".format(color['GREY'],
len(dependencies), msg[2]))
print("{0} {1} will be installed, {2} allready installed and "
"{3} {4}".format(count[1], msg[0], idata[2], count[0],
msg[1]))
print("will be upgraded.{0}\n".format(color['ENDC']))
answer = arch_support(idata[3], self.UNST, idata[2],
dependencies)
if answer in['y', 'Y']:
# installs = b_ins[0]
# upgraded = b_ins[1]
# versions = b_ins[2]
b_ins = build_install(dependencies, idata[0])
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]
# sbo version = mdata1]
# package arch = mdata[2]
mdata = matching_data(self.name, self.UNST)
sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
color['ENDC']))
if mdata[0]:
print("\nPackages with name matching [ {0}{1}{2} ]"
"\n".format(color['CYAN'], self.name, color['ENDC']))
top_view()
print("Matching:")
for match, ver, march in zip(mdata[0], mdata[1], mdata[2]):
if find_package(match + sp + ver, pkg_path):
view_packages(color['GREEN'], match, ver, "", march)
count_installed += 1
else:
view_packages(color['RED'], match, ver, "", march)
count_uninstalled += 1
# insstall message = msg[0]
# uninstall message = msg[1]
# total message = msg[2]
msg = msgs(mdata[0], count_installed, count_uninstalled)
print("\nInstalling summary")
print("=" * 79)
print("{0}Total found {1} matching {2}.".format(
color['GREY'], len(mdata[0]), msg[2]))
print("{0} installed {1} and {2} uninstalled {3}.{4}"
"\n".format(count_installed, msg[0],
count_uninstalled, msg[1], color['ENDC']))
else:
pkg_not_found("\n", self.name, "No matching", "\n")
>>>>>>> master
except KeyboardInterrupt:
print("") # new line at exit
sys.exit(0)
<<<<<<< HEAD
def _continue_to_install(self):
'''
Continue to install
@ -471,286 +336,3 @@ class SBoInstall(object):
installs.append(prgnam)
PackageManager(binary).upgrade()
return [installs, upgraded]
=======
def one_for_all(self):
'''
Create one list for all packages
'''
requires = []
requires.append(self.name)
for pkg in self.dependencies_list:
requires += pkg
requires.reverse()
return requires
def remove_dbs(self):
'''
Remove double dependencies
'''
requires = self.one_for_all()
dependencies = []
for duplicate in requires:
if duplicate not in dependencies:
dependencies.append(duplicate)
return dependencies
def installing_data(dependencies, support):
'''
Create two lists one for package version and one
for package arch
'''
package_sum = 0
sbo_versions, package_arch = [], []
sys.stdout.write("{0}Resolving dependencies ...{1}".format(
color['GREY'], color['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()
package_arch.append(select_arch(sources, 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(color['GREY'], color['ENDC']))
return [sbo_versions, package_arch, package_sum, sources]
def pkg_colors_tag(name, sbo_versions, count_upg, count_ins):
'''
Tag with color green if package already installed,
color yellow for packages to upgrade and color red
if not installed.
'''
# check if 'sbo_versions' is list if true
# then get last package from list is master package
# if false 'sbo_version' is a string
if isinstance(sbo_versions, list):
sbo_versions = sbo_versions[-1]
master_pkg = ("{0}-{1}".format(name, sbo_versions))
if find_package(master_pkg, pkg_path):
paint = color['GREEN']
elif find_package(name + sp, pkg_path):
paint = color['YELLOW']
count_upg += 1
else:
paint = color['RED']
count_ins += 1
return paint, [count_upg, count_ins]
def arch_colors_tag(support, package_arch):
'''
Arch color tag
'''
paint = ""
if support[0] in package_arch[-1]:
paint = color['RED']
elif support[1] in package_arch[-1]:
paint = color['YELLOW']
return paint
def top_view():
'''
View top template
'''
template(78)
print("{0}{1}{2}{3}{4}{5}{6}".format(
"| Package", " " * 30,
"Version", " " * 10,
"Arch", " " * 9,
"Repository"))
template(78)
def view_packages(*args):
'''
View slackbuild packages with version and arch
'''
print(" {0}{1}{2}{3} {4}{5}{6} {7}{8}{9}{10}".format(
args[0], args[1], color['ENDC'],
" " * (37-len(args[1])), args[2],
" " * (16-len(args[2])), args[3], args[4], color['ENDC'],
" " * (13-len(args[4])), "SBo"))
def msgs(packages, count_ins, count_uni):
'''
Print singular plural
'''
total_msg = ins_msg = uns_msg = "package"
if len(packages) > 1:
total_msg = total_msg + "s"
if count_ins > 1:
ins_msg = ins_msg + "s"
if count_uni > 1:
uns_msg = uns_msg + "s"
return [ins_msg, uns_msg, total_msg]
def arch_support(source, support, package_sum, dependencies):
'''
Check if package supported or tested by arch
before proceed to install.
Exit if all packages already installed
'''
if source in support:
print("{0}The package {1}{2}\n".format(color['RED'], source,
color['ENDC']))
answer = ""
elif package_sum == len(dependencies):
answer = ""
elif default_answer == "y":
answer = default_answer
else:
answer = raw_input("Would you like to continue [Y/n]? ")
return answer
def filenames(sources):
'''
Download sources and return filenames
'''
filename = []
for src in sources:
# get file from source
filename.append(src.split("/")[-1])
return filename
def search_in_tmp(prgnam):
'''
Search for binarys packages in /tmp directory
'''
binary = []
for search in find_package(prgnam, tmp):
if "_SBo" in search:
binary.append(search)
return binary
def build_install(dependencies, sbo_versions):
'''
Searches the package name and version in /tmp to
install. If find two or more packages e.g. to build
tag 2 or 3 will fit most
'''
installs, upgraded, versions = [], [], []
os.chdir(build_path)
for pkg, ver in zip(dependencies, sbo_versions):
prgnam = ("{0}-{1}".format(pkg, ver))
sbo_file = "".join(find_package(prgnam, pkg_path))
if sbo_file:
template(78)
pkg_found(pkg, split_package(sbo_file)[1])
template(78)
else:
sbo_url = sbo_search_pkg(pkg)
sbo_link = SBoLink(sbo_url).tar_gz()
src_link = SBoGrep(pkg).source().split()
script = sbo_link.split("/")[-1]
dwn_srcs = sbo_link.split() + src_link
Download(build_path, dwn_srcs).start()
sources = filenames(src_link)
BuildPackage(script, sources, build_path).build()
binary_list = search_in_tmp(prgnam)
try:
binary = (tmp + max(binary_list)).split()
except ValueError:
build_FAILED(sbo_url, prgnam)
sys.exit(0)
if find_package(pkg + sp, pkg_path):
print("{0}[ Upgrading ] --> {1}{2}".format(color['GREEN'],
color['ENDC'],
pkg))
upgraded.append(pkg)
else:
print("{0}[ Installing ] --> {1}{2}".format(color['GREEN'],
color['ENDC'],
pkg))
PackageManager(binary).upgrade()
installs.append(pkg)
versions.append(ver)
return [installs, upgraded, versions]
def reference(*args):
'''
Reference list with packages installed
and upgraded
'''
template(78)
print("| Total {0} {1} installed and {2} {3} upgraded".format(
args[0], args[1], args[2], args[3]))
template(78)
for pkg, ver in zip(args[4], args[5]):
installed = ("{0}-{1}".format(pkg, ver))
if find_package(installed, pkg_path):
if pkg in args[6]:
print("| Package {0} upgraded successfully".format(installed))
else:
print("| Package {0} installed successfully".format(installed))
else:
print("| Package {0} NOT installed".format(installed))
template(78)
def write_deps(dependencies):
'''
Write dependencies in a log file
into directory `/var/log/slpkg/dep/`
'''
name = dependencies[-1]
if find_package(name + sp, pkg_path):
dep_path = log_path + "dep/"
if not os.path.exists(dep_path):
os.mkdir(dep_path)
if os.path.isfile(dep_path + name):
os.remove(dep_path + name)
if len(dependencies[:-1]) > 0:
with open(dep_path + name, "w") as f:
for dep in dependencies[:-1]:
f.write(dep + "\n")
f.close()
def matching_data(name, support):
'''
Open and read SLACKBUILD.TXT file and store matching
packages
'''
sbo_matching, sbo_versions, packages_arch = [], [], []
toolbar_width, index = 3, 0
with open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r") as SLACKBUILDS_TXT:
for line in SLACKBUILDS_TXT:
if line.startswith("SLACKBUILD NAME: "):
sbo_name = line[17:].strip()
if name in sbo_name:
index += 1
toolbar_width = status(index, toolbar_width, 4)
sbo_matching.append(sbo_name)
sbo_versions.append(SBoGrep(sbo_name).version())
sources = SBoGrep(sbo_name).source()
packages_arch.append(select_arch(sources, support))
SLACKBUILDS_TXT.close()
return [sbo_matching, sbo_versions, packages_arch]
def select_arch(src, support):
'''
Looks if sources unsupported or untested
from arch else select arch
'''
arch = os.uname()[4]
if arch.startswith("i") and arch.endswith("86"):
arch = "i486"
for item in support:
if item in src:
arch = item
return arch
>>>>>>> master

View file

@ -25,26 +25,9 @@ import os
import sys
import pydoc
<<<<<<< HEAD
from slpkg.messages import Msg
from slpkg.downloader import Download
from slpkg.__metadata__ import MetaData as _m
=======
from slpkg.downloader import Download
from slpkg.__metadata__ import (
tmp,
build_path,
pkg_path,
color,
sp
)
from slpkg.messages import (
pkg_found,
pkg_not_found,
template,
build_FAILED
)
>>>>>>> master
from slpkg.pkg.find import find_package
from slpkg.pkg.build import BuildPackage
@ -61,13 +44,7 @@ class SBoNetwork(object):
def __init__(self, name):
self.name = name
<<<<<<< HEAD
Msg().reading()
=======
sys.stdout.write("{0}Reading package lists ...{1}".format(
color['GREY'], color['ENDC']))
sys.stdout.flush()
>>>>>>> master
grep = SBoGrep(self.name)
self.sbo_url = sbo_search_pkg(self.name)
if self.sbo_url:
@ -78,11 +55,7 @@ class SBoNetwork(object):
self.sbo_version = grep.version()
self.dwn_srcs = self.sbo_dwn.split() + self.source_dwn
self.space = ("\n" * 50)
<<<<<<< HEAD
Msg().done()
=======
sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
>>>>>>> master
def view(self):
'''
@ -117,7 +90,6 @@ class SBoNetwork(object):
pydoc.pager(SlackBuild + fill)
elif choice in ['B', 'b']:
self.build(FAULT)
<<<<<<< HEAD
delete(_m.build_path)
break
elif choice in ['I', 'i']:
@ -130,52 +102,25 @@ class SBoNetwork(object):
Msg().template(78)
Msg().pkg_found(self.name, self.sbo_version)
Msg().template(78)
=======
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)
pkg_found(self.name, self.sbo_version)
template(78)
>>>>>>> master
break
else:
break
else:
<<<<<<< HEAD
Msg().pkg_not_found("\n", self.name, "Can't view", "\n")
=======
pkg_not_found("\n", self.name, "Can't view", "\n")
>>>>>>> master
@staticmethod
def view_sbo(*args):
'''
View slackbuild.org
'''
<<<<<<< HEAD
color = _m.color
print("") # new line at start
Msg().template(78)
=======
print("") # new line at start
template(78)
>>>>>>> master
print("| {0}Package {1}{2}{3} --> {4}".format(color['GREEN'],
color['CYAN'], args[0],
color['GREEN'],
color['ENDC'] + args[1]))
<<<<<<< HEAD
Msg().template(78)
=======
template(78)
>>>>>>> master
print("| {0}Description : {1}{2}".format(color['GREEN'],
color['ENDC'], args[2]))
print("| {0}SlackBuild : {1}{2}".format(color['GREEN'], color['ENDC'],
@ -185,11 +130,7 @@ class SBoNetwork(object):
print("| {0}Requirements : {1}{2}".format(color['YELLOW'],
color['ENDC'],
", ".join(args[5])))
<<<<<<< HEAD
Msg().template(78)
=======
template(78)
>>>>>>> master
print(" {0}R{1}EADME View the README file".format(
color['RED'], color['ENDC']))
print(" {0}S{1}lackBuild View the SlackBuild file".format(
@ -226,11 +167,7 @@ class SBoNetwork(object):
'''
try:
choice = raw_input(" {0}Choose an option: {1}".format(
<<<<<<< HEAD
_m.color['GREY'], _m.color['ENDC']))
=======
color['GREY'], color['ENDC']))
>>>>>>> master
except KeyboardInterrupt:
print("") # new line at exit
sys.exit(0)
@ -250,7 +187,6 @@ class SBoNetwork(object):
Only build and create Slackware package
'''
if FAULT:
<<<<<<< HEAD
print("\n{0}The package {1} {2}\n".format(_m.color['RED'], FAULT,
_m.color['ENDC']))
sys.exit(0)
@ -263,18 +199,6 @@ class SBoNetwork(object):
for src in self.source_dwn:
sources.append(src.split("/")[-1])
BuildPackage(script, sources, _m.build_path).build()
=======
print("\n{0}The package {1} {2}\n".format(color['RED'], FAULT,
color['ENDC']))
sys.exit(0)
sources = []
os.chdir(build_path)
Download(build_path, self.dwn_srcs).start()
script = self.sbo_dwn.split("/")[-1]
for src in self.source_dwn:
sources.append(src.split("/")[-1])
BuildPackage(script, sources, build_path).build()
>>>>>>> master
def install(self, prgnam):
'''
@ -282,7 +206,6 @@ class SBoNetwork(object):
directory.
'''
binary_list = []
<<<<<<< HEAD
for search in find_package(prgnam, _m.output):
if "_SBo" in search:
binary_list.append(search)
@ -293,17 +216,5 @@ class SBoNetwork(object):
sys.exit(0)
print("[ {0}Installing{1} ] --> {2}".format(_m.color['GREEN'],
_m.color['ENDC'],
=======
for search in find_package(prgnam, tmp):
if "_SBo" in search:
binary_list.append(search)
try:
binary = (tmp + max(binary_list)).split()
except ValueError:
build_FAILED(self.sbo_url, prgnam)
sys.exit(0)
print("[ {0}Installing{1} ] --> {2}".format(color['GREEN'],
color['ENDC'],
>>>>>>> master
self.name))
PackageManager(binary).upgrade()

View file

@ -22,14 +22,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.repositories import Repo
<<<<<<< HEAD
from slpkg.__metadata__ import MetaData as _m
=======
from slpkg.__metadata__ import (
arch,
slack_rel
)
>>>>>>> master
from slack_version import slack_ver
@ -39,7 +32,6 @@ def mirrors(name, location):
Select Slackware official mirror packages
based architecture and version.
'''
<<<<<<< HEAD
rel = _m.slack_rel
ver = slack_ver()
repo = Repo().slack()
@ -53,21 +45,4 @@ def mirrors(name, location):
http = repo + "slackware-{0}/{1}{2}".format(ver, location, name)
else:
http = repo + "slackware-{0}/{1}{2}".format(rel, location, name)
=======
repo = Repo().slack()
if arch == "x86_64":
if slack_rel == "stable":
http = repo + "slackware64-{0}/{1}{2}".format(slack_ver(),
location, name)
else:
http = repo + "slackware64-{0}/{1}{2}".format(slack_rel,
location, name)
else:
if slack_rel == "stable":
http = repo + "slackware-{0}/{1}{2}".format(slack_ver(),
location, name)
else:
http = repo + "slackware-{0}/{1}{2}".format(slack_rel,
location, name)
>>>>>>> master
return http

View file

@ -25,50 +25,29 @@ import os
import sys
import subprocess
<<<<<<< HEAD
from slpkg.utils import Utils
from slpkg.sizes import units
from slpkg.messages import Msg
from slpkg.url_read import URL
from slpkg.remove import delete
=======
from slpkg.sizes import units
from slpkg.url_read import URL
from slpkg.remove import delete
from slpkg.messages import template
>>>>>>> master
from slpkg.checksum import check_md5
from slpkg.blacklist import BlackList
from slpkg.downloader import Download
from slpkg.grep_md5 import pkg_checksum
from slpkg.splitting import split_package
<<<<<<< HEAD
from slpkg.__metadata__ import MetaData as _m
from slpkg.pkg.find import find_package
from slpkg.pkg.manager import PackageManager
from slpkg.binary.greps import repo_data
=======
from slpkg.__metadata__ import (
pkg_path,
slpkg_tmp_patches,
default_answer,
color
)
from slpkg.pkg.find import find_package
from slpkg.pkg.manager import PackageManager
>>>>>>> master
from mirrors import mirrors
from greps import slack_data
from slack_version import slack_ver
class Patches(object):
<<<<<<< HEAD
def __init__(self):
self.version = _m.slack_rel
self.patch_path = _m.slpkg_tmp_patches
@ -77,24 +56,11 @@ class Patches(object):
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT",
"patches/")).reading()
self.step = 20
=======
def __init__(self, version):
self.version = version
self.patch_path = slpkg_tmp_patches
sys.stdout.write("{0}Reading package lists ...{1}".format(
color['GREY'], color['ENDC']))
sys.stdout.flush()
if self.version == "stable":
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT",
"patches/")).reading()
self.step = 10
>>>>>>> master
else:
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "")).reading()
self.step = 700
def start(self):
<<<<<<< HEAD
'''
Install new patches from official Slackware mirrors
'''
@ -218,134 +184,3 @@ class Patches(object):
if answer in ['y', 'Y']:
subprocess.call("lilo", shell=True)
break
=======
'''
Install new patches from official Slackware mirrors
'''
try:
(pkg_for_upgrade, dwn_links, upgrade_all, comp_sum,
uncomp_sum) = self.store()
sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
color['ENDC']))
if upgrade_all:
print("\nThese packages need upgrading:\n")
template(78)
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
"| Package", " " * 17,
"Version", " " * 12,
"Arch", " " * 4,
"Build", " " * 2,
"Repos", " " * 10,
"Size"))
template(78)
print("Upgrading:")
views(pkg_for_upgrade, upgrade_all, comp_sum)
unit, size = units(comp_sum, uncomp_sum)
print("\nInstalling summary")
print("=" * 79)
print("{0}Total {1} {2} will be upgraded.".format(
color['GREY'], len(upgrade_all), msgs(upgrade_all)))
print("Need to get {0} {1} of archives.".format(size[0],
unit[0]))
print("After this process, {0} {1} of additional disk space "
"will be used.{2}".format(size[1], unit[1],
color['ENDC']))
if default_answer == "y":
answer = default_answer
else:
answer = raw_input("\nWould you like to continue [Y/n]? ")
if answer in ['y', 'Y']:
Download(self.patch_path, dwn_links).start()
upgrade(self.patch_path, upgrade_all)
kernel(upgrade_all)
delete(self.patch_path, upgrade_all)
else:
slack_arch = ""
if os.uname()[4] == "x86_64":
slack_arch = 64
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
sys.exit(0)
def store(self):
'''
Store and return packages for upgrading
'''
(pkg_for_upgrade, dwn, upgrade, comp_sum,
uncomp_sum) = ([] for i in range(5))
data = slack_data(self.PACKAGES_TXT, self.step)
black = BlackList().packages()
for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]):
inst_pkg = find_package(split_package(name)[0] + "-", pkg_path)
if (inst_pkg and not os.path.isfile(pkg_path + name[:-4]) and
split_package(''.join(inst_pkg[0])) not in black):
dwn.append("{0}{1}/{2}".format(mirrors("", ""), loc, name))
comp_sum.append(comp)
uncomp_sum.append(uncomp)
upgrade.append(name)
pkg_for_upgrade.append('{0}-{1}'.format(
split_package(''.join(inst_pkg[0]))[0],
split_package(''.join(inst_pkg[0]))[1]))
return [pkg_for_upgrade, dwn, upgrade, comp_sum, uncomp_sum]
def views(pkg_for_upgrade, upgrade_all, comp_sum):
'''
Views packages
'''
for upg, upgrade, size in sorted(zip(pkg_for_upgrade, upgrade_all,
comp_sum)):
pkg_split = split_package(upgrade[:-4])
print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>12}{12}".format(
color['YELLOW'], upg, color['ENDC'],
" " * (24-len(upg)), pkg_split[1],
" " * (18-len(pkg_split[1])), pkg_split[2],
" " * (8-len(pkg_split[2])), pkg_split[3],
" " * (7-len(pkg_split[3])), "Slack",
size, " K"))
def msgs(upgrade_all):
'''
Print singular plural
'''
msg_pkg = "package"
if len(upgrade_all) > 1:
msg_pkg = msg_pkg + "s"
return msg_pkg
def upgrade(patch_path, upgrade_all):
'''
Upgrade packages
'''
for pkg in upgrade_all:
check_md5(pkg_checksum(pkg, "slack_patches"), patch_path + pkg)
print("[ {0}upgrading{1} ] --> {2}".format(color['YELLOW'],
color['ENDC'], pkg[:-4]))
PackageManager((patch_path + pkg).split()).upgrade()
def kernel(upgrade_all):
'''
Check if kernel upgraded if true
then reinstall 'lilo'
'''
for core in upgrade_all:
if "kernel" in core:
if default_answer == "y":
answer = default_answer
else:
print("")
template(78)
print("| {0}*** HIGHLY recommended reinstall 'LILO' "
"***{1}".format(color['RED'], color['ENDC']))
template(78)
answer = raw_input("\nThe kernel has been upgraded, "
"reinstall `LILO` [Y/n]? ")
if answer in ['y', 'Y']:
subprocess.call("lilo", shell=True)
break
>>>>>>> master

View file

@ -32,17 +32,7 @@ from checksum import check_md5
from grep_md5 import pkg_checksum
from url_read import URL
from downloader import Download
<<<<<<< HEAD
from __metadata__ import MetaData as _m
=======
from __metadata__ import (
__all__,
__version__,
__author__,
default_answer,
build_path
)
>>>>>>> master
def it_self_update():
@ -54,7 +44,6 @@ def it_self_update():
repository = 'github'
branch = 'master'
ver_link = ('https://raw.{0}usercontent.com/{1}/{2}/'
<<<<<<< HEAD
'{3}/{4}/__metadata__.py'.format(repository, _m.__author__,
_m.__all__, branch,
_m.__all__))
@ -68,61 +57,29 @@ def it_self_update():
else:
print("\nNew version '{0}-{1}' is available !\n".format(
_m.__all__, __new_version__))
=======
'{3}/{4}/__metadata__.py'.format(repository, __author__,
__all__, branch, __all__))
version_data = URL(ver_link).reading()
for line in version_data.splitlines():
if line.startswith('__version_info__'):
__new_version__ = '.'.join(re.findall(r'\d+', line))
if __new_version__ > __version__:
if default_answer == "y":
answer = default_answer
else:
print("\nNew version '{0}-{1}' is available !\n".format(
__all__, __new_version__))
>>>>>>> master
answer = raw_input("Would you like to upgrade [Y/n]? ")
if answer in ['y', 'Y']:
print("") # new line after answer
else:
sys.exit(0)
dwn_link = ['https://{0}.com/{1}/{2}/archive/'
<<<<<<< HEAD
'v{3}.tar.gz'.format(repository, _m.__author__, _m.__all__,
__new_version__)]
if not os.path.exists(_m.build_path):
os.makedirs(_m.build_path)
Download(_m.build_path, dwn_link).start()
os.chdir(_m.build_path)
=======
'v{3}.tar.gz'.format(repository, __author__, __all__,
__new_version__)]
Download(build_path, dwn_link).start()
os.chdir(build_path)
>>>>>>> master
slpkg_tar_file = 'v' + __new_version__ + '.tar.gz'
tar = tarfile.open(slpkg_tar_file)
tar.extractall()
tar.close()
<<<<<<< HEAD
file_name = '{0}-{1}'.format(_m.__all__, _m.__new_version__)
os.chdir(file_name)
check_md5(pkg_checksum(slpkg_tar_file[1:], "slpkg"),
_m.build_path + slpkg_tar_file)
=======
file_name = '{0}-{1}'.format(__all__, __new_version__)
os.chdir(file_name)
check_md5(pkg_checksum(slpkg_tar_file[1:], "slpkg"),
build_path + slpkg_tar_file)
>>>>>>> master
subprocess.call('chmod +x {0}'.format('install.sh'), shell=True)
subprocess.call('sh install.sh', shell=True)
else:
print('\n{0}: There is no new version, already used the last !'
<<<<<<< HEAD
'\n'.format(_m.__all__))
=======
'\n'.format(__all__))
>>>>>>> master
sys.exit(0)

View file

@ -24,11 +24,7 @@
import sys
import time
<<<<<<< HEAD:slpkg/toolbar.py
from __metadata__ import MetaData as _m
=======
from __metadata__ import color
>>>>>>> master:slpkg/toolbar.py
def status(index, width, step):
@ -36,15 +32,8 @@ def status(index, width, step):
Print toolbar status
'''
if index == width:
<<<<<<< HEAD:slpkg/toolbar.py
sys.stdout.write("{0}.{1}".format(_m.color['GREY'], _m.color['ENDC']))
sys.stdout.flush()
width += step
time.sleep(0.02)
=======
sys.stdout.write("{0}.{1}".format(color['GREY'], color['ENDC']))
sys.stdout.flush()
width += step
time.sleep(0.05)
>>>>>>> master:slpkg/toolbar.py
return width

View file

@ -21,38 +21,18 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
<<<<<<< HEAD
from utils import Utils
from messages import Msg
from __metadata__ import MetaData as _m
=======
import sys
from messages import (
template
)
from __metadata__ import (
pkg_path,
color,
sp
)
>>>>>>> master
from pkg.find import find_package
from sbo.search import sbo_search_pkg
<<<<<<< HEAD
from sbo.dependency import Requires
from binary.search import search_pkg
from binary.dependency import Dependencies
=======
from sbo.dependency import sbo_dependencies_pkg
from others.search import search_pkg
from others.dependency import dependencies_pkg
>>>>>>> master
def track_dep(name, repo):
@ -62,7 +42,6 @@ def track_dep(name, repo):
if allready installed and color red
if not installed.
'''
<<<<<<< HEAD
Msg().resolving()
if repo == "sbo":
dependencies_list = Requires().sbo(name)
@ -78,33 +57,10 @@ def track_dep(name, repo):
requires = Utils().dimensional_list(dependencies_list)
requires.reverse()
dependencies = Utils().remove_dbs(requires)
=======
sys.stdout.write("{0}Reading package lists ...{1}".format(color['GREY'],
color['ENDC']))
sys.stdout.flush()
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(color['GREY'], color['ENDC']))
if find_pkg:
requires, dependencies = [], []
# Create one list for all packages
for pkg in dependencies_list:
requires += pkg
requires.reverse()
# Remove double dependencies
for duplicate in requires:
if duplicate not in dependencies:
dependencies.append(duplicate)
>>>>>>> master
if dependencies == []:
dependencies = ["No dependencies"]
pkg_len = len(name) + 24
print("") # new line at start
<<<<<<< HEAD
Msg().template(pkg_len)
print("| Package {0}{1}{2} dependencies :".format(_m.color['CYAN'],
name,
@ -125,26 +81,6 @@ def track_dep(name, repo):
print(" |")
print(" {0}{1}: {2}{3}{4}".format("+--", index, _m.color['RED'],
pkg, _m.color['ENDC']))
=======
template(pkg_len)
print("| Package {0}{1}{2} dependencies :".format(color['CYAN'], name,
color['ENDC']))
template(pkg_len)
print("\\")
print(" +---{0}[ Tree of dependencies ]{1}".format(color['YELLOW'],
color['ENDC']))
index = 0
for pkg in dependencies:
index += 1
if find_package(pkg + sp, pkg_path):
print(" |")
print(" {0}{1}: {2}{3}{4}".format("+--", index, color['GREEN'],
pkg, color['ENDC']))
else:
print(" |")
print(" {0}{1}: {2}{3}{4}".format("+--", index, color['RED'],
pkg, color['ENDC']))
>>>>>>> master
print("") # new line at end
else:
print("\nNo package was found to match\n")

View file

@ -24,11 +24,7 @@
import sys
import urllib2
<<<<<<< HEAD
from __metadata__ import MetaData as _m
=======
from __metadata__ import color
>>>>>>> master
class URL(object):
@ -45,11 +41,7 @@ class URL(object):
return f.read()
except (urllib2.URLError, ValueError):
print("\n{0}Can't read file '{1}'{2}".format(
<<<<<<< HEAD
_m.color['RED'], self.link.split('/')[-1], _m.color['ENDC']))
=======
color['RED'], self.link.split('/')[-1], color['ENDC']))
>>>>>>> master
return ' '
except KeyboardInterrupt:
print("") # new line at exit

View file

@ -23,28 +23,14 @@
import sys
<<<<<<< HEAD
from __metadata__ import MetaData as _m
=======
from __metadata__ import (
__version__,
__license__,
__email__
)
>>>>>>> master
def prog_version():
'''
Print version, license and email
'''
<<<<<<< HEAD
print("Version : {0}".format(_m.__version__))
print("Licence : {0}".format(_m.__license__))
print("Email : {0}".format(_m.__email__))
=======
print("Version : {0}".format(__version__))
print("Licence : {0}".format(__license__))
print("Email : {0}".format(__email__))
>>>>>>> master
sys.exit(0)