update source v2.0.2

This commit is contained in:
Dimitris Zlatanidis 2014-10-21 06:32:30 +03:00
parent be9a61aee4
commit 7324c1d690
16 changed files with 104 additions and 98 deletions

View file

@ -1,3 +1,8 @@
Version 2.0.2
21-10-2014
[Updated] - Update source.
Version 2.0.1 Version 2.0.1
20-10-2014 20-10-2014

View file

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

View file

@ -3,7 +3,7 @@
.. image:: https://travis-ci.org/dslackw/slpkg.svg?branch=master .. image:: https://travis-ci.org/dslackw/slpkg.svg?branch=master
:target: https://travis-ci.org/dslackw/slpkg :target: https://travis-ci.org/dslackw/slpkg
.. image:: https://landscape.io/github/dslackw/slpkg/master/landscape.png .. image:: https://landscape.io/github/dslackw/slpkg/master/landscape.png
:target: https://landscape.io/github/dslackw/slpkg/master :target: https://landscape.io/github/dslackw/slpkg/master
.. image:: https://pypip.in/d/slpkg/badge.png .. image:: https://pypip.in/d/slpkg/badge.png
:target: https://pypi.python.org/pypi/slpkg :target: https://pypi.python.org/pypi/slpkg
.. image:: https://pypip.in/license/slpkg/badge.png .. image:: https://pypip.in/license/slpkg/badge.png
@ -11,9 +11,9 @@
Latest Release: Latest Release:
- Version: 2.0.1 - Version: 2.0.2
- `Package <https://sourceforge.net/projects/slpkg/files/slpkg/binary/>`_ - `Package <https://sourceforge.net/projects/slpkg/files/slpkg/binary/>`_
- `Source <https://github.com/dslackw/slpkg/archive/v2.0.1.tar.gz>`_ - `Source <https://github.com/dslackw/slpkg/archive/v2.0.2.tar.gz>`_
- `CHANGELOG <https://github.com/dslackw/slpkg/blob/master/CHANGELOG>`_ - `CHANGELOG <https://github.com/dslackw/slpkg/blob/master/CHANGELOG>`_
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png .. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png
@ -100,8 +100,8 @@ Untar the archive and run install.sh script:
.. code-block:: bash .. code-block:: bash
$ tar xvf slpkg-2.0.1.tar.gz $ tar xvf slpkg-2.0.2.tar.gz
$ cd slpkg-2.0.1 $ cd slpkg-2.0.2
$ ./install.sh $ ./install.sh
Using `pip <https://pip.pypa.io/en/latest/>`_ : Using `pip <https://pip.pypa.io/en/latest/>`_ :

View file

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

View file

@ -26,7 +26,7 @@ import sys
import gzip import gzip
import shutil import shutil
from slpkg import __version__, __email__, __author__ from slpkg.__metadate__ import __version__, __email__, __author__
try: try:
from setuptools import setup from setuptools import setup

View file

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

View file

@ -1,7 +1,7 @@
PRGNAM="slpkg" PRGNAM="slpkg"
VERSION="2.0.1" VERSION="2.0.1"
HOMEPAGE="https://github.com/dslackw/slpkg" HOMEPAGE="https://github.com/dslackw/slpkg"
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v2.0.1.tar.gz" DOWNLOAD="https://github.com/dslackw/slpkg/archive/v2.0.2.tar.gz"
MD5SUM="" MD5SUM=""
DOWNLOAD_x86_64="" DOWNLOAD_x86_64=""
MD5SUM_x86_64="" MD5SUM_x86_64=""

View file

@ -1,5 +1 @@
#!/usr/bin/python # [ main ] directory
# -*- coding: utf-8 -*-
from main import *
from __metadata__ import __author__, __version__, __license__, __email__

View file

@ -26,7 +26,7 @@ import subprocess
__all__ = "slpkg" __all__ = "slpkg"
__author__ = "dslackw" __author__ = "dslackw"
__version_info__ = (2, 0, 1) __version_info__ = (2, 0, 2)
__version__ = "{0}.{1}.{2}".format(*__version_info__) __version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)" __license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com" __email__ = "d.zlatanidis@gmail.com"

View file

@ -103,20 +103,20 @@ class BlackList(object):
''' '''
Print blacklist packages Print blacklist packages
''' '''
exit = 0 quit = 0
print("\nPackages in blacklist:\n") print("\nPackages in blacklist:\n")
for black in self.packages(): for black in self.packages():
if black: if black:
print("{0}{1}{2}".format(GREEN, black, ENDC)) print("{0}{1}{2}".format(GREEN, black, ENDC))
exit = 1 quit = 1
if exit == 1: if quit == 1:
print # new line at exit print # new line at exit
def add(self, pkgs): def add(self, pkgs):
''' '''
Add blacklist packages if not exist Add blacklist packages if not exist
''' '''
exit = 0 quit = 0
blacklist = self.packages() blacklist = self.packages()
pkgs = set(pkgs) pkgs = set(pkgs)
print("\nAdd packages in blacklist:\n") print("\nAdd packages in blacklist:\n")
@ -125,16 +125,16 @@ class BlackList(object):
if pkg not in blacklist: if pkg not in blacklist:
print("{0}{1}{2}".format(GREEN, pkg, ENDC)) print("{0}{1}{2}".format(GREEN, pkg, ENDC))
black_conf.write(pkg + "\n") black_conf.write(pkg + "\n")
exit = 1 quit = 1
black_conf.close() black_conf.close()
if exit == 1: if quit == 1:
print # new line at exit print # new line at exit
def remove(self, pkgs): def remove(self, pkgs):
''' '''
Remove packages from blacklist Remove packages from blacklist
''' '''
exit = 0 quit = 0
print("\nRemove packages from blacklist:\n") print("\nRemove packages from blacklist:\n")
with open(self.blackfile, "w") as remove: with open(self.blackfile, "w") as remove:
for line in self.black_conf.splitlines(): for line in self.black_conf.splitlines():
@ -142,7 +142,7 @@ class BlackList(object):
remove.write(line + "\n") remove.write(line + "\n")
else: else:
print("{0}{1}{2}".format(RED, line, ENDC)) print("{0}{1}{2}".format(RED, line, ENDC))
exit = 1 quit = 1
remove.close() remove.close()
if exit == 1: if quit == 1:
print # new line at exit print # new line at exit

View file

@ -66,11 +66,11 @@ def build_FAILED(sbo_url, prgnam):
print # new line at end print # new line at end
def template(max): def template(max_len):
''' '''
Print template Print template
''' '''
print("+" + "=" * max) print("+" + "=" * max_len)
def view_sbo(pkg, sbo_url, sbo_desc, sbo_dwn, source_dwn, sbo_req): def view_sbo(pkg, sbo_url, sbo_desc, sbo_dwn, source_dwn, sbo_req):

View file

@ -101,8 +101,7 @@ class PackageManager(object):
[removed, [removed,
dependencies, dependencies,
rmv_list, rmv_list,
rmv_dependencies ] = ([] for i in range(3))
] = ([] for i in range(4))
print("\nPackages with name matching [ {0}{1}{2} ]\n".format( print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
CYAN, ", ".join(self.binary), ENDC)) CYAN, ", ".join(self.binary), ENDC))
for pkg in self.binary: for pkg in self.binary:
@ -162,7 +161,6 @@ class PackageManager(object):
shell=True)) shell=True))
rmv_list.append(dep) rmv_list.append(dep)
os.remove(dep_path + rmv) os.remove(dep_path + rmv)
rmv_dependencies += dependencies[:-1]
else: else:
if find_package(rmv + sp, pkg_path): if find_package(rmv + sp, pkg_path):
print(subprocess.check_output( print(subprocess.check_output(

View file

@ -79,20 +79,20 @@ class QueuePkgs(object):
''' '''
Print packages from queue Print packages from queue
''' '''
exit = 0 quit = 0
print("\nPackages in queue:\n") print("\nPackages in queue:\n")
for pkg in self.packages(): for pkg in self.packages():
if pkg: if pkg:
print("{0}{1}{2}".format(GREEN, pkg, ENDC)) print("{0}{1}{2}".format(GREEN, pkg, ENDC))
exit = 1 quit = 1
if exit == 1: if quit == 1:
print # new line at exit print # new line at exit
def add(self, pkgs): def add(self, pkgs):
''' '''
Add packages in queue if not exist Add packages in queue if not exist
''' '''
exit = 0 quit = 0
queue_list = self.packages() queue_list = self.packages()
pkgs = set(pkgs) pkgs = set(pkgs)
print("\nAdd packages in queue:\n") print("\nAdd packages in queue:\n")
@ -102,19 +102,19 @@ class QueuePkgs(object):
if pkg not in queue_list and find is not None: if pkg not in queue_list and find is not None:
print("{0}{1}{2}".format(GREEN, pkg, ENDC)) print("{0}{1}{2}".format(GREEN, pkg, ENDC))
queue.write(pkg + "\n") queue.write(pkg + "\n")
exit = 1 quit = 1
else: else:
print("{0}{1}{2}".format(RED, pkg, ENDC)) print("{0}{1}{2}".format(RED, pkg, ENDC))
exit = 1 quit = 1
queue.close() queue.close()
if exit == 1: if quit == 1:
print # new line at exit print # new line at exit
def remove(self, pkgs): def remove(self, pkgs):
''' '''
Remove packages from queue Remove packages from queue
''' '''
exit = 0 quit = 0
print("\nRemove packages from queue:\n") print("\nRemove packages from queue:\n")
if pkgs == ["all"]: if pkgs == ["all"]:
pkgs = self.packages() pkgs = self.packages()
@ -124,9 +124,9 @@ class QueuePkgs(object):
queue.write(line + "\n") queue.write(line + "\n")
else: else:
print("{0}{1}{2}".format(RED, line, ENDC)) print("{0}{1}{2}".format(RED, line, ENDC))
exit = 1 quit = 1
queue.close() queue.close()
if exit == 1: if quit == 1:
print # new line at exit print # new line at exit
def build(self): def build(self):

View file

@ -28,10 +28,10 @@ from init import initialization
from __metadata__ import pkg_path, sp from __metadata__ import pkg_path, sp
from colors import RED, GREEN, GREY, YELLOW, CYAN, ENDC from colors import RED, GREEN, GREY, YELLOW, CYAN, ENDC
from dependency import sbo_dependencies_pkg
from pkg.find import find_package from pkg.find import find_package
from dependency import sbo_dependencies_pkg
def track_dep(name): def track_dep(name):
''' '''

View file

@ -53,13 +53,15 @@ def sbo_network(name):
sys.stdout.flush() sys.stdout.flush()
initialization() initialization()
sbo_url = sbo_search_pkg(name) sbo_url = sbo_search_pkg(name)
sys.stdout.write(done)
if sbo_url: if sbo_url:
grep = SBoGrep(name) grep = SBoGrep(name)
sbo_desc = grep.description()[len(name) + 2:-1] sbo_desc = grep.description()[len(name) + 2:-1]
sbo_req = grep.requires() sbo_req = grep.requires()
source_dwn = grep.source().split() source_dwn = grep.source().split()
sbo_dwn = sbo_slackbuild_dwn(sbo_url) sbo_dwn = sbo_slackbuild_dwn(sbo_url)
sys.stdout.write(done) sbo_version = grep.version()
prgnam = ("{0}-{1}".format(name, sbo_version))
view_sbo(name, sbo_url, sbo_desc, sbo_dwn.split("/")[-1], view_sbo(name, sbo_url, sbo_desc, sbo_dwn.split("/")[-1],
", ".join([src.split("/")[-1] for src in source_dwn]), ", ".join([src.split("/")[-1] for src in source_dwn]),
sbo_req) sbo_req)
@ -71,72 +73,30 @@ def sbo_network(name):
FAULT = "".join(source_dwn) FAULT = "".join(source_dwn)
while True: while True:
try: try:
read = raw_input(" {0}Choose an option: {1}".format(GREY, ENDC)) choice = raw_input(" {0}Choose an option: {1}".format(GREY,
ENDC))
except KeyboardInterrupt: except KeyboardInterrupt:
print # new line at exit print # new line at exit
break break
if read == "D" or read == "d": if choice in ["D", "d"]:
path = "" download("", sbo_dwn, source_dwn)
Download(path, sbo_dwn).start()
for src in source_dwn:
Download(path, src).start()
break break
elif read == "R" or read == "r": elif choice in ["R", "r"]:
readme = "README" readme = "README"
pydoc.pager(read_readme(sbo_url, readme)) pydoc.pager(read_readme(sbo_url, readme))
elif read == "F" or read == "f": elif choice in ["F", "f"]:
_info = ".info" _info = ".info"
pydoc.pager(read_info_slackbuild(sbo_url, name, _info)) pydoc.pager(read_info_slackbuild(sbo_url, name, _info))
elif read == "S" or read == "s": elif choice in ["S", "s"]:
_SlackBuild = ".SlackBuild" _SlackBuild = ".SlackBuild"
pydoc.pager(read_info_slackbuild(sbo_url, name, _SlackBuild)) pydoc.pager(read_info_slackbuild(sbo_url, name, _SlackBuild))
elif read == "B" or read == "b": elif choice in ["B", "b"]:
if FAULT: build(sbo_dwn, source_dwn, FAULT)
print("\n{0}The package {1} {2}\n".format(RED, FAULT, ENDC))
sys.exit()
if not os.path.exists(build_path):
os.mkdir(build_path)
sources = []
os.chdir(build_path)
script = sbo_dwn.split("/")[-1]
Download(build_path, sbo_dwn).start()
for src in source_dwn:
Download(build_path, src).start()
sources.append(src.split("/")[-1])
build_package(script, sources, build_path)
break break
elif read == "I" or read == "i": elif choice in ["I", "i"]:
if FAULT:
print("\n{0}The package {1} {2}\n".format(RED, FAULT, ENDC))
sys.exit()
if not os.path.exists(build_path):
os.mkdir(build_path)
sbo_version = grep.version()
prgnam = ("{0}-{1}".format(name, sbo_version))
if not find_package(prgnam + sp, pkg_path): if not find_package(prgnam + sp, pkg_path):
sources = [] build(sbo_dwn, source_dwn, FAULT)
os.chdir(build_path) install(name, prgnam, sbo_url)
Download(build_path, sbo_dwn).start()
script = sbo_dwn.split("/")[-1]
for src in source_dwn:
Download(build_path, src).start()
sources.append(src.split("/")[-1])
build_package(script, sources, build_path)
# 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 = []
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(sbo_url, prgnam)
sys.exit()
print("[ {0}Installing{1} ] --> {2}".format(GREEN, ENDC,
name))
PackageManager(binary).upgrade()
break break
else: else:
template(78) template(78)
@ -146,6 +106,52 @@ def sbo_network(name):
else: else:
break break
else: else:
sys.stdout.write(done)
message = "Can't view" message = "Can't view"
pkg_not_found("\n", name, message, "\n") pkg_not_found("\n", name, message, "\n")
def download(path, sbo_dwn, source_dwn):
'''
Download sources
'''
Download(path, sbo_dwn).start()
for src in source_dwn:
Download(path, src).start()
def build(sbo_dwn, source_dwn, FAULT):
'''
Only build and create Slackware package
'''
if FAULT:
print("\n{0}The package {1} {2}\n".format(RED, FAULT, ENDC))
sys.exit()
if not os.path.exists(build_path):
os.mkdir(build_path)
sources = []
os.chdir(build_path)
Download(build_path, sbo_dwn).start()
script = sbo_dwn.split("/")[-1]
for src in source_dwn:
Download(build_path, src).start()
sources.append(src.split("/")[-1])
build_package(script, sources, build_path)
def install(name, prgnam, sbo_url):
'''
Install Slackware package found in /tmp
directory.
'''
binary_list = []
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(sbo_url, prgnam)
sys.exit()
print("[ {0}Installing{1} ] --> {2}".format(GREEN, ENDC,
name))
PackageManager(binary).upgrade()

View file

@ -22,6 +22,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from __metadata__ import arch from __metadata__ import arch
from slack_version import slack_ver from slack_version import slack_ver