updated for version 1.9.4

This commit is contained in:
Dimitris Zlatanidis 2014-10-01 21:10:13 +03:00
parent 4e779f91bf
commit 3ab159530a
22 changed files with 155 additions and 116 deletions

View file

@ -1,3 +1,11 @@
Version 1.9.4
01-10-2014
[Feature] - Added support install packages from Slackware current (version)
repository.
Added support upgrade current version. (Upgrade all Slackware current tree)
[Updated] - Fix arguments.
Version 1.9.3
29-09-2014

View file

@ -5,10 +5,8 @@ Installation
Python & OS Support
-------------------
slpkg works with Python versions 2.7.5+
slpkg works on Slackware stable distribution.
Slackware current not support yet.
slpkg works with Python versions 2.7.5+ (Python 3 not supported yet)
slpkg works on Slackware distribution.
Install slpkg
-------------

View file

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

View file

@ -7,9 +7,9 @@
Latest Release:
- Version: 1.9.3
- Version: 1.9.4
- `Package <https://sourceforge.net/projects/slpkg/files/slpkg/binary/>`_
- `Source <https://github.com/dslackw/slpkg/archive/v1.9.3.tar.gz>`_
- `Source <https://github.com/dslackw/slpkg/archive/v1.9.4.tar.gz>`_
- `CHANGELOG <https://github.com/dslackw/slpkg/blob/master/CHANGELOG>`_
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png
@ -98,15 +98,15 @@ Untar the archive and run install.sh script:
.. code-block:: bash
$ tar xvf slpkg-1.9.3.tar.gz
$ cd slpkg-1.9.3
$ tar xvf slpkg-1.9.4.tar.gz
$ cd slpkg-1.9.4
$ ./install.sh
Using `pip <https://pip.pypa.io/en/latest/>`_ :
.. code-block:: bash
$ pip install slpkg
$ pip install --upgrade slpkg
uninstall:
@ -124,32 +124,32 @@ Command Line Tool Usage
Utility for easy management packages in Slackware
Optional arguments:
-h, --help show this help message and exit
-v, --version print version and exit
-a, script [source...] auto build packages
-l, all, sbo, slack, noarch list of installed packages
-c, <repository> --upgrade check if your packages is up to date
-s, <repository> <package> download, build & install packages
-f, <package> find installed packages
-t, <package> packages tracking dependencies from SBo
-n, <package> view packages from SBo repository
-b, --list blacklisted packages
-b [package...] --add --remove add, remove packages in blacklist
-i, [package...] install binary packages
-u, [package...] upgrade binary packages
-o, [package...] reinstall binary packages
-r, [package...] remove binary packages
-d, [package...] display the contents of the packages
-h, --help show this help message and exit
-v, --version print version and exit
-a, script [source...] auto build packages
-l, all, sbo, slack, noarch list of installed packages
-c, <repository> --upgrade --current check if your packages is up to date
-s, <repository> <package> --current download, build & install packages
-f, <package> find installed packages
-t, <package> packages tracking dependencies from SBo
-n, <package> view packages from SBo repository
-b, --list blacklisted packages
-b [package...] --add --remove add, remove packages in blacklist
-i, [package...] install binary packages
-u, [package...] upgrade binary packages
-o, [package...] reinstall binary packages
-r, [package...] remove binary packages
-d, [package...] display the contents of the packages
Repositories:
SlackBuilds = sbo
Slackware = slack
Slackware = slack '--current'
Slpkg Examples
--------------
Find package from slackbuilds.org download,
Find packages from slackbuilds.org download,
build and install with all dependencies :
.. code-block:: bash
@ -202,11 +202,11 @@ build and install with all dependencies :
Find packages from `Slackware official mirrors <http://mirrors.slackware.com/>`_
download and install:
download and install (use '--current' to switch in current repository):
.. code-block:: bash
$ slpkg -s slack mozilla
$ slpkg -s slack mozilla (add '--current' to switch in current version)
Packages with name matching [ mozilla ]
Reading package lists ..............................Done
@ -281,11 +281,11 @@ Check if your packages is up to date from slackbuilds.org:
Would you like to upgrade [Y/n]?
Check if your distribution is up to date from `Slackware official mirrors
<http://mirrors.slackware.com/>`_
<http://mirrors.slackware.com/>`_ (use '--current' to switch in current repository):
.. code-block:: bash
$ slpkg -c slack --upgrade
$ slpkg -c slack --upgrade (add '--current' to switch in current version)
Reading package lists .......Done
These packages need upgrading:
@ -329,7 +329,7 @@ Find packages from slackbuilds.org:
Install Download/Build/Install
Quit Quit
> _
Choose an option: _
Auto tool to build package:
@ -580,8 +580,8 @@ Remove packages with all dependencies:
+==============================================================================
Using the blacklist file manually from /etc/slpkg/blacklist or
with the following options:
Add packages in blacklist file manually from
/etc/slpkg/blacklist or with the following options:
.. code-block:: bash

View file

@ -21,7 +21,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=slpkg
VERSION=${VERSION:-1.9.3}
VERSION=${VERSION:-1.9.4}
TAG=${TAG:-_dsw}
cd ..

View file

@ -17,8 +17,8 @@ slpkg - Utility for easy management packages in Slackware
.SH SYNOPSIS
\fBUsage: slpkg [-h] [-v] [-a script [sources...]]
[-l all, sbo, slack, noarch]
[-c <repository> --upgrade]
[-s <repository> <package>]
[-c <repository> --upgrade --current]
[-s <repository> <package> --current]
[-f] [-t] [-n] [-i [...]]
[-u [...]] [-o [...]] [-r [...]] [-d [...]]\fp
@ -30,26 +30,26 @@ It's a quick and easy way to manage your packages in slackware to a command.
\fBUtility for easy management packages in Slackware
Optional arguments:
-h, --help show this help message and exit
-v, --version print version and exit
-a, script [source...] auto build packages
-l, all, sbo, slack, noarch list of installed packages
-c, <repository> --upgrade check if your packages is up to date
-s, <repository> <package> download, build & install packages
-f, <package> find installed packages
-t, <package> packages tracking dependencies from SBo
-n, <package> view packages from SBo repository
-b, --list blacklisted packages
-b [package...] --add --remove add, remove packages in blacklist
-i, [package...] install binary packages
-u, [package...] upgrade binary packages
-o, [package...] reinstall binary packages
-r, [package...] remove binary packages
-d, [package...] display the contents of the packages
-h, --help show this help message and exit
-v, --version print version and exit
-a, script [source...] auto build packages
-l, all, sbo, slack, noarch list of installed packages
-c, <repository> --upgrade --current check if your packages is up to date
-s, <repository> <package> --current download, build & install packages
-f, <package> find installed packages
-t, <package> packages tracking dependencies from SBo
-n, <package> view packages from SBo repository
-b, --list blacklisted packages
-b [package...] --add --remove add, remove packages in blacklist
-i, [package...] install binary packages
-u, [package...] upgrade binary packages
-o, [package...] reinstall binary packages
-r, [package...] remove binary packages
-d, [package...] display the contents of the packages
Repositories:
SlackBuilds = sbo
Slackware = slack\fP
Slackware = slack '--current'\fP
.SH GLOBAL OPTIONS
.TP
@ -68,16 +68,16 @@ With this argument, build slackware package from source quickly and easy.
Four display options list, sbo, slack, noarch and all packages
items that are installed on the system.
.SS -c , <repository> check if your packages is up to date
\fBslpkg\fP \fB-c\fP <\fIrepository\fP> \fI--upgrade\fP
\fBslpkg\fP \fB-c\fP <\fIrepository\fP> \fI--upgrade\fP \fI--current\fP
.PP
Check your packages from Slackware official mirrors or from
slackbuilds.org is up to date.
slackbuilds.org is up to date. Use '--current' to switch in current repository.
.SS -s , <repository> download, build and install package with all dependencies
\fBslpkg\fP \fB-s\fP <\fIrepository\fP> <\fIname of package\fP>
\fBslpkg\fP \fB-s\fP <\fIrepository\fP> <\fIname of package\fP> \fI--current\fP
.PP
Installs or upgrade packages from the repository slackbuilds.org automatically resolving all
dependencies of the package. Also installs the official distribution Slackware
packages.
packages. Use '--current' to install packages from Slackware current repository.
.SS -f find packages
\fBslpkg\fP \fB-f\fP <\fIname of packages\fP>
.PP

View file

@ -2,5 +2,8 @@
# GNU wget
# Slackware 32 x86
# Slackware 64 x86_64
# Slackware current (not supported yet)
# 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.

View file

@ -23,7 +23,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=slpkg
VERSION=${VERSION:-1.9.3}
VERSION=${VERSION:-1.9.4}
BUILD=${BUILD:-1}
TAG=${TAG:-_dsw}

View file

@ -1,7 +1,7 @@
PRGNAM="slpkg"
VERSION="1.9.3"
VERSION="1.9.4"
HOMEPAGE="https://github.com/dslackw/slpkg"
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.9.3.tar.gz"
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.9.4.tar.gz"
MD5SUM=""
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""

View file

@ -26,7 +26,7 @@ import subprocess
__all__ = "slpkg"
__author__ = "dslackw"
__version_info__ = (1, 9, 3)
__version_info__ = (1, 9, 4)
__version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"

View file

@ -48,11 +48,14 @@ def blacklisted():
'''
Print blacklist packages
'''
exit = 0
print("\nPackages in blacklist:\n")
for black in black_packages():
if black:
print(black)
print # new line at exit
exit = 1
if exit == 1:
print # new line at exit
def add_blacklist(pkgs):
'''
@ -92,4 +95,3 @@ def remove_blacklist(pkgs):
black_conf.close()
if exit == 1:
print # new line at exit

View file

@ -36,7 +36,8 @@ def initialization():
'''
Slpkg initialization, creating directories and SLACKBUILDS.TXT in
/var/lib/slpkg/sbo_repo/ and ChangeLog.txt in /var/log/slpkg/ from
slackbuilds.org
slackbuilds.org also create blacklist configuration file in /etc/
slpkg.
'''
s_user(getpass.getuser())
blacklist_conf = [

View file

@ -48,32 +48,32 @@ def main():
"slpkg - version {0}\n".format(__version__),
"Utility for easy management packages in Slackware\n",
"Optional arguments:",
" -h, --help show this help message and exit",
" -v, --version print version and exit",
" -a, script [source...] auto build packages",
" -l, all, sbo, slack, noarch list of installed packages",
" -c, <repository> --upgrade check if your packages is up to date",
" -s, <repository> <package> download, build & install packages",
" -f, <package> find installed packages",
" -t, <package> packages tracking dependencies from SBo",
" -n, <package> view packages from SBo repository",
" -b, --list blacklisted packages",
" -b [package...] --add --remove add, remove packages in blacklist",
" -i, [package...] install binary packages",
" -u, [package...] upgrade binary packages",
" -o, [package...] reinstall binary packages",
" -r, [package...] remove binary packages",
" -d, [package...] display the contents of the packages\n",
" -h, --help show this help message and exit",
" -v, --version print version and exit",
" -a, script [source...] auto build packages",
" -l, all, sbo, slack, noarch list of installed packages",
" -c, <repository> --upgrade --current check if your packages is up to date",
" -s, <repository> <package> --current download, build & install packages",
" -f, <package> find installed packages",
" -t, <package> packages tracking dependencies from SBo",
" -n, <package> view packages from SBo repository",
" -b, --list blacklisted packages",
" -b [package...] --add --remove add, remove packages in blacklist",
" -i, [package...] install binary packages",
" -u, [package...] upgrade binary packages",
" -o, [package...] reinstall binary packages",
" -r, [package...] remove binary packages",
" -d, [package...] display the contents of the packages\n",
"Repositories:",
" SlackBuilds = sbo",
" Slackware = slack\n",
" Slackware = slack '--current'\n",
]
usage = [
"slpkg - version {0}\n".format(__version__),
"Usage: slpkg [-h] [-v] [-a script [sources...]]",
" [-l all, sbo, slack, noarch]",
" [-c <repository> --upgrade]",
" [-s <repository> <package>]",
" [-c <repository> --upgrade --current]",
" [-s <repository> <package> --current]",
" [-f] [-t] [-n] [-b --list]",
" [-b [...] --add --remove] [-i [...]]",
" [-u [...]] [-o [...]] [-r [...]] [-d [...]]\n",
@ -84,9 +84,9 @@ def main():
repository = ["sbo", "slack"]
if len(args) == 0:
for opt in usage: print(opt)
elif len(args) == 1 and args[0] == "-h" or args[0] == "--help":
elif len(args) == 1 and args[0] == "-h" or args[0] == "--help" and args[1:] == []:
for opt in arguments: print(opt)
elif len(args) == 1 and args[0] == "-v" or args[0] == "--version":
elif len(args) == 1 and args[0] == "-v" or args[0] == "--version" and args[1:] == []:
prog_version()
elif len(args) == 3 and args[0] == "-a":
build_package(args[1], args[2:], path)
@ -100,14 +100,28 @@ def main():
if args[1] == repository[0] and args[2] == "--upgrade":
sbo_check()
elif args[1] == repository[1] and args[2] == "--upgrade":
patches()
version = "stable"
patches(version)
else:
for opt in usage: print(opt)
elif len(args) == 4 and args[0] == "-c":
if args[1] == repository[1] and args[3] == "--current":
version = "current"
patches(version)
else:
for opt in usage: print(opt)
elif len(args) == 3 and args[0] == "-s":
if args[1] == repository[0]:
sbo_build(args[2])
elif args[1] == repository[1]:
install(args[2])
version = "stable"
install(args[2], version)
elif len(args) == 4 and args[0] == "-s":
if args[1] == repository[1] and args[3] == "--current":
version = "current"
install(args[2], version)
else:
for opt in usage: print(opt)
elif len(args) == 2 and args[0] == "-t":
pkg_tracking(args[1])
elif len(args) == 2 and args[0] == "-n":

View file

@ -48,7 +48,7 @@ def s_user(user):
Check for root user
'''
if user != "root":
print("\nError: must have root privileges\n")
print("\nslpkg: error: must have root privileges\n")
sys.exit()
def build_FAILED(sbo_url, prgnam):

View file

@ -31,7 +31,7 @@ def find_package(find_pkg, directory):
'''
pkgs = []
blacklist = black_packages()
for pkg in os.listdir(directory):
for pkg in sorted(os.listdir(directory)):
if pkg.startswith(find_pkg) and find_pkg[:-1] not in blacklist:
pkgs.append(pkg)
return pkgs

View file

@ -174,7 +174,7 @@ def pkg_find(binary):
matching = size = int()
print("\nInstalled packages with name matching [ {0}{1}{2} ]\n".format(
CYAN, binary, ENDC))
for match in sorted(find_package(binary, pkg_path)):
for match in find_package(binary, pkg_path):
if binary in match:
matching += 1
print("[ {0}installed{1} ] - {2}".format(

View file

@ -28,7 +28,7 @@ from slpkg.colors import *
from slpkg.init import initialization
from slpkg.downloader import download
from slpkg.__metadata__ import (tmp, pkg_path, build_path,
log_path, lib_path, sp)
log_path, lib_path, sp)
from slpkg.messages import (pkg_not_found, pkg_found, template,
build_FAILED, sbo_packages_view)

View file

@ -69,7 +69,7 @@ def sbo_network(name):
FAULT = "".join(source_dwn)
while True:
try:
read = raw_input(" {0}>{1} ".format(GREY, ENDC))
read = raw_input(" {0}Choose an option: {1}".format(GREY, ENDC))
except KeyboardInterrupt:
print # new line at exit
break

View file

@ -39,7 +39,7 @@ from slpkg.pkg.manager import pkg_upgrade, pkg_reinstall
from mirrors import mirrors
from slack_version import slack_ver
def install(slack_pkg):
def install(slack_pkg, version):
'''
Install packages from official Slackware distribution
'''
@ -63,9 +63,9 @@ def install(slack_pkg):
sys.stdout.flush()
init = initialization()
blacklist = black_packages()
PACKAGES = url_read(mirrors(name="PACKAGES.TXT", location=""))
EXTRA = url_read(mirrors(name="PACKAGES.TXT", location="extra/"))
PASTURE = url_read(mirrors(name="PACKAGES.TXT", location="pasture/"))
PACKAGES = url_read(mirrors("PACKAGES.TXT", "", version))
EXTRA = url_read(mirrors("PACKAGES.TXT", "extra/", version))
PASTURE = url_read(mirrors("PACKAGES.TXT", "pasture/", version))
PACKAGES_TXT = PACKAGES + EXTRA + PASTURE
index, toolbar_width = 0, 800
for line in PACKAGES_TXT.splitlines():
@ -85,7 +85,7 @@ def install(slack_pkg):
uncomp_size.append(line[30:-2].strip())
for loc, name, comp, uncomp in zip(package_location, package_name, comp_size, uncomp_size):
if slack_pkg in name and slack_pkg not in blacklist:
dwn_list.append("{0}{1}/{2}".format(mirrors("",""), loc, name))
dwn_list.append("{0}{1}/{2}".format(mirrors("","", version), loc, name))
install_all.append(name)
comp_sum.append(comp)
uncomp_sum.append(uncomp)

View file

@ -24,15 +24,23 @@
from slpkg.__metadata__ import arch
from slack_version import slack_ver
def mirrors(name, location):
def mirrors(name, location, version):
'''
Select Slackware official mirror packages
based architecture
based architecture and version.
'''
if arch == "x86_64":
http = "http://mirrors.slackware.com/slackware/slackware64-{0}/{1}{2}".format(
slack_ver(), location, name)
if version == "stable":
http = "http://mirrors.slackware.com/slackware/slackware64-{0}/{1}{2}".format(
slack_ver(), location, name)
else:
http = "http://mirrors.slackware.com/slackware/slackware64-{0}/{1}{2}".format(
version, location, name)
else:
http = "http://mirrors.slackware.com/slackware/slackware-{0}/{1}{2}".format(
slack_ver(), location, name)
if version == "stable":
http = "http://mirrors.slackware.com/slackware/slackware-{0}/{1}{2}".format(
slack_ver(), location, name)
else:
http = "http://mirrors.slackware.com/slackware/slackware-{0}/{1}{2}".format(
version, location, name)
return http

View file

@ -39,7 +39,7 @@ from slpkg.pkg.manager import pkg_upgrade
from mirrors import mirrors
from slack_version import slack_ver
def patches():
def patches(version):
'''
Install new patches from official Slackware mirrors
'''
@ -58,14 +58,19 @@ def patches():
sys.stdout.flush()
init = initialization()
blacklist = black_packages()
PACKAGE_TXT = url_read(mirrors(name="PACKAGES.TXT", location="patches/"))
index, toolbar_width = 0, 100
if version == "stable":
PACKAGE_TXT = url_read(mirrors("PACKAGES.TXT", "patches/", version))
step = 100
else:
PACKAGE_TXT = url_read(mirrors("PACKAGES.TXT", "", version))
step = 700
index, toolbar_width = 0, step
for line in PACKAGE_TXT.splitlines():
index += 1
if index == toolbar_width:
sys.stdout.write("{0}.{1}".format(GREY, ENDC))
sys.stdout.flush()
toolbar_width += 100
toolbar_width += step
time.sleep(0.05)
if line.startswith("PACKAGE NAME"):
package_name.append(line[15:].strip())
@ -77,7 +82,7 @@ def patches():
uncomp_size.append(line[30:-2].strip())
for loc, name, comp, uncomp in zip(package_location, package_name, comp_size, uncomp_size):
if not os.path.isfile(pkg_path + name[:-4]) and name.split("-")[-4] not in " ".join(blacklist):
dwn_patches.append("{0}{1}/{2}".format(mirrors("",""), loc, name))
dwn_patches.append("{0}{1}/{2}".format(mirrors("","", version), loc, name))
comp_sum.append(comp)
uncomp_sum.append(uncomp)
upgrade_all.append(name)
@ -105,7 +110,7 @@ def patches():
name = upg_ver[:-(len(ver) + 1)]
arch = arch[1:-1]
print(" {0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11:>12}{12}".format(
GREEN, name, ENDC, \
YELLOW, name, ENDC, \
" " * (25-len(name)), ver, \
" " * (19-len(ver)), arch, \
" " * (8-len(arch)), build, \
@ -156,8 +161,8 @@ def patches():
else:
if os.uname()[4] == "x86_64":
slack_arch = 64
print("\nSlackware{0} v{1} distribution is up to date\n".format(
slack_arch, slack_ver()))
print("\nSlackware{0} '{1}' v{2} distribution is up to date\n".format(
slack_arch, version, slack_ver()))
except KeyboardInterrupt:
print # new line at exit
sys.exit()

View file

@ -32,7 +32,7 @@ def url_read(link):
f = urllib2.urlopen(link)
return f.read()
except urllib2.URLError:
print ("\nError: connection refused\n")
print ("\nslpkg: error: connection refused\n")
sys.exit()
except KeyboardInterrupt:
print # new line at exit