updated for version 1.9.8

This commit is contained in:
Dimitris Zlatanidis 2014-10-07 22:05:52 +03:00
parent a5bb698e36
commit ac6ad56731
32 changed files with 604 additions and 473 deletions

View file

@ -1,3 +1,8 @@
Version 1.9.8
07-10-2014
[Updated] - Source code update.
Version 1.9.7 Version 1.9.7
06-10-2014 06-10-2014

View file

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

View file

@ -7,9 +7,9 @@
Latest Release: Latest Release:
- Version: 1.9.7 - Version: 1.9.8
- `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/v1.9.7.tar.gz>`_ - `Source <https://github.com/dslackw/slpkg/archive/v1.9.8.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
@ -96,8 +96,8 @@ Untar the archive and run install.sh script:
.. code-block:: bash .. code-block:: bash
$ tar xvf slpkg-1.9.7.tar.gz $ tar xvf slpkg-1.9.8.tar.gz
$ cd slpkg-1.9.7 $ cd slpkg-1.9.8
$ ./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:-1.9.7} VERSION=${VERSION:-1.9.8}
TAG=${TAG:-_dsw} TAG=${TAG:-_dsw}
cd .. cd ..

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:-1.9.7} VERSION=${VERSION:-1.9.8}
BUILD=${BUILD:-1} BUILD=${BUILD:-1}
TAG=${TAG:-_dsw} TAG=${TAG:-_dsw}

View file

@ -1,7 +1,7 @@
PRGNAM="slpkg" PRGNAM="slpkg"
VERSION="1.9.7" VERSION="1.9.8"
HOMEPAGE="https://github.com/dslackw/slpkg" HOMEPAGE="https://github.com/dslackw/slpkg"
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.9.7.tar.gz" DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.9.8.tar.gz"
MD5SUM="" MD5SUM=""
DOWNLOAD_x86_64="" DOWNLOAD_x86_64=""
MD5SUM_x86_64="" MD5SUM_x86_64=""

View file

@ -26,7 +26,7 @@ import subprocess
__all__ = "slpkg" __all__ = "slpkg"
__author__ = "dslackw" __author__ = "dslackw"
__version_info__ = (1, 9, 7) __version_info__ = (1, 9, 8)
__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

@ -24,6 +24,7 @@
import os import os
from __metadata__ import bls_path from __metadata__ import bls_path
class BlackList(object): class BlackList(object):
''' '''
Blacklist class to add, remove or listed packages Blacklist class to add, remove or listed packages

View file

@ -22,14 +22,29 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import os import os
import sys
import subprocess import subprocess
from colors import * from colors import *
def download(path, url):
class Download(object):
def __init__(self, path, url):
self.path = path
self.url = url
self.file_name = self.url.split("/")[-1]
def start(self):
''' '''
Download files usign wget. Download files usign wget.
Check if file exist or file is broken. Check if file already download the skip or continue
download if before stoped.
''' '''
print("\n{0}[ Download ] -->{1} {2}\n".format(GREEN, ENDC, url.split("/")[-1])) print("\n{0}[ Download ] -->{1} {2}\n".format(GREEN, ENDC, self.file_name))
subprocess.call("wget -N --directory-prefix={0} {1}".format(path, url), shell=True) try:
subprocess.call("wget -c -N --directory-prefix={0} {1}".format(
self.path, self.url), shell=True)
except KeyboardInterrupt:
print # new line at cancel
sys.exit()

View file

@ -25,12 +25,18 @@ import os
import sys import sys
import urllib2 import urllib2
def server_file_size(url):
class FileSize(object):
def __init__(self, registry):
self.registry = registry
def server(self):
''' '''
Returns the size of remote files Returns the size of remote files
''' '''
try: try:
tar = urllib2.urlopen(url) tar = urllib2.urlopen(self.registry)
meta = tar.info() meta = tar.info()
return int(meta.getheaders("Content-Length")[0]) return int(meta.getheaders("Content-Length")[0])
except (urllib2.URLError, IndexError): except (urllib2.URLError, IndexError):
@ -40,8 +46,8 @@ def server_file_size(url):
print # new line at exit print # new line at exit
sys.exit() sys.exit()
def local_file_size(registry): def local(self):
''' '''
Returns the size of local files Returns the size of local files
''' '''
return os.path.getsize(registry) return os.path.getsize(self.registry)

View file

@ -25,13 +25,14 @@ import os
import sys import sys
import getpass import getpass
from file_size import *
from messages import s_user from messages import s_user
from url_read import url_read from url_read import url_read
from __metadata__ import log_path, lib_path from __metadata__ import log_path, lib_path
from file_size import server_file_size, local_file_size
from slack.slack_version import slack_ver from slack.slack_version import slack_ver
def initialization(): def initialization():
''' '''
Slpkg initialization, creating directories and SLACKBUILDS.TXT in Slpkg initialization, creating directories and SLACKBUILDS.TXT in
@ -76,8 +77,8 @@ def initialization():
log.close() log.close()
print("File ChangeLog.txt created in {0}".format(sbo_log)) print("File ChangeLog.txt created in {0}".format(sbo_log))
# We take the size of ChangeLog.txt from the server and locally # We take the size of ChangeLog.txt from the server and locally
server = server_file_size(sbo_url + "ChangeLog.txt") server = FileSize(sbo_url + "ChangeLog.txt").server()
local = local_file_size(sbo_log + "ChangeLog.txt") local = FileSize(sbo_log + "ChangeLog.txt").local()
# If the two files differ in size delete and replaced with new # If the two files differ in size delete and replaced with new
if server != local: if server != local:
os.remove("{0}{1}".format(sbo_lib, "SLACKBUILDS.TXT")) os.remove("{0}{1}".format(sbo_lib, "SLACKBUILDS.TXT"))

View file

@ -21,21 +21,22 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
import getpass import getpass
from colors import * from colors import *
from messages import s_user from messages import s_user
from blacklist import BlackList
from version import prog_version from version import prog_version
from __metadata__ import path, __version__ from __metadata__ import path, __version__
from blacklist import BlackList
from pkg.manager import *
from pkg.build import build_package from pkg.build import build_package
from pkg.manager import PackageManager
from sbo.check import sbo_check from sbo.check import sbo_check
from sbo.views import sbo_network from sbo.views import sbo_network
from sbo.tracking import track_dep
from sbo.slackbuild import sbo_build from sbo.slackbuild import sbo_build
from sbo.dependency import pkg_tracking
from slack.patches import patches from slack.patches import patches
from slack.install import install from slack.install import install
@ -92,7 +93,7 @@ def main():
elif len(args) == 2 and args[0] == "-l": elif len(args) == 2 and args[0] == "-l":
sbo_list = ["all", "sbo", "slack", "noarch"] sbo_list = ["all", "sbo", "slack", "noarch"]
if args[1] in sbo_list: if args[1] in sbo_list:
pkg_list(args[1]) PackageManager(None).list(args[1])
else: else:
for opt in usage: print(opt) for opt in usage: print(opt)
elif len(args) == 3 and args[0] == "-c": elif len(args) == 3 and args[0] == "-c":
@ -122,7 +123,7 @@ def main():
else: else:
for opt in usage: print(opt) for opt in usage: print(opt)
elif len(args) == 2 and args[0] == "-t": elif len(args) == 2 and args[0] == "-t":
pkg_tracking(args[1]) track_dep(args[1])
elif len(args) == 2 and args[0] == "-n": elif len(args) == 2 and args[0] == "-n":
sbo_network(args[1]) sbo_network(args[1])
elif len(args) == 2 and args[0] == "-b" and args[1] == "--list": elif len(args) == 2 and args[0] == "-b" and args[1] == "--list":
@ -132,17 +133,17 @@ def main():
elif len(args) > 2 and args[0] == "-b" and args[-1] == "--remove": elif len(args) > 2 and args[0] == "-b" and args[-1] == "--remove":
BlackList().remove(args[1:-1]) BlackList().remove(args[1:-1])
elif len(args) > 1 and args[0] == "-i": elif len(args) > 1 and args[0] == "-i":
pkg_install(args[1:]) PackageManager(args[1:]).install()
elif len(args) > 1 and args[0] == "-u": elif len(args) > 1 and args[0] == "-u":
pkg_upgrade(args[1:]) PackageManager(args[1:]).upgrade()
elif len(args) > 1 and args[0] == "-o": elif len(args) > 1 and args[0] == "-o":
pkg_reinstall(args[1:]) PackageManager(args[1:]).reinstall()
elif len(args) > 1 and args[0] == "-r": elif len(args) > 1 and args[0] == "-r":
pkg_remove(args[1:]) PackageManager(args[1:]).remove()
elif len(args) > 1 and args[0] == "-f": elif len(args) > 1 and args[0] == "-f":
pkg_find(args[1:]) PackageManager(args[1:]).find()
elif len(args) > 1 and args[0] == "-d": elif len(args) > 1 and args[0] == "-d":
pkg_display(args[1:]) PackageManager(args[1:]).display()
else: else:
for opt in usage: print(opt) for opt in usage: print(opt)

View file

@ -25,6 +25,7 @@ import sys
from colors import * from colors import *
from __metadata__ import __all__ from __metadata__ import __all__
def pkg_not_found(bol, pkg, message, eol): def pkg_not_found(bol, pkg, message, eol):
''' '''
Print message when package not found Print message when package not found
@ -63,7 +64,7 @@ def build_FAILED(sbo_url, prgnam):
def template(max): def template(max):
''' '''
Print view template Print template
''' '''
print("+" + "=" * max) print("+" + "=" * max)

View file

@ -34,7 +34,8 @@ from slpkg.checksum import md5sum
from slpkg.__metadata__ import log_path from slpkg.__metadata__ import log_path
from slpkg.messages import pkg_not_found, template from slpkg.messages import pkg_not_found, template
from slpkg.sbo.greps import sbo_checksum_pkg from slpkg.sbo.greps import SBoGrep
def build_package(script, sources, path): def build_package(script, sources, path):
''' '''
@ -65,7 +66,7 @@ def build_package(script, sources, path):
for src in sources: for src in sources:
# fix build sources with spaces # fix build sources with spaces
src = src.replace("%20", " ") src = src.replace("%20", " ")
sbo_md5 = sbo_checksum_pkg(prgnam) sbo_md5 = SBoGrep(prgnam).checksum()
md5 = md5sum(src) md5 = md5sum(src)
if sbo_md5 != md5: if sbo_md5 != md5:
template(78) template(78)

View file

@ -27,6 +27,7 @@ from slpkg.blacklist import BlackList
from slpkg.slack.splitting import split_package from slpkg.slack.splitting import split_package
def find_package(find_pkg, directory): def find_package(find_pkg, directory):
''' '''
Find packages Find packages

View file

@ -32,66 +32,80 @@ from slpkg.__metadata__ import pkg_path, sp, log_path
from find import find_package from find import find_package
def pkg_install(binary):
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 Install Slackware binary packages
''' '''
for pkg in binary: for pkg in self.binary:
try: try:
print(subprocess.check_output("installpkg {0}".format(pkg), shell=True)) print(subprocess.check_output("installpkg {0}".format(
pkg), shell=True))
print("Completed!\n") print("Completed!\n")
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
message = "Can't install" message = "Can't install"
if len(binary) > 1: if len(self.binary) > 1:
bol = eol = str() bol = eol = str()
else: else:
bol = eol = "\n" bol = eol = "\n"
pkg_not_found(bol, pkg, message, eol) pkg_not_found(bol, pkg, message, eol)
def pkg_upgrade(binary): def upgrade(self):
''' '''
Upgrade Slackware binary packages Upgrade Slackware binary packages
''' '''
for pkg in binary: for pkg in self.binary:
try: try:
print(subprocess.check_output("upgradepkg --install-new {0}".format(pkg), print(subprocess.check_output("upgradepkg --install-new {0}".format(
shell=True)) pkg), shell=True))
print("Completed!\n") print("Completed!\n")
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
message = "Can't upgrade" message = "Can't upgrade"
if len(binary) > 1: if len(self.binary) > 1:
bol = eol = str() bol = eol = str()
else: else:
bol = eol = "\n" bol = eol = "\n"
pkg_not_found(bol, pkg, message, eol) pkg_not_found(bol, pkg, message, eol)
def pkg_reinstall(binary): def reinstall(self):
''' '''
Reinstall Slackware binary packages Reinstall Slackware binary packages
''' '''
for pkg in binary: for pkg in self.binary:
try: try:
print(subprocess.check_output("upgradepkg --reinstall {0}".format(pkg), print(subprocess.check_output("upgradepkg --reinstall {0}".format(
shell=True)) pkg), shell=True))
print("Completed!\n") print("Completed!\n")
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
message = "Can't reinstall" message = "Can't reinstall"
if len(binary) > 1: if len(self.binary) > 1:
bol = eol = str() bol = eol = str()
else: else:
bol = eol = "\n" bol = eol = "\n"
pkg_not_found(bol, pkg, message, eol) pkg_not_found(bol, pkg, message, eol)
def pkg_remove(binary): def remove(self):
''' '''
Remove Slackware binary packages Remove Slackware binary packages
''' '''
dep_path = log_path + "dep/" dep_path = log_path + "dep/"
removed, dependencies, \ [
rmv_list, rmv_dependencies = ([] for i in range(4)) removed,
dependencies,
rmv_list,
rmv_dependencies
] = ([] 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(binary), ENDC)) CYAN, ", ".join(self.binary), ENDC))
for pkg in binary: for pkg in self.binary:
pkgs = find_package(pkg + sp, pkg_path) pkgs = find_package(pkg + sp, pkg_path)
if pkgs: if pkgs:
print(RED + "[ delete ] --> " + ENDC + "\n ".join(pkgs)) print(RED + "[ delete ] --> " + ENDC + "\n ".join(pkgs))
@ -138,19 +152,22 @@ def pkg_remove(binary):
if remove_dep == "y" or remove_dep == "Y": if remove_dep == "y" or remove_dep == "Y":
for dep in dependencies: for dep in dependencies:
if find_package(dep + sp, pkg_path): if find_package(dep + sp, pkg_path):
print(subprocess.check_output("removepkg {0}".format(dep), shell=True)) print(subprocess.check_output("removepkg {0}".format(
dep), shell=True))
rmv_list.append(dep) rmv_list.append(dep)
os.remove(dep_path + rmv) os.remove(dep_path + rmv)
rmv_dependencies += dependencies[:-1] rmv_dependencies += dependencies[:-1]
else: else:
if find_package(rmv + sp, pkg_path): if find_package(rmv + sp, pkg_path):
print(subprocess.check_output("removepkg {0}".format(rmv), shell=True)) print(subprocess.check_output("removepkg {0}".format(
rmv), shell=True))
rmv_list.append(rmv) rmv_list.append(rmv)
f.close() f.close()
os.remove(dep_path + rmv) os.remove(dep_path + rmv)
else: else:
if find_package(rmv + sp, pkg_path): if find_package(rmv + sp, pkg_path):
print(subprocess.check_output("removepkg {0}".format(rmv), shell=True)) print(subprocess.check_output("removepkg {0}".format(
rmv), shell=True))
rmv_list.append(rmv) rmv_list.append(rmv)
# Prints all removed packages # Prints all removed packages
if len(rmv_list) > 1: if len(rmv_list) > 1:
@ -165,16 +182,16 @@ def pkg_remove(binary):
template(78) template(78)
print # new line at end print # new line at end
def pkg_find(binary): def find(self):
''' '''
Find installed Slackware packages Find installed Slackware packages
''' '''
binary = "".join(binary) self.binary = "".join(self.binary)
matching = size = int() matching = size = int()
print("\nInstalled packages with name begin matching [ {0}{1}{2} ]\n".format( print("\nInstalled packages with name begin matching [ {0}{1}{2} ]\n".format(
CYAN, binary, ENDC)) CYAN, self.binary, ENDC))
for match in find_package(binary, pkg_path): for match in find_package(self.binary, pkg_path):
if binary in match: if self.binary in match:
matching += 1 matching += 1
print("[ {0}installed{1} ] - {2}".format( print("[ {0}installed{1} ] - {2}".format(
GREEN, ENDC, match)) GREEN, ENDC, match))
@ -189,9 +206,11 @@ def pkg_find(binary):
size += float(line[26:-1]) size += float(line[26:-1])
break break
if matching == 0: if matching == 0:
print("No package was found to match\n") message = "Can't find"
pkg_not_found("", self.binary, message, "\n")
else: else:
print("\n{0}Total found {1} matching packages.{2}".format(GREY, matching, ENDC)) print("\n{0}Total found {1} matching packages.{2}".format(
GREY, matching, ENDC))
unit = "Kb" unit = "Kb"
if size > 1024: if size > 1024:
unit = "Mb" unit = "Mb"
@ -199,23 +218,24 @@ def pkg_find(binary):
print("{0}Size of installed packages {1} {2}.{3}\n".format( print("{0}Size of installed packages {1} {2}.{3}\n".format(
GREY, round(size, 2), unit, ENDC)) GREY, round(size, 2), unit, ENDC))
def pkg_display(binary): def display(self):
''' '''
Print the Slackware packages contents Print the Slackware packages contents
''' '''
for pkg in binary: for pkg in self.binary:
if find_package(pkg + sp, pkg_path): if find_package(pkg + sp, pkg_path):
print(subprocess.check_output("cat {0}{1}".format(pkg_path, print(subprocess.check_output("cat {0}{1}".format(pkg_path,
" /var/log/packages/".join(find_package(pkg +sp, pkg_path))), shell=True)) " /var/log/packages/".join(find_package(
pkg + sp, pkg_path))), shell=True))
else: else:
message = "Can't dislpay" message = "Can't dislpay"
if len(binary) > 1: if len(self.binary) > 1:
bol = eol = str() bol = eol = str()
else: else:
bol = eol = "\n" bol = eol = "\n"
pkg_not_found(bol, pkg, message, eol) pkg_not_found(bol, pkg, message, eol)
def pkg_list(pattern): def list(self, pattern):
''' '''
List with the installed packages List with the installed packages
''' '''

View file

@ -26,18 +26,19 @@ import sys
from slpkg.pkg.find import find_package from slpkg.pkg.find import find_package
from slpkg.pkg.build import build_package from slpkg.pkg.build import build_package
from slpkg.pkg.manager import pkg_upgrade from slpkg.pkg.manager import PackageManager
from slpkg.colors import * from slpkg.colors import *
from slpkg.init import initialization from slpkg.init import initialization
from slpkg.downloader import download from slpkg.downloader import Download
from slpkg.messages import template, build_FAILED from slpkg.messages import template, build_FAILED
from slpkg.__metadata__ import tmp, pkg_path, build_path, sp from slpkg.__metadata__ import tmp, pkg_path, build_path, sp
from greps import SBoGrep
from search import sbo_search_pkg from search import sbo_search_pkg
from download import sbo_slackbuild_dwn from download import sbo_slackbuild_dwn
from dependency import sbo_dependencies_pkg from dependency import sbo_dependencies_pkg
from greps import sbo_source_dwn, sbo_version_pkg
def sbo_check(): def sbo_check():
''' '''
@ -48,7 +49,7 @@ def sbo_check():
but install the package with maximum build tag if find the but install the package with maximum build tag if find the
some version in /tmp directory. some version in /tmp directory.
''' '''
try:
done = "{0}Done{1}\n".format(GREY, ENDC) done = "{0}Done{1}\n".format(GREY, ENDC)
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC) reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
sys.stdout.write(reading_lists) sys.stdout.write(reading_lists)
@ -56,9 +57,19 @@ def sbo_check():
init = initialization() init = initialization()
arches = ["-x86_64-", "-i486-", "-arm-", "-noarch-"] arches = ["-x86_64-", "-i486-", "-arm-", "-noarch-"]
index, toolbar_width = int(), 3 index, toolbar_width = int(), 3
dependencies, dependencies_list, \ [
requires, upgrade, installed, sbo_list, \ dependencies,
upg_name, pkg_for_upg, upg_ver, upg_arch = ([] for i in range(10)) dependencies_list,
requires,
upgrade,
installed,
sbo_list,
upg_name,
pkg_for_upg,
upg_ver,
upg_arch
] = ([] for i in range(10))
try:
for pkg in os.listdir(pkg_path): for pkg in os.listdir(pkg_path):
if pkg.endswith("_SBo"): if pkg.endswith("_SBo"):
sbo_list.append(pkg) sbo_list.append(pkg)
@ -83,7 +94,7 @@ def sbo_check():
# search packages if exists in the repository # search packages if exists in the repository
# and it gets to avoidable modified packages # and it gets to avoidable modified packages
# from the user with the tag _SBo # from the user with the tag _SBo
sbo_package = ("{0}-{1}".format(name, sbo_version_pkg(name))) sbo_package = ("{0}-{1}".format(name, SBoGrep(name).version()))
if sbo_package > package: if sbo_package > package:
upg_name.append(name) upg_name.append(name)
sys.stdout.write(done) sys.stdout.write(done)
@ -119,7 +130,7 @@ def sbo_check():
# In the end lest a check of the packages that are on the list # In the end lest a check of the packages that are on the list
# are already installed. # are already installed.
for pkg in dependencies_list: for pkg in dependencies_list:
ver = sbo_version_pkg(pkg) ver = SBoGrep(pkg).version()
prgnam = ("{0}-{1}".format(pkg, ver)) prgnam = ("{0}-{1}".format(pkg, ver))
pkg_version = ver # if package not installed pkg_version = ver # if package not installed
# take version from repository # take version from repository
@ -179,12 +190,12 @@ def sbo_check():
prgnam = ("{0}-{1}".format(name, version)) prgnam = ("{0}-{1}".format(name, version))
sbo_url = sbo_search_pkg(name) sbo_url = sbo_search_pkg(name)
sbo_dwn = sbo_slackbuild_dwn(sbo_url) sbo_dwn = sbo_slackbuild_dwn(sbo_url)
src_dwn = sbo_source_dwn(name).split() src_dwn = SBoGrep(name).source().split()
script = sbo_dwn.split("/")[-1] # keep file from script link script = sbo_dwn.split("/")[-1] # keep file from script link
download(build_path, sbo_dwn) Download(build_path, sbo_dwn).start()
sources = [] sources = []
for src in src_dwn: for src in src_dwn:
download(build_path, src) Download(build_path, src).start()
sources.append(src.split("/")[-1]) # keep file from source link sources.append(src.split("/")[-1]) # keep file from source link
build_package(script, sources, build_path) build_package(script, sources, build_path)
# Searches the package name and version in /tmp to install. # Searches the package name and version in /tmp to install.
@ -206,7 +217,7 @@ def sbo_check():
# Use this list to pick out what # Use this list to pick out what
# packages will be installed # packages will be installed
installed.append(name) installed.append(name)
pkg_upgrade(binary) PackageManager(binary).upgrade()
if len(pkg_for_upg) > 1: if len(pkg_for_upg) > 1:
template(78) template(78)
print("| Total {0} {1} upgraded and {2} {3} installed".format( print("| Total {0} {1} upgraded and {2} {3} installed".format(

View file

@ -24,15 +24,11 @@
import sys import sys
from slpkg.colors import * from slpkg.colors import *
from slpkg.init import initialization
from slpkg.blacklist import BlackList from slpkg.blacklist import BlackList
from slpkg.__metadata__ import pkg_path, sp
from slpkg.messages import pkg_not_found, template
from slpkg.pkg.find import find_package
from greps import SBoGrep
from search import sbo_search_pkg from search import sbo_search_pkg
from greps import sbo_requires_pkg
dep_results = [] dep_results = []
@ -45,7 +41,7 @@ def sbo_dependencies_pkg(name):
blacklist = BlackList().packages() blacklist = BlackList().packages()
sbo_url = sbo_search_pkg(name) sbo_url = sbo_search_pkg(name)
if sbo_url: if sbo_url:
requires = sbo_requires_pkg(name) requires = SBoGrep(name).requires()
for req in requires: for req in requires:
# avoid to add %README% as dependency and # avoid to add %README% as dependency and
# if require in blacklist # if require in blacklist
@ -62,51 +58,3 @@ def sbo_dependencies_pkg(name):
except KeyboardInterrupt: except KeyboardInterrupt:
print # new line at exit print # new line at exit
sys.exit() sys.exit()
def pkg_tracking(name):
'''
View tree of dependencies and also
highlight packages with color green
if allready installed and color red
if not installed.
'''
done = "{0}Done{1}\n".format(GREY, ENDC)
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
sys.stdout.write(reading_lists)
sys.stdout.flush()
init = initialization()
dependencies_list = sbo_dependencies_pkg(name)
if dependencies_list is not None:
sys.stdout.write(done)
print # new line at start
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)
if dependencies == []:
dependencies = ["No dependencies"]
pkg_len = len(name) + 24
template(pkg_len)
print("| Package {0}{1}{2} dependencies :".format(CYAN, name, ENDC))
template(pkg_len)
print("\\")
print(" +---{0}[ Tree of dependencies ]{1}".format(YELLOW, ENDC))
index = int()
for pkg in dependencies:
index += 1
if find_package(pkg + sp, pkg_path):
print(" |")
print(" {0}{1}: {2}{3}{4}".format("+--", index, GREEN, pkg, ENDC))
else:
print(" |")
print(" {0}{1}: {2}{3}{4}".format("+--", index, RED, pkg, ENDC))
print # new line at end
else:
sys.stdout.write(done)
message = "From slackbuilds.org"
pkg_not_found("\n", name, message, "\n")

View file

@ -21,6 +21,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
def sbo_slackbuild_dwn(sbo_url): def sbo_slackbuild_dwn(sbo_url):
''' '''
Create download slackbuild tar.gz archive Create download slackbuild tar.gz archive

View file

@ -28,102 +28,105 @@ from slpkg.__metadata__ import arch, lib_path
from search import sbo_search_pkg from search import sbo_search_pkg
def sbo_source_dwn(name):
class SBoGrep(object):
'''
Class data grab
'''
def __init__(self, name):
self.name = name
arch64 = "x86_64"
self.line_name = "SLACKBUILD NAME: "
self.line_down = "SLACKBUILD DOWNLOAD: "
self.line_down_64 = "SLACKBUILD DOWNLOAD_{0}: ".format(arch64)
self.line_req = "SLACKBUILD REQUIRES: "
self.line_ver = "SLACKBUILD VERSION: "
self.line_md5 = "SLACKBUILD MD5SUM: "
self.line_md5_64 = "SLACKBUILD MD5SUM_{0}: ".format(arch64)
self.line_des = "SLACKBUILD SHORT DESCRIPTION: "
self.sbo_txt = lib_path + "sbo_repo/SLACKBUILDS.TXT"
def source(self):
''' '''
Grab sources downloads links Grab sources downloads links
''' '''
if arch == "x86_64": if arch == "x86_64":
with open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r") as SLACKBUILDS_TXT: with open(self.sbo_txt, "r") as SLACKBUILDS_TXT:
for line in SLACKBUILDS_TXT: for line in SLACKBUILDS_TXT:
if arch == "x86_64": if line.startswith(self.line_name):
if line.startswith("SLACKBUILD NAME: "):
sbo_name = line[17:].strip() sbo_name = line[17:].strip()
if line.startswith("SLACKBUILD DOWNLOAD_x86_64: "): if line.startswith(self.line_down_64):
if sbo_name == name: if sbo_name == self.name:
if line[28:].strip(): if line[28:].strip():
SLACKBUILDS_TXT.close() SLACKBUILDS_TXT.close()
return line[28:].strip() return line[28:].strip()
with open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r") as SLACKBUILDS_TXT: with open(self.sbo_txt, "r") as SLACKBUILDS_TXT:
for line in SLACKBUILDS_TXT: for line in SLACKBUILDS_TXT:
if line.startswith("SLACKBUILD NAME: "): if line.startswith(self.line_name):
sbo_name = line[17:].strip() sbo_name = line[17:].strip()
if line.startswith("SLACKBUILD DOWNLOAD: "): if line.startswith(self.line_down):
if sbo_name == name: if sbo_name == self.name:
SLACKBUILDS_TXT.close() SLACKBUILDS_TXT.close()
return line[21:].strip() return line[21:].strip()
def sbo_requires_pkg(name): def requires(self):
''' '''
Grab package requirements Grab package requirements
''' '''
with open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r") as SLACKBUILDS_TXT: with open(self.sbo_txt, "r") as SLACKBUILDS_TXT:
for line in SLACKBUILDS_TXT: for line in SLACKBUILDS_TXT:
if line.startswith("SLACKBUILD NAME: "): if line.startswith(self.line_name):
sbo_name = line[17:].strip() sbo_name = line[17:].strip()
if line.startswith("SLACKBUILD REQUIRES: "): if line.startswith(self.line_req):
if sbo_name == name: if sbo_name == self.name:
SLACKBUILDS_TXT.close() SLACKBUILDS_TXT.close()
return line[21:].strip().split() return line[21:].strip().split()
def sbo_build_tag(sbo_url, name): def version(self):
# This feature is not yet used
# because the program is doing heavy on search.
# Looking for the best option to be able to use
# the BUILD tag
''' '''
Grab .SlackBuild BUILD tag Grab package version
''' '''
read_info = url_read(sbo_url + name + ".SlackBuild") with open(self.sbo_txt, "r") as SLACKBUILDS_TXT:
for line in read_info.splitlines():
if line.startswith("BUILD=${BUILD:"):
return line[15:-1].strip().split()
def sbo_version_pkg(name):
'''
Grab package verion
'''
with open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r") as SLACKBUILDS_TXT:
for line in SLACKBUILDS_TXT: for line in SLACKBUILDS_TXT:
if line.startswith("SLACKBUILD NAME: "): if line.startswith(self.line_name):
sbo_name = line[17:].strip() sbo_name = line[17:].strip()
if line.startswith("SLACKBUILD VERSION: "): if line.startswith(self.line_ver):
if sbo_name == name: if sbo_name == self.name:
SLACKBUILDS_TXT.close() SLACKBUILDS_TXT.close()
return line[20:].strip() return line[20:].strip()
def sbo_checksum_pkg(name): def checksum(self):
''' '''
Grab checksum string Grab checksum string
''' '''
if arch == "x86_64": if arch == "x86_64":
with open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r") as SLACKBUILDS_TXT: with open(self.sbo_txt, "r") as SLACKBUILDS_TXT:
for line in SLACKBUILDS_TXT: for line in SLACKBUILDS_TXT:
if arch == "x86_64": if line.startswith(self.line_name):
if line.startswith("SLACKBUILD NAME: "):
sbo_name = line[17:].strip() sbo_name = line[17:].strip()
if line.startswith("SLACKBUILD MD5SUM_x86_64: "): if line.startswith(self.line_md5_64):
if sbo_name == name: if sbo_name == self.name:
if line[26:].strip(): if line[26:].strip():
SLACKBUILDS_TXT.close() SLACKBUILDS_TXT.close()
return line[26:].strip() return line[26:].strip()
with open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r") as SLACKBUILDS_TXT: with open(self.sbo_txt, "r") as SLACKBUILDS_TXT:
for line in SLACKBUILDS_TXT: for line in SLACKBUILDS_TXT:
if line.startswith("SLACKBUILD NAME: "): if line.startswith(self.line_name):
sbo_name = line[17:].strip() sbo_name = line[17:].strip()
if line.startswith("SLACKBUILD MD5SUM: "): if line.startswith(self.line_md5):
if sbo_name == name: if sbo_name == self.name:
SLACKBUILDS_TXT.close() SLACKBUILDS_TXT.close()
return line[19:].strip() return line[19:].strip()
def sbo_description_pkg(name): def description(self):
''' '''
Grab package verion Grab package verion
''' '''
with open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r") as SLACKBUILDS_TXT: with open(self.sbo_txt, "r") as SLACKBUILDS_TXT:
for line in SLACKBUILDS_TXT: for line in SLACKBUILDS_TXT:
if line.startswith("SLACKBUILD NAME: "): if line.startswith(self.line_name):
sbo_name = line[17:].strip() sbo_name = line[17:].strip()
if line.startswith("SLACKBUILD SHORT DESCRIPTION: "): if line.startswith(self.line_des):
if sbo_name == name: if sbo_name == self.name:
SLACKBUILDS_TXT.close() SLACKBUILDS_TXT.close()
return line[31:].strip() return line[31:].strip()

View file

@ -25,6 +25,7 @@ import os
from slpkg.url_read import url_read from slpkg.url_read import url_read
def read_readme(sbo_url, sbo_readme): def read_readme(sbo_url, sbo_readme):
''' '''
Read SlackBuild README file Read SlackBuild README file

View file

@ -30,6 +30,7 @@ from slpkg.blacklist import BlackList
from slpkg.slack.slack_version import slack_ver from slpkg.slack.slack_version import slack_ver
def sbo_search_pkg(name): def sbo_search_pkg(name):
''' '''
Search for package path from SLACKBUILDS.TXT file Search for package path from SLACKBUILDS.TXT file

View file

@ -26,20 +26,21 @@ import sys
from slpkg.colors import * from slpkg.colors import *
from slpkg.init import initialization from slpkg.init import initialization
from slpkg.downloader import download from slpkg.downloader import Download
from slpkg.__metadata__ import (tmp, pkg_path, build_path, from slpkg.__metadata__ import (tmp, pkg_path, build_path,
log_path, lib_path, sp) log_path, lib_path, sp)
from slpkg.messages import (pkg_not_found, pkg_found, template, from slpkg.messages import (pkg_found, template, build_FAILED,
build_FAILED, sbo_packages_view) pkg_not_found, sbo_packages_view)
from slpkg.pkg.find import find_package from slpkg.pkg.find import find_package
from slpkg.pkg.build import build_package from slpkg.pkg.build import build_package
from slpkg.pkg.manager import pkg_upgrade from slpkg.pkg.manager import PackageManager
from greps import SBoGrep
from search import sbo_search_pkg from search import sbo_search_pkg
from download import sbo_slackbuild_dwn from download import sbo_slackbuild_dwn
from dependency import sbo_dependencies_pkg from dependency import sbo_dependencies_pkg
from greps import sbo_source_dwn, sbo_version_pkg
def sbo_build(name): def sbo_build(name):
''' '''
@ -47,14 +48,21 @@ def sbo_build(name):
with all dependencies if version is greater than with all dependencies if version is greater than
that established. that established.
''' '''
sbo_ver, pkg_arch, installs, upgraded, \
versions, requires, dependencies = ([] for i in range(7))
PKG_COLOR = DEP_COLOR = ARCH_COLOR = str()
done = "{0}Done{1}\n".format(GREY, ENDC) done = "{0}Done{1}\n".format(GREY, ENDC)
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC) reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
sys.stdout.write(reading_lists) sys.stdout.write(reading_lists)
sys.stdout.flush() sys.stdout.flush()
init = initialization() init = initialization()
[
sbo_ver,
pkg_arch,
installs,
upgraded,
versions,
requires,
dependencies
] = ([] for i in range(7))
PKG_COLOR = DEP_COLOR = ARCH_COLOR = str()
dependencies_list = sbo_dependencies_pkg(name) dependencies_list = sbo_dependencies_pkg(name)
try: try:
if dependencies_list is not None or sbo_search_pkg(name) is not None: if dependencies_list is not None or sbo_search_pkg(name) is not None:
@ -73,9 +81,9 @@ def sbo_build(name):
# Create two lists one for package version and one # Create two lists one for package version and one
# for package arch. # for package arch.
for pkg in dependencies: for pkg in dependencies:
version = sbo_version_pkg(pkg) version = SBoGrep(pkg).version()
sbo_ver.append(version) sbo_ver.append(version)
src = sbo_source_dwn(pkg) src = SBoGrep(pkg).source()
pkg_arch.append(select_arch(src)) pkg_arch.append(select_arch(src))
sbo_pkg = ("{0}-{1}".format(pkg, version)) sbo_pkg = ("{0}-{1}".format(pkg, version))
if find_package(sbo_pkg, pkg_path): if find_package(sbo_pkg, pkg_path):
@ -138,7 +146,7 @@ def sbo_build(name):
# before proceed to install # before proceed to install
UNST = ["UNSUPPORTED", "UNTESTED"] UNST = ["UNSUPPORTED", "UNTESTED"]
if src in UNST: if src in UNST:
print("\n{0}The package {1}{2}\n".format(RED, src, ENDC)) print("{0}The package {1}{2}\n".format(RED, src, ENDC))
read = "" read = ""
# exit if all packages already installed # exit if all packages already installed
elif pkg_sum == len(dependencies): elif pkg_sum == len(dependencies):
@ -160,13 +168,13 @@ def sbo_build(name):
else: else:
sbo_url = sbo_search_pkg(pkg) sbo_url = sbo_search_pkg(pkg)
sbo_link = sbo_slackbuild_dwn(sbo_url) sbo_link = sbo_slackbuild_dwn(sbo_url)
src_link = sbo_source_dwn(pkg).split() src_link = SBoGrep(pkg).source().split()
script = sbo_link.split("/")[-1] # get file from script script = sbo_link.split("/")[-1] # get file from script
download(build_path, sbo_link) Download(build_path, sbo_link).start()
sources = [] sources = []
for src in src_link: for src in src_link:
sources.append(src.split("/")[-1]) # get file from source sources.append(src.split("/")[-1]) # get file from source
download(build_path, src) Download(build_path, src).start()
build_package(script, sources, build_path) build_package(script, sources, build_path)
# Searches the package name and version in /tmp to install. # Searches the package name and version in /tmp to install.
# If find two or more packages e.g. to build tag # If find two or more packages e.g. to build tag
@ -187,7 +195,7 @@ def sbo_build(name):
else: else:
print("{0}[ Installing ] --> {1}{2}".format( print("{0}[ Installing ] --> {1}{2}".format(
GREEN, ENDC, pkg)) GREEN, ENDC, pkg))
pkg_upgrade(binary) PackageManager(binary).upgrade()
installs.append(pkg) installs.append(pkg)
versions.append(ver) versions.append(ver)
# Reference list with packages installed # Reference list with packages installed
@ -235,8 +243,8 @@ def sbo_build(name):
sys.stdout.flush() sys.stdout.flush()
toolbar_width += 6 toolbar_width += 6
sbo_matching.append(sbo_name) sbo_matching.append(sbo_name)
sbo_ver.append(sbo_version_pkg(sbo_name)) sbo_ver.append(SBoGrep(sbo_name).version())
src = sbo_source_dwn(sbo_name) src = SBoGrep(sbo_name).source()
pkg_arch.append(select_arch(src)) pkg_arch.append(select_arch(src))
SLACKBUILDS_TXT.close() SLACKBUILDS_TXT.close()
sys.stdout.write(done) sys.stdout.write(done)
@ -270,7 +278,8 @@ def sbo_build(name):
print("{0} installed {1} and {2} uninstalled {3}.{4}\n".format( print("{0} installed {1} and {2} uninstalled {3}.{4}\n".format(
ins, ins_msg, uns, uns_msg, ENDC)) ins, ins_msg, uns, uns_msg, ENDC))
else: else:
print("\nNo package was found to match\n") message = "No matching"
pkg_not_found("\n", name, message, "\n")
except KeyboardInterrupt: except KeyboardInterrupt:
print # new line at exit print # new line at exit
sys.exit() sys.exit()

81
slpkg/sbo/tracking.py Executable file
View file

@ -0,0 +1,81 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# tracking.py file is part of slpkg.
# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Utility for easy management packages in Slackware
# https://github.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
from slpkg.colors import *
from slpkg.messages import template
from slpkg.init import initialization
from slpkg.__metadata__ import pkg_path, sp
from dependency import sbo_dependencies_pkg
from slpkg.pkg.find import find_package
def track_dep(name):
'''
View tree of dependencies and also
highlight packages with color green
if allready installed and color red
if not installed.
'''
done = "{0}Done{1}\n".format(GREY, ENDC)
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
sys.stdout.write(reading_lists)
sys.stdout.flush()
init = initialization()
dependencies_list = sbo_dependencies_pkg(name)
if dependencies_list is not None:
sys.stdout.write(done)
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)
if dependencies == []:
dependencies = ["No dependencies"]
pkg_len = len(name) + 24
print # new line at start
template(pkg_len)
print("| Package {0}{1}{2} dependencies :".format(CYAN, name, ENDC))
template(pkg_len)
print("\\")
print(" +---{0}[ Tree of dependencies ]{1}".format(YELLOW, ENDC))
index = int()
for pkg in dependencies:
index += 1
if find_package(pkg + sp, pkg_path):
print(" |")
print(" {0}{1}: {2}{3}{4}".format("+--", index, GREEN, pkg, ENDC))
else:
print(" |")
print(" {0}{1}: {2}{3}{4}".format("+--", index, RED, pkg, ENDC))
print # new line at end
else:
sys.stdout.write(done)
print("\nNo package was found to match\n")

View file

@ -27,20 +27,21 @@ import pydoc
from slpkg.colors import * from slpkg.colors import *
from slpkg.init import initialization from slpkg.init import initialization
from slpkg.downloader import download from slpkg.downloader import Download
from slpkg.__metadata__ import tmp, build_path, pkg_path, sp from slpkg.__metadata__ import tmp, build_path, pkg_path, sp
from slpkg.messages import (pkg_not_found, pkg_found, view_sbo, from slpkg.messages import (pkg_found, view_sbo, pkg_not_found,
template, build_FAILED) template, build_FAILED)
from slpkg.pkg.build import build_package from slpkg.pkg.build import build_package
from slpkg.pkg.find import find_package from slpkg.pkg.find import find_package
from slpkg.pkg.manager import pkg_upgrade from slpkg.pkg.manager import PackageManager
from read import * from read import *
from greps import * from greps import SBoGrep
from search import sbo_search_pkg from search import sbo_search_pkg
from download import sbo_slackbuild_dwn from download import sbo_slackbuild_dwn
def sbo_network(name): def sbo_network(name):
''' '''
View SlackBuild package, read or install them View SlackBuild package, read or install them
@ -53,10 +54,10 @@ def sbo_network(name):
init = initialization() init = initialization()
sbo_url = sbo_search_pkg(name) sbo_url = sbo_search_pkg(name)
if sbo_url: if sbo_url:
sbo_desc = sbo_description_pkg(name)[len(name) + 2:-1] sbo_desc = SBoGrep(name).description()[len(name) + 2:-1]
sbo_req = sbo_requires_pkg(name) sbo_req = SBoGrep(name).requires()
sbo_dwn = sbo_slackbuild_dwn(sbo_url) sbo_dwn = sbo_slackbuild_dwn(sbo_url)
source_dwn = sbo_source_dwn(name).split() source_dwn = SBoGrep(name).source().split()
sys.stdout.write(done) sys.stdout.write(done)
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]), \
@ -75,9 +76,9 @@ def sbo_network(name):
break break
if read == "D" or read == "d": if read == "D" or read == "d":
path = "" path = ""
download(path, sbo_dwn) Download(path, sbo_dwn).start()
for src in source_dwn: for src in source_dwn:
download(path, src) Download(path, src).start()
break break
elif read == "R" or read == "r": elif read == "R" or read == "r":
readme = "README" readme = "README"
@ -97,9 +98,9 @@ def sbo_network(name):
sources = [] sources = []
os.chdir(build_path) os.chdir(build_path)
script = sbo_dwn.split("/")[-1] # get file from script link script = sbo_dwn.split("/")[-1] # get file from script link
download(build_path, sbo_dwn) Download(build_path, sbo_dwn).start()
for src in source_dwn: for src in source_dwn:
download(build_path, src) Download(build_path, src).start()
sources.append(src.split("/")[-1]) # get file from source link sources.append(src.split("/")[-1]) # get file from source link
build_package(script, sources, build_path) build_package(script, sources, build_path)
break break
@ -109,15 +110,15 @@ def sbo_network(name):
sys.exit() sys.exit()
if not os.path.exists(build_path): if not os.path.exists(build_path):
os.mkdir(build_path) os.mkdir(build_path)
sbo_version = sbo_version_pkg(name) sbo_version = SBoGrep(name).version()
prgnam = ("{0}-{1}".format(name, sbo_version)) prgnam = ("{0}-{1}".format(name, sbo_version))
if find_package(prgnam + sp, pkg_path) == []: if find_package(prgnam + sp, pkg_path) == []:
sources = [] sources = []
os.chdir(build_path) os.chdir(build_path)
download(build_path, sbo_dwn) Download(build_path, sbo_dwn).start()
script = sbo_dwn.split("/")[-1] # get file from script link script = sbo_dwn.split("/")[-1] # get file from script link
for src in source_dwn: for src in source_dwn:
download(build_path, src) Download(build_path, src).start()
sources.append(src.split("/")[-1]) # get file from source link sources.append(src.split("/")[-1]) # get file from source link
build_package(script, sources, build_path) build_package(script, sources, build_path)
# Searches the package name and version in /tmp to install. # Searches the package name and version in /tmp to install.
@ -133,7 +134,7 @@ def sbo_network(name):
build_FAILED(sbo_url, prgnam) build_FAILED(sbo_url, prgnam)
sys.exit() sys.exit()
print("{0}[ Installing ] --> {1} {2}".format(GREEN, ENDC, name)) print("{0}[ Installing ] --> {1} {2}".format(GREEN, ENDC, name))
pkg_upgrade(binary) PackageManager(binary).upgrade()
break break
else: else:
template(78) template(78)
@ -144,5 +145,5 @@ def sbo_network(name):
break break
else: else:
sys.stdout.write(done) sys.stdout.write(done)
message = "From slackbuilds.org" message = "Can't view"
pkg_not_found("\n", name, message, "\n") pkg_not_found("\n", name, message, "\n")

View file

@ -27,29 +27,37 @@ import time
from slpkg.colors import * from slpkg.colors import *
from slpkg.url_read import url_read from slpkg.url_read import url_read
from slpkg.downloader import download from slpkg.downloader import Download
from slpkg.blacklist import BlackList from slpkg.blacklist import BlackList
from slpkg.messages import pkg_not_found, template from slpkg.messages import pkg_not_found, template
from slpkg.__metadata__ import slpkg_tmp, pkg_path, slack_archs from slpkg.__metadata__ import slpkg_tmp, pkg_path, slack_archs
from slpkg.pkg.find import find_package from slpkg.pkg.find import find_package
from slpkg.pkg.manager import pkg_upgrade, pkg_reinstall from slpkg.pkg.manager import PackageManager
from mirrors import mirrors from mirrors import mirrors
from splitting import split_package from splitting import split_package
def install(slack_pkg, version): def install(slack_pkg, version):
''' '''
Install packages from official Slackware distribution Install packages from official Slackware distribution
''' '''
try: try:
pkg_sum = uni_sum = upg_sum = int()
comp_sum, uncomp_sum, names, dwn_list, comp_size, \
uncomp_size, install_all, package_name, \
package_location = ([] for i in range(9))
done = "{0}Done{1}\n".format(GREY, ENDC) done = "{0}Done{1}\n".format(GREY, ENDC)
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC) reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
[
comp_sum,
uncomp_sum,
names, dwn_list,
comp_size,
uncomp_size,
install_all,
package_name,
package_location
] = ([] for i in range(9))
arch = COLOR = str() arch = COLOR = str()
pkg_sum = uni_sum = upg_sum = int()
# create directories if not exists # create directories if not exists
tmp_path = slpkg_tmp + "packages/" tmp_path = slpkg_tmp + "packages/"
if not os.path.exists(slpkg_tmp): if not os.path.exists(slpkg_tmp):
@ -150,21 +158,22 @@ def install(slack_pkg, version):
read = raw_input("\nWould you like to install [Y/n]? ") read = raw_input("\nWould you like to install [Y/n]? ")
if read == "Y" or read == "y": if read == "Y" or read == "y":
for dwn in dwn_list: for dwn in dwn_list:
download(tmp_path, dwn) Download(tmp_path, dwn).start()
download(tmp_path, dwn + ".asc") Download(tmp_path, dwn + ".asc").start()
for install, name in zip(install_all, names): for install, name in zip(install_all, names):
package = ((tmp_path + install).split())
if os.path.isfile(pkg_path + install[:-4]): if os.path.isfile(pkg_path + install[:-4]):
print("{0}[ reinstalling ] --> {1}{2}".format( print("{0}[ reinstalling ] --> {1}{2}".format(
GREEN, ENDC, install)) GREEN, ENDC, install))
pkg_reinstall((tmp_path + install).split()) PackageManager(package).reinstall()
elif find_package(name + "-", pkg_path): elif find_package(name + "-", pkg_path):
print("{0}[ upgrading ] --> {1}{2}".format( print("{0}[ upgrading ] --> {1}{2}".format(
GREEN, ENDC, install)) GREEN, ENDC, install))
pkg_upgrade((tmp_path + install).split()) PackageManager(package).upgrade()
else: else:
print("{0}[ installing ] --> {1}{2}".format( print("{0}[ installing ] --> {1}{2}".format(
GREEN, ENDC, install)) GREEN, ENDC, install))
pkg_upgrade((tmp_path + install).split()) PackageManager(package).upgrade()
read = raw_input("Removal downloaded packages [Y/n]? ") read = raw_input("Removal downloaded packages [Y/n]? ")
if read == "Y" or read == "y": if read == "Y" or read == "y":
for remove in install_all: for remove in install_all:

View file

@ -24,6 +24,7 @@
from slpkg.__metadata__ import arch from slpkg.__metadata__ import arch
from slack_version import slack_ver from slack_version import slack_ver
def mirrors(name, location, version): def mirrors(name, location, version):
''' '''
Select Slackware official mirror packages Select Slackware official mirror packages

View file

@ -29,26 +29,35 @@ import subprocess
from slpkg.colors import * from slpkg.colors import *
from slpkg.url_read import url_read from slpkg.url_read import url_read
from slpkg.messages import template from slpkg.messages import template
from slpkg.downloader import download from slpkg.downloader import Download
from slpkg.blacklist import BlackList from slpkg.blacklist import BlackList
from slpkg.__metadata__ import pkg_path, slpkg_tmp from slpkg.__metadata__ import pkg_path, slpkg_tmp
from slpkg.pkg.manager import pkg_upgrade from slpkg.pkg.manager import PackageManager
from mirrors import mirrors from mirrors import mirrors
from splitting import split_package from splitting import split_package
from slack_version import slack_ver from slack_version import slack_ver
def patches(version): def patches(version):
''' '''
Install new patches from official Slackware mirrors Install new patches from official Slackware mirrors
''' '''
try: try:
slack_arch = str()
comp_sum, uncomp_sum, dwn_patches, comp_size, uncomp_size, \
upgrade_all, package_name, package_location = ([] for i in range(8))
done = "{0}Done{1}\n".format(GREY, ENDC) done = "{0}Done{1}\n".format(GREY, ENDC)
reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC) reading_lists = "{0}Reading package lists ...{1}".format(GREY, ENDC)
[
comp_sum,
uncomp_sum,
dwn_patches,
comp_size,
uncomp_size,
upgrade_all,
package_name,
package_location
] = ([] for i in range(8))
slack_arch = str()
patch_path = slpkg_tmp + "patches/" patch_path = slpkg_tmp + "patches/"
if not os.path.exists(slpkg_tmp): if not os.path.exists(slpkg_tmp):
os.mkdir(slpkg_tmp) os.mkdir(slpkg_tmp)
@ -156,11 +165,11 @@ def patches(version):
read = raw_input("\nWould you like to upgrade [Y/n]? ") read = raw_input("\nWould you like to upgrade [Y/n]? ")
if read == "Y" or read == "y": if read == "Y" or read == "y":
for dwn in dwn_patches: for dwn in dwn_patches:
download(patch_path, dwn) Download(patch_path, dwn).start()
download(patch_path, dwn + ".asc") Download(patch_path, dwn + ".asc").start()
for pkg in upgrade_all: for pkg in upgrade_all:
print("{0}[ upgrading ] --> {1}{2}".format(GREEN, ENDC, pkg[:-4])) print("{0}[ upgrading ] --> {1}{2}".format(GREEN, ENDC, pkg[:-4]))
pkg_upgrade((patch_path + pkg).split()) PackageManager((patch_path + pkg).split()).upgrade()
for kernel in upgrade_all: for kernel in upgrade_all:
if "kernel" in kernel: if "kernel" in kernel:
print("The kernel has been upgraded, reinstall `lilo` ...") print("The kernel has been upgraded, reinstall `lilo` ...")

View file

@ -23,6 +23,7 @@
import re import re
def slack_ver(): def slack_ver():
''' '''
Open file and read Slackware version Open file and read Slackware version

View file

@ -25,6 +25,7 @@ from slpkg.__metadata__ import slack_archs
from slack_version import slack_ver from slack_version import slack_ver
def split_package(package): def split_package(package):
''' '''
Split package in name, version Split package in name, version

View file

@ -24,6 +24,7 @@
import sys import sys
import urllib2 import urllib2
def url_read(link): def url_read(link):
''' '''
Open url and read Open url and read

View file

@ -23,6 +23,7 @@
from __metadata__ import __version__, __license__, __email__ from __metadata__ import __version__, __license__, __email__
def prog_version(): def prog_version():
''' '''
Print version, license and email Print version, license and email