diff --git a/CHANGELOG b/CHANGELOG index 219a6af2..dc860e6f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,11 @@ +Version 2.0.7 +22-11-2014 + +[Feature] - Add more option in slpkg.conf file. + - Add slackware-mirrors file in /etc/slpkg + +[Updated] - Fix upgrade Slackware packages if installed. + Version 2.0.6 18-11-2014 diff --git a/INSTALL b/INSTALL index d89a9efd..5812fa58 100644 --- a/INSTALL +++ b/INSTALL @@ -17,30 +17,10 @@ There are mainly five ways: Untar or unzip the archive, cd in slpkg-?.?.? directory. Run install.sh in this directory `./install.sh` and slpkg auto-installed. -2) Using the SlackBuild script in the directory slpkg-?.?.?/slackbuild. +2) Download slpkg package from slackbuilds.org. - Untar the archive `tar xvf slpkg-?.?.?.tar.gz` - - Copy the source tar archive `cp slpkg-?.?.?.tar.gz slpkg-?.?.?/slackbuild`, - change directory `cd slpkg-?.?.?/slackbuild`, fix the version if need in - SlackBuild.slpkg give execution permissions to script `chmod +x SlackBuild.slpkg` - and run as root ./SlackBuild.slpkg. - - SlackBuild package created so install package with `upgradepkg --install-new - /tmp/slpkg-?.?.?-x86_64-1_dsw.tgz` (x86_64 for Slackware64). - -3) Using pip: - - `pip install slpkg` or upgrade `pip install --upgrade slpkg` - -4) Download slpkg package from slackbuilds.org and run the second procedure described above. - -5) Download binary package from sourceforge: +3) Download binary package from sourceforge: https://sourceforge.net/projects/slpkg/ and use Slackware command `upgradepkg --install-new ` - - -Proposed mode if you want to have installed the most updated version is 1 or 2 and 3 -process. diff --git a/PKG-INFO b/PKG-INFO index 4a2d7b12..3248c94d 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: slpkg -Version: 2.0.6 +Version: 2.0.7 Author: dslackw Author-email: d zlatanidis at gmail com Maintainer: dslackw diff --git a/README.rst b/README.rst index a625b885..c84d0155 100644 --- a/README.rst +++ b/README.rst @@ -11,9 +11,9 @@ Latest Release: -- Version: 2.0.6 +- Version: 2.0.7 - `Package `_ -- `Source `_ +- `Source `_ - `CHANGELOG `_ .. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png @@ -32,10 +32,20 @@ Python language. It's use is for managing packages in Slackware linux distributi Supported Repositories: - SBo - `slackbuilds.org `_ + Arch: {x86, x86_64} + Versions: {11.0, 12.0, 12.1, 12.2, 13.0, 13.1, 13.37, 14.0, 14.1} - Slack - `slackware.com `_ + 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 - `alien bob `_ + 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 - `slacky.eu `_ + Arch: {x86, x86_64} + Versions: {11.0, 12.0, 12.1, 12.2, 13.0, 13.1, 13.37, 14.0, 14.1} - Robby's - `rworkman's `_ + Arch: {x86, x86_64} + Versions: {11.0, 12.0, 12.1, 12.2, 13.0, 13.1, 13.37, 14.0, 14.1} Slpkg works in accordance with the standards of the organization slackbuilds.org to builds packages. Also uses the Slackware linux instructions for installation, @@ -102,29 +112,38 @@ Untar the archive and run install.sh script: .. code-block:: bash - $ tar xvf slpkg-2.0.6.tar.gz - $ cd slpkg-2.0.6 + $ tar xvf slpkg-2.0.7.tar.gz + $ cd slpkg-2.0.7 $ ./install.sh -Using `pip `_ : - -.. code-block:: bash - - $ pip install --upgrade slpkg - - uninstall: - - $ pip uninstall slpkg - -Using Slackware command: +From SourceForge: Download binary package from `SourceForge `_ +Upgrade +------------- + +In each upgrade should track the configuration files in the file '/etc/slpkg' for +new updates. + + Slackware Current ----------------- For Slackware 'current' users must change the variable VERSION in /etc/slpkg.conf file. +.. code-block:: bash + +$ slpkg -g --config=nano + + +Slackware Mirrors +----------------- + +Slpkg uses the central mirror "http://mirrors.slackware.com/slackware/" +to find the nearest one. If however for some reason this troublesome +please edit the file in /etc/slpkg/slackware-mirrors + Command Line Tool Usage ----------------------- diff --git a/conf/slackware-mirrors b/conf/slackware-mirrors new file mode 100644 index 00000000..69ede6bc --- /dev/null +++ b/conf/slackware-mirrors @@ -0,0 +1,183 @@ +# List of Slackware Mirrors copy from : +# http://mirrors.slackware.com/mirrorlist/ +# +# slackware-mirrors file is part of slpkg. +# +# Copyright 2014 Dimitris Zlatanidis +# All rights reserved. +# +# Utility for easy management packages in Slackware +# +# https://github.com/dslackw/slpkg +# +# Slpkg is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# END OF LEGAL NOTICE +# +# +# Slpkg uses the central mirror "http://mirrors.slackware.com/slackware/" +# to find the nearest one. If however for some reason this troublesome +# 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: Wed Nov 19 05:47:02 UTC 2014 +# +# Available http mirrors: +# +# au http://ftp.swin.edu.au/slackware/ +# au http://mirror.aarnet.edu.au/pub/slackware/ +# au http://mirror.internode.on.net/pub/slackware/ +# au http://syd.mirror.rackspace.com/slackware/ +# be http://ftp.belnet.be/ftp.slackware.com/ +# bg http://mirrors.unixsol.org/slackware/ +# bg http://slackware.telecoms.bg/slackware/ +# bg http://x.ultranet.biz/slackware/ +# br http://linorg.usp.br/slackware/ +# br http://mirror.ic.ufmt.br/slackware/ +# ca http://mirror.csclub.uwaterloo.ca/slackware/ +# ca http://mirror.its.dal.ca/slackware/ +# cn http://mirror.bjtu.edu.cn/slackware/ +# cz http://mirror.oss.maxcdn.com/slackware/ +# de http://ftp5.gwdg.de/pub/linux/slackware/ +# de http://mirror.netcologne.de/slackware/ +# ec http://mirror.cedia.org.ec/slackware/ +# fr http://slackware.mirrors.ovh.net/ftp.slackware.com/ +# gb http://lon.mirror.rackspace.com/slackware/ +# gb http://mirror.bytemark.co.uk/slackware/ +# gb http://slackware.org.uk/slackware/ +# gb http://www.mirrorservice.org/sites/ftp.slackware.com/pub/slackware/ +# gr http://ftp.cc.uoc.gr/mirrors/linux/slackware/ +# hk http://hkg.mirror.rackspace.com/slackware/ +# hr http://mirror.slackware.hr/slackware/ +# id http://iso.ukdw.ac.id/slackware/ +# id http://mirrors.gudangteknologi.com/slackware +# id http://repo.ukdw.ac.id/slackware/ +# ie http://ftp.heanet.ie/mirrors/ftp.slackware.com/pub/slackware/ +# it http://slackware.muzzy.it/ +# jp http://ftp.nara.wide.ad.jp/pub/Linux/slackware/ +# lt http://atviras.lt/veidrodziai/slackware/ +# lt http://slackware.laukas.lt +# mk http://slackware.blizoo.mk/slackware/ +# nc http://mirror.lagoon.nc/pub/slackware/ +# nl http://ftp.bit.nl/mirror/slackware/ +# nl http://mirror.nl.leaseweb.net/slackware/ +# nl http://slackware.bokxing-it.nl/mirror/ +# no http://ftp.slackware.no/slackware/ +# nz http://ftp.slackware.org.nz/slackware/ +# ph http://mirror.pregi.net/slackware/ +# pl http://ftp.slackware.pl/pub/slackware/ +# pl http://piotrkosoft.net/pub/mirrors/ftp.slackware.com/pub/slackware/ +# pl http://sunsite.icm.edu.pl/pub/Linux/slackware/ +# pt http://darkstar.ist.utl.pt/slackware/ +# pt http://ftp.rnl.tecnico.ulisboa.pt/pub/slackware/ +# ru http://mirror.corbina.net/slackware/ +# ru http://mirror.yandex.ru/slackware/ +# ru http://slackware.tsu.ru/slackware/ +# sk http://mirror.wheel.sk/slackware/ +# tr http://ftp.linux.org.tr/slackware/ +# tw http://ftp.yzu.edu.tw/Linux/Slackware/ +# ua http://ifconfig.com.ua/slackware/ +# ua http://mirror.linux.lg.ua/slackware/ +# ua http://mirrors.nix.org.ua/linux/slackware/ +# us http://carroll.cac.psu.edu/pub/linux/distributions/slackware +# us http://dfw.mirror.rackspace.com/slackware/ +# us http://ftp.gtlib.gatech.edu/pub/slackware/ +# us http://ftp.slackware.com/pub/slackware/ +# us http://lug.mtu.edu/slackware/ +# us http://mirror.lug.udel.edu/pub/slackware/ +# us http://mirror.metrocast.net/slackware/ +# us http://mirror.nexcess.net/slackware/ +# us http://mirror.pw/slackware/ +# us http://mirror.quintex.com/slackware/ +# us http://mirrors.kingrst.com/slackware/ +# us http://mirrors.xmission.com/slackware/ +# us http://mirrors1.kernel.org/slackware/ +# us http://mirrors2.kernel.org/slackware/ +# us http://mirrors3.kernel.org/slackware/ +# us http://mirrors4.kernel.org/slackware/ +# us http://slackblog.com/slackware/ +# us http://slackbuilds.org/mirror/slackware/ +# us http://slackware.cs.utah.edu/ +# us http://slackware.mirrorcatalogs.com/ +# us http://slackware.mirrors.tds.net/pub/slackware/ +# us http://taper.alienbase.nl/mirrors/slackware/ +# za http://ftp.is.co.za/mirror/ftp.slackware.com/pub/ +# za http://ftp.wa.co.za/pub/slackware/ +# za http://slackware.mirror.ac.za/ +# +# Available ftp mirrors: +# +# au ftp://ftp.swin.edu.au/slackware/ +# au ftp://mirror.aarnet.edu.au/pub/slackware/ +# au ftp://mirror.internode.on.net/pub/slackware/ +# au ftp://syd.mirror.rackspace.com/slackware/ +# be ftp://ftp.belnet.be/mirror/ftp.slackware.com/ +# bg ftp://mirrors.unixsol.org/slackware/ +# bg ftp://slackware.telecoms.bg/slackware/ +# br ftp://linorg.usp.br/slackware/ +# ca ftp://mirror.csclub.uwaterloo.ca/slackware/ +# ca ftp://mirror.its.dal.ca/slackware/ +# cz ftp://mirror.oss.maxcdn.com/slackware/ +# de ftp://ftp5.gwdg.de/pub/linux/slackware/ +# de ftp://mirror.netcologne.de/slackware/ +# ec ftp://mirror.cedia.org.ec/slackware/ +# fr ftp://slackware.mirrors.ovh.net/ftp.slackware.com/ +# gb ftp://ftp.mirrorservice.org/sites/ftp.slackware.com/pub/slackware/ +# gb ftp://ftp.slackware.org.uk/slackware +# gb ftp://lon.mirror.rackspace.com/slackware/ +# gb ftp://mirror.bytemark.co.uk/slackware/ +# gr ftp://ftp.cc.uoc.gr/mirrors/linux/slackware/ +# hk ftp://hkg.mirror.rackspace.com/slackware/ +# hr ftp://mirror.slackware.hr/slackware/ +# ie ftp://ftp.heanet.ie/mirrors/ftp.slackware.com/pub/slackware/ +# it ftp://slackware.muzzy.it/slackware/ +# jp ftp://ftp.nara.wide.ad.jp/pub/Linux/slackware/ +# nc ftp://mirror.lagoon.nc/pub/slackware/ +# nl ftp://ftp.bit.nl/mirror/slackware/ +# nl ftp://mirror.nl.leaseweb.net/slackware/ +# no ftp://ftp.slackware.no/slackware/ +# nz ftp://ftp.slackware.org.nz/slackware/ +# ph ftp://mirror.pregi.net/slackware/ +# pl ftp://ftp.piotrkosoft.net/pub/mirrors/ftp.slackware.com/pub/slackware/ +# pl ftp://ftp.slackware.pl/pub/slackware/ +# pl ftp://sunsite.icm.edu.pl/pub/Linux/slackware/ +# pt ftp://darkstar.ist.utl.pt/pub/slackware/ +# pt ftp://ftp.rnl.tecnico.ulisboa.pt/pub/slackware/ +# ru ftp://mirror.corbina.net/slackware/ +# ru ftp://mirror.yandex.ru/slackware/ +# ru ftp://slackware.tsu.ru/slackware/ +# tr ftp://ftp.linux.org.tr/slackware/ +# tw ftp://ftp.yzu.edu.tw/Linux/Slackware/ +# ua ftp://ifconfig.com.ua/pub/Mirror/slackware/ +# ua ftp://mirrors.nix.org.ua/linux/slackware/ +# us ftp://carroll.cac.psu.edu/pub/linux/distributions/slackware +# us ftp://dfw.mirror.rackspace.com/slackware/ +# us ftp://ftp.gtlib.gatech.edu/pub/slackware +# us ftp://ftp.lug.udel.edu/pub/slackware/ +# us ftp://ftp.slackware.com/pub/slackware/ +# us ftp://lug.mtu.edu/slackware/ +# us ftp://mirror.nexcess.net/slackware/ +# us ftp://mirror.quintex.com/slackware/ +# us ftp://mirrors.xmission.com/slackware/ +# us ftp://mirrors1.kernel.org/slackware/ +# us ftp://mirrors2.kernel.org/slackware/ +# us ftp://mirrors3.kernel.org/slackware/ +# us ftp://mirrors4.kernel.org/slackware/ +# us ftp://slackware.cs.utah.edu/slackware/ +# us ftp://slackware.mirrorcatalogs.com/ +# us ftp://slackware.mirrors.tds.net/pub/slackware +# 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/ diff --git a/conf/slpkg.conf b/conf/slpkg.conf index a3bd262f..4f90c3ee 100644 --- a/conf/slpkg.conf +++ b/conf/slpkg.conf @@ -46,3 +46,11 @@ DEL_BUILD=off # Keep build log file if SBO_BUILD_LOG is 'on'. SBO_BUILD_LOG=on + +# Define default answer to slpkg questions. +# Choose 'y' if you do not want to questions. +DEFAULT_ANSWER=n + +# Define default answer for the removal of dependencies. +# Choose 'y' if you do not want to question. +REMOVE_DEPS_ANSWER=n diff --git a/install.sh b/install.sh index 9e837a54..88b05d1b 100755 --- a/install.sh +++ b/install.sh @@ -21,41 +21,25 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=slpkg -VERSION=${VERSION:-2.0.6} +VERSION=${VERSION:-2.0.7} TAG=${TAG:-_dsw} -cd .. # Installation script. # With this script allows you to install the slpkg as a package SlackBuild. # Select archive to copy in slackbuild directory # support wget download. -if [ -f $PRGNAM-$VERSION.zip ]; then - cp $PRGNAM-$VERSION.zip $PRGNAM-$VERSION/slackbuild - cd $PRGNAM-$VERSION/slackbuild - chmod +x $PRGNAM.SlackBuild - ./$PRGNAM.SlackBuild - rm $PRGNAM-$VERSION.zip -elif [ -f v$VERSION.zip ]; then - cp v$VERSION.zip $PRGNAM-$VERSION/slackbuild - cd $PRGNAM-$VERSION/slackbuild - chmod +x $PRGNAM.SlackBuild - ./$PRGNAM.SlackBuild - rm v$VERSION.zip +ARCHIVES="$PRGNAM-$VERSION.tar.gz $PRGNAM-$VERSION.zip v$VERSION.tar.gz v$VERSION.zip" +cd .. +for file in $ARCHIVES; do + if [ -f $file ]; then + cp $file $PRGNAM-$VERSION/slackbuild + cd $PRGNAM-$VERSION/slackbuild + chmod +x $PRGNAM.SlackBuild + ./$PRGNAM.SlackBuild + rm $file + fi +done -elif [ -f $PRGNAM-$VERSION.tar.gz ]; then - cp $PRGNAM-$VERSION.tar.gz $PRGNAM-$VERSION/slackbuild - cd $PRGNAM-$VERSION/slackbuild - chmod +x $PRGNAM.SlackBuild - ./$PRGNAM.SlackBuild - rm $PRGNAM-$VERSION.tar.gz - -else - cp v$VERSION.tar.gz $PRGNAM-$VERSION/slackbuild - cd $PRGNAM-$VERSION/slackbuild - chmod +x $PRGNAM.SlackBuild - ./$PRGNAM.SlackBuild - rm v$VERSION.tar.gz -fi # install or upgrade with new version -upgradepkg --install-new /tmp/$PRGNAM-$VERSION-*$TAG.tgz +upgradepkg --install-new /tmp/$PRGNAM-$VERSION-*$TAG.t?z diff --git a/man/slpkg.8 b/man/slpkg.8 index 52364090..4e071936 100644 --- a/man/slpkg.8 +++ b/man/slpkg.8 @@ -186,6 +186,9 @@ For example: /etc/slpkg/blacklist List of packages to skip +/etc/slpkg/slackware-mirrors + List of Slackware Mirrors + /var/log/slpkg ChangeLog.txt repositories files SlackBuilds logs and dependencies files diff --git a/setup.py b/setup.py index 33ca09e2..83a4ffa5 100755 --- a/setup.py +++ b/setup.py @@ -26,7 +26,11 @@ import sys import gzip import shutil -from slpkg.__metadata__ import __version__, __email__, __author__ +from slpkg.__metadata__ import ( + __version__, + __email__, + __author__ +) try: from setuptools import setup @@ -81,15 +85,13 @@ if "install" in sys.argv: os.chmod(man_path, int("444", 8)) conf_path = "/etc/slpkg/" - conf_file = "conf/slpkg.conf" - black_file = "conf/blacklist" + conf_file = [ + 'conf/slpkg.conf', + 'conf/blacklist', + 'conf/slackware-mirrors' + ] if not os.path.exists(conf_path): os.system("mkdir -p {0}".format(conf_path)) - # slpkg.conf file - if not os.path.isfile(conf_path + conf_file): - print("Installing slpkg configuration file") - shutil.copy2(conf_file, conf_path) - # blacklist file - if not os.path.isfile(conf_path + black_file): - print("Installing blacklist configuration file") - shutil.copy2(black_file, conf_path) + for conf in conf_file: + print("Installing '{0}' file".format(conf.split("/")[-1])) + shutil.copy2(conf, conf_path) diff --git a/slackbuild/README b/slackbuild/README deleted file mode 100644 index ef8128b8..00000000 --- a/slackbuild/README +++ /dev/null @@ -1,13 +0,0 @@ -Slpkg is Open Source software written in Python language. -It's use is for managing packages in Slackware linux -distribution. Supported Repositories: - -- SBo - slackbuilds.org -- Slack - slackware.com -- Alien - alien bob -- Slacky - slacky.eu -- Robby's - rworkman's - -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. diff --git a/slackbuild/doinst.sh b/slackbuild/doinst.sh index 236b3a62..c06beaa6 100644 --- a/slackbuild/doinst.sh +++ b/slackbuild/doinst.sh @@ -8,7 +8,10 @@ config() { fi } -config /etc/slpkg/slpkg.conf.new +CONFIGS="slpkg.conf blacklist slackware-mirrors" +for file in $CONFIGS; do + config /etc/slpkg/${file}.new +done if [ -x /usr/bin/update-desktop-database ]; then /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 diff --git a/slackbuild/slpkg.SlackBuild b/slackbuild/slpkg.SlackBuild index da989b78..f34f5449 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.0.6} +VERSION=${VERSION:-2.0.7} BUILD=${BUILD:-1} TAG=${TAG:-_dsw} @@ -78,15 +78,11 @@ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | gr | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true mkdir -p $PKG/etc/slpkg -# check if blacklist file if already exist in /etc/slpkg -if [ ! -f "/etc/$PRGNAM/blacklist" ]; then - mkdir -p $PKG/etc/$PRGNAM - install -D -m0644 conf/blacklist $PKG/etc/$PRGNAM/blacklist -fi - -# install configuration file -mkdir -p $PKG/etc/slpkg -install -D -m0644 conf/slpkg.conf $PKG/etc/slpkg/slpkg.conf.new +# install configurations files +CONFIGS="slpkg.conf blacklist slackware-mirrors" +for file in $CONFIGS; do + install -D -m0644 conf/$file $PKG/etc/slpkg/${file}.new +done # install man page mkdir -p $PKG/usr/man/man8 diff --git a/slackbuild/slpkg.info b/slackbuild/slpkg.info deleted file mode 100644 index 9c63aa5a..00000000 --- a/slackbuild/slpkg.info +++ /dev/null @@ -1,10 +0,0 @@ -PRGNAM="slpkg" -VERSION="2.0.6" -HOMEPAGE="https://github.com/dslackw/slpkg" -DOWNLOAD="https://github.com/dslackw/slpkg/archive/v2.0.6.tar.gz" -MD5SUM="" -DOWNLOAD_x86_64="" -MD5SUM_x86_64="" -REQUIRES="" -MAINTAINER="Dimitris Zlatanidis" -EMAIL="d.zlatanidis@gmail.com" diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index ae453de2..353e3156 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# __metadata__.py +# __metadata__.py file is part of slpkg. # Copyright 2014 Dimitris Zlatanidis # All rights reserved. @@ -24,12 +24,11 @@ import os import getpass -from config import config_file from messages import s_user __all__ = "slpkg" __author__ = "dslackw" -__version_info__ = (2, 0, 6) +__version_info__ = (2, 0, 7) __version__ = "{0}.{1}.{2}".format(*__version_info__) __license__ = "GNU General Public License v3 (GPLv3)" __email__ = "d.zlatanidis@gmail.com" @@ -39,19 +38,6 @@ s_user(getpass.getuser()) # temponary path tmp = "/tmp/" -if not os.path.exists("/etc/slpkg/"): - os.mkdir("/etc/slpkg/") - -if not os.path.isfile("/etc/slpkg/slpkg.conf"): - with open("/etc/slpkg/slpkg.conf", "w") as conf: - for line in config_file(): - conf.write(line) - conf.close() - -f = open("/etc/slpkg/slpkg.conf", "r") -conf = f.read() -f.close() - # Default configuration values slack_rel = "stable" build_path = "/tmp/slpkg/build/" @@ -61,27 +47,37 @@ del_all = "on" sbo_check_md5 = "on" del_build = "off" sbo_build_log = "on" +default_answer = "n" +remove_deps_answer = "n" -for line in conf.splitlines(): - line = line.lstrip() - if line.startswith("VERSION"): - slack_rel = line[8:].strip() - if not slack_rel: - slack_rel = "stable" - if line.startswith("BUILD"): - build_path = line[6:].strip() - if line.startswith("PACKAGES"): - slpkg_tmp_packages = line[9:].strip() - if line.startswith("PATCHES"): - slpkg_tmp_patches = line[8:].strip() - if line.startswith("DEL_ALL"): - del_all = line[8:].strip() - if line.startswith("DEL_BUILD"): - del_build = line[10:].strip() - if line.startswith("SBO_CHECK_MD5"): - sbo_check_md5 = line[14:].strip() - if line.startswith("SBO_BUILD_LOG"): - sbo_build_log = line[14:].strip() +if os.path.isfile("/etc/slpkg/slpkg.conf"): + f = open("/etc/slpkg/slpkg.conf", "r") + conf = f.read() + f.close() + for line in conf.splitlines(): + line = line.lstrip() + if line.startswith("VERSION"): + slack_rel = line[8:].strip() + if not slack_rel: + slack_rel = "stable" + if line.startswith("BUILD"): + build_path = line[6:].strip() + if line.startswith("PACKAGES"): + slpkg_tmp_packages = line[9:].strip() + if line.startswith("PATCHES"): + slpkg_tmp_patches = line[8:].strip() + if line.startswith("DEL_ALL"): + del_all = line[8:].strip() + if line.startswith("DEL_BUILD"): + del_build = line[10:].strip() + if line.startswith("SBO_CHECK_MD5"): + sbo_check_md5 = line[14:].strip() + if line.startswith("SBO_BUILD_LOG"): + sbo_build_log = line[14:].strip() + if line.startswith("DEFAULT_ANSWER"): + default_answer = line[15:].strip() + if line.startswith("REMOVE_DEPS_ANSWER"): + remove_deps_answer = line[19:].strip() # repositories repositories = [ @@ -107,8 +103,5 @@ log_path = "/var/log/slpkg/" # packages log files path pkg_path = "/var/log/packages/" -# blacklist conf path -bls_path = "/etc/slpkg/" - # computer architecture arch = os.uname()[4] diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py index 800135ea..9a52da3d 100755 --- a/slpkg/blacklist.py +++ b/slpkg/blacklist.py @@ -21,9 +21,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os - -from __metadata__ import bls_path from colors import ( RED, GREEN, @@ -37,56 +34,8 @@ class BlackList(object): in blacklist file. ''' def __init__(self): - ''' - Initialization blacklist file if not exist in /etc/slpkg - create it by default. - ''' - blacklist_conf = [ - "# This is the blacklist file. Each package listed here may " + - "not be\n", - "# installed be upgraded be find or deleted.\n", - "# NOTE: The settings here affect all repositories.\n", - "#\n", - "# An example syntax is as follows:\n", - "# add a package from SBo repository:\n", - "# brasero\n", - "#\n", - "# Add package from slackware repository:\n", - "# example add package 'wicd-1.7.2.4-x86_64-4.txz':\n", - "# wicd\n", - "#\n", - "# Sometimes the automatic kernel update creates problems " + - "because you\n", - "# may need to file intervention 'lilo'. The slpkg automatically " + - "detects\n", - "# if the core has been upgraded and running 'lilo'. If you want " + - "to avoid\n", - "# any problems uncomment the lines below.\n", - "#\n", - "# kernel-firmware\n", - "# kernel-generic\n", - "# kernel-generic-smp\n", - "# kernel-headers\n", - "# kernel-huge\n", - "# kernel-huge-smp\n", - "# kernel-modules\n", - "# kernel-modules-smp\n", - "# kernel-source\n" - "#\n", - "#\n", - "# aaa_elflibs can't be updated.\n", - "aaa_elflibs\n" - ] self.quit = False - self.blackfile = bls_path + "blacklist" - if not os.path.exists(bls_path): - os.mkdir(bls_path) - if not os.path.isfile(self.blackfile): - with open(self.blackfile, "w") as conf: - for line in blacklist_conf: - conf.write(line) - conf.close() - + self.blackfile = "/etc/slpkg/blacklist" f = open(self.blackfile, "r") self.black_conf = f.read() f.close() diff --git a/slpkg/config.py b/slpkg/config.py index 8837af54..3fa06fb2 100755 --- a/slpkg/config.py +++ b/slpkg/config.py @@ -21,7 +21,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import os import subprocess from colors import ( @@ -30,71 +29,6 @@ from colors import ( ) -def config_file(): - slpkg_conf = [ - "# Configuration file for slpkg\n", - "\n", - "# slpkg.conf file is part of slpkg.\n", - "\n", - "# Copyright 2014 Dimitris Zlatanidis \n", - "# All rights reserved.\n", - "\n", - "# Utility for easy management packages in Slackware\n", - "\n", - "# https://github.com/dslackw/slpkg\n", - "\n", - "# Slpkg is free software: you can redistribute it and/or modify\n", - "# it under the terms of the GNU General Public License as published " + - "by\n", - "# the Free Software Foundation, either version 3 of the License, or\n", - "# (at your option) any later version.\n", - "# This program is distributed in the hope that it will be useful,\n", - "# but WITHOUT ANY WARRANTY; without even the implied warranty of\n", - "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n", - "# GNU General Public License for more details.\n", - "# You should have received a copy of the GNU General Public License\n", - "# along with this program. If not, see .\n", - "\n", - "# Slackware version 'stable' or 'current'.\n", - "VERSION=stable\n", - "\n", - "# Build directory for repository slackbuilds.org. In this directory\n", - "# downloaded sources and scripts for building.\n", - "BUILD=/tmp/slpkg/build/\n", - "\n", - "# If SBO_CHECK_MD5 is 'on' the system will check all downloaded\n", - "# sources from SBo repository.\n", - "SBO_CHECK_MD5=on\n", - "\n", - "# Download directory for others repositories that use binaries files" + - "\n", - "# for installation.\n", - "PACKAGES=/tmp/slpkg/packages/\n", - "\n", - "# Download directory for Slackware patches file.\n", - "PATCHES=/tmp/slpkg/patches/\n", - "\n", - "# Delete all downloaded files if DEL_ALL is 'on'.\n", - "DEL_ALL=on\n", - "\n", - "# Delete build directory after each process if DEL_BUILD is 'on'.\n", - "DEL_BUILD=off\n", - "\n", - "# Keep build log file if SBO_BUILD_LOG is 'on'.\n", - "SBO_BUILD_LOG=on\n" - ] - - if not os.path.exists("/etc/slpkg"): - os.mkdir("/etc/slpkg") - if not os.path.isfile("/etc/slpkg/slpkg.conf"): - with open("/etc/slpkg/slpkg.conf", "w") as conf: - for line in slpkg_conf: - conf.write(line) - conf.close() - return slpkg_conf - - class Config(object): def __init__(self): @@ -113,7 +47,9 @@ class Config(object): 'PATCHES', 'DEL_ALL', 'DEL_BUILD', - 'SBO_BUILD_LOG' + 'SBO_BUILD_LOG', + 'DEFAULT_ANSWER', + 'REMOVE_DEPS_ANSWER' ] f = open(self.config_file, "r") read_conf = f.read() @@ -129,5 +65,4 @@ class Config(object): ''' Edit configuration file ''' - subprocess.call("{0} {1}".format(editor, self.config_file), - shell=True) + subprocess.call("{0} {1}".format(editor, self.config_file), shell=True) diff --git a/slpkg/init.py b/slpkg/init.py index d83ee012..150de9b9 100755 --- a/slpkg/init.py +++ b/slpkg/init.py @@ -196,7 +196,6 @@ class Initialization(object): os.remove("{0}{1}".format(args[3], args[4])) os.remove("{0}{1}".format(args[0], args[1])) print("\nNEWS in " + args[1]) - print("slpkg ...initialization") sys.stdout.write("Files re-created ...") sys.stdout.flush() for fu in args[5].split(): diff --git a/slpkg/others/check.py b/slpkg/others/check.py index 1d52cc44..b7590083 100755 --- a/slpkg/others/check.py +++ b/slpkg/others/check.py @@ -38,7 +38,8 @@ from slpkg.colors import ( from slpkg.__metadata__ import ( pkg_path, lib_path, - slpkg_tmp_packages + slpkg_tmp_packages, + default_answer ) from slpkg.pkg.manager import PackageManager @@ -122,8 +123,11 @@ class OthersUpgrade(object): unit[0])) print("After this process, {0} {1} of additional disk " "space will be used.{2}".format(size[1], unit[1], ENDC)) - read = raw_input("\nWould you like to upgrade [Y/n]? ") - if read in ['Y', 'y']: + if default_answer == "y": + answer = default_answer + else: + answer = raw_input("\nWould you like to continue [Y/n]? ") + if answer in ['y', 'Y']: upgrade_all.reverse() packages_dwn(self.tmp_path, dwn_links) upgrade(self.tmp_path, upgrade_all) diff --git a/slpkg/others/greps.py b/slpkg/others/greps.py index a294eaa9..299ffbeb 100755 --- a/slpkg/others/greps.py +++ b/slpkg/others/greps.py @@ -26,7 +26,6 @@ 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 @@ -178,6 +177,7 @@ class Requires(object): 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(): diff --git a/slpkg/others/install.py b/slpkg/others/install.py index 18c9e043..9f25afdb 100755 --- a/slpkg/others/install.py +++ b/slpkg/others/install.py @@ -45,7 +45,8 @@ from slpkg.__metadata__ import ( pkg_path, lib_path, log_path, - slpkg_tmp_packages + slpkg_tmp_packages, + default_answer ) from slpkg.pkg.find import find_package @@ -146,8 +147,12 @@ class OthersInstall(object): print("After this process, {0} {1} of additional disk " "space will be used.{2}".format(size[1], unit[1], ENDC)) - read = raw_input("\nWould you like to install [Y/n]? ") - if read in ['Y', 'y']: + 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() packages_dwn(self.tmp_path, dwn_links) install(self.tmp_path, install_all) diff --git a/slpkg/pkg/build.py b/slpkg/pkg/build.py index 7066556a..f52fbe20 100755 --- a/slpkg/pkg/build.py +++ b/slpkg/pkg/build.py @@ -42,7 +42,8 @@ from slpkg.messages import ( from slpkg.__metadata__ import ( log_path, sbo_build_log, - sbo_check_md5 + sbo_check_md5, + default_answer ) from slpkg.sbo.greps import SBoGrep @@ -124,8 +125,11 @@ def check_md5(sbo_md5, src): print("| Expected: {0}".format(md5)) print("| Found: {0}".format(sbo_md5)) template(78) - read = raw_input("\nDo you want to continue [Y/n]? ") - if read == "Y" or read == "y": + if default_answer == "y": + answer = default_answer + else: + answer = raw_input("Would you like to continue [Y/n]? ") + if answer in ['y', 'Y']: pass else: sys.exit() diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py index 4c835b9d..5a3daefb 100755 --- a/slpkg/pkg/manager.py +++ b/slpkg/pkg/manager.py @@ -39,10 +39,12 @@ from slpkg.colors import ( from slpkg.__metadata__ import ( pkg_path, sp, - log_path + log_path, + default_answer, + remove_deps_answer ) -from find import find_package +from slpkg.pkg.find import find_package class PackageManager(object): @@ -111,9 +113,12 @@ class PackageManager(object): if len(removed) > 1: msg = msg + "s" try: - remove_pkg = raw_input( - "\nAre you sure to remove {0} {1} [Y/n]? ".format( - str(len(removed)), msg)) + if default_answer == "y": + remove_pkg = default_answer + else: + remove_pkg = raw_input( + "\nAre you sure to remove {0} {1} [Y/n]? ".format( + str(len(removed)), msg)) except KeyboardInterrupt: print("") # new line at exit sys.exit() @@ -125,9 +130,12 @@ class PackageManager(object): if os.path.isfile(dep_path + rmv): dependencies = self.view_deps(dep_path, rmv) try: - remove_dep = raw_input( - "\nRemove dependencies (maybe used by other " - "packages) [Y/n]? ") + if remove_deps_answer == "y": + remove_dep = remove_deps_answer + else: + remove_dep = raw_input( + "\nRemove dependencies (maybe used by " + "other packages) [Y/n]? ") except KeyboardInterrupt: print("") # new line at exit sys.exit() diff --git a/slpkg/repositories.py b/slpkg/repositories.py index 494686dc..e50a7ebd 100755 --- a/slpkg/repositories.py +++ b/slpkg/repositories.py @@ -22,6 +22,9 @@ # along with this program. If not, see . +import os + + class Repo(object): def __init__(self): @@ -31,7 +34,16 @@ class Repo(object): ''' Official slackware repository ''' - return "http://mirrors.slackware.com/slackware/" + default = "http://mirrors.slackware.com/slackware/" + if os.path.isfile("/etc/slpkg/slackware-mirrors"): + with open("/etc/slpkg/slackware-mirrors", "r") as slacks: + mirrors = slacks.read() + slacks.close() + for line in mirrors.splitlines(): + line = line.rstrip() + if not line.startswith("#") and line: + default = line.split()[-1] + return default def sbo(self): ''' diff --git a/slpkg/sbo/check.py b/slpkg/sbo/check.py index 45ecc529..80b435e4 100755 --- a/slpkg/sbo/check.py +++ b/slpkg/sbo/check.py @@ -47,6 +47,7 @@ from slpkg.__metadata__ import ( tmp, pkg_path, build_path, + default_answer, sp ) @@ -97,8 +98,11 @@ class SBoCheck(object): # message install = msg[0] # message upgrade = msg[1] count, msg = view_packages(data[1], data[2], data[3]) - read = raw_input("Would you like to upgrade [Y/n]? ") - if read in ['y', 'Y']: + if default_answer == "y": + answer = default_answer + else: + answer = raw_input("Would you like to continue [Y/n]? ") + if answer in ['y', 'Y']: os.chdir(build_path) for name, version in zip(data[0], data[2]): prgnam = ("{0}-{1}".format(name, version)) diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index 66515100..b9cfb303 100755 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -34,6 +34,7 @@ from slpkg.__metadata__ import ( build_path, log_path, lib_path, + default_answer, sp ) from slpkg.colors import ( @@ -118,8 +119,9 @@ class SBoInstall(object): "{3} {4}".format(count[1], msg[0], idata[2], count[0], msg[1])) print("will be upgraded.{0}\n".format(ENDC)) - read = arch_support(idata[3], self.UNST, idata[2], dependencies) - if read in['y', 'Y']: + answer = arch_support(idata[3], self.UNST, idata[2], + dependencies) + if answer in['y', 'Y']: # installs = b_ins[0] # upgraded = b_ins[1] # versions = b_ins[2] @@ -293,12 +295,14 @@ def arch_support(source, support, package_sum, dependencies): ''' if source in support: print("{0}The package {1}{2}\n".format(RED, source, ENDC)) - read = "" + answer = "" elif package_sum == len(dependencies): - read = "" + answer = "" + elif default_answer == "y": + answer = default_answer else: - read = raw_input("Do you want to continue [Y/n]? ") - return read + answer = raw_input("Would you like to continue [Y/n]? ") + return answer def dwn_sources(sources): diff --git a/slpkg/slack/install.py b/slpkg/slack/install.py index 7bfa7560..51eed8f3 100755 --- a/slpkg/slack/install.py +++ b/slpkg/slack/install.py @@ -43,7 +43,8 @@ from slpkg.colors import ( from slpkg.__metadata__ import ( pkg_path, lib_path, - slpkg_tmp_packages + slpkg_tmp_packages, + default_answer ) from slpkg.pkg.find import find_package @@ -104,8 +105,11 @@ class Slack(object): unit[0])) print("After this process, {0} {1} of additional disk space " "will be used.{2}".format(size[1], unit[1], ENDC)) - read = raw_input("\nWould you like to install [Y/n]? ") - if read in ['y', 'Y']: + if default_answer == "y": + answer = default_answer + else: + answer = raw_input("\nWould you like to continue [Y/n]? ") + if answer in ['y', 'Y']: slack_dwn(self.tmp_path, dwn_links) install(self.tmp_path, install_all) delete(self.tmp_path, install_all) diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py index 4eb1f63a..9742f94f 100755 --- a/slpkg/slack/patches.py +++ b/slpkg/slack/patches.py @@ -37,9 +37,11 @@ from slpkg.colors import ( ) from slpkg.__metadata__ import ( pkg_path, - slpkg_tmp_patches + slpkg_tmp_patches, + default_answer ) +from slpkg.pkg.find import find_package from slpkg.pkg.manager import PackageManager from remove import delete @@ -94,8 +96,11 @@ class Patches(object): unit[0])) print("After this process, {0} {1} of additional disk space " "will be used.{2}".format(size[1], unit[1], ENDC)) - read = raw_input("\nWould you like to upgrade [Y/n]? ") - if read in ['y', 'Y']: + if default_answer == "y": + answer = default_answer + else: + answer = raw_input("\nWould you like to continue [Y/n]? ") + if answer in ['y', 'Y']: slack_dwn(self.patch_path, dwn_links) upgrade(self.patch_path, upgrade_all) kernel(upgrade_all) @@ -117,37 +122,15 @@ class Patches(object): (dwn, upgrade, comp_sum, uncomp_sum) = ([] for i in range(4)) data = slack_data(self.PACKAGES_TXT, self.step) black = BlackList().packages() - if self.version == "stable": # stables versions upgrade - for name, loc, comp, uncomp in zip(data[0], data[1], data[2], - data[3]): - if (not os.path.isfile(pkg_path + name[:-4]) and split_package( - name)[0] not in black): + 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("", "", self.version), loc, name)) comp_sum.append(comp) uncomp_sum.append(uncomp) upgrade.append(name) - else: # current version upgrade - installed = [] - # get all installed packages and store the package name. - for pkg in os.listdir(pkg_path): - installed.append(split_package(pkg)[0]) - for name, loc, comp, uncomp in zip(data[0], data[1], data[2], - data[3]): - # If the package from the current repository is installed - # (check with the name) but not is in the path (check with - # all package like 'apr-1.5.0-x86_64-1') then add to list for - # upgrade. - # etc. 'apr' in list 'installed' ?? if yes 'apr-1.5.0-x86_64-1' - # exist in /var/log/packages ?? if no add to upgrade. - if split_package(name)[0] in installed: - if (not os.path.isfile(pkg_path + name[:-4]) and - split_package(name)[0] not in black): - dwn.append("{0}{1}/{2}".format( - mirrors("", "", self.version), loc, name)) - comp_sum.append(comp) - uncomp_sum.append(uncomp) - upgrade.append(name) return [dwn, upgrade, comp_sum, uncomp_sum] diff --git a/slpkg/url_read.py b/slpkg/url_read.py index 147f8e3b..1d08bf7a 100755 --- a/slpkg/url_read.py +++ b/slpkg/url_read.py @@ -37,7 +37,7 @@ class URL(object): try: f = urllib2.urlopen(self.link) return f.read() - except urllib2.URLError: + except (urllib2.URLError, ValueError): print("\nslpkg: error: connection refused\n") sys.exit() except KeyboardInterrupt: