From 9c318564b8835ad9e3604a113596b2f1186a2e31 Mon Sep 17 00:00:00 2001 From: dslackw Date: Mon, 4 Aug 2014 03:02:38 +0300 Subject: [PATCH] updated for version 1.6.9 --- CHANGELOG | 12 ++++ PKG-INFO | 142 +++++++++++++++++++++++++--------------- README.rst | 24 +++---- man/slpkg.8 | 26 ++++---- slackbuild/README | 12 ++-- slackbuild/slack-desc | 10 +-- slackbuild/slpkg.info | 2 +- slpkg/__metadata__.py | 9 ++- slpkg/colors.py | 2 +- slpkg/main.py | 40 ++++------- slpkg/pkg/__init__.py | 2 +- slpkg/pkg/build.py | 7 +- slpkg/pkg/find.py | 6 +- slpkg/pkg/manager.py | 32 ++++----- slpkg/sbo/__init__.py | 2 +- slpkg/sbo/check.py | 18 +++-- slpkg/sbo/dependency.py | 36 +++++++--- slpkg/sbo/read.py | 2 +- slpkg/sbo/search.py | 2 +- slpkg/sbo/slackbuild.py | 64 +++++++++++------- slpkg/sbo/views.py | 13 ++-- slpkg/slack/__init__.py | 2 +- slpkg/slack/patches.py | 9 ++- 23 files changed, 285 insertions(+), 189 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f21b9066..8d5cb77b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,15 @@ + +04-08-2014 +Version 1.6.9 + +[Updated] - Remove non-useful code + Fix /tmp/slpkg/readme/ path create + +[Feature] - Added build path, drop all packages in Slpkg_Build directory + Added build and install packages only if new version available and + package not installed (slpkg -s sbo) + Added display installed packages in tracking dependencies + 01-08-2014 Version 1.6.8 diff --git a/PKG-INFO b/PKG-INFO index d896e69d..7ce9653f 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,11 +1,12 @@ Metadata-Version: 1.1 Name: slpkg -Version: 1.6.8 +Version: 1.6.9 Author: dslackw Author-email: d zlatanidis at gmail com Maintainer: dslackw Maintainer-email: d zlatanidis at gmail com Home-page: https://github.com/dslackw/slpkg +Download-url: http://sourceforge.net/projects/slpkg Summary: Utility for easy management packages in Slackware Description: .. image:: https://badge.fury.io/py/slpkg.png :target: http://badge.fury.io/py/slpkg @@ -13,14 +14,20 @@ Description: .. image:: https://badge.fury.io/py/slpkg.png :target: https://pypi.python.org/pypi/slpkg .. image:: https://pypip.in/license/slpkg/badge.png :target: https://pypi.python.org/pypi/slpkg + .. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png + :target: https://github.com/dslackw/slpkg - Slpkg is a terminal multitool in order to easy use Slackware packages. + Slpkg is a terminal multitool in order to easy use `Slackware +`_ packages. Features ======== - - Build packages from source with all dependencies - - Find and Download packages from slackbuilds.org + - Build third party packages from source with all dependencies + - Install packages through from official `Slackware `_ +mirrors + - Find and Download packages from `slackbuilds.org `_ + - Grabs packages from slackbuilds.org in real time - Automatic tool build and install packages - Check if your distribution is up to date - Display the contents of the packages @@ -34,7 +41,8 @@ Description: .. image:: https://badge.fury.io/py/slpkg.png - Remove packages - No dependencies - It's a quick and easy way to manage your packages in slackware + It's a quick and easy way to manage your packages in `Slackware +`_ to a command. `[CHANGELOG] `_ @@ -44,22 +52,12 @@ Description: .. image:: https://badge.fury.io/py/slpkg.png .. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png - :target: https://asciinema.org/a/11059 + :target: https://asciinema.org/a/11183 Installation ------------ - Using slackware command: - - .. code-block:: bash - - Download from SlackBuilds http://slackbuilds.org - - or - - using sbopkg tool SBOPKG http://www.sbopkg.org - - Using pip: + Using `pip `_ (best way to have last updates): .. code-block:: bash @@ -69,14 +67,28 @@ https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png $ pip uninstall slpkg + Using Slackware command: + + .. code-block:: bash + + Download http://slackbuilds.org/repository/14.1/system/slpkg from +slackbuilds.org + + using SBOPKG http://www.sbopkg.org + + Download binary package from SourceForge: + + .. code-block:: bash + + Download https://sourceforge.net/projects/slpkg + Command Line Tool Usage - ----------------------- + ======================= .. code-block:: bash usage: slpkg [-h] [-v] [-a script [source ...]] - [-l all, sbo, slack, noarch, other [all, sbo, slack, noarch, -other ...]] + [-l all, sbo, slack, noarch, other] [-c sbo, slack [sbo, slack ...]] [-s sbo, slack [sbo, slack ...]] [-t] [-n] [-i [...]] [-u [...]] [-o [...]] [-r [...]] [-f [...]] [-d [...]] @@ -88,19 +100,19 @@ other ...]] -v, --verbose print version and exit -a script [source ...] auto build package - -l all, sbo, slack, noarch, other [all, sbo, slack, noarch, other ...] + -l all, sbo, slack, noarch, other list of installed packages -c sbo, slack [sbo, slack ...] check if your packages is up to date -s sbo, slack [sbo, slack ...] download, build & install packages -t tracking dependencies - -n find packages from SBo repository + -n view packages from SBo repository -i [ ...] install binary packages -u [ ...] upgrade binary packages -o [ ...] reinstall binary packages -r [ ...] remove packages - -f [ ...] find if packages installed + -f [ ...] view installed packages -d [ ...] display the contents of the packages @@ -115,20 +127,22 @@ other ...]] $ slpkg -s sbo brasero +============================================================================== - | Build dependecies tree for package brasero + | Build dependencies tree for package brasero: +============================================================================== - Searching [ brasero ] from slackbuilds.org ... - Searching [ libunique ] from slackbuilds.org ... - Searching [ gst1-plugins-bad ] from slackbuilds.org ... - Searching [ gst1-plugins-base ] from slackbuilds.org ... - Searching [ gstreamer1 ] from slackbuilds.org ... - Searching [ orc ] from slackbuilds.org ... + [ found ] --> brasero + [ found ] --> libunique + [ found ] --> gst1-plugins-bad + [ found ] --> gst1-plugins-base + [ found ] --> gstreamer1 + [ found ] --> orc +============================================================================== | Start download, build and install packages +============================================================================== - Searching [ orc ] from slackbuilds.org ... - + [ found ] --> orc + . + . + . +============================================================================== | Installing new package /tmp/brasero-3.11.3-x86_64-1_SBo.tgz +============================================================================== @@ -147,15 +161,6 @@ other ...]] Executing install script for brasero-3.11.3-x86_64-1_SBo.tgz. Package brasero-3.11.3-x86_64-1_SBo.tgz installed. - +============================================================================== - | Package orc installed - | Package gstreamer1 installed - | Package gst1-plugins-base installed - | Package gst1-plugins-bad installed - | Package libunique installed - | Package brasero installed - +============================================================================== - Find packages from `Slackware official mirrors `_ download and install: @@ -177,11 +182,20 @@ other ...]] $ slpkg -t brasero + Search dependencies for package brasero from slackbuilds.org: + + [ found ] --> brasero + [ found ] --> libunique + [ found ] --> gst1-plugins-bad + [ found ] --> gst1-plugins-base + [ found ] --> gstreamer1 + [ found ] --> orc + +========================= | brasero dependencies : +========================= \ - +---[ Tree of dependecies ] + +---[ Tree of dependencies ] | +-- 1 orc | @@ -196,7 +210,10 @@ other ...]] .. code-block:: bash $ slpkg -c sbo flashplayer-plugin - Searching [ flashplayer-plugin ] from slackbuilds.org ... + + Search for package flashplayer-plugin from slackbuilds.org: + + [ found ] --> flashplayer-plugin New version is available: +============================================================================== @@ -206,29 +223,41 @@ other ...]] Would you like to install ? [Y/y] $ slpkg -c sbo ranger - Searching [ ranger ] from slackbuilds.org ... + + Search for package ranger from slackbuilds.org: - Package ranger is up to date + [ found ] --> ranger + + Package ranger-1.6.1-x86_64-1_SBo is up to date $ slpkg -c sbo termcolor - No such package termcolor: Can't find + No such package termcolor: Not installed Check if your distribution is up to date from `Slackware official mirrors -`_ + `_ .. code-block:: bash $ slpkg -c slack upgrade - Your system is up to date + These packages need upgrading: + + [ upgrade ] --> dhcpcd-6.0.5-x86_64-3_slack14.1.txz + [ upgrade ] --> samba-4.1.11-x86_64-1_slack14.1.txz + [ upgrade ] --> xscreensaver-5.29-x86_64-1_slack14.1.txz + + Would you like to upgrade ? [Y/y] Find slackbuild from slackbuilds.org: .. code-block:: bash $ slpkg -n bitfighter - Searching [ bitfighter ] from slackbuilds.org ... + + Search for package bitfighter from slackbuilds.org: + + [ found ] --> bitfighter +=============================================================================== | Package bitfighter --> @@ -281,11 +310,13 @@ http://slackbuilds.org/repository/14.1/games/bitfighter/ creating /tmp/SBo/package-termcolor/usr/lib64/python2.7 creating /tmp/SBo/package-termcolor/usr/lib64/python2.7/site-packages copying build/lib/termcolor.py -> -/tmp/SBo/package-termcolor/usr/lib64/python2.7/site-packages + /tmp/SBo/package-termcolor/usr/lib64/python2.7/site-packages byte-compiling -/tmp/SBo/package-termcolor/usr/lib64/python2.7/site-packages/termcolor.py to termcolor.pyc +/tmp/SBo/package-termcolor/usr/lib64/python2.7/site-packages/termcolor.py + to termcolor.pyc running install_egg_info Writing + /tmp/SBo/package-termcolor/usr/lib64/python2.7/site-packages/termcolor-1.1.0-py2.7.egg-info Slackware package maker, version 3.14159. @@ -361,6 +392,9 @@ http://slackbuilds.org/repository/14.1/games/bitfighter/ .. code-block:: bash $ slpkg -f termcolor lua yetris you-get rar pip + + Packages with name matching [ termcolor, lua, yetris, you-get, rar, pip ] + [ installed ] - termcolor-1.1.0-x86_64-1_SBo No such package lua: Cant find [ installed ] - yetris-2.0.1-x86_64-1_SBo @@ -421,7 +455,9 @@ http://slackbuilds.org/repository/14.1/games/bitfighter/ .. code-block:: bash $ slpkg -r termcolor - + + Packages with name matching [ termcolor ] + [ delete ] --> termcolor-1.1.0-x86_64-1_SBo Are you sure to remove 1 package(s) [Y/y] y @@ -454,6 +490,8 @@ http://slackbuilds.org/repository/14.1/games/bitfighter/ $ slpkg -f termcolor lua rar + Packages with name matching [ termcolor, lua, rar ] + No such package termcolor: Cant find No such package lua: Cant find [ installed ] - rar-5.0.1-x86_64-1_SBo diff --git a/README.rst b/README.rst index 64e5778b..952da157 100644 --- a/README.rst +++ b/README.rst @@ -56,15 +56,11 @@ Using `pip `_ (best way to have last updates): Using Slackware command: -`[Download] `_ from slackbuilds.org +Download http://slackbuilds.org/repository/14.1/system/slpkg from slackbuilds.org -or - -using `SBOPKG `_ tool +Using SBOPKG http://www.sbopkg.org Download binary package from SourceForge: - -`[Download] `_ slpkg Command Line Tool Usage ----------------------- @@ -90,12 +86,12 @@ Command Line Tool Usage check if your packages is up to date -s sbo, slack [sbo, slack ...] download, build & install packages - -t tracking dependencies + -t packages tracking dependencies from SBo -n view packages from SBo repository -i [ ...] install binary packages -u [ ...] upgrade binary packages -o [ ...] reinstall binary packages - -r [ ...] remove packages + -r [ ...] remove binary packages -f [ ...] view installed packages -d [ ...] display the contents of the packages @@ -181,13 +177,17 @@ Tracking all dependencies of packages: \ +---[ Tree of dependencies ] | - +-- 1 orc + +--1 orc | - +-- 1 gstreamer1 + +--2 gstreamer1 | - +-- 1 gst1-plugins-base + +--3 gst1-plugins-base | - +-- 2 libunique, gst1-plugins-bad + +--4 gst1-plugins-bad + | + +--5 libunique + + NOTE: green installed, red not installed Check if your packages is up to date from slackbuilds.org: diff --git a/man/slpkg.8 b/man/slpkg.8 index 842dcb0b..56250434 100644 --- a/man/slpkg.8 +++ b/man/slpkg.8 @@ -34,12 +34,12 @@ It's a quick and easy way to manage your packages in slackware to a command. \fB-s sbo, slack [sbo, slack ...]\fP \fB download, build & install packages\fP \fB list of installed packages\fP - \fB-t tracking dependencies\fP + \fB-t packages tracking dependencies from SBo\fP \fB-n view packages from SBo repositority\fP \fB-i [ ...] install binary packages\fP \fB-u [ ...] upgrade binary packages\fP \fB-o [ ...] reinstall binary packages\fP - \fB-r [ ...] remove packages\fP + \fB-r [ ...] remove binary packages\fP \fB-f [ ...] view installed packages\fP \fB-d [ ...] display the contents of the packages\fP @@ -75,13 +75,13 @@ the network. (www.slackbuilds.org) .PP Check your packages from Slackware official mirrors or from slackbuilds.org is up to date. -.SS -s , sbo, slack [sbo, slack ...] find, download, build and install -package with all dependencies +.SS -s , sbo, slack [sbo, slack ...] find, download, build and install package with all dependencies \fBslpkg\fP \fB-s\fP <\fIsbo\fP> <\fIslack\fP> <\fIname of package\fP> .PP Find package from slackbuild.org with all dependencies, -download, build and install them. Even download and install official -packages from Slackware official mirrors and install. +download, build and install them if not installed or new version is +available. Even download and install official packages from Slackware +official mirrors and install. .SS -i , install binary package \fBslpkg\fP \fB-i\fP <\fIpackages.t?z\fP> .PP @@ -131,16 +131,20 @@ $ \fBslpkg -t brasero\fP +========================= | brasero dependencies : +========================= - \ + \\ +---[ Tree of dependencies ] | - -- 1 orc + --1: orc | - -- 1 gstreamer1 + --2: gstreamer1 | - -- 1 gst1-plugins-base + --3: gst1-plugins-base | - -- 2 libunique gst1-plugins-bad + --4: gst1-plugins-bad + | + --5: libunique + + NOTE: green installed, red not installed $ \fBslpkg -s sbo brasero\fP diff --git a/slackbuild/README b/slackbuild/README index 1547fcdd..7a57ec44 100644 --- a/slackbuild/README +++ b/slackbuild/README @@ -1,11 +1,15 @@ -Slpkg is a terminal tool in order to easy use Slackware packages. +Slpkg is a terminal multitool in order to easy use Slackware +packages. Features --------- +======== -- Build packages from source with all dependencies +- Build third party packages from source with all dependencies +- Install packages through from official Slackware mirrros - Find and Download packages from slackbuilds.org +- Grabs packages from slackbuilds.org in real time - Automatic tool build and install packages +- Check if your distribution is up to date - Display the contents of the packages - Install-upgrade Slackware packages - Build and install all in a command @@ -17,5 +21,5 @@ Features - Remove packages - No dependencies -It's a quick and easy way to manage your packages in slackware +It's a quick and easy way to manage your packages in `Slackware > Next page ') - stop += 50 + page += 50 if "sbo" in binary: for pkg in os.listdir(pkg_path): if 'SBo' in pkg: index += 1 - print ("[{0}{1}{2}] {3}".format(colors.WHEAT, index, colors.ENDC, pkg)) - if index == stop: + print ("{0}{1}:{2} {3}".format(colors.GREY, index, colors.ENDC, pkg)) + if index == page: key = raw_input('\nPress [ Enter ] >> Next page ') - stop += 50 + page += 50 if "slack" in binary: for pkg in os.listdir(pkg_path): if 'slack' in pkg: index += 1 - print ("[{0}{1}{2}] {3}".format(colors.WHEAT, index, colors.ENDC, pkg)) - if index == stop: + print ("{0}{1}:{2} {3}".format(colors.GREY, index, colors.ENDC, pkg)) + if index == page: key = raw_input('\nPress [ Enter ] >> Next page ') - stop += 50 + page += 50 if "noarch" in binary: for pkg in os.listdir(pkg_path): if 'noarch' in pkg: index += 1 - print ("[{0}{1}{2}] {3}".format(colors.WHEAT, index, colors.ENDC, pkg)) - if index == stop: + print ("{0}{1}:{2} {3}".format(colors.GREY, index, colors.ENDC, pkg)) + if index == page: key = raw_input('\nPress [ Enter ] >> Next page ') - stop += 50 + page += 50 if "other" in binary: for pkg in os.listdir(pkg_path): if 'SBo' in pkg or 'slack' in pkg or 'noarch' in pkg: pass else: index += 1 - print ("[{0}{1}{2}] {3}".format(colors.WHEAT, index, colors.ENDC, pkg)) - if index == stop: + print ("{0}{1}:{2} {3}".format(colors.GREY, index, colors.ENDC, pkg)) + if index == page: key = raw_input('\nPress [ Enter ] >> Next page ') - stop += 50 + page += 50 print # new line at end except KeyboardInterrupt: print # new line at exit diff --git a/slpkg/sbo/__init__.py b/slpkg/sbo/__init__.py index 71519fb9..24cb94b3 100644 --- a/slpkg/sbo/__init__.py +++ b/slpkg/sbo/__init__.py @@ -1 +1 @@ -# [ sbo ] directory +# [ slackbuilds ] directory diff --git a/slpkg/sbo/check.py b/slpkg/sbo/check.py index b08d9f54..37146021 100755 --- a/slpkg/sbo/check.py +++ b/slpkg/sbo/check.py @@ -11,7 +11,7 @@ from slpkg.colors import colors from slpkg.functions import get_file from slpkg.messages import pkg_not_found, s_user, template from slpkg.__metadata__ import tmp, pkg_path, uname, arch, sp -from slpkg.__metadata__ import sbo_arch, sbo_tag, sbo_filetype +from slpkg.__metadata__ import sbo_arch, sbo_tag, sbo_filetype, build_path from search import sbo_search_pkg from download import sbo_slackbuild_dwn @@ -38,17 +38,20 @@ def sbo_check(name): sbo_dwn = sbo_slackbuild_dwn(sbo_url, name) source_dwn = sbo_source_dwn(sbo_url, name) extra_dwn = sbo_extra_dwn(sbo_url, name) - sbo_file = sbo_file[len(name) + 1:-len(arch) - 7] - if sbo_version > sbo_file: - print ("\n{0}New version is available:{1}".format(colors.YELLOW, colors.ENDC)) + sbo_file_version = sbo_file[len(name) + 1:-len(arch) - 7] + if sbo_version > sbo_file_version: + print ("\n{0}New version is available:{1}".format( + colors.YELLOW, colors.ENDC)) template(78) print ("| Package: {0} {1} --> {2} {3}".format( - name, sbo_file, name, sbo_version)) + name, sbo_file_version, name, sbo_version)) template(78) print # new line at start read = raw_input("Would you like to install ? [Y/y] ") if read == "Y" or read == "y": s_user(getpass.getuser()) + os.system("mkdir -p {0}".format(build_path)) + os.chdir(build_path) prgnam = sbo_prgnam_pkg(sbo_url, name) pkg_for_install = ("{0}-{1}".format(prgnam, sbo_version)) script = get_file(sbo_dwn, "/") @@ -60,8 +63,9 @@ def sbo_check(name): for src in extra_dwn.split(): os.system("wget -N {0}".format(src)) extra.append(get_file(src, "/")) - build_package(script, source, extra) - binary = (tmp + pkg_for_install + sbo_arch + sbo_tag + sbo_filetype).split() + build_package(script, source, extra, build_path) + binary = ("{0}{1}{2}{3}{4}".format( + tmp, pkg_for_install, sbo_arch, sbo_tag, sbo_filetype).split()) pkg_upgrade(binary) else: print ("\nPackage {0} is up to date\n".format( diff --git a/slpkg/sbo/dependency.py b/slpkg/sbo/dependency.py index 59524fd8..8a77fb00 100755 --- a/slpkg/sbo/dependency.py +++ b/slpkg/sbo/dependency.py @@ -2,9 +2,13 @@ # -*- coding: utf-8 -*- import sys + from slpkg.colors import colors +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 * from search import sbo_search_pkg from download import sbo_slackbuild_dwn @@ -25,7 +29,7 @@ def sbo_dependencies_pkg(name): else: sbo_req = sbo_requires_pkg(sbo_url, name) dependencies = sbo_req.split() - if dependencies != []: + if dependencies: dep_results.append(dependencies) for line in dependencies: sbo_dependencies_pkg(line) @@ -39,23 +43,35 @@ def pkg_tracking(name): Print tree of dependencies ''' print ('\nSearch dependencies for package {0} from slackbuilds.org:\n'.format(name)) - dependencies = sbo_dependencies_pkg(name) - if dependencies is None: + dependencies_list = sbo_dependencies_pkg(name) + if dependencies_list is None: pass - elif dependencies == []: + elif dependencies_list == []: print ("\nPackage {0} no dependencies\n".format(name)) else: print # new line at start + requires, dependencies = [], [] + for pkg in dependencies_list: + requires += pkg + requires.reverse() + for duplicate in requires: + if duplicate not in dependencies: + dependencies.append(duplicate) pkg_len = len(name) + 24 template(pkg_len) print ("| Package {0}{1}{2} dependencies :".format(colors.CYAN, name, colors.ENDC)) template(pkg_len) - dependencies.reverse() + #clear_dependencies.reverse() print ("\\") print (" +---{0}[ Tree of dependencies ]{1}".format(colors.YELLOW, colors.ENDC)) - for i in range(len(dependencies)): - print (" |") - print (" ".join((" +--", str(len(dependencies[i])), - ", ".join(dependencies[i])))) - print # new line at end + index = 0 + for pkg in dependencies: + index += 1 + if find_package(pkg + sp, pkg_path): + print (" |") + print (" {0}{1}: {2}{3}{4}".format("+--", index, colors.GREEN, pkg, colors.ENDC)) + else: + print (" |") + print (" {0}{1}: {2}{3}{4}".format("+--", index, colors.RED, pkg, colors.ENDC)) + print ("\n NOTE: green installed, red not installed\n") diff --git a/slpkg/sbo/read.py b/slpkg/sbo/read.py index 60205d0b..83b9b0ad 100755 --- a/slpkg/sbo/read.py +++ b/slpkg/sbo/read.py @@ -8,7 +8,7 @@ from slpkg.url_read import url_read from slpkg.__metadata__ import slpkg_path # create tmp directory if not exist -os.system("mkdir -p /tmp/readme/") +os.system("mkdir -p {0}readme/".format(slpkg_path)) def read_readme(sbo_url, name, site): ''' diff --git a/slpkg/sbo/search.py b/slpkg/sbo/search.py index ad6422f6..9b766ee5 100755 --- a/slpkg/sbo/search.py +++ b/slpkg/sbo/search.py @@ -23,7 +23,7 @@ def sbo_search_pkg(name): sbo_location.append(line.replace('SLACKBUILD LOCATION: ./', '')) for loc in sbo_location: if get_file(loc, '/') == name: - print ('{0}[ found ] --> {1} {2}'.format(colors.CYAN, colors.ENDC, name)) + print ('{0}[ found ] --> {1}{2}'.format(colors.CYAN, colors.ENDC, name)) return sbo_url + loc.replace(name, '') + name + "/" except KeyboardInterrupt: print # new line at exit diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index 1cbfe37a..de734ab5 100755 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -6,16 +6,19 @@ import sys import getpass from slpkg.colors import colors from slpkg.functions import get_file -from slpkg.messages import pkg_not_found, template, s_user -from slpkg.__metadata__ import tmp, sbo_arch, sbo_tag, sbo_filetype +from slpkg.__metadata__ import tmp, pkg_path, build_path, sp +from slpkg.__metadata__ import sbo_arch, sbo_tag, sbo_filetype, arch +from slpkg.messages import pkg_not_found, pkg_found, template, s_user +from slpkg.pkg.find import find_package from slpkg.pkg.build import build_package from slpkg.pkg.manager import pkg_upgrade from search import sbo_search_pkg from download import sbo_slackbuild_dwn from dependency import sbo_dependencies_pkg -from greps import sbo_prgnam_pkg, sbo_version_pkg, sbo_source_dwn, sbo_extra_dwn +from greps import sbo_source_dwn, sbo_extra_dwn +from greps import sbo_prgnam_pkg, sbo_version_pkg def sbo_build(name): ''' @@ -27,37 +30,52 @@ def sbo_build(name): template(78) print ("| Build dependencies tree for package {0}:".format(name)) template(78) - dependencies = sbo_dependencies_pkg(name) - if dependencies == None: + dependencies_list = sbo_dependencies_pkg(name) + if dependencies_list == None: pass else: try: - requires, extra = [], [] + os.system("mkdir -p {0}".format(build_path)) + os.chdir(build_path) + requires, dependencies, extra = [], [], [] requires.append(name) - for pkg in dependencies: + for pkg in dependencies_list: requires += pkg requires.reverse() + for duplicate in requires: + if duplicate not in dependencies: + dependencies.append(duplicate) print # new lines at start template(78) print ("| Start download, build and install packages:") template(78) - for pkg in requires: + for pkg in dependencies: sbo_url = sbo_search_pkg(pkg) - prgnam = ("{0}-{1}".format(sbo_prgnam_pkg(sbo_url, pkg), - sbo_version_pkg(sbo_url, pkg))) - sbo_link = sbo_slackbuild_dwn(sbo_url, pkg) - src_link = sbo_source_dwn(sbo_url, pkg) - ext_link = sbo_extra_dwn(sbo_url, pkg) - script = get_file(sbo_link, '/') - source = get_file(src_link, '/') - os.system("wget -N {0} {1}".format(sbo_link, src_link)) - if ext_link: - for src in ext_link: - os.system("wget -N {0}".format(src)) - extra.append(get_file(src, '/')) - build_package(script, source, extra) - binary = (tmp + prgnam + sbo_arch + sbo_tag + sbo_filetype).split() - pkg_upgrade(binary) + sbo_version = sbo_version_pkg(sbo_url, pkg) + sbo_file = "".join(find_package(pkg + sp, pkg_path)) + sbo_file_version = sbo_file[len(pkg) + 1:-len(arch) - 7] + if sbo_version > sbo_file_version: + prgnam = ("{0}-{1}".format(sbo_prgnam_pkg(sbo_url, pkg), + sbo_version_pkg(sbo_url, pkg))) + sbo_link = sbo_slackbuild_dwn(sbo_url, pkg) + src_link = sbo_source_dwn(sbo_url, pkg) + ext_link = sbo_extra_dwn(sbo_url, pkg) + script = get_file(sbo_link, '/') + source = get_file(src_link, '/') + os.system("wget -N {0} {1}".format(sbo_link, src_link)) + if ext_link: + for src in ext_link: + os.system("wget -N {0}".format(src)) + extra.append(get_file(src, '/')) + build_package(script, source, extra, build_path) + binary = ("{0}{1}{2}{3}{4}".format( + tmp, prgnam, sbo_arch, sbo_tag, sbo_filetype).split()) + pkg_upgrade(binary) + else: + template(78) + pkg_found(pkg) + template(78) + print # new line at end except KeyboardInterrupt: print # new line at exit sys.exit() diff --git a/slpkg/sbo/views.py b/slpkg/sbo/views.py index 23d84f92..ee7ede5d 100755 --- a/slpkg/sbo/views.py +++ b/slpkg/sbo/views.py @@ -5,7 +5,7 @@ import os from slpkg.colors import colors from slpkg.functions import get_file from slpkg.__metadata__ import tmp, pkg_path, slpkg_path, sp -from slpkg.__metadata__ import sbo_arch, sbo_tag, sbo_filetype +from slpkg.__metadata__ import sbo_arch, sbo_tag, sbo_filetype, build_path from slpkg.messages import s_user, pkg_not_found, pkg_found, view_sbo, template from slpkg.pkg.build import build_package @@ -67,6 +67,8 @@ def sbo_network(name): os.remove("{0}readme/{1}{2}".format(slpkg_path, name, site)) elif read == "B" or read == "b": s_user(getpass.getuser()) + os.system("mkdir -p {0}".format(build_path)) + os.chdir(build_path) script = get_file(sbo_dwn, "/") source = get_file(source_dwn, "/") print ("\n{0}Start -->{1}\n".format(colors.GREEN, colors.ENDC)) @@ -76,10 +78,12 @@ def sbo_network(name): for src in extra_dwn.split(): os.system("wget -N {0}".format(src)) extra.append(get_file(src, "/")) - build_package(script, source, extra) + build_package(script, source, extra, build_path) break elif read == "I" or read == "i": s_user(getpass.getuser()) + os.system("mkdir -p {0}".format(build_path)) + os.chdir(build_path) prgnam = sbo_prgnam_pkg(sbo_url, name) pkg_for_install = ("{0}-{1}".format(prgnam, sbo_version)) if find_package(prgnam + sp, pkg_path) == []: @@ -92,8 +96,9 @@ def sbo_network(name): for src in extra_dwn.split(): os.system("wget -N {0}".format(src)) extra.append(get_file(src, "/")) - build_package(script, source, extra) - binary = (tmp + pkg_for_install + sbo_arch + sbo_tag + sbo_filetype).split() + build_package(script, source, extra, build_path) + binary = ("{0}{1}{2}{3}{4}".format( + tmp, pkg_for_install, sbo_arch, sbo_tag, sbo_filetype).split()) pkg_upgrade(binary) break else: diff --git a/slpkg/slack/__init__.py b/slpkg/slack/__init__.py index 066ec507..f5920df3 100644 --- a/slpkg/slack/__init__.py +++ b/slpkg/slack/__init__.py @@ -1 +1 @@ -# [ slack ] directory +# [ slackware ] directory diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py index 68b08a4d..8c61c32e 100755 --- a/slpkg/slack/patches.py +++ b/slpkg/slack/patches.py @@ -7,7 +7,7 @@ import getpass from slpkg.colors import colors from slpkg.messages import s_user from slpkg.url_read import url_read -from slpkg.__metadata__ import pkg_path, slpkg_path +from slpkg.__metadata__ import pkg_path, slpkg_path, arch from slpkg.pkg.find import find_package from slpkg.pkg.manager import pkg_upgrade @@ -66,7 +66,12 @@ def patches(): print ("\nThere are packages in directory {0}{1}\n".format( slpkg_path, 'patches/')) else: - print ("\nSlackware {0} distribution is up to date\n".format(slack_ver())) + if arch == "x86_64": + slack_arch = 64 + else: + slack_arch = "" + print ("\nSlackware{0} v{1} distribution is up to date\n".format( + slack_arch, slack_ver())) except KeyboardInterrupt: print # new line at exit sys.exit()