diff --git a/CHANGELOG b/CHANGELOG index 51539fcb..32d6800d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,16 @@ +Version 2.1.5 +27-12-2014 + +[Feature] - Added slacker.it, slackonly.com, Alien's ktown, Alien's multilib, + Slacke E17 and E18, SalixOS and Slackel repositories. + - Added command 're-create'. + - Added command 'repolist'. + - Added command 'repoinfo'. + +[Updated] - Fix Slackware current upgrade checksums. + - Fix ingore hiden files in /var/log/packages/ path. + - Fix arguments. + Version 2.1.4 16-12-2014 diff --git a/PKG-INFO b/PKG-INFO index 63d794b4..b642005f 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: slpkg -Version: 2.1.4 +Version: 2.1.5 Author: dslackw Author-email: d zlatanidis at gmail com Maintainer: dslackw diff --git a/README.rst b/README.rst index 8833d950..a2237bf2 100644 --- a/README.rst +++ b/README.rst @@ -11,9 +11,9 @@ Latest Release: -- Version: 2.1.4 +- Version: 2.1.5 - `Package `_ -- `Source `_ +- `Source `_ - `CHANGELOG `_ .. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png @@ -37,7 +37,7 @@ Supported Repositories: - Slack - `Repository `_ Arch: {x86, x86_64} Versions: {3.3, 8.1, 9.0, 9.1, 10.0, 10.1, 10.2, 11.0, 12.0, 12.2, 13.0, 13.37, 14.0, 14.1, current} -- Alien - `Repository `_ +- Alien's - `Repository `_ Arch: {x86, x86_64} Versions: {11.0, 12.0, 12.1, 12.2, 13.0, 13.1, 13.37, 14.0, 14.1, current} - Slacky - `Repository `_ @@ -49,14 +49,38 @@ Supported Repositories: - Studioware - `Repository `_ Arch: {x86, x86_64} Versions: {13.37, 14.0, 14.1} +- Slackers - `Repository `_ + Arch: {x86_64} + Versions: {current} +- Slackonly - `Repository `_ + Arch: {x86, x86_64} + Versions: {14.1} +- Alien's ktown - `Repository `_ + Arch: {x86, x86_64} + Versions: {13.37, 14.0, 14.1, current} +- Alien's multi - `Repository `_ + Arch: {x86_64} + Versions: {13.0, 13.1, 13.37, 14.0, 14.1, current} +- Slacke E17 and E18 - `Repository `_ + Arch: {x86, x86_64, arm} + Versions: {14.1} +- SalixOS - `Repository `_ + Arch: {x86, x86_64} + Versions: {13.0, 13.1, 13.37, 14.0, 14.1} +- Slackel - `Repository `_ + Arch: {x86, x86_64} + Versions: {current} + * Choose repositories you need to work from file '/etc/slpkg/slpkg.conf' default is - all repositories. + 'slack' and 'sbo' repositories and read REPOSITORIES file for each of the particularities. Slpkg works in accordance with the standards of the organization slackbuilds.org to builds packages. Also uses the Slackware linux instructions for installation, upgrading or removing packages. +Slpkg must work with any Slackware based distribution such Salix and Slackel or Slax etc. + What makes slpkg to distinguish it from other tools; The user friendliness is its primary target as well as easy to understand and use, also use color to highlight packages and display warning messages, etc. @@ -65,10 +89,9 @@ The big advantages is resolving dependencies packages from repositories and moni upgraded packages. Also you can install official packages of your favorite distribution directly from the -official repositories -of Slackware. Even you can check for the official updates and install them. +official repositories of Slackware. Even you can check for the official updates and install them. -And as we say Slackers, Keep it Simple Stupid! +More features come ... .. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/slpkg_package.png :target: https://github.com/dslackw/slpkg @@ -112,8 +135,8 @@ Untar the archive and run install.sh script: .. code-block:: bash - $ tar xvf slpkg-2.1.4.tar.gz - $ cd slpkg-2.1.4 + $ tar xvf slpkg-2.1.5.tar.gz + $ cd slpkg-2.1.5 $ ./install.sh From SourceForge: @@ -203,6 +226,9 @@ Command Line Tool Usage Commands: update update all package lists + re-create recreate package lists + repolist list all repositories + repoinfo [repository] repository information update slpkg check and update slpkg Optional arguments: @@ -213,7 +239,7 @@ Command Line Tool Usage -q, --list, [package...] --add, --remove add, remove SBo packages in queue --build, --install, --build-install build, install packages from queue -g, --config, --config=[editor] configuration file management - -l, [repository], all, noarch list of installed packages + -l, [repository], all list of installed packages -c, [repository] --upgrade check for updated packages -s, [repository] [package] download, build & install -t, [repository] [package] tracking dependencies @@ -230,7 +256,64 @@ Command Line Tool Usage Slpkg Examples -------------- -Find packages from slackbuilds.org download, +If you use slpkg for the first time will have to create +and update the package lists: + +.. code-block:: bash + + $ slpkg update + + Update repository slack .......................Done + Update repository sbo .............Done + Update repository alien ...Done + Update repository slacky .....................................Done + Update repository studio ...................Done + Update repository slackr .............................................Done + Update repository slonly ...Done + Update repository ktown ...Done + Update repository salix ..................Done + Update repository slacke ...Done + Update repository slackl ...Done + Update repository multi ...Done + + +Take information repositories with commands: + +.. code-block:: bash + + $ slpkg repolist + + +============================================================================== + | Repo id Repo name Status + +============================================================================== + alien http://www.slackware.com/~alien/slackbuilds/ enabled + ktown http://alien.slackbook.org/ktown/ enabled + multi http://www.slackware.com/~alien/multilib/ enabled + rlw http://rlworkman.net/pkgs/ enabled + salix http://download.salixos.org/ enabled + sbo http://slackbuilds.org/slackbuilds/ enabled + slack http://mirrors.slackware.com/slackware/ enabled + slacke http://ngc891.blogdns.net/pub/ enabled + slackl http://www.slackel.gr/repo/ enabled + slackr http://www.slackers.it/repository/ disabled + slacky http://repository.slacky.eu/ enabled + slonly https://slackonly.com/pub/packages/ enabled + studio http://studioware.org/files/packages/ enabled + + For enable or disable repositories edit '/etc/slpkg/slpkg.conf' file + + $ slpkg repoinfo alien + + Last updated: Tue Dec 23 11:48:31 UTC 2014 + Number of packages: 3149 + Repo id: alien + Repo url: http://www.slackware.com/~alien/slackbuilds/ + Status: enabled + Total compressed packages: 9.3 Gb + Total uncompressed packages: 36.31 Gb + + +Find packages from repository download, build and install with all dependencies : .. code-block:: bash @@ -373,9 +456,9 @@ Check if your Slackware distribution is up to date: | Package Version 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 + dhcpcd-6.0.5 6.0.5 x86_64 3 Slack 92 K + samba-4.1.0 4.1.11 x86_64 1 Slack 9928 K + xscreensaver-5.22 5.29 x86_64 1 Slack 3896 K Installing summary =============================================================================== @@ -746,3 +829,9 @@ Man page it is available for full support: .. code-block:: bash $ man slpkg + + +Donate +-------- +If you feel satisfied with this project and want to thank me go +to `Slackware `_ and make a donation or visit the `store `_. diff --git a/REPOSITORIES b/REPOSITORIES new file mode 100644 index 00000000..a3ff89f1 --- /dev/null +++ b/REPOSITORIES @@ -0,0 +1,32 @@ +-------------------------------------------------------------------------------------- +This file was created to explain some peculiarities of repositories used by the slpkg. +-------------------------------------------------------------------------------------- + +SlackBuilds.org (sbo) FAQ(15): +Slackware current is not supported, but as a general rule, the scripts +should work on it as well. + +Rworkman's (rlw) repository use dependencies where displayed in central site +'http://rlworkman.net/pkgs/' and only those. Unfortunately there is no fixed reference +dependencies file PACKAGES.TXT. + +Slackers.it (slackr) repository must be used only from Slackware64 current users. +Also find in some packages will not show package description when you run the command +'slpkg -p slackr ' and this is because there is not constant reference to the +description of the file 'PACKAGES.TXT' as in other repositories. Some packages reference +dependencies not included in the repository. This can be checked if you run the command +'slpkg -t slackr '. (Example: noticed that the package 'digikam' indicate +dependence 'ffmpeg' but that is not available from the repository itself). + +Slackonly (slonly) repository contains no dependencies on file PACKAGES.TXT and this makes +it difficult to automatically resolve dependencies and in the file PACKAGES.TXT and some +lines with 'PACKAGE NAME:' there is no package so 'slpkg' can not find package. +Users with Slackware x86_64 will use this repository should establish from the beginning +the list of packages with the command 'slpkg re-create' to be updated with new packages +and it's because the repository has not 'ChangeLog.txt' file. + +Studioware (studio), Alien's ktown (ktown), Alien's multilib (multi), Slacke E17 and E18 +repository has no reference dependencies. + +Slackel.gr (slackl) repository must be used only from Slackware current users and has the +same peculiarities in the repository 'slackr'. diff --git a/TESTING b/TESTING index 378a6f85..86e1bd55 100644 --- a/TESTING +++ b/TESTING @@ -13,3 +13,20 @@ Release : 14.1 Version : stable Arch : x86, x86_64 +-------------------------------- +19-12-2014 +Slackware Arch: x86_64, Version: 14.1 'stable' + +Test to upgrade Slackware Linux Distribution. +Successful upgrade fresh full installation with command 'slpkg -c slack --upgrade' +Total 54 packages upgraded and kernel, after auto-install 'lilo' reinstall successfully so. + + +-------------------------------- +20-12-2014 +Slackware Arch: x86 Version 14.1 'current' + +Test to upgrade Slackware Linux Distribution. +Successful upgrade fresh full installation with command 'slpkg -c slack --upgrade' +Total 66 packages upgraded and kernel, after auto-install 'lilo' reinstall successfully so. + diff --git a/THANKS b/THANKS index 7c013738..ecadf07e 100644 --- a/THANKS +++ b/THANKS @@ -9,6 +9,10 @@ Willy Sudiarto Raharjo - https://github.com/willysr For the interesting and valuable advice around the systems of Slackware and SBo packages. +Kostas Nikiforakis - Tester + + For the tests in his system. + LinuxQuestions.org - http://www.linuxquestions.org In all members of the community of Slackware forum linuxquestions.org. diff --git a/bin/slpkg b/bin/slpkg index 5b068213..8f4dc70f 100755 --- a/bin/slpkg +++ b/bin/slpkg @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/conf/slackware-mirrors b/conf/slackware-mirrors index f54c9103..77ac732d 100644 --- a/conf/slackware-mirrors +++ b/conf/slackware-mirrors @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. # -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations. # # https://github.com/dslackw/slpkg # @@ -29,9 +29,9 @@ # please uncomment (remove the '#' character) only one mirror from # the list available below. You can also add a new mirror in the list # below. Be careful is the template that the rest. -# -# -# Last Updated: Mon Dec 15 02:47:02 UTC 2014 +# +# +# Last Updated: Sat Dec 27 09:47:02 UTC 2014 # # Available http mirrors: # @@ -106,6 +106,7 @@ # us http://mirrors2.kernel.org/slackware/ # us http://mirrors3.kernel.org/slackware/ # us http://mirrors4.kernel.org/slackware/ +# us http://reflect.cs.princeton.edu/slackware/ # us http://slackblog.com/slackware/ # us http://slackbuilds.org/mirror/slackware/ # us http://slackware.cs.utah.edu/ @@ -182,4 +183,4 @@ # us ftp://taper.alienbase.nl/ # za ftp://ftp.is.co.za/mirror/ftp.slackware.com/pub/ # za ftp://ftp.wa.co.za/pub/slackware/ -# za ftp://slackware.mirror.ac.za/ +# za ftp://slackware.mirror.ac.za/ diff --git a/conf/slpkg.conf b/conf/slpkg.conf index 55de32d8..0e28a3be 100644 --- a/conf/slpkg.conf +++ b/conf/slpkg.conf @@ -5,7 +5,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations. # https://github.com/dslackw/slpkg @@ -23,9 +23,13 @@ # Slackware version 'stable' or 'current'. VERSION=stable -# Choose repositories want to work. -# Available repositories : slack, sbo, alien, rlw, slacky, studio -REPOSITORIES=slack,sbo,alien,rlw,slacky,studio +# Choose repositories want to work. Read first REPOSITORIES file. +# Available repositories : slack,sbo,alien,rlw,slacky,studio,slackr,slonly, +# ktown{latest},multi,slacke{18},salix,slackl +# slackr (slackers.it) repository must used from Slackware64 current. +# Ktown (Alien's ktown) repository. Default ktown{latest}. +# Slacke (Enlightenment E17 and E18) repository. Default slacke{18}. +REPOSITORIES=slack,sbo # Build directory for repository slackbuilds.org. In this directory # downloaded sources and scripts for building. @@ -63,7 +67,9 @@ REMOVE_DEPS_ANSWER=n SKIP_UNST=n # Delete package dependencies if DEL_DEPS is on. -DEL_DEPS=on +# You must be careful if you enable this option because it can remove +# packages related to distribution. +DEL_DEPS=off # Use colors for highlighting. Choose 'on' or 'off'. USE_COLORS=on diff --git a/install.sh b/install.sh index e6ab2545..b0599e2d 100755 --- a/install.sh +++ b/install.sh @@ -21,7 +21,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=slpkg -VERSION=${VERSION:-2.1.4} +VERSION=${VERSION:-2.1.5} TAG=${TAG:-_dsw} # Installation script. diff --git a/man/slpkg.8 b/man/slpkg.8 index 8da9fa97..74009cb7 100644 --- a/man/slpkg.8 +++ b/man/slpkg.8 @@ -13,14 +13,14 @@ .\" .TH Slpkg "8" "5 2014" "slpkg" .SH NAME -slpkg - Utility for easy management packages in Slackware +Slpkg is a user-friendly package manager for Slackware installations .SH SYNOPSIS Usage: slpkg [-h] [-v] [-a script.tar.gz [sources...]] [-b --list, --add, --remove [...]] [-q --list, [...] --add, --remove] [ --build, --install, --build-install] [-g --config, --config=[editor]] - [-l [repository], all, noarch] + [-l [repository], all] [-c [repository] --upgrade] [-s [repository] [package][ [-t [repository] [package]] @@ -33,10 +33,13 @@ Usage: slpkg [-h] [-v] [-a script.tar.gz [sources...]] .PP It's a quick and easy way to manage your packages in slackware to a command. .SH EXAMPLES -Utility for easy management packages in Slackware +Slpkg is a user-friendly package manager for Slackware installations Commands: update update all package lists + re-create recreate package lists + repolist list all repositories + repoinfo [repository] repository information update slpkg check and update slpkg Optional arguments: @@ -47,7 +50,7 @@ Optional arguments: -q, --list, [package...] --add, --remove add, remove SBo packages in queue --build, --install, --build-install build, install packages from queue -g, --config, --config= configuration file management - -l, [repository], all, noarch list of installed packages + -l, [repository], all list of installed packages -c, [repository] --upgrade check for updated packages -s, [repository] [package] download, build & install -t, [repository] [package] tracking dependencies @@ -61,7 +64,23 @@ Optional arguments: -d, [package...] display the contents .SH REPOSITORIES - slack, sbo, alien, slacky, rlw, studio + slackware.com = 'slack' + SlackBuilds.org = 'sbo' + Alien's = 'alien' + slacky.eu = 'slacky' + rworkman's = 'rlw' + studioware.org = 'studio' + slacker.it = 'slackr' + slackonly.com = 'slonly' + Alien's ktown = 'ktown{latest}' + Alien's multilib = 'multi' + Slacke E17 and E18 = 'slacke{18}' + SalixOS = 'salix' + Slackel.gr = 'slackel' + + Default enable repository is 'slack' and 'sbo'. + Add or remove repository in configuration file '/etc/slpkg/slpkg.conf' + .SH COLORS red, green, yellow, cyan, grey .PP @@ -79,6 +98,22 @@ The following commands are available. Used to re-synchronize the package lists and create some important files. This command must run every new repository is added or new updates is available. +.SS re-create +\fBslpkg\fP \fBre-create\fP +.PP +It is sometimes useful to create all of the base file from the beginning so this +command deletes all the packages lists and re-created. + +.SS repolist +\fBslpkg\fP \fBrepolist\fP +.PP +Lists all enabled or disabled repositories. + +.SS repoinfo +\fBslpkg\fP \fBrepoinfo\fP <\fBrepository\fP> +.PP +View repository information. + .SS update slpkg \fBslpkg\fP \fBupdate\fP \fBslpkg\fP .PP diff --git a/requirements.txt b/requirements.txt index 86124fa4..011a32a7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,3 @@ # Slackware 32 x86 # Slackware 64 x86_64 # Slackware current -# -# NOTE from SlackBuilds.org FAQ(15): -# Slackware current is not supported, but as a general rule, the scripts -# should work on it as well. diff --git a/setup.py b/setup.py index f0ef3952..4a6fe267 100755 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slackbuild/doinst.sh b/slackbuild/doinst.sh index c06beaa6..f64c9d0d 100644 --- a/slackbuild/doinst.sh +++ b/slackbuild/doinst.sh @@ -10,7 +10,7 @@ config() { CONFIGS="slpkg.conf blacklist slackware-mirrors" for file in $CONFIGS; do - config /etc/slpkg/${file}.new + config etc/slpkg/${file}.new done if [ -x /usr/bin/update-desktop-database ]; then diff --git a/slackbuild/slpkg.SlackBuild b/slackbuild/slpkg.SlackBuild index 8a4d903c..4cf562fd 100755 --- a/slackbuild/slpkg.SlackBuild +++ b/slackbuild/slpkg.SlackBuild @@ -23,7 +23,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=slpkg -VERSION=${VERSION:-2.1.4} +VERSION=${VERSION:-2.1.5} BUILD=${BUILD:-1} TAG=${TAG:-_dsw} @@ -90,7 +90,8 @@ 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 TESTING ISSUES $PKG/usr/doc/$PRGNAM-$VERSION +cp -a README.rst CHANGELOG LICENSE TESTING ISSUES REPOSITORIES \ + $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index 227d7661..e971a2e4 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -6,11 +6,11 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # 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. @@ -23,10 +23,9 @@ import os - __all__ = "slpkg" __author__ = "dslackw" -__version_info__ = (2, 1, 4) +__version_info__ = (2, 1, 5) __version__ = "{0}.{1}.{2}".format(*__version_info__) __license__ = "GNU General Public License v3 (GPLv3)" __email__ = "d.zlatanidis@gmail.com" @@ -42,8 +41,40 @@ repositories = [ 'rlw', 'alien', 'slacky', - 'studio' + 'studio', + 'slackr', + 'slonly', + 'ktown{latest}', + 'multi', + 'slacke{18}', + 'salix', + 'slackl' ] + + +def ktown_repo(repositories): + ''' + Find if ktown repositories enabled then + take SUB_REPOSITORY + ''' + for i, repo in enumerate(repositories): + if 'ktown' in repo: + sub = repositories[i].replace('ktown', '') + repositories[i] = 'ktown' + return sub + + +def slacke_repo(repositories): + ''' + Find if slacke repositories enabled then + take SUB_REPOSITORY + ''' + for i, repo in enumerate(repositories): + if 'slacke' in repo: + sub = repositories[i].replace('slacke', '') + repositories[i] = 'slacke' + return sub + build_path = "/tmp/slpkg/build/" slpkg_tmp_packages = tmp + "slpkg/packages/" slpkg_tmp_patches = tmp + "slpkg/patches/" @@ -94,16 +125,19 @@ if os.path.isfile("/etc/slpkg/slpkg.conf"): if line.startswith("USE_COLORS"): use_colors = line[11:].strip() -if use_colors == "on": - color = { - 'RED': '\x1b[31m', - 'GREEN': '\x1b[32m', - 'YELLOW': '\x1b[33m', - 'CYAN': '\x1b[36m', - 'GREY': '\x1b[38;5;247m', - 'ENDC': '\x1b[0m' - } -else: +ktown_kde_repo = ktown_repo(repositories) +slacke_sub_repo = slacke_repo(repositories) + +color = { + 'RED': '\x1b[31m', + 'GREEN': '\x1b[32m', + 'YELLOW': '\x1b[33m', + 'CYAN': '\x1b[36m', + 'GREY': '\x1b[38;5;247m', + 'ENDC': '\x1b[0m' +} + +if use_colors == "off": color = { 'RED': '', 'GREEN': '', diff --git a/slpkg/arguments.py b/slpkg/arguments.py index 6dd17fc2..1047b87a 100644 --- a/slpkg/arguments.py +++ b/slpkg/arguments.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -21,19 +21,26 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import sys +from repolist import RepoList from __metadata__ import ( __version__, + repositories ) def options(): arguments = [ "\nslpkg - version {0}\n".format(__version__), - "Utility for easy management packages in Slackware\n", + "Slpkg is a user-friendly package manager for Slackware " + + "installations\n", "Commands:", " update update all package " + "lists", + " re-create recreate package lists", + " repolist list all repositories", + " repoinfo [repository] repository information", " update slpkg check and update slpkg\n", "Optional arguments:", " -h, --help show this help message " + @@ -48,7 +55,7 @@ def options(): "from queue", " -g, --config, --config=[editor] configuration file " + "management", - " -l, [repository], all, noarch list of installed " + + " -l, [repository], all list of installed " + "packages", " -c, [repository] --upgrade check for updated " + "packages", @@ -66,9 +73,20 @@ def options(): ] for opt in arguments: print(opt) + sys.exit(0) -def usage(): +def usage(repo): + error_repo = "" + if repo and repo not in repositories: + all_repos = RepoList().all_repos + del RepoList().all_repos + if repo in all_repos: + error_repo = ("slpkg: error: repository '{0}' is not activated" + "\n".format(repo)) + else: + error_repo = ("slpkg: error: repository '{0}' does not exist" + "\n".format(repo)) view = [ "slpkg - version {0}\n".format(__version__), "Usage: slpkg [-h] [-v] [-a script.tar.gz [sources...]]", @@ -76,14 +94,16 @@ def usage(): " [-q --list, [...] --add, --remove]", " [ --build, --install, --build-install]", " [-g --config, --config=[editor]]", - " [-l [repository], all, noarch]", + " [-l [repository], all]", " [-c [repository] --upgrade]", " [-s [repository] [package]", " [-t [repository] [package]", " [-p [repository] [package], --color=[]]", " [-f] [-n] [-i [...]] [-u [...]]", " [-o [...]] [-r [...]] [-d [...]]\n", + error_repo, "For more information try 'slpkg --help' or view manpage\n" ] for usg in view: print(usg) + sys.exit(0) diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py index 36d54b16..734b56f1 100644 --- a/slpkg/blacklist.py +++ b/slpkg/blacklist.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/checksum.py b/slpkg/checksum.py index da9b3595..e6245e2d 100644 --- a/slpkg/checksum.py +++ b/slpkg/checksum.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/config.py b/slpkg/config.py index 4b6cef38..d2f052ca 100644 --- a/slpkg/config.py +++ b/slpkg/config.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/desc.py b/slpkg/desc.py index 9d12075d..88da00c7 100644 --- a/slpkg/desc.py +++ b/slpkg/desc.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -26,7 +26,7 @@ from messages import pkg_not_found from __metadata__ import ( lib_path, repositories, - color + color, ) @@ -48,15 +48,7 @@ class PkgDesc(object): } self.COLOR = color_text[self.paint] if self.repo in repositories: - repos = { - 'sbo': 'sbo_repo/SLACKBUILDS.TXT', - 'slack': 'slack_repo/PACKAGES.TXT', - 'rlw': 'rlw_repo/PACKAGES.TXT', - 'alien': 'alien_repo/PACKAGES.TXT', - 'slacky': 'slacky_repo/PACKAGES.TXT', - 'studio': 'studio_repo/PACKAGES.TXT' - } - self.lib = lib_path + repos[self.repo] + self.lib = lib_path + '{0}_repo/PACKAGES.TXT'.format(self.repo) def view(self): f = open(self.lib, "r") diff --git a/slpkg/downloader.py b/slpkg/downloader.py index c7fe5d83..b91c1819 100644 --- a/slpkg/downloader.py +++ b/slpkg/downloader.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/file_size.py b/slpkg/file_size.py index db686a55..19e5ae07 100644 --- a/slpkg/file_size.py +++ b/slpkg/file_size.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/grep_md5.py b/slpkg/grep_md5.py index cdfe8a47..329e1292 100644 --- a/slpkg/grep_md5.py +++ b/slpkg/grep_md5.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -24,7 +24,10 @@ from slack.mirrors import mirrors from url_read import URL -from __metadata__ import lib_path +from __metadata__ import ( + lib_path, + slack_rel +) def pkg_checksum(binary, repo): @@ -32,18 +35,13 @@ def pkg_checksum(binary, repo): Return checksum from CHECKSUMS.md5 file by repository ''' md5 = "None" - if repo == "slack_patches": + if repo == "slack_patches" and slack_rel == "stable": CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "patches/")).reading() + elif repo == "slack_patches" and slack_rel == "current": + CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "")).reading() else: - repos = { - 'slack': 'slack_repo/CHECKSUMS.md5', - 'rlw': 'rlw_repo/CHECKSUMS.md5', - 'alien': 'alien_repo/CHECKSUMS.md5', - 'slacky': 'slacky_repo/CHECKSUMS.md5', - 'studio': 'studio_repo/CHECKSUMS.md5' - } - lib = repos[repo] - f = open(lib_path + lib, "r") + lib = '{0}{1}_repo/CHECKSUMS.md5'.format(lib_path, repo) + f = open(lib, "r") CHECKSUMS_md5 = f.read() f.close() for line in CHECKSUMS_md5.splitlines(): diff --git a/slpkg/init.py b/slpkg/init.py index a60a5144..5f88ec7b 100644 --- a/slpkg/init.py +++ b/slpkg/init.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -35,7 +35,8 @@ from __metadata__ import ( build_path, repositories, slpkg_tmp_packages, - slpkg_tmp_patches + slpkg_tmp_patches, + slacke_sub_repo ) from slack.mirrors import mirrors @@ -67,6 +68,7 @@ class Initialization(object): log = log_path + "slack/" lib = lib_path + "slack_repo/" lib_file = "PACKAGES.TXT" + lst_file = "" md5_file = "CHECKSUMS.md5" log_file = "ChangeLog.txt" if not os.path.exists(log): @@ -74,6 +76,7 @@ class Initialization(object): if not os.path.exists(lib): os.mkdir(lib) packages = mirrors(lib_file, "") + filelist_txt = "" pkg_checksums = mirrors(md5_file, "") extra = mirrors(lib_file, "extra/") ext_checksums = mirrors(md5_file, "extra/") @@ -88,7 +91,7 @@ class Initialization(object): self.write(lib, md5_file, checksums_md5) self.write(log, log_file, changelog_txt) self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt, - md5_file, checksums_md5) + md5_file, checksums_md5, lst_file, filelist_txt) def sbo(self): ''' @@ -98,6 +101,7 @@ class Initialization(object): log = log_path + "sbo/" lib = lib_path + "sbo_repo/" lib_file = "SLACKBUILDS.TXT" + lst_file = "" md5_file = "" log_file = "ChangeLog.txt" if not os.path.exists(log): @@ -105,12 +109,13 @@ class Initialization(object): if not os.path.exists(lib): os.mkdir(lib) packages_txt = "{0}{1}/{2}".format(repo, slack_ver(), lib_file) + filelist_txt = "" checksums_md5 = "" changelog_txt = "{0}/{1}/{2}".format(repo, slack_ver(), log_file) self.write(lib, lib_file, packages_txt) self.write(log, log_file, changelog_txt) self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt, - md5_file, checksums_md5) + md5_file, checksums_md5, lst_file, filelist_txt) def rlw(self): ''' @@ -120,6 +125,7 @@ class Initialization(object): log = log_path + "rlw/" lib = lib_path + "rlw_repo/" lib_file = "PACKAGES.TXT" + lst_file = "" md5_file = "CHECKSUMS.md5" log_file = "ChangeLog.txt" if not os.path.exists(log): @@ -127,13 +133,14 @@ class Initialization(object): if not os.path.exists(lib): os.mkdir(lib) packages_txt = "{0}{1}/{2}".format(repo, slack_ver(), lib_file) + filelist_txt = "" checksums_md5 = "{0}{1}/{2}".format(repo, slack_ver(), md5_file) changelog_txt = "{0}{1}/{2}".format(repo, slack_ver(), log_file) self.write(lib, lib_file, packages_txt) self.write(lib, md5_file, checksums_md5) self.write(log, log_file, changelog_txt) self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt, - md5_file, checksums_md5) + md5_file, checksums_md5, lst_file, filelist_txt) def alien(self): ''' @@ -143,6 +150,7 @@ class Initialization(object): log = log_path + "alien/" lib = lib_path + "alien_repo/" lib_file = "PACKAGES.TXT" + lst_file = "" md5_file = "CHECKSUMS.md5" log_file = "ChangeLog.txt" if not os.path.exists(log): @@ -150,13 +158,14 @@ class Initialization(object): if not os.path.exists(lib): os.mkdir(lib) packages_txt = "{0}{1}".format(repo, lib_file) + filelist_txt = "" checksums_md5 = "{0}{1}".format(repo, md5_file) changelog_txt = "{0}{1}".format(repo, log_file) self.write(lib, lib_file, packages_txt) self.write(lib, md5_file, checksums_md5) self.write(log, log_file, changelog_txt) self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt, - md5_file, checksums_md5) + md5_file, checksums_md5, lst_file, filelist_txt) def slacky(self): ''' @@ -168,6 +177,7 @@ class Initialization(object): log = log_path + "slacky/" lib = lib_path + "slacky_repo/" lib_file = "PACKAGES.TXT" + lst_file = "" md5_file = "CHECKSUMS.md5" log_file = "ChangeLog.txt" if not os.path.exists(log): @@ -178,6 +188,7 @@ class Initialization(object): ar = "64" packages_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(), lib_file) + filelist_txt = "" checksums_md5 = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(), md5_file) @@ -187,9 +198,9 @@ class Initialization(object): self.write(lib, md5_file, checksums_md5) self.write(log, log_file, changelog_txt) self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt, - md5_file, checksums_md5) + md5_file, checksums_md5, lst_file, filelist_txt) - def studioware(self): + def studio(self): ''' Creating alien local library ''' @@ -199,6 +210,7 @@ class Initialization(object): log = log_path + "studio/" lib = lib_path + "studio_repo/" lib_file = "PACKAGES.TXT" + lst_file = "" md5_file = "CHECKSUMS.md5" log_file = "ChangeLog.txt" if not os.path.exists(log): @@ -209,6 +221,7 @@ class Initialization(object): ar = "64" packages_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(), lib_file) + filelist_txt = "" checksums_md5 = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(), md5_file) changelog_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(), @@ -217,7 +230,206 @@ class Initialization(object): self.write(lib, md5_file, checksums_md5) self.write(log, log_file, changelog_txt) self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt, - md5_file, checksums_md5) + md5_file, checksums_md5, lst_file, filelist_txt) + + def slackr(self): + ''' + Creating slackers local library + ''' + repo = Repo().slackers() + log = log_path + "slackr/" + lib = lib_path + "slackr_repo/" + lib_file = "PACKAGES.TXT" + lst_file = "FILELIST.TXT" + md5_file = "CHECKSUMS.md5" + log_file = "ChangeLog.txt" + if not os.path.exists(log): + os.mkdir(log) + if not os.path.exists(lib): + os.mkdir(lib) + packages_txt = "{0}{1}".format(repo, lib_file) + filelist_txt = "{0}{1}".format(repo, lst_file) + checksums_md5 = "{0}{1}".format(repo, md5_file) + changelog_txt = "{0}{1}".format(repo, log_file) + self.write(lib, lib_file, packages_txt) + self.write(lib, lst_file, filelist_txt) + self.write(lib, md5_file, checksums_md5) + self.write(log, log_file, changelog_txt) + self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt, + md5_file, checksums_md5, lst_file, filelist_txt) + + def slonly(self): + ''' + Creating slackers local library + ''' + ar = "{0}-x86".format(slack_ver()) + arch = os.uname()[4] + repo = Repo().slackonly() + log = log_path + "slonly/" + lib = lib_path + "slonly_repo/" + lib_file = "PACKAGES.TXT" + lst_file = "FILELIST.TXT" + md5_file = "CHECKSUMS.md5" + log_file = "ChangeLog.txt" + if not os.path.exists(log): + os.mkdir(log) + if not os.path.exists(lib): + os.mkdir(lib) + if arch == "x86_64": + ar = "{0}-x86_64".format(slack_ver()) + packages_txt = "{0}{1}/{2}".format(repo, ar, lib_file) + filelist_txt = "{0}{1}/{2}".format(repo, ar, lst_file) + checksums_md5 = "{0}{1}/{2}".format(repo, ar, md5_file) + # ChangeLog.txt file available only for x86 arch + changelog_txt = "{0}{1}-x86/{2}".format(repo, slack_ver(), log_file) + self.write(lib, lib_file, packages_txt) + self.write(lib, lst_file, filelist_txt) + self.write(lib, md5_file, checksums_md5) + self.write(log, log_file, changelog_txt) + self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt, + md5_file, checksums_md5, lst_file, filelist_txt) + + def ktown(self): + ''' + Creating alien ktown local library + ''' + repo = Repo().ktown() + log = log_path + "ktown/" + lib = lib_path + "ktown_repo/" + lib_file = "PACKAGES.TXT" + lst_file = "" + md5_file = "CHECKSUMS.md5" + log_file = "ChangeLog.txt" + if not os.path.exists(log): + os.mkdir(log) + if not os.path.exists(lib): + os.mkdir(lib) + packages_txt = "{0}{1}".format(repo, lib_file) + filelist_txt = "" + checksums_md5 = "{0}{1}".format(repo, md5_file) + changelog_txt = "{0}{1}".format(repo, log_file) + self.write(lib, lib_file, packages_txt) + self.write(lib, md5_file, checksums_md5) + self.write(log, log_file, changelog_txt) + self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt, + md5_file, checksums_md5, lst_file, filelist_txt) + + def multi(self): + ''' + Creating alien multilib local library + ''' + repo = Repo().multi() + log = log_path + "multi/" + lib = lib_path + "multi_repo/" + lib_file = "PACKAGES.TXT" + lst_file = "" + md5_file = "CHECKSUMS.md5" + log_file = "ChangeLog.txt" + if not os.path.exists(log): + os.mkdir(log) + if not os.path.exists(lib): + os.mkdir(lib) + packages_txt = "{0}{1}".format(repo, lib_file) + filelist_txt = "" + checksums_md5 = "{0}{1}".format(repo, md5_file) + changelog_txt = "{0}{1}".format(repo, log_file) + self.write(lib, lib_file, packages_txt) + self.write(lib, md5_file, checksums_md5) + self.write(log, log_file, changelog_txt) + self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt, + md5_file, checksums_md5, lst_file, filelist_txt) + + def slacke(self): + ''' + Creating Slacke local library + ''' + ar = "" + arch = os.uname()[4] + repo = Repo().slacke() + log = log_path + "slacke/" + lib = lib_path + "slacke_repo/" + lib_file = "PACKAGES.TXT" + lst_file = "" + md5_file = "CHECKSUMS.md5" + log_file = "ChangeLog.txt" + if not os.path.exists(log): + os.mkdir(log) + if not os.path.exists(lib): + os.mkdir(lib) + if arch == "x86_64": + ar = "64" + elif arch == "arm": + ar = "arm" + packages_txt = "{0}slacke{1}/slackware{2}-{3}/{4}".format( + repo, slacke_sub_repo[1:-1], ar, slack_ver(), lib_file) + filelist_txt = "" + checksums_md5 = "{0}slacke{1}/slackware{2}-{3}/{4}".format( + repo, slacke_sub_repo[1:-1], ar, slack_ver(), md5_file) + changelog_txt = "{0}slacke{1}/slackware{2}-{3}/{4}".format( + repo, slacke_sub_repo[1:-1], ar, slack_ver(), log_file) + self.write(lib, lib_file, packages_txt) + self.write(lib, md5_file, checksums_md5) + self.write(log, log_file, changelog_txt) + self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt, + md5_file, checksums_md5, lst_file, filelist_txt) + + def salix(self): + ''' + Creating SalixOS local library + ''' + ar = "i486" + arch = os.uname()[4] + repo = Repo().salix() + log = log_path + "salix/" + lib = lib_path + "salix_repo/" + lib_file = "PACKAGES.TXT" + lst_file = "" + md5_file = "CHECKSUMS.md5" + log_file = "ChangeLog.txt" + if not os.path.exists(log): + os.mkdir(log) + if not os.path.exists(lib): + os.mkdir(lib) + if arch == "x86_64": + ar = "x86_64" + packages_txt = "{0}{1}/{2}/{3}".format(repo, ar, slack_ver(), lib_file) + filelist_txt = "" + checksums_md5 = "{0}{1}/{2}/{3}".format(repo, ar, slack_ver(), md5_file) + changelog_txt = "{0}{1}/{2}/{3}".format(repo, ar, slack_ver(), log_file) + self.write(lib, lib_file, packages_txt) + self.write(lib, md5_file, checksums_md5) + self.write(log, log_file, changelog_txt) + self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt, + md5_file, checksums_md5, lst_file, filelist_txt) + + def slackl(self): + ''' + Creating SalixOS local library + ''' + ar = "i486" + arch = os.uname()[4] + repo = Repo().slackel() + log = log_path + "slackl/" + lib = lib_path + "slackl_repo/" + lib_file = "PACKAGES.TXT" + lst_file = "" + md5_file = "CHECKSUMS.md5" + log_file = "ChangeLog.txt" + if not os.path.exists(log): + os.mkdir(log) + if not os.path.exists(lib): + os.mkdir(lib) + if arch == "x86_64": + ar = "x86_64" + packages_txt = "{0}{1}/current/{2}".format(repo, ar, lib_file) + filelist_txt = "" + checksums_md5 = "{0}{1}/current/{2}".format(repo, ar, md5_file) + changelog_txt = "{0}{1}/current/{2}".format(repo, ar, log_file) + self.write(lib, lib_file, packages_txt) + self.write(lib, md5_file, checksums_md5) + self.write(log, log_file, changelog_txt) + self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt, + md5_file, checksums_md5, lst_file, filelist_txt) @staticmethod def write(path, data_file, file_url): @@ -240,9 +452,16 @@ class Initialization(object): @staticmethod def remote(*args): ''' - args[0]=log, args[1]=log_file, arg[2]=changelog_txt - args[3]=lib, args[4]=lib_file, arg[5]=packages_txt - args[6]=md5_file, args[7]=checksums_md5 + args[0] = log + args[1] = log_file + args[2] = changelog_txt + args[3] = lib + args[4] = lib_file + args[5] = packages_txt + args[6] = md5_file + args[7] = checksums_md5 + args[8] = lst_file + args[9] = filelist_txt We take the size of ChangeLog.txt from the server and locally. If the two files differ in size delete and replace all files with new. @@ -259,6 +478,9 @@ class Initialization(object): # remove CHECKSUMS.md5 if args[6]: os.remove("{0}{1}".format(args[3], args[6])) + # remove FILELIST.TXT + if args[8]: + os.remove("{0}{1}".format(args[3], args[8])) for fu in args[5].split(): PACKAGES_TXT += URL(fu).reading() CHANGELOG_TXT = URL(args[2]).reading() @@ -285,19 +507,36 @@ class Initialization(object): toolbar_width = status(index, toolbar_width, 700) f.write(line + "\n") f.close() + # create FILELIST.TXT file + if args[8]: + FILELIST_TXT = URL(args[9]).reading() + with open("{0}{1}".format(args[3], args[8]), "w") as f: + for line in FILELIST_TXT.splitlines(): + index += 1 + toolbar_width = status(index, toolbar_width, 700) + f.write(line + "\n") + f.close() + + def re_create(self): + ''' + Remove all package lists with changelog and checksums files + and create lists again + ''' + for repo in repositories: + changelogs = '{0}{1}{2}'.format(log_path, repo, '/ChangeLog.txt') + if os.path.isfile(changelogs): + os.remove(changelogs) + for f in os.listdir(lib_path + '{0}_repo/'.format(repo)): + packages = '{0}{1}_repo/{2}'.format(lib_path, repo, f) + if os.path.isfile(packages): + os.remove(packages) + Update().repository() class Update(object): def __init__(self): - self.repos = { - 'sbo': Initialization().sbo, - 'slack': Initialization().slack, - 'rlw': Initialization().rlw, - 'alien': Initialization().alien, - 'slacky': Initialization().slacky, - 'studio': Initialization().studioware - } + self._init = 'Initialization()' def repository(self): ''' @@ -308,7 +547,7 @@ class Update(object): sys.stdout.write("{0}Update repository {1} ...{2}".format( color['GREY'], repo, color['ENDC'])) sys.stdout.flush() - self.repos[repo]() + exec('{0}.{1}()'.format(self._init, repo)) sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC'])) print("") # new line at end diff --git a/slpkg/main.py b/slpkg/main.py index c49a2d3e..da79ab8f 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -24,7 +24,8 @@ import sys import getpass -from slpkg_update import it_self_update +from repoinfo import RepoInfo +from repolist import RepoList from desc import PkgDesc from config import Config @@ -34,7 +35,9 @@ from tracking import track_dep from blacklist import BlackList from version import prog_version from arguments import options, usage +from slpkg_update import it_self_update from init import ( + Initialization, Update, check_exists_repositories ) @@ -69,17 +72,8 @@ class Case(object): def slack_install(self): Slack(self.package).start() - def rlw_install(self): - OthersInstall(self.package, "rlw", self.release).start() - - def alien_install(self): - OthersInstall(self.package, "alien", self.release).start() - - def slacky_install(self): - OthersInstall(self.package, "slacky", self.release).start() - - def studioware_install(self): - OthersInstall(self.package, "studio", self.release).start() + def others_install(self, repo): + OthersInstall(self.package, repo, slack_rel).start() def sbo_upgrade(self): SBoCheck().start() @@ -87,17 +81,8 @@ class Case(object): def slack_upgrade(self): Patches(self.release).start() - def rlw_upgrade(self): - OthersUpgrade("rlw", self.release).start() - - def alien_upgrade(self): - OthersUpgrade("alien", self.release).start() - - def slacky_upgrade(self): - OthersUpgrade("slacky", self.release).start() - - def studioware_upgrade(self): - OthersUpgrade("studio", self.release).start() + def others_upgrade(self, repo): + OthersUpgrade(repo, self.release).start() def main(): @@ -108,61 +93,83 @@ def main(): blacklist = BlackList() queue = QueuePkgs() + # all_args = [ + # 'update', 're-create', 'repolist', 'repoinfo', + # '-h', '--help', '-v', '-a', '-b', + # '-q', '-g', '-l', '-c', '-s', '-t', '-p', '-f', + # '-n', '-i', '-u', '-o', '-r', '-d' + # ] + + without_repos = [ + '-h', '--help', '-v', '-a', '-b', + '-q', '-g', '-f', '-n', '-i', '-u', + '-o', '-r', '-d' + ] + if len(args) == 1 and args[0] == "update": Update().repository() if len(args) == 2 and args[0] == "update" and args[1] == "slpkg": it_self_update() - # checking if repositories exists - check_exists_repositories() + if len(args) == 1 and args[0] == "repolist": + RepoList().repos() if len(args) == 0: - usage() + usage('') elif (len(args) == 1 and args[0] == "-h" or args[0] == "--help" and args[1:] == []): options() - elif (len(args) == 1 and args[0] == "-v" or + + if (len(args) == 1 and args[0] == "-v" or args[0] == "--version" and args[1:] == []): prog_version() - elif len(args) == 3 and args[0] == "-a": + + # checking if repositories exists + check_exists_repositories() + + if len(args) == 1 and args[0] == "re-create": + Initialization().re_create() + + if (len(args) == 2 and args[0] == "repoinfo" and + args[1] in RepoList().all_repos): + del RepoList().all_repos + RepoInfo().view(args[1]) + elif (len(args) == 2 and args[0] == "repoinfo" and + args[1] not in RepoList().all_repos): + usage(args[1]) + + if len(args) == 3 and args[0] == "-a": BuildPackage(args[1], args[2:], path).build() elif len(args) == 2 and args[0] == "-l": - pkg_list = ["all", "noarch"] + repositories + pkg_list = ["all"] + repositories if args[1] in pkg_list: PackageManager(None).list(args[1]) else: - usage() + usage('') elif len(args) == 3 and args[0] == "-c" and args[2] == "--upgrade": - pkg = Case("") - upgrade = { - 'sbo': pkg.sbo_upgrade, - 'slack': pkg.slack_upgrade, - 'rlw': pkg.rlw_upgrade, - 'alien': pkg.alien_upgrade, - 'slacky': pkg.slacky_upgrade, - 'studio': pkg.studioware_upgrade - } - if args[1] in repositories: + if args[1] in repositories and args[1] not in ['slack', 'sbo']: + Case('').others_upgrade(args[1]) + elif args[1] in ['slack', 'sbo']: + upgrade = { + 'sbo': Case(args[2]).sbo_upgrade, + 'slack': Case(args[2]).slack_upgrade + } upgrade[args[1]]() else: - usage() + usage(args[1]) elif len(args) == 3 and args[0] == "-s": - pkg = Case(args[2]) - install = { - 'sbo': pkg.sbo_install, - 'slack': pkg.slack_install, - 'rlw': pkg.rlw_install, - 'alien': pkg.alien_install, - 'slacky': pkg.slacky_install, - 'studio': pkg.studioware_install - } - if args[1] in repositories: + if args[1] in repositories and args[1] not in ['slack', 'sbo']: + Case(args[2]).others_install(args[1]) + elif args[1] in ['slack', 'sbo']: + install = { + 'sbo': Case(args[2]).sbo_install, + 'slack': Case(args[2]).slack_install + } install[args[1]]() else: - usage() - elif (len(args) == 3 and args[0] == "-t" and args[1] in repositories - and args[1] != "slack"): + usage(args[1]) + elif (len(args) == 3 and args[0] == "-t" and args[1] in repositories): track_dep(args[2], args[1]) elif len(args) == 2 and args[0] == "-n" and "sbo" in repositories: SBoNetwork(args[1]).view() @@ -193,7 +200,7 @@ def main(): PackageManager(args[1:]).reinstall() elif len(args) > 1 and args[0] == "-r": PackageManager(args[1:]).remove() - elif len(args) > 1 and args[0] == "-f": + elif len(args) == 2 and args[0] == "-f": PackageManager(args[1:]).find() elif len(args) == 3 and args[0] == "-p" and args[1] in repositories: PkgDesc(args[2], args[1], "").view() @@ -203,7 +210,7 @@ def main(): if args[1] in repositories and tag in colors: PkgDesc(args[2], args[1], tag).view() else: - usage() + usage(args[1]) elif len(args) > 1 and args[0] == "-d": PackageManager(args[1:]).display() elif len(args) == 2 and args[0] == "-g" and args[1].startswith("--config"): @@ -213,9 +220,12 @@ def main(): elif editor: Config().edit(editor) else: - usage() + usage('') else: - usage() + if len(args) > 1 and args[0] not in without_repos: + usage(args[1]) + else: + usage('') if __name__ == "__main__": main() diff --git a/slpkg/md5sum.py b/slpkg/md5sum.py index bc534387..09ef5abe 100644 --- a/slpkg/md5sum.py +++ b/slpkg/md5sum.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/messages.py b/slpkg/messages.py index af61d180..0d338030 100644 --- a/slpkg/messages.py +++ b/slpkg/messages.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -76,12 +76,3 @@ def template(max_len): Print template ''' print("+" + "=" * max_len) - - -def slacky_error(): - ''' - Slacky repository error - ''' - print("\nRepository slack working together with the slacky.") - print("Please add the repository slack from file " + - "'/etc/slpkg/slpkg.conf'\n") diff --git a/slpkg/others/check.py b/slpkg/others/check.py index e0116e8b..80b2e9c6 100644 --- a/slpkg/others/check.py +++ b/slpkg/others/check.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -26,6 +26,7 @@ import sys from slpkg.sizes import units from slpkg.remove import delete +from slpkg.toolbar import status from slpkg.repositories import Repo from slpkg.messages import template from slpkg.checksum import check_md5 @@ -38,9 +39,11 @@ from slpkg.__metadata__ import ( lib_path, slpkg_tmp_packages, default_answer, - color + color, + slacke_sub_repo ) +from slpkg.pkg.find import find_package from slpkg.pkg.manager import PackageManager from slpkg.slack.slack_version import slack_ver @@ -54,46 +57,101 @@ class OthersUpgrade(object): self.repo = repo self.version = version self.tmp_path = slpkg_tmp_packages - repos = Repo() sys.stdout.write("{0}Reading package lists ...{1}".format( color['GREY'], color['ENDC'])) sys.stdout.flush() self.step = 700 - repos = Repo() - if self.repo == "rlw": - lib = lib_path + "rlw_repo/PACKAGES.TXT" - self.mirror = "{0}{1}/".format(repos.rlw(), slack_ver()) - elif self.repo == "alien": - lib = lib_path + "alien_repo/PACKAGES.TXT" - self.mirror = repos.alien() - self.step = self.step * 2 - elif self.repo == "slacky": - lib = lib_path + "slacky_repo/PACKAGES.TXT" - arch = "" - if os.uname()[4] == "x86_64": - arch = "64" - self.mirror = "{0}slackware{1}-{2}/".format(repos.slacky(), arch, - slack_ver()) - self.step = self.step * 2 - elif self.repo == "studio": - lib = lib_path + "studio_repo/PACKAGES.TXT" - arch = "" - if os.uname()[4] == "x86_64": - arch = "64" - self.mirror = "{0}slackware{1}-{2}/".format(repos.studioware(), - arch, slack_ver()) - self.step = self.step * 2 - f = open(lib, "r") + exec('self._init_{0}()'.format(self.repo)) + + f = open(self.lib, "r") self.PACKAGES_TXT = f.read() f.close() + def _init_rlw(self): + self.lib = lib_path + "rlw_repo/PACKAGES.TXT" + self.mirror = "{0}{1}/".format(Repo().rlw(), slack_ver()) + + def _init_alien(self): + self.lib = lib_path + "alien_repo/PACKAGES.TXT" + self.mirror = Repo().alien() + self.step = self.step * 2 + + def _init_slacky(self): + self.lib = lib_path + "slacky_repo/PACKAGES.TXT" + arch = "" + if os.uname()[4] == "x86_64": + arch = "64" + self.mirror = "{0}slackware{1}-{2}/".format(Repo().slacky(), arch, + slack_ver()) + self.step = self.step * 2 + + def _init_studio(self): + self.lib = lib_path + "studio_repo/PACKAGES.TXT" + arch = "" + if os.uname()[4] == "x86_64": + arch = "64" + self.mirror = "{0}slackware{1}-{2}/".format(Repo().studioware(), + arch, slack_ver()) + self.step = self.step * 2 + + def _init_slackr(self): + self.lib = lib_path + "slackr_repo/PACKAGES.TXT" + self.mirror = Repo().slackers() + self.step = self.step * 2 + + def _init_slonly(self): + self.lib = lib_path + "slonly_repo/PACKAGES.TXT" + arch = "{0}-x86".format(slack_ver()) + if os.uname()[4] == "x86_64": + arch = "{0}-x86_64".format(slack_ver()) + self.mirror = "{0}{1}/".format(Repo().slackonly(), arch) + self.step = self.step * 3 + + def _init_ktown(self): + self.lib = lib_path + "ktown_repo/PACKAGES.TXT" + self.mirror = Repo().ktown() + self.step = self.step * 2 + + def _init_multi(self): + self.lib = lib_path + "multi_repo/PACKAGES.TXT" + self.mirror = Repo().multi() + self.step = self.step * 2 + + def _init_slacke(self): + arch = "" + if os.uname()[4] == "x86_64": + arch = "64" + elif os.uname()[4] == "arm": + arch = "arm" + self.lib = lib_path + "slacke_repo/PACKAGES.TXT" + self.mirror = "{0}slacke{1}/slackware{2}-{3}/".format( + Repo().slacke(), slacke_sub_repo[1:-1], arch, slack_ver()) + self.step = self.step * 2 + + def _init_salix(self): + arch = "i486" + if os.uname()[4] == "x86_64": + arch = "x86_64" + self.lib = lib_path + "salix_repo/PACKAGES.TXT" + self.mirror = "{0}{1}/{2}/".format(Repo().salix(), arch, slack_ver()) + self.step = self.step * 2 + + def _init_slackl(self): + arch = "i486" + if os.uname()[4] == "x86_64": + arch = "x86_64" + self.lib = lib_path + "slackl_repo/PACKAGES.TXT" + self.mirror = "{0}{1}/current/".format(Repo().slackel(), arch) + self.step = self.step * 2 + def start(self): ''' Install packages from official Slackware distribution ''' try: - dwn_links, upgrade_all, comp_sum, uncomp_sum = self.store() + (pkg_for_upgrade, dwn_links, upgrade_all, comp_sum, + uncomp_sum) = self.store() sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC'])) print("") # new line at start @@ -101,14 +159,14 @@ class OthersUpgrade(object): template(78) print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format( "| Package", " " * 17, - "New version", " " * 8, + "New version", " " * 9, "Arch", " " * 4, "Build", " " * 2, - "Repos", " " * 10, + "Repos", " " * 9, "Size")) template(78) print("Upgrading:") - views(upgrade_all, comp_sum, self.repo) + views(pkg_for_upgrade, upgrade_all, comp_sum, self.repo) unit, size = units(comp_sum, uncomp_sum) msg = msgs(upgrade_all) print("\nInstalling summary") @@ -130,7 +188,7 @@ class OthersUpgrade(object): upgrade(self.tmp_path, upgrade_all, self.repo, self.version) delete(self.tmp_path, upgrade_all) else: - print("No new updates in the repository '{0}'\n".format( + print("No new updates from repository '{0}'\n".format( self.repo)) except KeyboardInterrupt: print("") # new line at exit @@ -140,65 +198,54 @@ class OthersUpgrade(object): ''' Store and return packages for install ''' - dwn, install, comp_sum, uncomp_sum = ([] for i in range(4)) - black = BlackList().packages() + pkg_for_upgrade, dwn, install, comp_sum, uncomp_sum = ( + [] for i in range(5)) # name = data[0] # location = data[1] # size = data[2] # unsize = data[3] - installed = self.installed() data = repo_data(self.PACKAGES_TXT, self.step, self.repo, self.version) - for pkg in installed: + index, toolbar_width = 0, 700 + for pkg in self.installed(): + index += 1 + toolbar_width = status(index, toolbar_width, 10) for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]): inst_pkg = split_package(pkg) - repo_pkg = split_package(name[:-4]) + if name: # this tips because some pkg_name is empty + repo_pkg = split_package(name[:-4]) if (repo_pkg[0] == inst_pkg[0] and - name[:-4] > pkg and inst_pkg[0] not in black): + repo_pkg[1] > inst_pkg[1] and + inst_pkg[0] not in BlackList().packages()): # store downloads packages by repo dwn.append("{0}{1}/{2}".format(self.mirror, loc, name)) install.append(name) comp_sum.append(comp) uncomp_sum.append(uncomp) - return [dwn, install, comp_sum, uncomp_sum] + pkg_for_upgrade.append('{0}-{1}'.format( + inst_pkg[0], inst_pkg[1])) + return [pkg_for_upgrade, dwn, install, comp_sum, uncomp_sum] def installed(self): ''' - Return all installed packages by repository + Return all installed packages ''' - packages = [] - repository = { - 'rlw': '_rlw', - 'alien': 'alien', - 'slacky': 'sl', - 'studio': 'se' - } - repo = repository[self.repo] - for pkg in os.listdir(pkg_path): - if pkg.endswith(repo): - packages.append(pkg) - return packages + return find_package('', pkg_path) -def views(upgrade_all, comp_sum, repository): +def views(pkg_for_upgrade, upgrade_all, comp_sum, repository): ''' Views packages ''' upg_sum = 0 # fix repositories align - align = { - 'rlw': ' ' * 3, - 'alien': ' ', - 'slacky': '', - 'studio': '' - } - repository += align[repository] - for pkg, comp in zip(upgrade_all, comp_sum): + repository = repository + (' ' * (6 - (len(repository)))) + for upg, pkg, comp in zip(pkg_for_upgrade, upgrade_all, comp_sum): pkg_split = split_package(pkg[:-4]) upg_sum += 1 - print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>11}{12}".format( - color['YELLOW'], pkg_split[0], color['ENDC'], - " " * (25-len(pkg_split[0])), pkg_split[1], + print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>10}{12}".format( + color['YELLOW'], upg, color['ENDC'], + " " * (24-len(upg)), pkg_split[1], " " * (19-len(pkg_split[1])), pkg_split[2], " " * (8-len(pkg_split[2])), pkg_split[3], " " * (7-len(pkg_split[3])), repository, diff --git a/slpkg/others/dependency.py b/slpkg/others/dependency.py index d260f33d..8996fc5a 100644 --- a/slpkg/others/dependency.py +++ b/slpkg/others/dependency.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/others/greps.py b/slpkg/others/greps.py index 775944db..fa6aaf97 100644 --- a/slpkg/others/greps.py +++ b/slpkg/others/greps.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -24,11 +24,12 @@ import os from slpkg.toolbar import status -from slpkg.__metadata__ import lib_path from slpkg.splitting import split_package from slpkg.slack.slack_version import slack_ver - -len_deps = 0 +from slpkg.__metadata__ import ( + lib_path, + ktown_kde_repo +) def repo_data(PACKAGES_TXT, step, repo, version): @@ -42,7 +43,10 @@ def repo_data(PACKAGES_TXT, step, repo, version): index += 1 toolbar_width = status(index, toolbar_width, step) if line.startswith("PACKAGE NAME"): - name.append(line[15:].strip()) + if repo == "slackr": + name.append(fix_slackers_pkg(line[15:])) + else: + name.append(line[15:].strip()) if line.startswith("PACKAGE LOCATION"): location.append(line[21:].strip()) if line.startswith("PACKAGE SIZE (compressed): "): @@ -61,7 +65,20 @@ def repo_data(PACKAGES_TXT, step, repo, version): rsize, runsize ) = alien_filter(name, location, size, unsize, version) - elif repo in ["slacky", "studio"]: + elif repo == "ktown": + (rname, + rlocation, + rsize, + runsize + ) = ktown_filter(name, location, size, unsize, version) + elif repo == "multi": + (rname, + rlocation, + rsize, + runsize + ) = multi_filter(name, location, size, unsize, version) + elif repo in ["slacky", "studio", "slackr", "slonly", "slacke", + "salix", "slackl"]: rname, rlocation, rsize, runsize = name, location, size, unsize return [rname, rlocation, rsize, runsize] @@ -86,7 +103,7 @@ def rlw_filter(name, location, size, unsize): def alien_filter(name, location, size, unsize, version): ''' - Filter alien repository data + Filter Alien's repository data ''' ver = slack_ver() if version == "current": @@ -104,40 +121,94 @@ def alien_filter(name, location, size, unsize, version): return [fname, flocation, fsize, funsize] +def ktown_filter(name, location, size, unsize, version): + ''' + Filter Alien's ktown repository data + ''' + ver = slack_ver() + if version == "current": + ver = "current" + path_pkg = "x86" + if os.uname()[4] == "x86_64": + path_pkg = os.uname()[4] + (fname, flocation, fsize, funsize) = ([] for i in range(4)) + for n, l, s, u in zip(name, location, size, unsize): + if path_pkg in l and ktown_kde_repo[1:-1] in l and l.startswith(ver): + fname.append(n) + flocation.append(l) + fsize.append(s) + funsize.append(u) + return [fname, flocation, fsize, funsize] + + +def multi_filter(name, location, size, unsize, version): + ''' + Filter Alien's multilib repository data + ''' + ver = slack_ver() + if version == "current": + ver = "current" + (fname, flocation, fsize, funsize) = ([] for i in range(4)) + for n, l, s, u in zip(name, location, size, unsize): + if l.startswith(ver): + fname.append(n) + flocation.append(l) + fsize.append(s) + funsize.append(u) + return [fname, flocation, fsize, funsize] + + +def fix_slackers_pkg(name): + ''' + Fix 'PACKAGE NAME:' from PACKAGES.TXT file + Beacause repository slackers.it not report the full + name in PACKAGES.TXT file use FILELIST.TXT to + get. + ''' + f = open(lib_path + "slackr_repo/FILELIST.TXT", "r") + FILELIST_TXT = f.read() + f.close() + for line in FILELIST_TXT.splitlines(): + if name in line and line.endswith(".txz"): + return line.split("/")[-1].strip() + # This trick fix spliting 'NoneType' packages + # reference wrong name between PACKAGE.TXT and + # FILELIST.TXT + return "" + + class Requires(object): def __init__(self, name, repo): self.name = name self.repo = repo - lib = lib_path + "slack_repo/PACKAGES.TXT" - f = open(lib, "r") - self.SLACK_PACKAGES_TXT = f.read() - f.close() def get_deps(self): ''' Grap package requirements from repositories ''' - if self.repo in ["alien", "slacky"]: - lib = { - 'alien': lib_path + "alien_repo/PACKAGES.TXT", - 'slacky': lib_path + "slacky_repo/PACKAGES.TXT" - } - f = open(lib[self.repo], "r") + if self.repo in ["alien", "slacky", "slackr", "salix", "slackl"]: + lib = '{0}{1}_repo/PACKAGES.TXT'.format(lib_path, self.repo) + f = open(lib, "r") PACKAGES_TXT = f.read() f.close() for line in PACKAGES_TXT.splitlines(): if line.startswith("PACKAGE NAME: "): - pkg = line[14:].strip() - pkg_name = split_package(pkg)[0] + if self.repo == "slackr": + pkg_name = line[14:].strip() + else: + pkg = line[14:].strip() + pkg_name = split_package(pkg)[0] if line.startswith("PACKAGE REQUIRED: "): if pkg_name == self.name: if line[17:].strip(): - if self.repo == "slacky": - return self.slacky_req_fix(line) - - else: + if self.repo in ["slacky", "salix", "slackl"]: + return self._req_fix(line) + elif self.repo == "alien": return line[18:].strip().split(",") + else: + return line[18:].strip().split() + elif self.repo == "rlw": # Robby's repository dependencies as shown in the central page # http://rlworkman.net/pkgs/ @@ -154,38 +225,23 @@ class Requires(object): else: return "" - def slacky_req_fix(self, line): + def _req_fix(self, line): ''' - Fix slacky requirements because many dependencies splitting + Fix slacky and salix requirements because many dependencies splitting with ',' and others with '|' ''' - slacky_deps = [] + deps = [] for dep in line[18:].strip().split(","): dep = dep.split("|") - if len(dep) > 1: - for d in dep: - slacky_deps.append(d.split()[0]) - dep = "".join(dep) - slacky_deps.append(dep.split()[0]) - slacky_deps = self.remove_slack_deps(slacky_deps) - return slacky_deps - - def remove_slack_deps(self, dependencies): - ''' - Because the repository slacky mentioned packages and dependencies - that exist in the distribution Slackware, this feature is intended - to remove them and return only those needed. - ''' - global len_deps - len_deps += len(dependencies) - name, slacky_deps = [], [] - index, toolbar_width, step = 0, 700, (len_deps * 500) - for line in self.SLACK_PACKAGES_TXT.splitlines(): - index += 1 - toolbar_width = status(index, toolbar_width, step) - if line.startswith("PACKAGE NAME:"): - name.append("-".join(line[15:].split("-")[:-3])) - for deps in dependencies: - if deps not in name: - slacky_deps.append(deps) - return slacky_deps + if self.repo == 'slacky': + if len(dep) > 1: + for d in dep: + deps.append(d.split()[0]) + dep = "".join(dep) + deps.append(dep.split()[0]) + else: + if len(dep) > 1: + for d in dep: + deps.append(d) + deps.append(dep[0]) + return deps diff --git a/slpkg/others/install.py b/slpkg/others/install.py index 86f9879a..2468da11 100644 --- a/slpkg/others/install.py +++ b/slpkg/others/install.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -33,7 +33,6 @@ from slpkg.downloader import Download from slpkg.grep_md5 import pkg_checksum from slpkg.splitting import split_package from slpkg.messages import ( - slacky_error, pkg_not_found, template ) @@ -43,7 +42,8 @@ from slpkg.__metadata__ import ( log_path, slpkg_tmp_packages, default_answer, - color + color, + slacke_sub_repo ) from slpkg.pkg.find import find_package @@ -62,55 +62,105 @@ class OthersInstall(object): self.repo = repo self.version = version self.tmp_path = slpkg_tmp_packages - if (not os.path.isfile(lib_path + "slack_repo/PACKAGES.TXT") and - repo == "slacky"): - slacky_error() - sys.exit(0) - repos = Repo() print("\nPackages with name matching [ {0}{1}{2} ]\n".format( color['CYAN'], self.package, color['ENDC'])) sys.stdout.write("{0}Reading package lists ...{1}".format( color['GREY'], color['ENDC'])) sys.stdout.flush() self.step = 700 - repos = Repo() - if self.repo == "rlw": - lib = lib_path + "rlw_repo/PACKAGES.TXT" - self.mirror = "{0}{1}/".format(repos.rlw(), slack_ver()) - elif self.repo == "alien": - lib = lib_path + "alien_repo/PACKAGES.TXT" - self.mirror = repos.alien() - self.step = self.step * 2 - elif self.repo == "slacky": - lib = lib_path + "slacky_repo/PACKAGES.TXT" - arch = "" - if os.uname()[4] == "x86_64": - arch = "64" - self.mirror = "{0}slackware{1}-{2}/".format(repos.slacky(), arch, - slack_ver()) - self.step = self.step * 2 - elif self.repo == "studio": - lib = lib_path + "studio_repo/PACKAGES.TXT" - arch = "" - if os.uname()[4] == "x86_64": - arch = "64" - self.mirror = "{0}slackware{1}-{2}/".format(repos.studioware(), - arch, slack_ver()) - self.step = self.step * 2 - f = open(lib, "r") + exec('self._init_{0}()'.format(self.repo)) + + f = open(self.lib, "r") self.PACKAGES_TXT = f.read() f.close() sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC'])) + def _init_rlw(self): + self.lib = lib_path + "rlw_repo/PACKAGES.TXT" + self.mirror = "{0}{1}/".format(Repo().rlw(), slack_ver()) + + def _init_alien(self): + self.lib = lib_path + "alien_repo/PACKAGES.TXT" + self.mirror = Repo().alien() + self.step = self.step * 2 + + def _init_slacky(self): + self.lib = lib_path + "slacky_repo/PACKAGES.TXT" + arch = "" + if os.uname()[4] == "x86_64": + arch = "64" + self.mirror = "{0}slackware{1}-{2}/".format(Repo().slacky(), arch, + slack_ver()) + self.step = self.step * 2 + + def _init_studio(self): + self.lib = lib_path + "studio_repo/PACKAGES.TXT" + arch = "" + if os.uname()[4] == "x86_64": + arch = "64" + self.mirror = "{0}slackware{1}-{2}/".format(Repo().studioware(), + arch, slack_ver()) + self.step = self.step * 2 + + def _init_slackr(self): + self.lib = lib_path + "slackr_repo/PACKAGES.TXT" + self.mirror = Repo().slackers() + self.step = self.step * 2 + + def _init_slonly(self): + self.lib = lib_path + "slonly_repo/PACKAGES.TXT" + arch = "{0}-x86".format(slack_ver()) + if os.uname()[4] == "x86_64": + arch = "{0}-x86_64".format(slack_ver()) + self.mirror = "{0}{1}/".format(Repo().slackonly(), arch) + self.step = self.step * 3 + + def _init_ktown(self): + self.lib = lib_path + "ktown_repo/PACKAGES.TXT" + self.mirror = Repo().ktown() + self.step = self.step * 2 + + def _init_multi(self): + self.lib = lib_path + "multi_repo/PACKAGES.TXT" + self.mirror = Repo().multi() + self.step = self.step * 2 + + def _init_slacke(self): + arch = "" + if os.uname()[4] == "x86_64": + arch = "64" + elif os.uname()[4] == "arm": + arch = "arm" + self.lib = lib_path + "slacke_repo/PACKAGES.TXT" + self.mirror = "{0}slacke{1}/slackware{2}-{3}/".format( + Repo().slacke(), slacke_sub_repo[1:-1], arch, slack_ver()) + self.step = self.step * 2 + + def _init_salix(self): + arch = "i486" + if os.uname()[4] == "x86_64": + arch = "x86_64" + self.lib = lib_path + "salix_repo/PACKAGES.TXT" + self.mirror = "{0}{1}/{2}/".format(Repo().salix(), arch, slack_ver()) + self.step = self.step * 2 + + def _init_slackl(self): + arch = "i486" + if os.uname()[4] == "x86_64": + arch = "x86_64" + self.lib = lib_path + "slackl_repo/PACKAGES.TXT" + self.mirror = "{0}{1}/current/".format(Repo().slackel(), arch) + self.step = self.step * 2 + def start(self): ''' Install packages from official Slackware distribution ''' try: dependencies = resolving_deps(self.package, self.repo) - (dwn_links, install_all, comp_sum, uncomp_sum, - matching) = self.store(dependencies) + (dwn_links, install_all, comp_sum, uncomp_sum + ) = self.store(dependencies) sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC'])) print("") # new line at start @@ -124,46 +174,34 @@ class OthersInstall(object): "Repos", " " * 10, "Size")) template(78) - if not matching: - print("Installing:") - sums = views(install_all, comp_sum, self.repo, dependencies) - unit, size = units(comp_sum, uncomp_sum) - msg = msgs(install_all, sums[2]) - print("\nInstalling summary") - print("=" * 79) - print("{0}Total {1} {2}.".format(color['GREY'], - len(install_all), msg[0])) - print("{0} {1} will be installed, {2} will be upgraded and " - "{3} will be resettled.".format(sums[2], msg[1], - sums[1], sums[0])) - print("Need to get {0} {1} of archives.".format(size[0], - unit[0])) - print("After this process, {0} {1} of additional disk " - "space will be used.{2}".format(size[1], unit[1], - color['ENDC'])) - if default_answer == "y": - answer = default_answer - else: - answer = raw_input("\nWould you like to continue " + - "[Y/n]? ") - if answer in ['y', 'Y']: - install_all.reverse() - Download(self.tmp_path, dwn_links).start() - install(self.tmp_path, install_all, self.repo, - self.version) - write_deps(dependencies) - delete(self.tmp_path, install_all) + print("Installing:") + sums = views(install_all, comp_sum, self.repo, dependencies) + unit, size = units(comp_sum, uncomp_sum) + msg = msgs(install_all, sums[2]) + print("\nInstalling summary") + print("=" * 79) + print("{0}Total {1} {2}.".format(color['GREY'], + len(install_all), msg[0])) + print("{0} {1} will be installed, {2} will be upgraded and " + "{3} will be resettled.".format(sums[2], msg[1], + sums[1], sums[0])) + print("Need to get {0} {1} of archives.".format(size[0], + unit[0])) + print("After this process, {0} {1} of additional disk " + "space will be used.{2}".format(size[1], unit[1], + color['ENDC'])) + if default_answer == "y": + answer = default_answer else: - print("Matching:") - sums = views(install_all, comp_sum, self.repo, dependencies) - msg = msgs(install_all, sums[2]) - print("\nInstalling summary") - print("=" * 79) - print("{0}Total found {1} matching {2}.".format( - color['GREY'], len(install_all), msg[1])) - print("{0} installed {1} and {2} uninstalled {3}.{4}" - "\n".format(sums[0] + sums[1], msg[0], sums[2], - msg[1], color['ENDC'])) + answer = raw_input("\nWould you like to continue " + + "[Y/n]? ") + if answer in ['y', 'Y']: + install_all.reverse() + Download(self.tmp_path, dwn_links).start() + install(self.tmp_path, install_all, self.repo, + self.version) + write_deps(dependencies) + delete(self.tmp_path, install_all) else: pkg_not_found("", self.package, "No matching", "\n") except KeyboardInterrupt: @@ -176,7 +214,6 @@ class OthersInstall(object): ''' dwn, install, comp_sum, uncomp_sum = ([] for i in range(4)) black = BlackList().packages() - matching = False # name = data[0] # location = data[1] # size = data[2] @@ -202,13 +239,11 @@ class OthersInstall(object): install.append(name) comp_sum.append(comp) uncomp_sum.append(uncomp) - if len(install) > 1: - matching = True dwn.reverse() install.reverse() comp_sum.reverse() uncomp_sum.reverse() - return [dwn, install, comp_sum, uncomp_sum, matching] + return [dwn, install, comp_sum, uncomp_sum] def views(install_all, comp_sum, repository, dependencies): @@ -217,13 +252,7 @@ def views(install_all, comp_sum, repository, dependencies): ''' count = pkg_sum = uni_sum = upg_sum = 0 # fix repositories align - align = { - 'rlw': ' ' * 3, - 'alien': ' ', - 'slacky': '', - 'studio': '' - } - repository += align[repository] + repository = repository + (' ' * (6 - (len(repository)))) for pkg, comp in zip(install_all, comp_sum): pkg_split = split_package(pkg[:-4]) if find_package(pkg_split[0] + "-" + pkg_split[1], pkg_path): @@ -235,10 +264,10 @@ def views(install_all, comp_sum, repository, dependencies): else: COLOR = color['RED'] uni_sum += 1 - print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>11}{12}".format( + print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>11}{12}".format( COLOR, pkg_split[0], color['ENDC'], - " " * (25-len(pkg_split[0])), pkg_split[1], - " " * (19-len(pkg_split[1])), pkg_split[2], + " " * (24-len(pkg_split[0])), pkg_split[1], + " " * (18-len(pkg_split[1])), pkg_split[2], " " * (8-len(pkg_split[2])), pkg_split[3], " " * (7-len(pkg_split[3])), repository, comp, " K")) diff --git a/slpkg/others/search.py b/slpkg/others/search.py index 4341fed2..8e22c997 100644 --- a/slpkg/others/search.py +++ b/slpkg/others/search.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -24,8 +24,10 @@ import sys from slpkg.blacklist import BlackList -from slpkg.__metadata__ import lib_path from slpkg.splitting import split_package +from slpkg.__metadata__ import ( + lib_path +) def search_pkg(name, repo): @@ -35,16 +37,14 @@ def search_pkg(name, repo): ''' try: blacklist = BlackList().packages() - repo_dir = { - "rlw": "rlw_repo/PACKAGES.TXT", - "alien": "alien_repo/PACKAGES.TXT", - "slacky": "slacky_repo/PACKAGES.TXT", - "studio": "studio_repo/PACKAGES.TXT" - } - with open(lib_path + repo_dir[repo], "r") as PACKAGES_TXT: + with open(lib_path + '{0}_repo/PACKAGES.TXT'.format( + repo), "r") as PACKAGES_TXT: for line in PACKAGES_TXT: - if line.startswith("PACKAGE NAME: "): - pkg_name = split_package(line[15:])[0].strip() + if line.startswith("PACKAGE NAME: ") and len(line) > 16: + if repo == 'slackr': + pkg_name = line[15:].strip() + else: + pkg_name = split_package(line[15:])[0].strip() if name == pkg_name and name not in blacklist: PACKAGES_TXT.close() return pkg_name diff --git a/slpkg/pkg/build.py b/slpkg/pkg/build.py index 7ad2bb97..2911acaa 100644 --- a/slpkg/pkg/build.py +++ b/slpkg/pkg/build.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/pkg/find.py b/slpkg/pkg/find.py index 9e2877a9..77d68f51 100644 --- a/slpkg/pkg/find.py +++ b/slpkg/pkg/find.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -34,6 +34,7 @@ def find_package(find_pkg, directory): pkgs = [] blacklist = BlackList().packages() for pkg in sorted(os.listdir(directory)): - if pkg.startswith(find_pkg)and split_package(pkg)[0] not in blacklist: + if (not pkg.startswith('.') and pkg.startswith(find_pkg) + and split_package(pkg)[0] not in blacklist): pkgs.append(pkg) return pkgs diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py index 0478c7e7..27b21ad6 100644 --- a/slpkg/pkg/manager.py +++ b/slpkg/pkg/manager.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -40,6 +40,7 @@ from slpkg.__metadata__ import ( ) from slpkg.pkg.find import find_package +from slpkg.slack.slack_version import slack_ver class PackageManager(object): @@ -227,12 +228,11 @@ class PackageManager(object): ''' Find installed Slackware packages ''' - self.binary = "".join(self.binary) matching = size = 0 print("\nPackages with matching name [ {0}{1}{2} ]\n".format( - color['CYAN'], self.binary, color['ENDC'])) - for match in find_package(self.binary, pkg_path): - if self.binary in match: + color['CYAN'], ''.join(self.binary), color['ENDC'])) + for match in find_package(''.join(self.binary), pkg_path): + if ''.join(self.binary) in match: matching += 1 print("[ {0}installed{1} ] - {2}".format( color['GREEN'], color['ENDC'], match)) @@ -286,33 +286,38 @@ class PackageManager(object): row = int(tty_size[0]) - 2 try: pkg_list = { - 'sbo': '_SBo', - 'slack': '_slack', - 'noarch': '-noarch-', - 'rlw': '_rlw', - 'alien': 'alien', - 'slacky': 'sl', - 'studio': 'se', - 'all': '' + 'sbo': ['_SBo'], + 'slack': ['_slack{0}'.format(slack_ver())], + 'rlw': ['_rlw'], + 'alien': ['alien'], + 'slacky': ['sl'], + 'studio': ['se'], + 'slackr': ['cf'], + 'slonly': ['_slack'], + 'ktown': ['alien'], + 'multi': ['alien', 'alien_slack{0}'.format(slack_ver()), + 'compat32'], + 'slacke': ['jp'], + 'salix': ['gv', 'rl', 'msb', 'dj', 'tg', 'cp', 'tjb', 'alien'], + 'slackl': [''], + 'all': [''] } search = pkg_list[pattern] index, page = 0, row - sl = search - if search == "-noarch-": - search = "" for pkg in find_package("", pkg_path): - if pkg.endswith(search) and sl in pkg: - index += 1 - print("{0}{1}:{2} {3}".format(color['GREY'], index, - color['ENDC'], pkg)) - if index == page: - read = raw_input("\nPress {0}Enter{1} to " - "continue... ".format(color['CYAN'], - color['ENDC'])) - if read in ['Q', 'q']: - break - print("") # new line after page - page += row + for tag in search: + if pkg.endswith(tag): + index += 1 + print("{0}{1}:{2} {3}".format(color['GREY'], index, + color['ENDC'], pkg)) + if index == page: + read = raw_input("\nPress {0}Enter{1} to " + "continue... ".format( + color['CYAN'], color['ENDC'])) + if read in ['Q', 'q']: + break + print("") # new line after page + page += row print("") # new line at end except KeyboardInterrupt: print("") # new line at exit diff --git a/slpkg/queue.py b/slpkg/queue.py index 3919b9e3..8c0662fa 100644 --- a/slpkg/queue.py +++ b/slpkg/queue.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/remove.py b/slpkg/remove.py index 454be3df..3302afdb 100644 --- a/slpkg/remove.py +++ b/slpkg/remove.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/repoinfo.py b/slpkg/repoinfo.py new file mode 100644 index 00000000..652f27ca --- /dev/null +++ b/slpkg/repoinfo.py @@ -0,0 +1,111 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# repoinfo.py file is part of slpkg. + +# Copyright 2014 Dimitris Zlatanidis +# All rights reserved. + +# Slpkg is a user-friendly package manager for Slackware installations + +# 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 . + +import os +import sys + +from sizes import units +from repolist import RepoList +from __metadata__ import ( + lib_path, + log_path, + repositories, + color +) + + +class RepoInfo(object): + + def __init__(self): + self.form = { + 'Last updated:': '', + 'Number of packages:': '', + 'Repo id:': '', + 'Repo url:': '', + 'Status:': '', + 'Total compressed packages:': '', + 'Total uncompressed packages:': '' + } + + self.all_repos = RepoList().all_repos + del RepoList().all_repos + + def view(self, repo): + ''' + View repository information + ''' + status = '{0}disabled{1}'.format(color['RED'], color['ENDC']) + self.form['Status:'] = status + if (repo in repositories and + os.path.isfile(log_path + '{0}/ChangeLog.txt'.format(repo))): + status = '{0}enabled{1}'.format(color['GREEN'], color['ENDC']) + if repo != 'sbo': + data = self.repository_data(repo) + size = units(data[1], data[2]) + self.form['Repo id:'] = repo + self.form['Repo url:'] = self.all_repos[repo] + self.form['Total compressed packages:'] = '{0} {1}'.format( + str(size[1][0]), str(size[0][0])) + self.form['Total uncompressed packages:'] = '{0} {1}'.format( + str(size[1][1]), str(size[0][1])) + self.form['Number of packages:'] = data[0] + self.form['Status:'] = status + self.form['Last updated:'] = data[3] + elif repo == 'sbo': + sum_sbo_pkgs = 0 + for line in open(lib_path + 'sbo_repo/SLACKBUILDS.TXT', 'r'): + if line.startswith('SLACKBUILD NAME: '): + sum_sbo_pkgs += 1 + with open(log_path + 'sbo/ChangeLog.txt', 'r') as changelog_txt: + last_upd = changelog_txt.readline().replace('\n', '') + self.form['Repo id:'] = repo + self.form['Repo url:'] = self.all_repos[repo] + self.form['Total compressed packages:'] = '' + self.form['Total uncompressed packages:'] = '' + self.form['Number of packages:'] = sum_sbo_pkgs + self.form['Status:'] = status + self.form['Last updated:'] = last_upd + print('') + for key, value in sorted(self.form.iteritems()): + print color['GREY'] + key + color['ENDC'], value + print('') + sys.exit(0) + + def repository_data(self, repo): + ''' + Grap data packages + ''' + sum_pkgs, size, unsize, last_upd = 0, [], [], '' + for line in open(lib_path + repo + '_repo/PACKAGES.TXT', 'r'): + if line.startswith('PACKAGES.TXT;'): + last_upd = line[14:].strip() + if line.startswith('PACKAGE NAME:'): + sum_pkgs += 1 + if line.startswith('PACKAGE SIZE (compressed): '): + size.append(line[28:-2].strip()) + if line.startswith('PACKAGE SIZE (uncompressed): '): + unsize.append(line[30:-2].strip()) + if repo in ['salix', 'slackl']: + with open(log_path + '{0}/ChangeLog.txt'.format(repo), 'r') as log: + last_upd = log.readline().replace('\n', '') + return [sum_pkgs, size, unsize, last_upd] diff --git a/slpkg/repolist.py b/slpkg/repolist.py new file mode 100644 index 00000000..1a1e46ee --- /dev/null +++ b/slpkg/repolist.py @@ -0,0 +1,75 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +# repolist.py file is part of slpkg. + +# Copyright 2014 Dimitris Zlatanidis +# All rights reserved. + +# Slpkg is a user-friendly package manager for Slackware installations + +# 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 . + + +import sys + +from repositories import Repo +from messages import template +from __metadata__ import ( + repositories, + color +) + + +class RepoList(object): + + def __init__(self): + self.all_repos = { + 'slack': Repo().slack(), + 'sbo': Repo().sbo(), + 'rlw': Repo().rlw(), + 'alien': Repo().alien(), + 'slacky': Repo().slacky(), + 'studio': Repo().studioware(), + 'slackr': Repo().slackers(), + 'slonly': Repo().slackonly(), + 'ktown': Repo().ktown(), + 'multi': Repo().multi(), + 'slacke': Repo().slacke(), + 'salix': Repo().salix(), + 'slackl': Repo().slackel() + } + + def repos(self): + ''' + View or enabled or disabled repositories + ''' + print('') + template(78) + print('{0}{1}{2}{3}{4}'.format( + '| Repo id', ' ' * 10, + 'Repo name', ' ' * 45, + 'Status')) + template(78) + for repo_id, repo_name in sorted(self.all_repos.iteritems()): + status, COLOR = 'disabled', color['RED'] + if repo_id in repositories: + status, COLOR = 'enabled', color['GREEN'] + print(' {0}{1}{2}{3}{4}{5:>15}{6}'.format( + repo_id, ' ' * (17 - len(repo_id)), + repo_name, ' ' * (45 - len(repo_name)), + COLOR, status, color['ENDC'])) + print("\nFor enable or disable repositories edit " + "'/etc/slpkg/slpkg.conf' file\n") + sys.exit(0) diff --git a/slpkg/repositories.py b/slpkg/repositories.py index 1af91211..ddd74de5 100644 --- a/slpkg/repositories.py +++ b/slpkg/repositories.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -59,7 +59,7 @@ class Repo(object): def alien(self): ''' - Alien repository + Alien's slackbuilds repository ''' return "http://www.slackware.com/~alien/slackbuilds/" @@ -74,3 +74,45 @@ class Repo(object): Studioware repository ''' return "http://studioware.org/files/packages/" + + def slackers(self): + ''' + Slackers.it repository + ''' + return "http://www.slackers.it/repository/" + + def slackonly(self): + ''' + Slackonly.com repository + ''' + return "https://slackonly.com/pub/packages/" + + def ktown(self): + ''' + Alien's ktown repository + ''' + return "http://alien.slackbook.org/ktown/" + + def multi(self): + ''' + Alien's multilib repository + ''' + return "http://www.slackware.com/~alien/multilib/" + + def slacke(self): + ''' + Slacke slacke{17|18} repository + ''' + return "http://ngc891.blogdns.net/pub/" + + def salix(self): + ''' + SalixOS salix repository + ''' + return "http://download.salixos.org/" + + def slackel(self): + ''' + Slackel.gr slackel repository + ''' + return "http://www.slackel.gr/repo/" diff --git a/slpkg/sbo/check.py b/slpkg/sbo/check.py index 8bc08937..f68777f2 100644 --- a/slpkg/sbo/check.py +++ b/slpkg/sbo/check.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -225,7 +225,7 @@ def order_list(upgrade_names): def store(dependencies): ''' - In the end lest a check of the packages that are on the list + In the end last a check of the packages that are on the list are already installed. ''' (upgrade_name, @@ -276,9 +276,9 @@ def view_packages(package_for_upgrade, upgrade_version, upgrade_arch): else: COLOR = color['RED'] count_installed += 1 - print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format( - COLOR, upg, color['ENDC'], " " * (38-len(upg)), color['GREEN'], - ver, color['ENDC'], " " * (17-len(ver)), arch, + print(" {0}{1}{2}{3} {4}{5}{6} {7}{8}{9}{10}".format( + COLOR, upg, color['ENDC'], " " * (37-len(upg)), color['GREEN'], + ver, color['ENDC'], " " * (16-len(ver)), arch, " " * (13-len(arch)), "SBo")) msg_upg = "package" msg_ins = msg_upg diff --git a/slpkg/sbo/compressed.py b/slpkg/sbo/compressed.py index 8b9f1822..2118f07f 100644 --- a/slpkg/sbo/compressed.py +++ b/slpkg/sbo/compressed.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/sbo/dependency.py b/slpkg/sbo/dependency.py index 27e7aab9..082f0157 100644 --- a/slpkg/sbo/dependency.py +++ b/slpkg/sbo/dependency.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/sbo/greps.py b/slpkg/sbo/greps.py index d0e7335f..c6f2b0e7 100644 --- a/slpkg/sbo/greps.py +++ b/slpkg/sbo/greps.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/sbo/read.py b/slpkg/sbo/read.py index 7d9f11e2..02011c56 100644 --- a/slpkg/sbo/read.py +++ b/slpkg/sbo/read.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/sbo/remove.py b/slpkg/sbo/remove.py index f7c78e8d..f400091b 100644 --- a/slpkg/sbo/remove.py +++ b/slpkg/sbo/remove.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/sbo/search.py b/slpkg/sbo/search.py index e7b4e2a5..8678cbf2 100644 --- a/slpkg/sbo/search.py +++ b/slpkg/sbo/search.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index b096f515..fd3b7af7 100644 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -260,10 +260,10 @@ def view_packages(*args): ''' View slackbuild packages with version and arch ''' - print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format( + print(" {0}{1}{2}{3} {4}{5}{6} {7}{8}{9}{10}".format( args[0], args[1], color['ENDC'], - " " * (38-len(args[1])), args[2], - " " * (17-len(args[2])), args[3], args[4], color['ENDC'], + " " * (37-len(args[1])), args[2], + " " * (16-len(args[2])), args[3], args[4], color['ENDC'], " " * (13-len(args[4])), "SBo")) diff --git a/slpkg/sbo/views.py b/slpkg/sbo/views.py index 7b49ff99..aa1d972d 100644 --- a/slpkg/sbo/views.py +++ b/slpkg/sbo/views.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/sizes.py b/slpkg/sizes.py index a99b5972..17ce2f5d 100644 --- a/slpkg/sizes.py +++ b/slpkg/sizes.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/slack/greps.py b/slpkg/slack/greps.py index e953e65a..81cf2fff 100644 --- a/slpkg/slack/greps.py +++ b/slpkg/slack/greps.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/slack/install.py b/slpkg/slack/install.py index 7a093d4d..13ce55de 100644 --- a/slpkg/slack/install.py +++ b/slpkg/slack/install.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -145,10 +145,10 @@ def views(install_all, comp_sum): else: COLOR = color['RED'] uni_sum += 1 - print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>12}{12}".format( + print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>12}{12}".format( COLOR, pkg_split[0], color['ENDC'], - " " * (25-len(pkg_split[0])), pkg_split[1], - " " * (19-len(pkg_split[1])), pkg_split[2], + " " * (24-len(pkg_split[0])), pkg_split[1], + " " * (18-len(pkg_split[1])), pkg_split[2], " " * (8-len(pkg_split[2])), pkg_split[3], " " * (7-len(pkg_split[3])), "Slack", comp, " K")) diff --git a/slpkg/slack/mirrors.py b/slpkg/slack/mirrors.py index 0f5e3912..8efa981e 100644 --- a/slpkg/slack/mirrors.py +++ b/slpkg/slack/mirrors.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py index 0293692a..61418560 100644 --- a/slpkg/slack/patches.py +++ b/slpkg/slack/patches.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -60,7 +60,7 @@ class Patches(object): if self.version == "stable": self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "patches/")).reading() - self.step = 100 + self.step = 10 else: self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "")).reading() self.step = 700 @@ -70,7 +70,8 @@ class Patches(object): Install new patches from official Slackware mirrors ''' try: - dwn_links, upgrade_all, comp_sum, uncomp_sum = self.store() + (pkg_for_upgrade, dwn_links, upgrade_all, comp_sum, + uncomp_sum) = self.store() sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC'])) if upgrade_all: @@ -85,7 +86,7 @@ class Patches(object): "Size")) template(78) print("Upgrading:") - views(upgrade_all, comp_sum) + views(pkg_for_upgrade, upgrade_all, comp_sum) unit, size = units(comp_sum, uncomp_sum) print("\nInstalling summary") print("=" * 79) @@ -119,30 +120,34 @@ class Patches(object): ''' Store and return packages for upgrading ''' - (dwn, upgrade, comp_sum, uncomp_sum) = ([] for i in range(4)) + (pkg_for_upgrade, dwn, upgrade, comp_sum, + uncomp_sum) = ([] for i in range(5)) data = slack_data(self.PACKAGES_TXT, self.step) black = BlackList().packages() for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]): - if find_package(split_package(name)[0] + "-", pkg_path): - if (not os.path.isfile(pkg_path + name[:-4]) and - split_package(name)[0] not in black): - dwn.append("{0}{1}/{2}".format(mirrors("", ""), loc, name)) - comp_sum.append(comp) - uncomp_sum.append(uncomp) - upgrade.append(name) - return [dwn, upgrade, comp_sum, uncomp_sum] + inst_pkg = find_package(split_package(name)[0] + "-", pkg_path) + if (inst_pkg and not os.path.isfile(pkg_path + name[:-4]) and + split_package(''.join(inst_pkg[0])) not in black): + dwn.append("{0}{1}/{2}".format(mirrors("", ""), loc, name)) + comp_sum.append(comp) + uncomp_sum.append(uncomp) + upgrade.append(name) + pkg_for_upgrade.append('{0}-{1}'.format( + split_package(''.join(inst_pkg[0]))[0], + split_package(''.join(inst_pkg[0]))[1])) + return [pkg_for_upgrade, dwn, upgrade, comp_sum, uncomp_sum] -def views(upgrade_all, comp_sum): +def views(pkg_for_upgrade, upgrade_all, comp_sum): ''' Views packages ''' - for upgrade, size in zip(upgrade_all, comp_sum): + for upg, upgrade, size in zip(pkg_for_upgrade, upgrade_all, comp_sum): pkg_split = split_package(upgrade[:-4]) - print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>12}{12}".format( - color['YELLOW'], pkg_split[0], color['ENDC'], - " " * (25-len(pkg_split[0])), pkg_split[1], - " " * (19-len(pkg_split[1])), pkg_split[2], + print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>12}{12}".format( + color['YELLOW'], upg, color['ENDC'], + " " * (24-len(upg)), pkg_split[1], + " " * (18-len(pkg_split[1])), pkg_split[2], " " * (8-len(pkg_split[2])), pkg_split[3], " " * (7-len(pkg_split[3])), "Slack", size, " K")) @@ -176,6 +181,16 @@ def kernel(upgrade_all): ''' for core in upgrade_all: if "kernel" in core: - print("The kernel has been upgraded, reinstall `lilo` ...") - subprocess.call("lilo", shell=True) - break + if default_answer == "y": + answer = default_answer + else: + print("") + template(78) + print("| {0}*** HIGHLY recommended reinstall 'LILO' " + "***{1}".format(color['RED'], color['ENDC'])) + template(78) + answer = raw_input("\nThe kernel has been upgraded, " + "reinstall `LILO` [Y/n]? ") + if answer in ['y', 'Y']: + subprocess.call("lilo", shell=True) + break diff --git a/slpkg/slack/slack_version.py b/slpkg/slack/slack_version.py index 75c866a7..1dd1e55f 100644 --- a/slpkg/slack/slack_version.py +++ b/slpkg/slack/slack_version.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/slpkg_update.py b/slpkg/slpkg_update.py index 4ec86aae..a57648e8 100644 --- a/slpkg/slpkg_update.py +++ b/slpkg/slpkg_update.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/splitting.py b/slpkg/splitting.py index 5f7a5619..61d8c507 100644 --- a/slpkg/splitting.py +++ b/slpkg/splitting.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -21,8 +21,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from slack.slack_version import slack_ver - def split_package(package): ''' @@ -30,25 +28,12 @@ def split_package(package): arch and build tag. ''' split = package.split("-") - sbo = "_SBo" - slack = "_slack{0}".format(slack_ver()) - rlw = "_rlw" - alien = "alien" - slacky = "sl" - studio = "se" build = split[-1] - if build.endswith(sbo): - build = split[-1][:-4] # and remove .t?z extension - if build.endswith(slack): - build = split[-1][:-len(slack)] - elif build.endswith(rlw): - build = split[-1][:-len(rlw)] - elif build.endswith(alien): - build = split[-1][:-len(alien)] - elif build.endswith(slacky): - build = split[-1][:-len(slacky)] - elif build.endswith(studio): - build = split[-1][:-len(studio)] + build_a, build_b = '', '' + build_a = build[:1] + if build[1:2].isdigit(): + build_b = build[1:2] + build = build_a + build_b arch = split[-2] ver = split[-3] name = "-".join(split[:-3]) diff --git a/slpkg/toolbar.py b/slpkg/toolbar.py index 7a19690c..bb2b43d8 100644 --- a/slpkg/toolbar.py +++ b/slpkg/toolbar.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/tracking.py b/slpkg/tracking.py index aecb62cf..79b825d5 100644 --- a/slpkg/tracking.py +++ b/slpkg/tracking.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -21,15 +21,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os import sys from messages import ( - template, - slacky_error + template ) from __metadata__ import ( - lib_path, pkg_path, color, sp @@ -51,10 +48,6 @@ def track_dep(name, repo): if allready installed and color red if not installed. ''' - if (not os.path.isfile(lib_path + "slack_repo/PACKAGES.TXT") and - repo == "slacky"): - slacky_error() - sys.exit(0) sys.stdout.write("{0}Reading package lists ...{1}".format(color['GREY'], color['ENDC'])) sys.stdout.flush() diff --git a/slpkg/url_read.py b/slpkg/url_read.py index 9ff3bac2..4c05a2c6 100644 --- a/slpkg/url_read.py +++ b/slpkg/url_read.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg diff --git a/slpkg/version.py b/slpkg/version.py index dfee0b7b..c92acf60 100644 --- a/slpkg/version.py +++ b/slpkg/version.py @@ -6,7 +6,7 @@ # Copyright 2014 Dimitris Zlatanidis # All rights reserved. -# Utility for easy management packages in Slackware +# Slpkg is a user-friendly package manager for Slackware installations # https://github.com/dslackw/slpkg @@ -21,6 +21,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import sys + from __metadata__ import ( __version__, __license__, @@ -35,3 +37,4 @@ def prog_version(): print("Version : {0}".format(__version__)) print("Licence : {0}".format(__license__)) print("Email : {0}".format(__email__)) + sys.exit(0)