From f01743f3bd23150516e680bdf6025d0d2575bcc5 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 27 Aug 2014 21:45:00 +0300 Subject: [PATCH] updated for version 1.7.7 --- CHANGELOG | 9 +++ INSTALL | 3 - PKG-INFO | 123 ++++++++++++++++++++++------------- README.rst | 13 ++-- bin/slpkg | 4 +- man/slpkg.8 | 13 ++-- setup.py | 5 +- slackbuild/slack-desc | 10 +-- slackbuild/slpkg.SlackBuild | 8 +-- slackbuild/slpkg.info | 4 +- slpkg/__metadata__.py | 14 +++- slpkg/colors.py | 4 +- slpkg/functions.py | 4 +- slpkg/main.py | 12 ++-- slpkg/messages.py | 28 ++++---- slpkg/pkg/build.py | 17 +++-- slpkg/pkg/find.py | 4 +- slpkg/pkg/manager.py | 10 ++- slpkg/sbo/check.py | 30 +++++---- slpkg/sbo/dependency.py | 51 +++++++-------- slpkg/sbo/download.py | 11 ++-- slpkg/sbo/file_size.py | 4 +- slpkg/sbo/greps.py | 4 +- slpkg/sbo/init.py | 4 +- slpkg/sbo/read.py | 4 +- slpkg/sbo/search.py | 4 +- slpkg/sbo/slackbuild.py | 64 ++++++++++-------- slpkg/sbo/views.py | 44 ++++++++----- slpkg/slack/install.py | 45 ++++--------- slpkg/slack/mirrors.py | 4 +- slpkg/slack/patches.py | 35 ++++------ slpkg/slack/slack_version.py | 4 +- slpkg/url_read.py | 4 +- slpkg/version.py | 5 +- 34 files changed, 318 insertions(+), 284 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b515f16b..cf9c4aa3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,13 @@ +Version 1.7.7 +26-08-2014 + +[Updated] - Fix install noarch packages from SBo repository + Fix avoid '%README%' as dependency + Fix arguments + Fix messages + Version 1.7.6 +25-08-2014 [Updated] - Bugfix IndexError '-aa' in cli argparseoptions. Fix arch's diff --git a/INSTALL b/INSTALL index 2c9b1510..16f9adad 100644 --- a/INSTALL +++ b/INSTALL @@ -40,6 +40,3 @@ There are mainly four ways: Proposed mode if you want to have installed the most updated version is 1 and 2 process. - - - diff --git a/PKG-INFO b/PKG-INFO index 705cc47f..c9de501c 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: slpkg -Version: 1.7.6 +Version: 1.7.7 Author: dslackw Author-email: d zlatanidis at gmail com Maintainer: dslackw @@ -25,8 +25,7 @@ Description: .. image:: https://badge.fury.io/py/slpkg.png ======== - Build third party packages from source with all dependencies - - Install packages through from official `Slackware `_ -mirrors + - 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 @@ -51,9 +50,8 @@ mirrors Video Tutorial ============== - .. image:: -https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png - :target: https://asciinema.org/a/11265 + .. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png + :target: https://asciinema.org/a/11457 Installation ------------ @@ -68,21 +66,20 @@ https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png $ pip uninstall slpkg + Using Slackware command: - - Download http://slackbuilds.org/repository/14.1/system/slpkg from slackbuilds.org - Using SBOPKG http://www.sbopkg.org + Download `SBo package `_ + + Download binary package from `SourceForge `_ - Download binary package from SourceForge: Command Line Tool Usage ----------------------- .. code-block:: bash - usage: slpkg [-h] [-v] [-a script [source ...]] - [-l all, sbo, slack, noarch, other] + usage: slpkg [-h] [-v] [-a script [source ...]] [-l all, sbo, slack, noarch] [-c sbo, slack [sbo, slack ...]] [-s sbo, slack [sbo, slack ...]] [-t] [-n] [-i [...]] [-u [...]] [-o [...]] [-r [...]] [-f [...]] [-d [...]] @@ -94,7 +91,7 @@ https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png -v, --verbose print version and exit -a script [source ...] auto build package - -l all, sbo, slack, noarch, other + -l all, sbo, slack, noarch list of installed packages -c sbo, slack [sbo, slack ...] check if your packages is up to date @@ -120,10 +117,25 @@ https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png $ slpkg -s sbo brasero Building dependency tree...... Done - The following packages will be automatically installed or upgraded with new -version: + + The following packages will be automatically installed or upgraded with new version: - orc gstreamer1 gst1-plugins-base gst1-plugins-bad libunique brasero + +============================================================================== + | Package Version Arch Repository + +============================================================================== + Installing: + brasero 3.11.3 x86_64 SBo + Installing for dependencies: + orc 0.4.19 x86_64 SBo + gstreamer1 1.2.2 x86_64 SBo + gst1-plugins-base 1.2.2 x86_64 SBo + gst1-plugins-bad 1.2.2 x86_64 SBo + libunique 1.1.6 x86_64 SBo + + Installing summary + =============================================================================== + Total 6 packages. + 6 packages will be installed, 0 allready installed. Do you want to continue [Y/n]? y . @@ -158,9 +170,21 @@ version: Reading package lists.............................. Done - [ install ] --> mozilla-firefox-24.1.0esr-x86_64-1 - [ install ] --> mozilla-nss-3.15.2-x86_64-2 - [ install ] --> mozilla-thunderbird-24.1.0-x86_64-1 + +============================================================================== + | Package Arch Build Repos Size + +============================================================================== + Installing: + mozilla-firefox-24.1.0esr x86_64 1 Slack 23524 K + mozilla-nss-3.15.2 x86_64 2 Slack 1592 K + mozilla-thunderbird-24.1.0 x86_64 1 Slack 24208 K + + Installing summary + =============================================================================== + + Total 3 packages. + 3 packages will be installed, 0 allready installed. + Need to get 6.02 Mb of archives. + After this process, 15.72 Mb of additional disk space will be used. Would you like to install [Y/n]? @@ -188,31 +212,33 @@ version: | +--5 libunique - NOTE: green installed, red not installed - Check if your packages is up to date from slackbuilds.org: .. code-block:: bash - $ slpkg -c sbo flashplayer-plugin + $ slpkg -c sbo upgrade Reading package lists. Done - New version is available: + These packages need upgrading: + +============================================================================== - | Package: flashplayer-plugin 11.2.202.356 --> flashplayer-plugin 11.2.202.394 + | Package New version Arch Repository +============================================================================== - - Would you like to install [Y/n]? - - $ slpkg -c sbo ranger - Reading package lists. Done - - Package 'ranger-1.6.1' is up to date - - $ slpkg -c sbo termcolor - Reading package lists. Done - - No such package termcolor: Not installed + Upgrading: + six-1.7.1 1.7.3 x86_64 SBo + pysetuptools-3.4 3.6 x86_64 SBo + Jinja2-2.7.0 2.7.2 x86_64 SBo + pysed-0.3.0 0.3.1 x86_64 SBo + Pafy-0.3.56 0.3.58 x86_64 SBo + MarkupSafe-0.21 0.23 x86_64 SBo + pip-1.5.3 1.5.6 x86_64 SBo + colored-1.1.1 1.1.4 x86_64 SBo + + Installing summary + =============================================================================== + Total 8 packages will be upgraded. + + Would you like to upgrade [Y/n]? Check if your distribution is up to date from `Slackware official mirrors `_ @@ -224,10 +250,20 @@ version: 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 + +============================================================================== + | Package Arch Build Repos Size + +============================================================================== + Upgrading: + dhcpcd-6.0.5 x86_64 3 Slack 92 K + samba-4.1.11 x86_64 1 Slack 9928 K + xscreensaver-5.29 x86_64 1 Slack 3896 K + Installing summary + =============================================================================== + Total 3 package will be upgrading. + Need to get 1.70 Mb of archives. + After this process, 9.51 Mb of additional disk space will be used. + Would you like to upgrade [Y/y]? Find packages from slackbuilds.org: @@ -251,7 +287,7 @@ version: Download Download this package Build Download and build this package Install Download/Build/Install - + Quit Quit _ Auto tool to build package: @@ -453,8 +489,7 @@ version: --> Deleting /usr/lib64/python2.7/site-packages/termcolor-1.1.0-py2.7.egg-info --> Deleting /usr/lib64/python2.7/site-packages/termcolor.py --> Deleting /usr/lib64/python2.7/site-packages/termcolor.pyc - --> Deleting -/usr/lib64/python3.3/site-packages/__pycache__/termcolor.cpython-33.pyc + --> Deleting /usr/lib64/python3.3/site-packages/__pycache__/termcolor.cpython-33.pyc --> Deleting /usr/lib64/python3.3/site-packages/termcolor-1.1.0-py3.3.egg-info --> Deleting /usr/lib64/python3.3/site-packages/termcolor.py --> Deleting empty directory /usr/lib64/python3.3/site-packages/__pycache__/ @@ -497,8 +532,7 @@ version: | werkzeug +============================================================================== - Remove dependencies [Y/n]? y - + Remove dependencies (maybe used by other packages) [Y/n]? y . . . @@ -516,6 +550,7 @@ version: .. code-block:: bash $ man slpkg +Keywords: slackware, slpkg, slackpkg, sbopkg, package, build, install, yum, apt-get, linux, unix Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Console Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3) diff --git a/README.rst b/README.rst index c0098812..c2158ec9 100644 --- a/README.rst +++ b/README.rst @@ -65,9 +65,9 @@ Command Line Tool Usage .. code-block:: bash - usage: slpkg [-h] [-v] [-a script [source ...]] [-l all, sbo, slack, noarch] - [-c sbo, slack [sbo, slack ...]] - [-s sbo, slack [sbo, slack ...]] [-t] [-n] [-i [...]] + usage: slpkg [-h] [-v] [-a script [source ...]] + [-l all, sbo, slack, noarch] [-c sbo, slack [ ...]] + [-s sbo, slack [ ...]] [-t] [-n] [-i [...]] [-u [...]] [-o [...]] [-r [...]] [-f [...]] [-d [...]] Utility for easy management packages in Slackware @@ -79,9 +79,9 @@ Command Line Tool Usage auto build package -l all, sbo, slack, noarch list of installed packages - -c sbo, slack [sbo, slack ...] + -c sbo, slack [ ...] check if your packages is up to date - -s sbo, slack [sbo, slack ...] + -s sbo, slack [ ...] download, build & install packages -t packages tracking dependencies from SBo -n view packages from SBo repository @@ -263,8 +263,7 @@ Find packages from slackbuilds.org: | Package bitfighter --> http://slackbuilds.org/repository/14.1/games/bitfighter/ +=============================================================================== | SlackBuild : bitfighter.tar.gz - | Source : bitfighter-019c.tar.gz - | Extra : classic_level_pack.zip + | Sources : bitfighter-019c.tar.gz | Requirements : OpenAL, SDL2, speex, libmodplug +=============================================================================== README View the README file diff --git a/bin/slpkg b/bin/slpkg index b97ca031..24d2b575 100755 --- a/bin/slpkg +++ b/bin/slpkg @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# slpkg +# slpkg file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. diff --git a/man/slpkg.8 b/man/slpkg.8 index aa56a75d..24ace5dc 100644 --- a/man/slpkg.8 +++ b/man/slpkg.8 @@ -15,10 +15,10 @@ .SH NAME slpkg - Utility for easy management packages in Slackware .SH SYNOPSIS - \fBusage: slpkg [-h] [-v] [-a script [source ...]] [-l all, sbo, slack, noarch] - [-c sbo, slack [sbo, slack ...]] - [-s sbo, slack [sbo, slack ...]] [-t] [-n] [-i [...]] - [-u [...]] [-o [...]] [-r [...]] [-f [...]] [-d [...]]\fP + \fBusage: slpkg [-h] [-v] [-a script [source ...]] + [-l all, sbo, slack, noarch] [-c sbo, slack [ ...]] + [-s sbo, slack [ ...]] [-t] [-n] [-i [...]] + [-u [...]] [-o [...]] [-r [...]] [-f [...]] [-d [...]]\fP .SH DESCRIPTION \fBslpkg\fP is a terminal multitool in order to easy use Slackware packages. @@ -31,9 +31,9 @@ It's a quick and easy way to manage your packages in slackware to a command. \fB auto build packages\fP \fB-l all, sbo, slack, noarch\fP \fB list of installed packages\fP - \fB-c sbo, slack [sbo, slack ...]\fp + \fB-c sbo, slack [ ...]\fp \fB check if your packages is up to date\fP - \fB-s sbo, slack [sbo, slack ...]\fP + \fB-s sbo, slack [ ...]\fP \fB download, build & install packages\fP \fB list of installed packages\fP \fB-t packages tracking dependencies from SBo\fP @@ -230,7 +230,6 @@ $ \fBslpkg -n termcolor\fP +============================================================================== | SlackBuild : termcolor.tar.gz | Source : termcolor-1.1.0.tar.gz - | Extra : | Requirements : +=============================================================================== README View the README file diff --git a/setup.py b/setup.py index 5e2ee2f8..d2a560cb 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# setup.py +# setup.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. @@ -69,4 +69,3 @@ if 'install' in sys.argv: man_page = "man/slpkg.8" shutil.copy2(man_page, man_path) os.chmod(man_path, int('444', 8)) - diff --git a/slackbuild/slack-desc b/slackbuild/slack-desc index 9ddb071a..fe8cda8c 100644 --- a/slackbuild/slack-desc +++ b/slackbuild/slack-desc @@ -8,12 +8,12 @@ |-----handy-ruler------------------------------------------------------| slpkg: slpkg (Slackware tool in Python) slpkg: -slpkg: Slpkg is a terminal multitool in order to easy use Slackware -slpkg: packages. It's a quick and easy way to manage your packages in -slpkg: slackware to a command -slpkg: +slpkg: Slpkg is a terminal multitool in order to easy use Slackware +slpkg: packages. It's a quick and easy way to manage your packages in +slpkg: Slackware to a command. Slpkg uses Slackware commands to upgrade, +slpkg: install or remove packages. +slpkg: slpkg: Homepage: https://github.com/dslackw/slpkg slpkg: slpkg: slpkg: -slpkg: diff --git a/slackbuild/slpkg.SlackBuild b/slackbuild/slpkg.SlackBuild index d3da84f1..23e3333b 100755 --- a/slackbuild/slpkg.SlackBuild +++ b/slackbuild/slpkg.SlackBuild @@ -23,7 +23,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=slpkg -VERSION=${VERSION:-1.7.6} +VERSION=${VERSION:-1.7.7} BUILD=${BUILD:-1} TAG=${TAG:-_dsw} @@ -35,7 +35,6 @@ if [ -z "$ARCH" ]; then esac fi - CWD=$(pwd) TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM @@ -70,9 +69,6 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -# ignore pip install man page -#sed -i 's/'install'//' setup.py - python setup.py install --root=$PKG find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ @@ -83,7 +79,7 @@ gzip -9 man/$PRGNAM.8 install -D -m0644 man/$PRGNAM.8.gz $PKG/usr/man/man8/$PRGNAM.8.gz mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a README.rst CHANGELOG LICENSE $PKG/usr/doc/$PRGNAM-$VERSION +cp -a README.rst CHANGELOG LICENSE CONTRIBUTING ISSUES $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install diff --git a/slackbuild/slpkg.info b/slackbuild/slpkg.info index a9e9df11..0d9a8487 100644 --- a/slackbuild/slpkg.info +++ b/slackbuild/slpkg.info @@ -1,7 +1,7 @@ PRGNAM="slpkg" -VERSION="1.7.6" +VERSION="1.7.7" HOMEPAGE="https://github.com/dslackw/slpkg" -DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.7.6.tar.gz" +DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.7.7.tar.gz" MD5SUM="" DOWNLOAD_x86_64="" MD5SUM_x86_64="" diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index dec8fc35..0137a9af 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -26,7 +26,7 @@ import subprocess __all__ = "slpkg" __author__ = "dslackw" -__version_info__ = (1, 7, 6) +__version_info__ = (1, 7, 7) __version__ = "{0}.{1}.{2}".format(*__version_info__) __license__ = "GNU General Public License v3 (GPLv3)" __email__ = "d.zlatanidis@gmail.com" @@ -67,3 +67,15 @@ elif "arm" in arch: build = "*" sbo_tag = "_SBo" sbo_filetype = ".tgz" + +''' Slackware architectures ''' +slack_archs = ( + "-noarch-", + "-x86_64-", + "-i386-", + "-i486-", + "-i686-", + "-x86-", + "-fw-" + ) + diff --git a/slpkg/colors.py b/slpkg/colors.py index c712ab10..970a1e64 100755 --- a/slpkg/colors.py +++ b/slpkg/colors.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# colors.py +# colors.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. diff --git a/slpkg/functions.py b/slpkg/functions.py index 218b2e71..99bee232 100755 --- a/slpkg/functions.py +++ b/slpkg/functions.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# functions.py +# functions.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. diff --git a/slpkg/main.py b/slpkg/main.py index 32754971..899407bd 100755 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# main.py +# main.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. @@ -87,14 +87,14 @@ def main(): parser.add_argument("-v", "--verbose", help="print version and exit", action="store_true") parser.add_argument("-a", help="auto build packages", - type=str, nargs="+", metavar=("script", "source")) + type=str, nargs="+", metavar=("script", "sources")) parser.add_argument("-l", help="list of installed packages", choices="all sbo slack noarch".split(), metavar=("all, sbo, slack, noarch")) parser.add_argument("-c", help="check if your packages is up to date", - type=str, nargs="+", metavar=("sbo, slack")) + type=str, nargs="+", metavar=("sbo, slack", "")) parser.add_argument("-s", help="download, build & install packages", - type=str, nargs="+", metavar=("sbo, slack")) + type=str, nargs="+", metavar=("sbo, slack","")) parser.add_argument("-t", help="packages tracking dependencies from SBo", type=str, metavar=("")) parser.add_argument("-n", help="view packages from SBo repository", @@ -172,7 +172,7 @@ def main(): err1_args("".join(args.s[0]), choices) elif len(args.s) < 2: if "sbo" in args.s or "slack" in args.s: - choices = ["upgrade"] + choices = ["package"] ext_err_args() err2_args(choices) else: diff --git a/slpkg/messages.py b/slpkg/messages.py index 41eb4ca2..46b3a520 100755 --- a/slpkg/messages.py +++ b/slpkg/messages.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# messages.py +# messages.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. @@ -29,41 +29,41 @@ def pkg_not_found(bol, pkg, message, eol): ''' Print message when package not found ''' - print ("{0}No such package {1}: {2}{3}".format(bol, pkg, message, eol)) + print("{0}No such package {1}: {2}{3}".format(bol, pkg, message, eol)) def pkg_found(pkg, version): ''' Print message when package found ''' - print ("| Package {0}-{1} is already installed".format(pkg, version)) + print("| Package {0}-{1} is already installed".format(pkg, version)) def pkg_installed(pkg): ''' Print message when package installed ''' - print ("| Package {0} installed".format(pkg)) + print("| Package {0} installed".format(pkg)) def ext_err_args(): ''' Extended error arguments view ''' - print ("usage: {0} [-h] [-v] [-a script [source ...]] [-l all, sbo, slack, noarch]".format(__all__)) - print (" [-c sbo, slack [sbo, slack ...]]") - print (" [-s sbo, slack [sbo, slack ...]] [-t] [-n] [-i [...]]") - print (" [-u [...]] [-o [...]] [-r [...]] [-f [...]] [-d [...]]") + print("usage: {0} [-h] [-v] [-a script [sources ...]]".format(__all__)) + print(" [-l all, sbo, slack, noarch] [-c sbo, slack [ ...]]") + print(" [-s sbo, slack [ ...]] [-t] [-n] [-i [...]]") + print(" [-u [...]] [-o [...]] [-r [...]] [-f [...]] [-d [...]]") def err1_args(invalid, choices): ''' Print error message arguments ''' - print ("{0}: error: invalid choice: '{1}' choose from {2}".format( + print("{0}: error: invalid choice: '{1}' choose from {2}".format( __all__, invalid, choices)) def err2_args(choices): ''' Print error message arguments ''' - print ("{0}: error: must enter at least two arguments: choose {1}".format( + print("{0}: error: must enter at least two arguments: choose {1}".format( __all__, choices)) def s_user(user): @@ -71,14 +71,14 @@ def s_user(user): Check for root user ''' if user != "root": - print ("\nError: must have root privileges\n") + print("\nError: must have root privileges\n") sys.exit() def template(max): ''' Print view template ''' - print ("+" + "=" * max) + print("+" + "=" * max) def view_sbo(pkg, sbo_url, sbo_dwn, source_dwn, sbo_req): print # new line at start @@ -87,7 +87,7 @@ def view_sbo(pkg, sbo_url, sbo_dwn, source_dwn, sbo_req): colors.CYAN, pkg, colors.GREEN, colors.ENDC + sbo_url)) template(78) print("| {0}SlackBuild : {1}{2}".format(colors.GREEN, colors.ENDC, sbo_dwn)) - print("| {0}Source : {1}{2}".format(colors.GREEN, colors.ENDC, source_dwn)) + print("| {0}Sources : {1}{2}".format(colors.GREEN, colors.ENDC, source_dwn)) print("| {0}Requirements : {1}{2}".format(colors.YELLOW, colors.ENDC, ", ".join(sbo_req))) template(78) diff --git a/slpkg/pkg/build.py b/slpkg/pkg/build.py index e6c9f105..8e87b8e7 100755 --- a/slpkg/pkg/build.py +++ b/slpkg/pkg/build.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# build.py +# build.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. @@ -33,21 +33,20 @@ def build_package(script, sources, path): ''' Build package from source ''' - pkg_name = script.replace(".tar.gz", "") + prgnam = script.replace(".tar.gz", "") try: tar = tarfile.open(script) tar.extractall() tar.close() for src in sources: - shutil.copy2(src, pkg_name) - os.chdir(path + pkg_name) - subprocess.call("chmod +x {0}.SlackBuild".format(pkg_name), shell=True) - subprocess.call("./{0}.SlackBuild".format(pkg_name), shell=True) + shutil.copy2(src, prgnam) + os.chdir(path + prgnam) + subprocess.call("chmod +x {0}.SlackBuild".format(prgnam), shell=True) + subprocess.call("./{0}.SlackBuild".format(prgnam), shell=True) os.chdir(path) except (OSError, IOError): message = "Wrong file" - bol, eol, pkg = "\n", "\n", "" - pkg_not_found(bol, pkg, message, eol) + pkg_not_found("\n", prgnam, message, "\n") except KeyboardInterrupt: print # new line at exit sys.exit() diff --git a/slpkg/pkg/find.py b/slpkg/pkg/find.py index 9cba9309..78da52d4 100755 --- a/slpkg/pkg/find.py +++ b/slpkg/pkg/find.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# find.py +# find.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py index c9bded06..52737061 100755 --- a/slpkg/pkg/manager.py +++ b/slpkg/pkg/manager.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# manager.py +# manager.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. @@ -95,9 +95,8 @@ def pkg_remove(binary): removed.append(pkg) else: message = "Can't remove" - bol, eol = "", "" not_found.append(pkg) - pkg_not_found(bol, pkg, message, eol) + pkg_not_found("", pkg, message, "") if removed == []: print # new line at end else: @@ -176,8 +175,7 @@ def pkg_find(binary): find_package(pkg + sp, pkg_path))) else: message = "Can't find" - bol, eol = "", "" - pkg_not_found(bol, pkg, message, eol) + pkg_not_found("", pkg, message, "") print # new line at end def pkg_display(binary): diff --git a/slpkg/sbo/check.py b/slpkg/sbo/check.py index b2463c77..8e2042c1 100755 --- a/slpkg/sbo/check.py +++ b/slpkg/sbo/check.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# check.py +# check.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. @@ -25,14 +25,15 @@ import os import sys import subprocess +from slpkg.pkg.find import find_package from slpkg.pkg.build import build_package from slpkg.pkg.manager import pkg_upgrade from slpkg.colors import colors from slpkg.messages import template from slpkg.functions import get_file -from slpkg.__metadata__ import tmp, pkg_path, build_path -from slpkg.__metadata__ import sbo_arch, build, sbo_tag, sbo_filetype +from slpkg.__metadata__ import (tmp, sbo_arch, build, sbo_tag, + sbo_filetype, pkg_path, build_path) from init import initialization from search import sbo_search_pkg @@ -49,9 +50,9 @@ def sbo_check(): sys.stdout.flush() initialization() index, toolbar_width = 0, 3 - pkg_name, sbo_ver, pkg_for_upg, sbo_list = [], [], [], [] + pkg_name, sbo_ver, pkg_for_upg, sbo_list, pkg_arch = [], [], [], [], [] for pkg in os.listdir(pkg_path): - if "_SBo" in pkg: + if pkg.endswith("_SBo"): sbo_list.append(pkg) if sbo_list: for pkg in sbo_list: @@ -70,14 +71,15 @@ def sbo_check(): arch = "noarch" else: arch = os.uname()[4] - name = pkg[:-(len(arch) + len("_SBo") + 3)] + name = pkg[:-(len(arch) + len(sbo_tag) + 3)] pkg_version = get_file(name, "-")[1:] name = name[:-(len(pkg_version) + 1)] sbo_version = sbo_version_pkg(name) if sbo_version > pkg_version: pkg_name.append(name) - pkg_for_upg.append(name + "-" + pkg_version) + pkg_for_upg.append("{0}-{1}".format(name, pkg_version)) sbo_ver.append(sbo_version) + pkg_arch.append(arch) sys.stdout.write("Done\n") if pkg_for_upg: print("\nThese packages need upgrading:\n") @@ -85,7 +87,7 @@ def sbo_check(): print "| Package", " "*27, "New version", " "*5, "Arch", " "*7, "Repository" template(78) print("Upgrading:") - for upg, ver in zip(pkg_for_upg, sbo_ver): + for upg, ver, arch in zip(pkg_for_upg, sbo_ver, pkg_arch): print " ", upg, " "*(34-len(upg)), ver, " "*( 16-len(ver)), arch, " "*(11-len(arch)), "SBo" msg_pkg = "package" @@ -99,10 +101,10 @@ def sbo_check(): if not os.path.exists(build_path): os.mkdir(build_path) os.chdir(build_path) - for name, version in zip(pkg_name, sbo_ver): - pkg_for_install = ("{0}-{1}".format(name, version)) + for name, version, arch in zip(pkg_name, sbo_ver, pkg_arch): + prgnam = ("{0}-{1}".format(name, version)) sbo_url = sbo_search_pkg(name) - sbo_dwn = sbo_slackbuild_dwn(sbo_url, name) + sbo_dwn = sbo_slackbuild_dwn(sbo_url) src_dwn = sbo_source_dwn(name).split() script = get_file(sbo_dwn, "/") print("\n{0}Start -->{1} {2}\n".format(colors.GREEN, colors.ENDC, name)) @@ -112,8 +114,8 @@ def sbo_check(): subprocess.call("wget -N {0}".format(src), shell=True) sources.append(get_file(src, "/")) build_package(script, sources, build_path) - binary = ("{0}{1}{2}{3}{4}{5}".format( - tmp, pkg_for_install, sbo_arch, build, sbo_tag, sbo_filetype).split()) + binary = ("{0}{1}-{2}-{3}{4}{5}".format( + tmp, prgnam, arch, build, sbo_tag, sbo_filetype).split()) print("{0}[ Upgrading ] --> {1}{2}".format( colors.GREEN, colors.ENDC, name)) pkg_upgrade(binary) diff --git a/slpkg/sbo/dependency.py b/slpkg/sbo/dependency.py index df29d511..cb3afceb 100755 --- a/slpkg/sbo/dependency.py +++ b/slpkg/sbo/dependency.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# dependency.py +# dependency.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. @@ -32,31 +32,28 @@ from slpkg.pkg.find import find_package from init import initialization from search import sbo_search_pkg from greps import sbo_requires_pkg -from download import sbo_slackbuild_dwn dep_results = [] def sbo_dependencies_pkg(name): ''' - Build tree of dependencies + Build all dependencies of a package ''' try: - if name is not "%README%": - sbo_url = sbo_search_pkg(name) - if sbo_url is None: - sys.stdout.write("Done\n") - message = "From slackbuilds.org" - bol, eol = "\n", "\n" - pkg_not_found(bol, name, message, eol) - else: - dependencies = sbo_requires_pkg(sbo_url, name) - if dependencies: - dep_results.append(dependencies) + dependencies = [] + sbo_url = sbo_search_pkg(name) + if sbo_url: + requires = sbo_requires_pkg(sbo_url, name) + for req in requires: + if "%README%" not in req: + dependencies.append(req) + if dependencies: + dep_results.append(dependencies) for dep in dependencies: - sys.stdout.write(".") - sys.stdout.flush() - sbo_dependencies_pkg(dep) - return dep_results + sys.stdout.write(".") + sys.stdout.flush() + sbo_dependencies_pkg(dep) + return dep_results except KeyboardInterrupt: print # new line at exit sys.exit() @@ -66,14 +63,10 @@ def pkg_tracking(name): Print tree of dependencies ''' sys.stdout.write("Reading package lists ...") + sys.stdout.flush() initialization() dependencies_list = sbo_dependencies_pkg(name) - if dependencies_list is None: - pass - elif dependencies_list == []: - sys.stdout.write("Done\n") - print("\nPackage {0} no dependencies\n".format(name)) - else: + if dependencies_list is not None: sys.stdout.write("Done\n") print # new line at start requires, dependencies = [], [] @@ -84,9 +77,11 @@ def pkg_tracking(name): if duplicate not in dependencies: dependencies.append(duplicate) pkg_len = len(name) + 24 + if dependencies == []: + dependencies = ["No dependencies"] template(pkg_len) print("| Package {0}{1}{2} dependencies :".format(colors.CYAN, name, - colors.ENDC)) + colors.ENDC)) template(pkg_len) print("\\") print(" +---{0}[ Tree of dependencies ]{1}".format(colors.YELLOW, colors.ENDC)) @@ -100,3 +95,7 @@ def pkg_tracking(name): print(" |") print(" {0}{1}: {2}{3}{4}".format("+--", index, colors.RED, pkg, colors.ENDC)) print # new line at end + else: + sys.stdout.write("Done\n") + message = "From slackbuilds.org" + pkg_not_found("\n", name, message, "\n") diff --git a/slpkg/sbo/download.py b/slpkg/sbo/download.py index 5d1486ee..f4abb135 100755 --- a/slpkg/sbo/download.py +++ b/slpkg/sbo/download.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# download.py +# download.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. @@ -21,9 +21,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -def sbo_slackbuild_dwn(sbo_url, name): +def sbo_slackbuild_dwn(sbo_url): ''' - Convert http repository link to - slackbuild download link + Create download slackbuild tar.gz script ''' - return sbo_url.replace(name + "/", name + ".tar.gz") + return sbo_url[:-1] + ".tar.gz" diff --git a/slpkg/sbo/file_size.py b/slpkg/sbo/file_size.py index 80991c19..52d3ea29 100755 --- a/slpkg/sbo/file_size.py +++ b/slpkg/sbo/file_size.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -* -# file_size.py +# file_size.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. diff --git a/slpkg/sbo/greps.py b/slpkg/sbo/greps.py index 336688ce..ee7583bc 100755 --- a/slpkg/sbo/greps.py +++ b/slpkg/sbo/greps.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# greps.py +# greps.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. diff --git a/slpkg/sbo/init.py b/slpkg/sbo/init.py index 29c08e7b..5c0fd67a 100755 --- a/slpkg/sbo/init.py +++ b/slpkg/sbo/init.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# init.py +# init.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. diff --git a/slpkg/sbo/read.py b/slpkg/sbo/read.py index 4f06539f..4334ab63 100755 --- a/slpkg/sbo/read.py +++ b/slpkg/sbo/read.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# read.py +# read.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. diff --git a/slpkg/sbo/search.py b/slpkg/sbo/search.py index 3922fccb..9b74f31c 100755 --- a/slpkg/sbo/search.py +++ b/slpkg/sbo/search.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# search.py +# search.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index 6b67ba7e..8a2b6e72 100755 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# slackbuild.py +# slackbuild.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. @@ -28,8 +28,8 @@ import subprocess from slpkg.colors import colors from slpkg.functions import get_file from slpkg.messages import pkg_not_found, pkg_found, template -from slpkg.__metadata__ import sbo_arch, build, sbo_tag, sbo_filetype -from slpkg.__metadata__ import tmp, pkg_path, build_path, log_path, sp +from slpkg.__metadata__ import (tmp, pkg_path, build_path, log_path, + sp, build, sbo_tag, sbo_filetype) from slpkg.pkg.find import find_package from slpkg.pkg.build import build_package @@ -50,14 +50,10 @@ def sbo_build(name): sys.stdout.write("Building dependency tree ...") initialization() dependencies_list = sbo_dependencies_pkg(name) - if dependencies_list == None: - pass - else: - try: - if not os.path.exists(build_path): - os.mkdir(build_path) - os.chdir(build_path) - requires, dependencies = [], [] + try: + if dependencies_list is not None: + pkg_sum, SC, EC = 0, "", "" + requires, dependencies, pkg_for_install = [], [], [] requires.append(name) for pkg in dependencies_list: requires += pkg @@ -65,8 +61,6 @@ def sbo_build(name): for duplicate in requires: if duplicate not in dependencies: dependencies.append(duplicate) - pkg_sum = 0 - pkg_for_install = [] if find_package(name + sp, pkg_path): pkg_for_install.append(colors.GREEN + name + colors.ENDC) pkg_sum = 1 @@ -82,29 +76,30 @@ def sbo_build(name): arch = "i486" elif "arm" in arch: arch = "arm" - else: - arch = os.uname()[4] if "UNSUPPORTED" in src: arch = "UNSUPPORTED" + SC, EC = colors.RED, colors.ENDC elif "UNTESTED" in src: arch = "UNTESTED" - print("The following packages will be automatically installed or upgraded with new version:\n") + SC, EC = colors.YELLOW, colors.ENDC + print("\nThe following packages will be automatically installed or upgraded") + print("with new version:\n") template(78) print "| Package", " "*31, "Version", " "*7, "Arch", " "*5, "Repository" template(78) print("Installing:") - print " ", "".join(pkg_for_install), " "*(38-len(name)), sbo_ver, " "*( - 14-len(sbo_ver)), arch, " "*(9-len(arch)), "SBo" + print " ", "".join(pkg_for_install), " "*(38-len(name)), sbo_ver, " "*( + 14-len(sbo_ver)), SC + arch + EC, " "*(9-len(arch)), "SBo" print("Installing for dependencies:") for dep in dependencies[:-1]: sbo_ver = sbo_version_pkg(dep) if find_package(dep + sp, pkg_path): - print " ", colors.GREEN + dep + colors.ENDC, " "*(38-len(dep)), sbo_ver, " "*( - 14-len(sbo_ver)), arch, " "*(9-len(arch)), "SBo" + print " ", colors.GREEN + dep + colors.ENDC, " "*(38-len( + dep)), sbo_ver, " "*(14-len(sbo_ver)), SC + arch + EC, " "*(9-len(arch)), "SBo" pkg_sum += 1 else: - print " ", colors.RED + dep + colors.ENDC, " "*(38-len(dep)), sbo_ver, " "*( - 14-len(sbo_ver)), arch, " "*(9-len(arch)), "SBo" + print " ", colors.RED + dep + colors.ENDC, " "*(38-len( + dep)), sbo_ver, " "*(14-len(sbo_ver)), SC + arch + EC, " "*(9-len(arch)), "SBo" msg_pkg = "package" msg_2_pkg = msg_pkg if len(dependencies) > 1: @@ -118,6 +113,9 @@ def sbo_build(name): (len(dependencies) - pkg_sum), msg_2_pkg, pkg_sum)) read = raw_input("\nDo you want to continue [Y/n]? ") if read == "Y" or read == "y": + if not os.path.exists(build_path): + os.mkdir(build_path) + os.chdir(build_path) for pkg in dependencies: sbo_version = sbo_version_pkg(pkg) sbo_file = "".join(find_package(pkg + sp, pkg_path)) @@ -125,7 +123,7 @@ def sbo_build(name): if sbo_version > sbo_file_version: prgnam = ("{0}-{1}".format(pkg, sbo_version_pkg(pkg))) sbo_url = sbo_search_pkg(pkg) - sbo_link = sbo_slackbuild_dwn(sbo_url, pkg) + sbo_link = sbo_slackbuild_dwn(sbo_url) src_link = sbo_source_dwn(pkg).split() script = get_file(sbo_link, "/") print("\n{0}Start -->{1} {2}\n".format(colors.GREEN, colors.ENDC, pkg)) @@ -135,6 +133,14 @@ def sbo_build(name): subprocess.call("wget -N {0}".format(src), shell=True) sources.append(get_file(src, "/")) build_package(script, sources, build_path) + ''' + Before installing new binary package look if arch is noarch. + This is because some maintainers changes arch manualy. + ''' + if "-noarch-" in "".join(find_package(prgnam, tmp)): + sbo_arch = "-noarch-" + else: + from slpkg.__metadata__ import sbo_arch binary = ("{0}{1}{2}{3}{4}{5}".format( tmp, prgnam, sbo_arch, build, sbo_tag, sbo_filetype).split()) print("{0}[ Installing ] --> {1}{2}".format( @@ -159,6 +165,10 @@ def sbo_build(name): for dep in dependencies: f.write(dep + "\n") f.close() - except KeyboardInterrupt: - print # new line at exit - sys.exit() + else: + sys.stdout.write("Done\n") + message = "From slackbuilds.org" + pkg_not_found("\n", name, message, "\n") + except KeyboardInterrupt: + print # new line at exit + sys.exit() diff --git a/slpkg/sbo/views.py b/slpkg/sbo/views.py index fc33acee..c9f0a7fd 100755 --- a/slpkg/sbo/views.py +++ b/slpkg/sbo/views.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# views.py +# views.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. @@ -27,9 +27,9 @@ import subprocess from slpkg.colors import colors from slpkg.functions import get_file -from slpkg.__metadata__ import tmp, pkg_path, slpkg_tmp, sp from slpkg.messages import pkg_not_found, pkg_found, view_sbo, template -from slpkg.__metadata__ import sbo_arch, build, sbo_tag, sbo_filetype, build_path +from slpkg.__metadata__ import (tmp, build, sbo_tag, sbo_filetype, build_path, + pkg_path, slpkg_tmp, sp) from slpkg.pkg.build import build_package from slpkg.pkg.find import find_package @@ -48,20 +48,14 @@ def sbo_network(name): ''' rdm_path = slpkg_tmp + "readme/" sys.stdout.write("Reading package lists ...") + sys.stdout.flush() initialization() sbo_url = sbo_search_pkg(name) - if sbo_url is None: - sys.stdout.write ("Done\n") - message = "From slackbuilds.org" - bol, eol = "\n", "\n" - pkg_not_found(bol, name, message, eol) - else: - if not os.path.exists(build_path): - os.mkdir(build_path) - sys.stdout.write ("Done\n") + if sbo_url: sbo_req = sbo_requires_pkg(sbo_url, name) - sbo_dwn = sbo_slackbuild_dwn(sbo_url, name) + sbo_dwn = sbo_slackbuild_dwn(sbo_url) source_dwn = sbo_source_dwn(name).split() + sys.stdout.write ("Done\n") view_sbo(name, sbo_url, get_file(sbo_dwn, "/"), ", ".join([get_file(src, "/") for src in source_dwn]), sbo_req) while True: @@ -93,6 +87,8 @@ def sbo_network(name): subprocess.call("less {0}{1}{2}".format(rdm_path, name, site), shell=True) os.remove("{0}{1}{2}".format(rdm_path, name, site)) elif read == "B" or read == "b": + if not os.path.exists(build_path): + os.mkdir(build_path) sources = [] os.chdir(build_path) script = get_file(sbo_dwn, "/") @@ -105,11 +101,13 @@ def sbo_network(name): print("Complete!\n") break elif read == "I" or read == "i": + if not os.path.exists(build_path): + os.mkdir(build_path) sbo_version = sbo_version_pkg(name) if find_package(name + sp, pkg_path) == []: sources = [] os.chdir(build_path) - pkg_for_install = ("{0}-{1}".format(name, sbo_version)) + prgnam = ("{0}-{1}".format(name, sbo_version)) print("\n{0}Start -->{1} {2}\n".format(colors.GREEN, colors.ENDC, name)) subprocess.call("wget -N {0}".format(sbo_dwn), shell=True) script = get_file(sbo_dwn, "/") @@ -117,8 +115,17 @@ def sbo_network(name): subprocess.call("wget -N {0}".format(src), shell=True) sources.append(get_file(src, "/")) build_package(script, sources, build_path) + ''' + Before installing new binary package look if arch is noarch. + This is because some maintainers changes arch manualy. + + ''' + if "-noarch-" in "".join(find_package(prgnam, tmp)): + sbo_arch = "-noarch-" + else: + from __metadata__ import sbo_arch binary = ("{0}{1}{2}{3}{4}{5}".format( - tmp, pkg_for_install, sbo_arch, build, sbo_tag, sbo_filetype).split()) + tmp, prgnam, sbo_arch, build, sbo_tag, sbo_filetype).split()) print("{0}[ Installing ] --> {1}{2}".format( colors.GREEN, colors.ENDC, name)) pkg_upgrade(binary) @@ -134,3 +141,8 @@ def sbo_network(name): break else: break + else: + sys.stdout.write ("Done\n") + message = "From slackbuilds.org" + pkg_not_found("\n", name, message, "\n") + diff --git a/slpkg/slack/install.py b/slpkg/slack/install.py index c1b958cc..d80cc556 100755 --- a/slpkg/slack/install.py +++ b/slpkg/slack/install.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# install.py +# install.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. @@ -29,7 +29,7 @@ import subprocess from slpkg.colors import colors from slpkg.url_read import url_read from slpkg.messages import pkg_not_found, template -from slpkg.__metadata__ import slpkg_tmp, pkg_path, sp +from slpkg.__metadata__ import slpkg_tmp, pkg_path, slack_archs from slpkg.pkg.manager import pkg_upgrade, pkg_reinstall @@ -44,7 +44,7 @@ def install(slack_pkg): dwn_list, comp_size, uncomp_size = [], [], [] install_all, package_name, package_location = [], [], [] tmp_path = slpkg_tmp + "packages/" - pkg_sum = 0 + pkg_sum, arch, SC, EC = 0, "", "", "" if not os.path.exists(tmp_path): if not os.path.exists(slpkg_tmp): os.mkdir(slpkg_tmp) @@ -83,41 +83,25 @@ def install(slack_pkg): template(78) print("Installing:") for pkg, comp in zip(install_all, comp_sum): - if "-noarch-" in pkg: - arch = "noarch" - elif "-x86_64-" in pkg: - arch = "x86_64" - elif "-i386-" in pkg: - arch = "i386" - elif "-i486-" in pkg: - arch = "i486" - elif "-i686-" in pkg: - arch = "i686" - elif "-x86-" in pkg: - arch = "x86" - elif "-fw-" in pkg: - arch = "fw" - else: - arch = "" + for archs in slack_archs: + if archs in pkg: + pkgs = pkg.replace(archs, "") + arch = archs[1:-1] if os.path.isfile(pkg_path + pkg[:-4]): pkg_sum += 1 SC, EC = colors.GREEN, colors.ENDC else: SC, EC = colors.RED, colors.ENDC - print " ", SC + pkg[:-5].replace(sp+arch+sp, "") + EC, " "*( - 40-len(pkg[:-5].replace(sp+arch+sp, ""))), arch, " "*( - 7-len(arch)), pkg[-5:-4].replace(sp+arch+sp, ""), " "*( - 6-len(pkg[-5:-4].replace(sp+arch+sp, ""))), "Slack", " ", comp, " "*( + print " ", SC + pkgs[:-5] + EC, " "*(40-len(pkgs[:-5])), arch, " "*( + 7-len(arch)), pkgs[-5:-4], " "*(6-len(pkgs[-5:-4])), "Slack", " ", comp, " "*( 3-len(comp)), "K" comp_unit, uncomp_unit = "Mb", "Mb" compressed = round((sum(map(float, comp_sum)) * 0.0001220703125), 2) uncompressed = round((sum(map(float, uncomp_sum)) * 0.0001220703125), 2) if compressed < 1: - compressed = sum(map(int, comp_sum)) - comp_unit = "Kb" + compressed, comp_unit = sum(map(int, comp_sum)), "Kb" if uncompressed < 1: - uncompressed = sum(map(int, uncomp_sum)) - uncomp_unit = "Kb" + uncompressed, uncomp_unit = sum(map(int, uncomp_sum)), "Kb" msg_pkg = "package" msg_2_pkg = msg_pkg if len(install_all) > 1: @@ -128,7 +112,7 @@ def install(slack_pkg): print("="*79) print("Total {0} {1}.".format(len(install_all), msg_pkg)) print("{0} {1} will be installed, {2} allready installed.".format( - (len(install_all) - pkg_sum), msg_2_pkg, pkg_sum)) + (len(install_all) - pkg_sum), msg_2_pkg, pkg_sum)) print("Need to get {0} {1} of archives.".format(compressed, comp_unit)) print("After this process, {0} {1} of additional disk space will be used.".format( uncompressed, uncomp_unit)) @@ -161,9 +145,8 @@ def install(slack_pkg): print("\nThere are packages in directory {0}\n".format( tmp_path)) else: - bol, eol = "", "\n" message = "No matching" - pkg_not_found(bol, slack_pkg, message, eol) + pkg_not_found("", slack_pkg, message, "\n") except KeyboardInterrupt: print # new line at exit sys.exit() diff --git a/slpkg/slack/mirrors.py b/slpkg/slack/mirrors.py index ac942682..b0f0356e 100755 --- a/slpkg/slack/mirrors.py +++ b/slpkg/slack/mirrors.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# mirrors.py +# mirrors.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py index 765c5cca..feed1213 100755 --- a/slpkg/slack/patches.py +++ b/slpkg/slack/patches.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# patches.py +# patches.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. @@ -29,7 +29,8 @@ import subprocess from slpkg.colors import colors from slpkg.url_read import url_read from slpkg.messages import template -from slpkg.__metadata__ import pkg_path, slpkg_tmp, sp +from slpkg.__metadata__ import (pkg_path, slpkg_tmp, + slack_archs) from slpkg.pkg.manager import pkg_upgrade @@ -83,31 +84,17 @@ def patches(): template(78) print("Upgrading:") for upgrade, size in zip(upgrade_all, comp_sum): - if "-noarch-" in upgrade: - arch = "noarch" - elif "-x86_64-" in upgrade: - arch = "x86_64" - elif "-i386-" in upgrade: - arch = "i386" - elif "-i486-" in upgrade: - arch = "i486" - elif "-i686-" in upgrade: - arch = "i686" - elif "-x86-" in upgrade: - arch = "x86" - elif "-fw-" in upgrade: - arch = "fw" - else: - arch = "" + for archs in slack_archs: + if archs in upgrade: + upg = upgrade.replace(archs, "") + arch = archs[1:-1] if "_slack" in upgrade: slack = "_slack" + slack_ver() else: slack = "" - print " ", upgrade[:-(5+len(slack))].replace( - sp+arch+sp, ""), " "*(40-len(upgrade[:-( - 5+len(slack))].replace(sp+arch+sp, ""))), arch, " "*( - 7-len(arch)), upgrade[-15:-14].replace(sp+arch+sp, ""), " "*( - 6-len(upgrade[-15:-14].replace(sp+arch+sp, ""))), "Slack", " ", size, " "*( + print " ", upg[:-(5+len(slack))], " "*(40-len(upg[:-( + 5+len(slack))])), arch, " "*(7-len(arch)), upg[-15:-14], " "*( + 6-len(upgrade[-15:-14])), "Slack", " ", size, " "*( 3-len(size)), "K" comp_unit, uncomp_unit = "Mb", "Mb" compressed = round((sum(map(float, comp_sum)) * 0.0001220703125), 2) diff --git a/slpkg/slack/slack_version.py b/slpkg/slack/slack_version.py index d34ae76f..9f65c0b7 100755 --- a/slpkg/slack/slack_version.py +++ b/slpkg/slack/slack_version.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# slack_version.py +# slack_version.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. diff --git a/slpkg/url_read.py b/slpkg/url_read.py index 69aa0bce..1096e3d1 100755 --- a/slpkg/url_read.py +++ b/slpkg/url_read.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# url_read.py +# url_read.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. diff --git a/slpkg/version.py b/slpkg/version.py index f2e715cb..5ae3d034 100755 --- a/slpkg/version.py +++ b/slpkg/version.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# version.py +# version.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -10,7 +10,7 @@ # https://github.com/dslackw/slpkg -# This program is free software: you can redistribute it and/or modify +# 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. @@ -30,4 +30,3 @@ def prog_version(): print ("Version : {}".format(__version__)) print ("Licence : {}".format(__license__)) print ("Email : {}".format(__email__)) -