updated for version 2.0.0

This commit is contained in:
Dimitris Zlatanidis 2014-10-16 05:10:24 +03:00
parent fc0beb98fa
commit 3e9d5ebb34
11 changed files with 44 additions and 50 deletions

View file

@ -1,3 +1,10 @@
Version 2.0.0
15-10-2014
[Updated] - Align PEP8 code style.
Fix sbo arch.
Update package splitting.
Version 1.9.9
11-10-2014

View file

@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: slpkg
Version: 1.9.9
Version: 2.0.0
Author: dslackw
Author-email: d zlatanidis at gmail com
Maintainer: dslackw

View file

@ -7,9 +7,9 @@
Latest Release:
- Version: 1.9.9
- Version: 2.0.0
- `Package <https://sourceforge.net/projects/slpkg/files/slpkg/binary/>`_
- `Source <https://github.com/dslackw/slpkg/archive/v1.9.9.tar.gz>`_
- `Source <https://github.com/dslackw/slpkg/archive/v2.0.0.tar.gz>`_
- `CHANGELOG <https://github.com/dslackw/slpkg/blob/master/CHANGELOG>`_
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png
@ -86,7 +86,7 @@ Tutorial
--------
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png
:target: https://asciinema.org/a/12544
:target: https://asciinema.org/a/12667
Installation
@ -96,8 +96,8 @@ Untar the archive and run install.sh script:
.. code-block:: bash
$ tar xvf slpkg-1.9.9.tar.gz
$ cd slpkg-1.9.9
$ tar xvf slpkg-2.0.0.tar.gz
$ cd slpkg-2.0.0
$ ./install.sh
Using `pip <https://pip.pypa.io/en/latest/>`_ :
@ -446,7 +446,7 @@ Find installed packages:
$ slpkg -f apr
Installed packages with name begin matching [ apr ]
Packages with matching name [ apr ]
[ installed ] - apr-1.5.0-x86_64-1_slack14.1
[ installed ] - apr-util-1.5.3-x86_64-1_slack14.1

View file

@ -21,7 +21,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=slpkg
VERSION=${VERSION:-1.9.9}
VERSION=${VERSION:-2.0.0}
TAG=${TAG:-_dsw}
cd ..

View file

@ -23,7 +23,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=slpkg
VERSION=${VERSION:-1.9.9}
VERSION=${VERSION:-2.0.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_dsw}

View file

@ -1,7 +1,7 @@
PRGNAM="slpkg"
VERSION="1.9.9"
VERSION="2.0.0"
HOMEPAGE="https://github.com/dslackw/slpkg"
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.9.9.tar.gz"
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v2.0.0.tar.gz"
MD5SUM=""
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""

View file

@ -58,14 +58,3 @@ bls_path = "/etc/slpkg/"
''' computer architecture '''
arch = os.uname()[4]
''' Slackware architectures '''
'''slack_archs = [
"-noarch-",
"-x86_64-",
"-i386-",
"-i486-",
"-i686-",
"-x86-",
"-fw-"
]'''

View file

@ -83,18 +83,20 @@ class BlackList(object):
conf.write(line)
conf.close()
f = open(self.blackfile, "r")
self.black_conf = f.read()
f.close()
def packages(self):
'''
Return blacklist packages from /etc/slpkg/blacklist
configuration file.
'''
blacklist = []
with open(self.blackfile, "r") as black_conf:
for read in black_conf:
read = read.lstrip()
if not read.startswith("#"):
blacklist.append(read.replace("\n", ""))
black_conf.close()
for read in self.black_conf.splitlines():
read = read.lstrip()
if not read.startswith("#"):
blacklist.append(read.replace("\n", ""))
return blacklist
def listed(self):
@ -134,16 +136,13 @@ class BlackList(object):
'''
exit = 0
print("\nRemove packages from blacklist:\n")
with open(self.blackfile, "r") as black_conf:
lines = black_conf.read()
black_conf.close()
with open(self.blackfile, "w") as black_conf:
for line in lines.splitlines():
with open(self.blackfile, "w") as remove:
for line in self.black_conf.splitlines():
if line not in pkgs:
black_conf.write(line + "\n")
remove.write(line + "\n")
else:
print("{0}{1}{2}".format(RED, line, ENDC))
exit = 1
black_conf.close()
remove.close()
if exit == 1:
print # new line at exit

View file

@ -34,7 +34,6 @@ def find_package(find_pkg, directory):
pkgs = []
blacklist = BlackList().packages()
for pkg in sorted(os.listdir(directory)):
name = split_package(pkg)[0]
if pkg.startswith(find_pkg) and name not in blacklist:
if pkg.startswith(find_pkg) and split_package(pkg)[0] not in blacklist:
pkgs.append(pkg)
return pkgs

View file

@ -58,18 +58,20 @@ class QueuePkgs(object):
queue.write(line)
queue.close()
f = open(self.queue_list, "r")
self.queued = f.read()
f.close()
def packages(self):
'''
Return queue list from /var/lib/queue/queue_list
file.
'''
queue_list = []
with open(self.queue_list, "r") as queue:
for read in queue:
read = read.lstrip()
if not read.startswith("#"):
queue_list.append(read.replace("\n", ""))
queue.close()
for read in self.queued.splitlines():
read = read.lstrip()
if not read.startswith("#"):
queue_list.append(read.replace("\n", ""))
return queue_list
def listed(self):
@ -113,13 +115,10 @@ class QueuePkgs(object):
'''
exit = 0
print("\nRemove packages from queue:\n")
with open(self.queue_list, "r") as queue:
lines = queue.read()
queue.close()
if pkgs == ["all"]:
pkgs = self.packages()
with open(self.queue_list, "w") as queue:
for line in lines.splitlines():
for line in self.queued.splitlines():
if line not in pkgs:
queue.write(line + "\n")
else:
@ -155,8 +154,7 @@ class QueuePkgs(object):
def install(self):
packages = self.packages()
if packages:
# new line at start
print
print # new line at start
for pkg in packages:
# check if package exist in repository
find = find_package(pkg, tmp)

View file

@ -38,5 +38,7 @@ def split_package(package):
build = split[-1][:-len(slack)]
else:
build = split[-1]
arch, ver, name = split[-2], split[-3], "-".join(split[:-3])
arch = split[-2]
ver = split[-3]
name = "-".join(split[:-3])
return [name, ver, arch, build]