mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
updated for version 1.7.6
This commit is contained in:
parent
043f814df1
commit
fb497262d2
19 changed files with 526 additions and 507 deletions
|
@ -1,5 +1,12 @@
|
|||
Version 1.7.6
|
||||
|
||||
[Updated] - Bugfix IndexError '-aa' in cli argparseoptions.
|
||||
Fix arch's
|
||||
|
||||
[Feature] - Added upgrade all SBo packages
|
||||
|
||||
22-08-2014
|
||||
Version 1.7.5.dev
|
||||
Version 1.7.5
|
||||
|
||||
[Feature] - Added report of packages will be installed the options
|
||||
`slpkg -s sbo <package>`
|
||||
|
|
2
PKG-INFO
2
PKG-INFO
|
@ -1,6 +1,6 @@
|
|||
Metadata-Version: 1.1
|
||||
Name: slpkg
|
||||
Version: 1.7.5
|
||||
Version: 1.7.6
|
||||
Author: dslackw
|
||||
Author-email: d zlatanidis at gmail com
|
||||
Maintainer: dslackw
|
||||
|
|
57
README.rst
57
README.rst
|
@ -39,7 +39,7 @@ Video Tutorial
|
|||
==============
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png
|
||||
:target: https://asciinema.org/a/11649
|
||||
:target: https://asciinema.org/a/11457
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
@ -67,8 +67,7 @@ Command Line Tool Usage
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
usage: slpkg [-h] [-v] [-a script [source ...]]
|
||||
[-l all, sbo, slack, noarch, other]
|
||||
usage: slpkg [-h] [-v] [-a script [source ...]] [-l all, sbo, slack, noarch]
|
||||
[-c sbo, slack [sbo, slack ...]]
|
||||
[-s sbo, slack [sbo, slack ...]] [-t] [-n] [-i [...]]
|
||||
[-u [...]] [-o [...]] [-r [...]] [-f [...]] [-d [...]]
|
||||
|
@ -80,7 +79,7 @@ Command Line Tool Usage
|
|||
-v, --verbose print version and exit
|
||||
-a script [source ...]
|
||||
auto build package
|
||||
-l all, sbo, slack, noarch, other
|
||||
-l all, sbo, slack, noarch
|
||||
list of installed packages
|
||||
-c sbo, slack [sbo, slack ...]
|
||||
check if your packages is up to date
|
||||
|
@ -108,16 +107,16 @@ build and install with all dependencies :
|
|||
Building dependency tree...... Done
|
||||
The following packages will be automatically installed or upgraded with new version:
|
||||
+==============================================================================
|
||||
| Package Version Arch Repository
|
||||
| Package Version Arch Repository
|
||||
+==============================================================================
|
||||
Installing:
|
||||
brasero 3.11.3 x86_64 SBo
|
||||
brasero 3.11.3 x86_64 SBo
|
||||
Installing for dependencies:
|
||||
orc 0.4.19 x86_64 SBo
|
||||
gstreamer1 1.2.2 x86_64 SBo
|
||||
gst1-plugins-base 1.2.2 x86_64 SBo
|
||||
gst1-plugins-bad 1.2.2 x86_64 SBo
|
||||
libunique 1.1.6 x86_64 SBo
|
||||
orc 0.4.19 x86_64 SBo
|
||||
gstreamer1 1.2.2 x86_64 SBo
|
||||
gst1-plugins-base 1.2.2 x86_64 SBo
|
||||
gst1-plugins-bad 1.2.2 x86_64 SBo
|
||||
libunique 1.1.6 x86_64 SBo
|
||||
|
||||
Installing summary
|
||||
===============================================================================
|
||||
|
@ -203,27 +202,31 @@ Check if your packages is up to date from slackbuilds.org:
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
$ slpkg -c sbo flashplayer-plugin
|
||||
$ slpkg -c sbo upgrade
|
||||
Reading package lists. Done
|
||||
|
||||
New version is available:
|
||||
Thece packages need upgrading:
|
||||
|
||||
+==============================================================================
|
||||
| Package: flashplayer-plugin 11.2.202.356 --> flashplayer-plugin 11.2.202.394
|
||||
| Package New version Arch Repository
|
||||
+==============================================================================
|
||||
Upgrading:
|
||||
six-1.7.1 1.7.3 x86_64 SBo
|
||||
pysetuptools-3.4 3.6 x86_64 SBo
|
||||
Jinja2-2.7.0 2.7.2 x86_64 SBo
|
||||
pysed-0.3.0 0.3.1 x86_64 SBo
|
||||
Pafy-0.3.56 0.3.58 x86_64 SBo
|
||||
MarkupSafe-0.21 0.23 x86_64 SBo
|
||||
pip-1.5.3 1.5.6 x86_64 SBo
|
||||
colored-1.1.1 1.1.4 x86_64 SBo
|
||||
|
||||
Installing summary
|
||||
===============================================================================
|
||||
Total 8 packages will be upgraded.
|
||||
|
||||
Would you like to upgrade [Y/n]?
|
||||
|
||||
Would you like to install [Y/n]?
|
||||
|
||||
$ slpkg -c sbo ranger
|
||||
Reading package lists. Done
|
||||
|
||||
Package ranger-1.6.1 is up to date
|
||||
|
||||
$ slpkg -c sbo termcolor
|
||||
Reading package lists. Done
|
||||
|
||||
No such package termcolor: Not installed
|
||||
|
||||
Check if your distribution is up to date from `Slackware official mirrors
|
||||
if your distribution is up to date from `Slackware official mirrors
|
||||
<http://mirrors.slackware.com/>`_
|
||||
|
||||
.. code-block:: bash
|
||||
|
|
50
man/slpkg.8
50
man/slpkg.8
|
@ -15,9 +15,11 @@
|
|||
.SH NAME
|
||||
slpkg - Utility for easy management packages in Slackware
|
||||
.SH SYNOPSIS
|
||||
\fBslpkg\fP \fB-h\fP \fB-v\fP \fB-a script [source ...]\fP \fB-l all, sbo, slack, noarch, other\fP
|
||||
\fB-t\fP \fB-n\fP \fB-c sbo, slack [sbo, slack ...]\fP \fB-s\ slack [sbo, slack ...] fP\fB-i [...]\fP
|
||||
\fB-u [...]\fP \fB-o [...]\fP \fB-r [...]\fP \fB-f [...]\fP \fB-d [...]\fP
|
||||
\fBusage: slpkg [-h] [-v] [-a script [source ...]] [-l all, sbo, slack, noarch]
|
||||
[-c sbo, slack [sbo, slack ...]]
|
||||
[-s sbo, slack [sbo, slack ...]] [-t] [-n] [-i [...]]
|
||||
[-u [...]] [-o [...]] [-r [...]] [-f [...]] [-d [...]]\fP
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBslpkg\fP is a terminal multitool in order to easy use Slackware packages.
|
||||
.PP
|
||||
|
@ -27,7 +29,7 @@ It's a quick and easy way to manage your packages in slackware to a command.
|
|||
\fB-v, --verbose print version and exit\fP
|
||||
\fB-a script [source ...]\fP
|
||||
\fB auto build packages\fP
|
||||
\fB-l all, sbo, slack, noarch, other\fP
|
||||
\fB-l all, sbo, slack, noarch\fP
|
||||
\fB list of installed packages\fP
|
||||
\fB-c sbo, slack [sbo, slack ...]\fp
|
||||
\fB check if your packages is up to date\fP
|
||||
|
@ -55,11 +57,11 @@ The following commands are available.
|
|||
.PP
|
||||
With this argument, build slackware package from source quickly and easy.
|
||||
Support .tar.gz and .tar.bz2 slackbuilds archives.
|
||||
.SS -l all, sbo, slack, noarch, other
|
||||
.SS -l all, sbo, slack, noarch
|
||||
\fBslpkg\fP \fB-l\fP <\fIall\fP> <\fIsbo\fP>
|
||||
.PP
|
||||
Two display options list, one for all packages and another
|
||||
only for packages SBo.
|
||||
Four display options list, sbo, slack, noarch and all packages
|
||||
items that are installed on the system.
|
||||
.SS -t , tracking dependencies
|
||||
\fBslpkg\fP \fB-t\fP <\fIname of package\fP>
|
||||
.PP
|
||||
|
@ -70,8 +72,8 @@ The sequence shown is that you must follow to correctly install package.
|
|||
.PP
|
||||
With this method you can find the SBo script that interests you through
|
||||
the network. (www.slackbuilds.org)
|
||||
.SS -c , sbo, slack [sbo, slack ...] check if your package is up to date
|
||||
\fBslpkg\fP \fB-c\fP <\fIsbo\fP> <\fIslack\fP> <\fIname of package\fP>
|
||||
.SS -c , sbo, slack [sbo, slack ...] check if your packages is up to date
|
||||
\fBslpkg\fP \fB-c\fP <\fIsbo\fP> <\fIslack\fP> <\fIupgrade\fP>
|
||||
.PP
|
||||
Check your packages from Slackware official mirrors or from
|
||||
slackbuilds.org is up to date.
|
||||
|
@ -94,14 +96,14 @@ Normally upgrade only upgrades packages that are already
|
|||
installed on the system, and will skip any packages that do not
|
||||
already have a version installed. 'Requires root privileges'
|
||||
(like slackware command upgradepkg --install-new)
|
||||
.SS -o reinstall binary package
|
||||
.SS -o , reinstall binary package
|
||||
\fBslpkg\fP \fB-o\fP <\fIpackages.t?z\fP>
|
||||
.PP
|
||||
Upgradepkg usually skips packages if the exact same package
|
||||
(matching name, version, arch, and build number) is already
|
||||
installed on the system.'Requires root privileges' (like
|
||||
slackware command upgradepkg --reinstall)
|
||||
.SS -r , remove package
|
||||
.SS -r , remove packages
|
||||
\fBslpkg\fP \fB-r\fP <\fIname of packages\fP>
|
||||
.PP
|
||||
Removes a previously installed Slackware package, while writing
|
||||
|
@ -116,7 +118,7 @@ privileges' (like slackware command removepkg)
|
|||
\fBslpkg\fP \fB-f\fP <\fIname of packages\fP>
|
||||
.PP
|
||||
Find if package allready installed or not.
|
||||
.SS -d display contents
|
||||
.SS -d , display contents
|
||||
\fBslpkg\fP \fB-d\fP <\fIname of packages\fP>
|
||||
.PP
|
||||
Display the contents of the package with all descriptions.
|
||||
|
@ -191,15 +193,29 @@ $ \fBslpkg -s sbo brasero\fP
|
|||
Package brasero-3.11.3-x86_64-1_SBo.tgz installed.
|
||||
|
||||
|
||||
$ \fBslpkg -c sbo flashplayer-plugin\fP
|
||||
$ \fBslpkg -c sbo upgrade\fP
|
||||
Reading package lists. Done
|
||||
|
||||
New version is available:
|
||||
These packages need upgrading:
|
||||
|
||||
+==============================================================================
|
||||
| Package: flashplayer-plugin 11.2.202.356 --> flashplayer-plugin 11.2.202.394
|
||||
| Package New version Arch Repository
|
||||
+==============================================================================
|
||||
|
||||
Would you like to install [Y/n]?
|
||||
Upgrading:
|
||||
six-1.7.1 1.7.3 x86_64 SBo
|
||||
pysetuptools-3.4 3.6 x86_64 SBo
|
||||
Jinja2-2.7.0 2.7.2 x86_64 SBo
|
||||
pysed-0.3.0 0.3.1 x86_64 SBo
|
||||
Pafy-0.3.56 0.3.58 x86_64 SBo
|
||||
MarkupSafe-0.21 0.23 x86_64 SBo
|
||||
pip-1.5.3 1.5.6 x86_64 SBo
|
||||
colored-1.1.1 1.1.4 x86_64 SBo
|
||||
|
||||
Installing summary
|
||||
===============================================================================
|
||||
Total 8 packages will be upgraded.
|
||||
|
||||
Would you like to upgrade [Y/n]?
|
||||
|
||||
$ \fBslpkg -c slack upgrade\fp
|
||||
Reading package lists....... Done
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Python 2.7.5
|
||||
# Python 2.7.5+
|
||||
# Slackware current (not supported yet)
|
||||
# Slackware
|
||||
# Slackware 64
|
||||
|
|
|
@ -26,7 +26,7 @@ import subprocess
|
|||
|
||||
__all__ = "slpkg"
|
||||
__author__ = "dslackw"
|
||||
__version_info__ = (1, 7, 5)
|
||||
__version_info__ = (1, 7, 6)
|
||||
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
||||
__license__ = "GNU General Public License v3 (GPLv3)"
|
||||
__email__ = "d.zlatanidis@gmail.com"
|
||||
|
@ -54,10 +54,16 @@ slpkg_tmp = tmp + "slpkg/"
|
|||
pkg_path = "/var/log/packages/"
|
||||
|
||||
''' computer architecture '''
|
||||
uname = os.uname()
|
||||
arch = (uname[4])
|
||||
arch = os.uname()[4]
|
||||
|
||||
''' slackbuild fietype binary packages '''
|
||||
sbo_arch = "*"
|
||||
sbo_tag = "?_SBo"
|
||||
if arch == "x86_64":
|
||||
sbo_arch = "-x86_64-"
|
||||
elif arch.startswith("i") and arch.endswith("86"):
|
||||
sbo_arch = "-i486-"
|
||||
elif "arm" in arch:
|
||||
sbo_arch = "-arm-"
|
||||
|
||||
build = "*"
|
||||
sbo_tag = "_SBo"
|
||||
sbo_filetype = ".tgz"
|
||||
|
|
191
slpkg/main.py
191
slpkg/main.py
|
@ -60,14 +60,14 @@ optional arguments:
|
|||
|
||||
'''
|
||||
|
||||
import argparse
|
||||
import getpass
|
||||
import argparse
|
||||
|
||||
from version import *
|
||||
from functions import *
|
||||
from colors import colors
|
||||
from __metadata__ import path
|
||||
from messages import ext_err_args
|
||||
from messages import ext_err_args, s_user
|
||||
from messages import err1_args, err2_args
|
||||
|
||||
from pkg.build import build_package
|
||||
|
@ -89,8 +89,8 @@ def main():
|
|||
parser.add_argument("-a", help="auto build packages",
|
||||
type=str, nargs="+", metavar=("script", "source"))
|
||||
parser.add_argument("-l", help="list of installed packages",
|
||||
choices="all sbo slack noarch other".split(),
|
||||
metavar=("all, sbo, slack, noarch, other"))
|
||||
choices="all sbo slack noarch".split(),
|
||||
metavar=("all, sbo, slack, noarch"))
|
||||
parser.add_argument("-c", help="check if your packages is up to date",
|
||||
type=str, nargs="+", metavar=("sbo, slack"))
|
||||
parser.add_argument("-s", help="download, build & install packages",
|
||||
|
@ -112,98 +112,109 @@ def main():
|
|||
parser.add_argument("-d", help="display the contents of the packages",
|
||||
type=str, nargs="+", metavar=(""))
|
||||
args = parser.parse_args()
|
||||
if args.verbose:
|
||||
prog_version()
|
||||
if args.a:
|
||||
s_user(getpass.getuser())
|
||||
build_package(args.a[0], args.a[1], args.a[2:], path)
|
||||
if args.l:
|
||||
pkg_list(args.l)
|
||||
if args.t:
|
||||
s_user(getpass.getuser())
|
||||
pkg_tracking(args.t)
|
||||
if args.n:
|
||||
s_user(getpass.getuser())
|
||||
sbo_network(args.n)
|
||||
if args.c:
|
||||
s_user(getpass.getuser())
|
||||
if len(args.c) == 2:
|
||||
if "sbo" in args.c:
|
||||
sbo_check("".join(args.c[1]))
|
||||
elif "slack" in args.c:
|
||||
if args.c[1] == "upgrade":
|
||||
patches()
|
||||
try:
|
||||
if args.verbose:
|
||||
prog_version()
|
||||
if args.a:
|
||||
s_user(getpass.getuser())
|
||||
build_package(args.a[0], args.a[1:], path)
|
||||
if args.l:
|
||||
pkg_list(args.l)
|
||||
if args.t:
|
||||
s_user(getpass.getuser())
|
||||
pkg_tracking(args.t)
|
||||
if args.n:
|
||||
s_user(getpass.getuser())
|
||||
sbo_network(args.n)
|
||||
if args.c:
|
||||
s_user(getpass.getuser())
|
||||
if len(args.c) == 2:
|
||||
if "sbo" in args.c:
|
||||
if args.c[1] == "upgrade":
|
||||
sbo_check()
|
||||
else:
|
||||
choices = ["upgrade"]
|
||||
ext_err_args()
|
||||
err1_args("".join(args.c[1]), choices)
|
||||
elif "slack" in args.c:
|
||||
if args.c[1] == "upgrade":
|
||||
patches()
|
||||
else:
|
||||
choices = ["upgrade"]
|
||||
ext_err_args()
|
||||
err1_args("".join(args.c[1]), choices)
|
||||
else:
|
||||
choices = ["sbo", "slack"]
|
||||
ext_err_args()
|
||||
err1_args("".join(args.c[0]), choices)
|
||||
elif len(args.c) < 2:
|
||||
if "sbo" in args.c or "slack" in args.c:
|
||||
choices = ['upgrade']
|
||||
ext_err_args()
|
||||
err2_args(choices)
|
||||
else:
|
||||
choices = ["sbo", "slack"]
|
||||
ext_err_args()
|
||||
err1_args("".join(args.c), choices)
|
||||
else:
|
||||
ext_err_args()
|
||||
err2_args()
|
||||
if args.s:
|
||||
s_user(getpass.getuser())
|
||||
if len(args.s) == 2:
|
||||
if "sbo" in args.s:
|
||||
sbo_build("".join(args.s[1]))
|
||||
elif "slack" in args.s:
|
||||
install("".join(args.s[1]))
|
||||
else:
|
||||
choices = ["sbo", "slack"]
|
||||
ext_err_args()
|
||||
err1_args("".join(args.s[0]), choices)
|
||||
elif len(args.s) < 2:
|
||||
if "sbo" in args.s or "slack" in args.s:
|
||||
choices = ["upgrade"]
|
||||
ext_err_args()
|
||||
err1_args("".join(args.c[1]), choices)
|
||||
err2_args(choices)
|
||||
else:
|
||||
choices = ["sbo", "slack"]
|
||||
ext_err_args()
|
||||
err1_args("".join(args.s), choices)
|
||||
else:
|
||||
choices = ["sbo", "slack"]
|
||||
ext_err_args()
|
||||
err1_args("".join(args.c[0]), choices)
|
||||
elif len(args.c) < 2:
|
||||
if "sbo" in args.c or "slack" in args.c:
|
||||
ext_err_args()
|
||||
err2_args()
|
||||
else:
|
||||
choices = ["sbo", "slack"]
|
||||
ext_err_args()
|
||||
err1_args("".join(args.c), choices)
|
||||
else:
|
||||
ext_err_args()
|
||||
err2_args()
|
||||
if args.s:
|
||||
s_user(getpass.getuser())
|
||||
if len(args.s) == 2:
|
||||
if "sbo" in args.s:
|
||||
sbo_build("".join(args.s[1]))
|
||||
elif "slack" in args.s:
|
||||
install("".join(args.s[1]))
|
||||
else:
|
||||
choices = ["sbo", "slack"]
|
||||
ext_err_args()
|
||||
err1_args("".join(args.s[0]), choices)
|
||||
elif len(args.s) < 2:
|
||||
if "sbo" in args.s or "slack" in args.s:
|
||||
ext_err_args()
|
||||
err2_args()
|
||||
else:
|
||||
choices = ["sbo", "slack"]
|
||||
ext_err_args()
|
||||
err1_args("".join(args.s), choices)
|
||||
else:
|
||||
ext_err_args()
|
||||
err2_args()
|
||||
if args.i:
|
||||
s_user(getpass.getuser())
|
||||
pkg_install(args.i)
|
||||
if args.u:
|
||||
s_user(getpass.getuser())
|
||||
pkg_upgrade(args.u)
|
||||
if args.o:
|
||||
s_user(getpass.getuser())
|
||||
pkg_reinstall(args.o)
|
||||
if args.r:
|
||||
s_user(getpass.getuser())
|
||||
pkg_remove(args.r)
|
||||
if args.f:
|
||||
pkg_find(args.f)
|
||||
if args.d:
|
||||
pkg_display(args.d)
|
||||
if not any([args.verbose,
|
||||
args.s,
|
||||
args.t,
|
||||
args.c,
|
||||
args.n,
|
||||
args.o,
|
||||
args.i,
|
||||
args.u,
|
||||
args.a,
|
||||
args.r,
|
||||
args.l,
|
||||
args.f,
|
||||
args.d]):
|
||||
os.system("slpkg -h")
|
||||
if args.i:
|
||||
s_user(getpass.getuser())
|
||||
pkg_install(args.i)
|
||||
if args.u:
|
||||
s_user(getpass.getuser())
|
||||
pkg_upgrade(args.u)
|
||||
if args.o:
|
||||
s_user(getpass.getuser())
|
||||
pkg_reinstall(args.o)
|
||||
if args.r:
|
||||
s_user(getpass.getuser())
|
||||
pkg_remove(args.r)
|
||||
if args.f:
|
||||
pkg_find(args.f)
|
||||
if args.d:
|
||||
pkg_display(args.d)
|
||||
if not any([args.verbose,
|
||||
args.s,
|
||||
args.t,
|
||||
args.c,
|
||||
args.n,
|
||||
args.o,
|
||||
args.i,
|
||||
args.u,
|
||||
args.a,
|
||||
args.r,
|
||||
args.l,
|
||||
args.f,
|
||||
args.d]):
|
||||
os.system("slpkg -h")
|
||||
except IndexError:
|
||||
ext_err_args()
|
||||
err2_args("")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -47,11 +47,10 @@ def ext_err_args():
|
|||
'''
|
||||
Extended error arguments view
|
||||
'''
|
||||
print ("usage: {0} [-h] [-v] [-a script [source ...]]".format(__all__))
|
||||
print (" [-l all, sbo, slack, noarch, other]")
|
||||
print (" [-c sbo, slack [sbo, slack ...]] [-t] [-n]")
|
||||
print (" [-s sbo, slack [sbo, slack ...]] [-i [...]] [-u [...]]")
|
||||
print (" [-o [...]] [-r [...]] [-f [...]] [-d [...]]")
|
||||
print ("usage: {0} [-h] [-v] [-a script [source ...]] [-l all, sbo, slack, noarch]".format(__all__))
|
||||
print (" [-c sbo, slack [sbo, slack ...]]")
|
||||
print (" [-s sbo, slack [sbo, slack ...]] [-t] [-n] [-i [...]]")
|
||||
print (" [-u [...]] [-o [...]] [-r [...]] [-f [...]] [-d [...]]")
|
||||
|
||||
def err1_args(invalid, choices):
|
||||
'''
|
||||
|
@ -60,12 +59,12 @@ def err1_args(invalid, choices):
|
|||
print ("{0}: error: invalid choice: '{1}' choose from {2}".format(
|
||||
__all__, invalid, choices))
|
||||
|
||||
def err2_args():
|
||||
def err2_args(choices):
|
||||
'''
|
||||
Print error message arguments
|
||||
'''
|
||||
print ("{0}: error: must enter at least two arguments".format(
|
||||
__all__))
|
||||
print ("{0}: error: must enter at least two arguments: choose {1}".format(
|
||||
__all__, choices))
|
||||
|
||||
def s_user(user):
|
||||
'''
|
||||
|
@ -81,7 +80,7 @@ def template(max):
|
|||
'''
|
||||
print ("+" + "=" * max)
|
||||
|
||||
def view_sbo(pkg, sbo_url, sbo_dwn, source_dwn, extra_dwn, sbo_req):
|
||||
def view_sbo(pkg, sbo_url, sbo_dwn, source_dwn, sbo_req):
|
||||
print # new line at start
|
||||
template(78)
|
||||
print("| {0}Package {1}{2}{3} --> {4}".format(colors.GREEN,
|
||||
|
@ -89,9 +88,8 @@ def view_sbo(pkg, sbo_url, sbo_dwn, source_dwn, extra_dwn, sbo_req):
|
|||
template(78)
|
||||
print("| {0}SlackBuild : {1}{2}".format(colors.GREEN, colors.ENDC, sbo_dwn))
|
||||
print("| {0}Source : {1}{2}".format(colors.GREEN, colors.ENDC, source_dwn))
|
||||
print("| {0}Extra : {1}{2}".format(colors.GREEN, colors.ENDC, extra_dwn))
|
||||
print("| {0}Requirements : {1}{2}".format(colors.YELLOW, colors.ENDC,
|
||||
", ".join(sbo_req.split())))
|
||||
", ".join(sbo_req)))
|
||||
template(78)
|
||||
print(" {0}R{1}EADME View the README file".format(colors.RED, colors.ENDC))
|
||||
print(" {0}S{1}lackBuild View the SlackBuild file".format(colors.RED, colors.ENDC))
|
||||
|
|
|
@ -27,9 +27,9 @@ import shutil
|
|||
import tarfile
|
||||
import subprocess
|
||||
|
||||
from slpkg.messages import pkg_not_found, s_user
|
||||
from slpkg.messages import pkg_not_found
|
||||
|
||||
def build_package(script, source, extra, path):
|
||||
def build_package(script, sources, path):
|
||||
'''
|
||||
Build package from source
|
||||
'''
|
||||
|
@ -38,10 +38,10 @@ def build_package(script, source, extra, path):
|
|||
tar = tarfile.open(script)
|
||||
tar.extractall()
|
||||
tar.close()
|
||||
shutil.copy2(source, pkg_name)
|
||||
for src in extra:
|
||||
for src in sources:
|
||||
shutil.copy2(src, pkg_name)
|
||||
os.chdir(path + pkg_name)
|
||||
subprocess.call("chmod +x {0}.SlackBuild".format(pkg_name), shell=True)
|
||||
subprocess.call("./{0}.SlackBuild".format(pkg_name), shell=True)
|
||||
os.chdir(path)
|
||||
except (OSError, IOError):
|
||||
|
|
|
@ -28,8 +28,8 @@ import subprocess
|
|||
from collections import OrderedDict
|
||||
|
||||
from slpkg.colors import colors
|
||||
from slpkg.messages import pkg_not_found, s_user, template
|
||||
from slpkg.__metadata__ import pkg_path, uname, arch, sp, log_path
|
||||
from slpkg.messages import pkg_not_found, template
|
||||
from slpkg.__metadata__ import pkg_path, sp, log_path
|
||||
|
||||
from find import find_package
|
||||
|
||||
|
@ -39,7 +39,7 @@ def pkg_install(binary):
|
|||
'''
|
||||
for pkg in binary:
|
||||
try:
|
||||
print subprocess.check_output('installpkg {0}'.format(pkg), shell=True)
|
||||
print subprocess.check_output("installpkg {0}".format(pkg), shell=True)
|
||||
except subprocess.CalledProcessError:
|
||||
message = "Can't install"
|
||||
if len(binary) > 1:
|
||||
|
@ -54,7 +54,7 @@ def pkg_upgrade(binary):
|
|||
'''
|
||||
for pkg in binary:
|
||||
try:
|
||||
print subprocess.check_output('upgradepkg --install-new {0}'.format(pkg),
|
||||
print subprocess.check_output("upgradepkg --install-new {0}".format(pkg),
|
||||
shell=True)
|
||||
except subprocess.CalledProcessError:
|
||||
message = "Can't upgrade"
|
||||
|
@ -70,7 +70,7 @@ def pkg_reinstall(binary):
|
|||
'''
|
||||
for pkg in binary:
|
||||
try:
|
||||
print subprocess.check_output('upgradepkg --reinstall {0}'.format(pkg),
|
||||
print subprocess.check_output("upgradepkg --reinstall {0}".format(pkg),
|
||||
shell=True)
|
||||
except subprocess.CalledProcessError:
|
||||
message = "Can't reinstall"
|
||||
|
@ -140,17 +140,17 @@ def pkg_remove(binary):
|
|||
if remove_dep == "y" or remove_dep == "Y":
|
||||
for dep in dependencies:
|
||||
if find_package(dep + sp, pkg_path):
|
||||
print subprocess.check_output('removepkg {0}'.format(dep), shell=True)
|
||||
print subprocess.check_output("removepkg {0}".format(dep), shell=True)
|
||||
os.remove(dep_path + rmv)
|
||||
rmv_dependencies += dependencies[:-1]
|
||||
else:
|
||||
if find_package(rmv + sp, pkg_path):
|
||||
print subprocess.check_output('removepkg {0}'.format(rmv), shell=True)
|
||||
print subprocess.check_output("removepkg {0}".format(rmv), shell=True)
|
||||
f.close()
|
||||
os.remove(dep_path + rmv)
|
||||
else:
|
||||
if find_package(rmv + sp, pkg_path):
|
||||
print subprocess.check_output('removepkg {0}'.format(rmv), shell=True)
|
||||
print subprocess.check_output("removepkg {0}".format(rmv), shell=True)
|
||||
'''
|
||||
Prints all removed packages
|
||||
'''
|
||||
|
@ -171,13 +171,13 @@ def pkg_find(binary):
|
|||
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
||||
colors.CYAN, ', '.join(binary), colors.ENDC))
|
||||
for pkg in binary:
|
||||
if find_package(pkg + sp, pkg_path) == []:
|
||||
if find_package(pkg + sp, pkg_path):
|
||||
print(colors.GREEN + "[ installed ] - " + colors.ENDC + "\n ".join(
|
||||
find_package(pkg + sp, pkg_path)))
|
||||
else:
|
||||
message = "Can't find"
|
||||
bol, eol = "", ""
|
||||
pkg_not_found(bol, pkg, message, eol)
|
||||
else:
|
||||
print(colors.GREEN + "[ installed ] - " + colors.ENDC + "\n ".join(
|
||||
find_package(pkg + sp, pkg_path)))
|
||||
print # new line at end
|
||||
|
||||
def pkg_display(binary):
|
||||
|
@ -185,70 +185,39 @@ def pkg_display(binary):
|
|||
Print the Slackware packages contents
|
||||
'''
|
||||
for pkg in binary:
|
||||
if find_package(pkg + sp, pkg_path) == []:
|
||||
if find_package(pkg + sp, pkg_path):
|
||||
print subprocess.check_output("cat {0}{1}".format(pkg_path,
|
||||
" /var/log/packages/".join(find_package(pkg +sp, pkg_path))), shell=True)
|
||||
else:
|
||||
message = "Can't dislpay"
|
||||
if len(binary) > 1:
|
||||
bol, eol = "", ""
|
||||
else:
|
||||
bol, eol = "\n", "\n"
|
||||
pkg_not_found(bol, pkg, message, eol)
|
||||
else:
|
||||
print subprocess.check_output("cat {0}{1}".format(pkg_path,
|
||||
" /var/log/packages/".join(find_package(pkg +sp, pkg_path))), shell=True)
|
||||
|
||||
def pkg_list(binary):
|
||||
def pkg_list(pattern):
|
||||
'''
|
||||
List with the installed packages
|
||||
'''
|
||||
try:
|
||||
print # new line at start
|
||||
if "sbo" in pattern:
|
||||
search = "_SBo"
|
||||
elif "slack" in pattern:
|
||||
search = "_slack"
|
||||
elif "noarch" in pattern:
|
||||
search = "-noarch-"
|
||||
elif "all" in pattern:
|
||||
search = ""
|
||||
index, page = 0, 50
|
||||
if "all" in binary:
|
||||
for pkg in sorted(os.listdir(pkg_path)):
|
||||
for pkg in sorted(os.listdir(pkg_path)):
|
||||
if search in pkg:
|
||||
index += 1
|
||||
print("{0}{1}:{2} {3}".format(colors.GREY, index, colors.ENDC, pkg))
|
||||
if index == page:
|
||||
key = raw_input('\nPress [ {0}Enter{1} ] >> Next page '.format(
|
||||
colors.CYAN, colors.ENDC))
|
||||
key = raw_input("\nPress [ {0}Enter{1} ] >> Next page ".format(
|
||||
colors.CYAN, colors.ENDC))
|
||||
page += 50
|
||||
if "sbo" in binary:
|
||||
for pkg in sorted(os.listdir(pkg_path)):
|
||||
if 'SBo' in pkg:
|
||||
index += 1
|
||||
print("{0}{1}:{2} {3}".format(colors.GREY, index, colors.ENDC, pkg))
|
||||
if index == page:
|
||||
key = raw_input('\nPress [ {0}Enter{1} ] >> Next page '.format(
|
||||
colors.CYAN, colors.ENDC))
|
||||
page += 50
|
||||
if "slack" in binary:
|
||||
for pkg in sorted(os.listdir(pkg_path)):
|
||||
if 'slack' in pkg:
|
||||
index += 1
|
||||
print("{0}{1}:{2} {3}".format(colors.GREY, index, colors.ENDC, pkg))
|
||||
if index == page:
|
||||
key = raw_input('\nPress [ {0}Enter{1} ] >> Next page '.format(
|
||||
colors.CYAN, colors.ENDC))
|
||||
page += 50
|
||||
if "noarch" in binary:
|
||||
for pkg in sorted(os.listdir(pkg_path)):
|
||||
if 'noarch' in pkg:
|
||||
index += 1
|
||||
print("{0}{1}:{2} {3}".format(colors.GREY, index, colors.ENDC, pkg))
|
||||
if index == page:
|
||||
key = raw_input('\nPress [ {0}Enter{1} ] >> Next page '.format(
|
||||
colors.CYAN, colors.ENDC))
|
||||
page += 50
|
||||
if "other" in binary:
|
||||
for pkg in sorted(os.listdir(pkg_path)):
|
||||
if 'SBo' in pkg or 'slack' in pkg or 'noarch' in pkg:
|
||||
pass
|
||||
else:
|
||||
index += 1
|
||||
print("{0}{1}:{2} {3}".format(colors.GREY, index, colors.ENDC, pkg))
|
||||
if index == page:
|
||||
key = raw_input('\nPress [ {0}Enter{1} ] >> Next page '.format(
|
||||
colors.CYAN, colors.ENDC))
|
||||
page += 50
|
||||
print # new line at end
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
|
|
|
@ -25,76 +25,104 @@ import os
|
|||
import sys
|
||||
import subprocess
|
||||
|
||||
from slpkg.pkg.find import find_package
|
||||
from slpkg.pkg.build import build_package
|
||||
from slpkg.pkg.manager import pkg_upgrade
|
||||
|
||||
from slpkg.colors import colors
|
||||
from slpkg.messages import template
|
||||
from slpkg.functions import get_file
|
||||
from slpkg.messages import pkg_not_found, template
|
||||
from slpkg.__metadata__ import tmp, pkg_path, arch, sp
|
||||
from slpkg.__metadata__ import sbo_arch, sbo_tag, sbo_filetype, build_path
|
||||
from slpkg.__metadata__ import tmp, pkg_path, build_path
|
||||
from slpkg.__metadata__ import sbo_arch, build, sbo_tag, sbo_filetype
|
||||
|
||||
from init import initialization
|
||||
from search import sbo_search_pkg
|
||||
from download import sbo_slackbuild_dwn
|
||||
from greps import sbo_source_dwn, sbo_extra_dwn, sbo_version_pkg
|
||||
from greps import sbo_source_dwn, sbo_version_pkg
|
||||
|
||||
def sbo_check(name):
|
||||
def sbo_check():
|
||||
'''
|
||||
Check for new package updates
|
||||
Upgrade all slackbuilds packages from slackbuilds.org
|
||||
repository
|
||||
'''
|
||||
sys.stdout.write("Reading package lists ...")
|
||||
sbo_file = "".join(find_package(name + sp, pkg_path))
|
||||
if sbo_file == "":
|
||||
sys.stdout.write("Done\n")
|
||||
message = "Not installed"
|
||||
bol, eol = "\n", "\n"
|
||||
pkg_not_found(bol, name, message, eol)
|
||||
else:
|
||||
try:
|
||||
sys.stdout.write("Reading package lists ...")
|
||||
sys.stdout.flush()
|
||||
sbo_url = sbo_search_pkg(name)
|
||||
if sbo_url is None:
|
||||
initialization()
|
||||
index, toolbar_width = 0, 3
|
||||
pkg_name, sbo_ver, pkg_for_upg, sbo_list = [], [], [], []
|
||||
for pkg in os.listdir(pkg_path):
|
||||
if "_SBo" in pkg:
|
||||
sbo_list.append(pkg)
|
||||
if sbo_list:
|
||||
for pkg in sbo_list:
|
||||
index += 1
|
||||
if index == toolbar_width:
|
||||
sys.stdout.write(".")
|
||||
sys.stdout.flush()
|
||||
toolbar_width += 3
|
||||
if "-x86_64-" in pkg:
|
||||
arch = "x86_64"
|
||||
elif "-i486-" in pkg:
|
||||
arch = "i486"
|
||||
elif "-arm-" in pkg:
|
||||
arch = "arm"
|
||||
elif "-noarch-" in pkg:
|
||||
arch = "noarch"
|
||||
else:
|
||||
arch = os.uname()[4]
|
||||
name = pkg[:-(len(arch) + len("_SBo") + 3)]
|
||||
pkg_version = get_file(name, "-")[1:]
|
||||
name = name[:-(len(pkg_version) + 1)]
|
||||
sbo_version = sbo_version_pkg(name)
|
||||
if sbo_version > pkg_version:
|
||||
pkg_name.append(name)
|
||||
pkg_for_upg.append(name + "-" + pkg_version)
|
||||
sbo_ver.append(sbo_version)
|
||||
sys.stdout.write("Done\n")
|
||||
message = "From slackbuilds.org"
|
||||
bol, eol = "\n", "\n"
|
||||
pkg_not_found(bol, name, message, eol)
|
||||
else:
|
||||
sys.stdout.write("Done\n")
|
||||
sbo_version = sbo_version_pkg(name)
|
||||
sbo_dwn = sbo_slackbuild_dwn(sbo_url, name)
|
||||
source_dwn = sbo_source_dwn(sbo_url, name)
|
||||
extra_dwn = sbo_extra_dwn(sbo_url, name)
|
||||
sbo_file_version = sbo_file[len(name) + 1:-len(arch) - 7]
|
||||
if sbo_version > sbo_file_version:
|
||||
print("\n{0}New version is available:{1}".format(
|
||||
colors.YELLOW, colors.ENDC))
|
||||
if pkg_for_upg:
|
||||
print("\nThese packages need upgrading:\n")
|
||||
template(78)
|
||||
print("| Package {0} {1} --> {2} {3}".format(
|
||||
name, sbo_file_version, name, sbo_version))
|
||||
print "| Package", " "*27, "New version", " "*5, "Arch", " "*7, "Repository"
|
||||
template(78)
|
||||
print # new line at start
|
||||
try:
|
||||
read = raw_input("Would you like to install [Y/n]? ")
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
sys.exit()
|
||||
print("Upgrading:")
|
||||
for upg, ver in zip(pkg_for_upg, sbo_ver):
|
||||
print " ", upg, " "*(34-len(upg)), ver, " "*(
|
||||
16-len(ver)), arch, " "*(11-len(arch)), "SBo"
|
||||
msg_pkg = "package"
|
||||
if len(pkg_for_upg) > 1:
|
||||
msg_pkg = msg_pkg + "s"
|
||||
print("\nInstalling summary")
|
||||
print("=" * 79)
|
||||
print("Total {0} {1} will be upgraded.\n".format(len(pkg_for_upg), msg_pkg))
|
||||
read = raw_input("Would you like to upgrade [Y/n]? ")
|
||||
if read == "Y" or read == "y":
|
||||
if not os.path.exists(build_path):
|
||||
os.mkdir(build_path)
|
||||
os.chdir(build_path)
|
||||
pkg_for_install = ("{0}-{1}".format(name, sbo_version))
|
||||
script = get_file(sbo_dwn, "/")
|
||||
source = get_file(source_dwn, "/")
|
||||
print("\n{0}Start -->{1}\n".format(colors.GREEN, colors.ENDC))
|
||||
subprocess.call("wget -N {0} {1}".format(sbo_dwn, source_dwn), shell=True)
|
||||
extra = []
|
||||
if extra_dwn:
|
||||
for src in extra_dwn.split():
|
||||
for name, version in zip(pkg_name, sbo_ver):
|
||||
pkg_for_install = ("{0}-{1}".format(name, version))
|
||||
sbo_url = sbo_search_pkg(name)
|
||||
sbo_dwn = sbo_slackbuild_dwn(sbo_url, name)
|
||||
src_dwn = sbo_source_dwn(name).split()
|
||||
script = get_file(sbo_dwn, "/")
|
||||
print("\n{0}Start -->{1} {2}\n".format(colors.GREEN, colors.ENDC, name))
|
||||
subprocess.call("wget -N {0}".format(sbo_dwn), shell=True)
|
||||
sources = []
|
||||
for src in src_dwn:
|
||||
subprocess.call("wget -N {0}".format(src), shell=True)
|
||||
extra.append(get_file(src, "/"))
|
||||
build_package(script, source, extra, build_path)
|
||||
binary = ("{0}{1}{2}{3}{4}".format(
|
||||
tmp, pkg_for_install, sbo_arch, sbo_tag, sbo_filetype).split())
|
||||
pkg_upgrade(binary)
|
||||
sources.append(get_file(src, "/"))
|
||||
build_package(script, sources, build_path)
|
||||
binary = ("{0}{1}{2}{3}{4}{5}".format(
|
||||
tmp, pkg_for_install, sbo_arch, build, sbo_tag, sbo_filetype).split())
|
||||
print("{0}[ Upgrading ] --> {1}{2}".format(
|
||||
colors.GREEN, colors.ENDC, name))
|
||||
pkg_upgrade(binary)
|
||||
print("Completed!\n")
|
||||
else:
|
||||
print("\nPackage {0}-{1} is up to date\n".format(name, sbo_file_version))
|
||||
print("\nAll SBo packages are up to date\n")
|
||||
else:
|
||||
sys.stdout.write("Done\n")
|
||||
print("\nNo SBo packages found\n")
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
sys.exit()
|
||||
|
|
|
@ -29,8 +29,9 @@ from slpkg.messages import pkg_not_found, template
|
|||
|
||||
from slpkg.pkg.find import find_package
|
||||
|
||||
from greps import sbo_requires_pkg
|
||||
from init import initialization
|
||||
from search import sbo_search_pkg
|
||||
from greps import sbo_requires_pkg
|
||||
from download import sbo_slackbuild_dwn
|
||||
|
||||
dep_results = []
|
||||
|
@ -48,14 +49,13 @@ def sbo_dependencies_pkg(name):
|
|||
bol, eol = "\n", "\n"
|
||||
pkg_not_found(bol, name, message, eol)
|
||||
else:
|
||||
sbo_req = sbo_requires_pkg(sbo_url, name)
|
||||
dependencies = sbo_req.split()
|
||||
dependencies = sbo_requires_pkg(sbo_url, name)
|
||||
if dependencies:
|
||||
dep_results.append(dependencies)
|
||||
for line in dependencies:
|
||||
sys.stdout.write(".")
|
||||
sys.stdout.flush()
|
||||
sbo_dependencies_pkg(line)
|
||||
for dep in dependencies:
|
||||
sys.stdout.write(".")
|
||||
sys.stdout.flush()
|
||||
sbo_dependencies_pkg(dep)
|
||||
return dep_results
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
|
@ -66,6 +66,7 @@ def pkg_tracking(name):
|
|||
Print tree of dependencies
|
||||
'''
|
||||
sys.stdout.write("Reading package lists ...")
|
||||
initialization()
|
||||
dependencies_list = sbo_dependencies_pkg(name)
|
||||
if dependencies_list is None:
|
||||
pass
|
||||
|
|
|
@ -26,35 +26,26 @@ import os
|
|||
from slpkg.url_read import url_read
|
||||
from slpkg.__metadata__ import arch, lib_path
|
||||
|
||||
def sbo_source_dwn(sbo_url, name):
|
||||
def sbo_source_dwn(name):
|
||||
'''
|
||||
Grep source downloads links
|
||||
Grep sources downloads links
|
||||
'''
|
||||
read_info = url_read(sbo_url + name + ".info")
|
||||
if arch == "x86_64":
|
||||
for line in read_info.splitlines():
|
||||
if line.startswith("DOWNLOAD_x86_64="):
|
||||
if len(line) > 18:
|
||||
return line[17:-1].strip()
|
||||
for line in read_info.splitlines():
|
||||
if line.startswith("DOWNLOAD="):
|
||||
return line[10:-1].strip()
|
||||
|
||||
def sbo_extra_dwn(sbo_url, name):
|
||||
'''
|
||||
Grep extra source downloads links
|
||||
'''
|
||||
read_info = url_read(sbo_url + name + ".info")
|
||||
extra = []
|
||||
for line in read_info.split():
|
||||
if line.endswith("\""):
|
||||
line = line[:-1].strip()
|
||||
if line.startswith("http"):
|
||||
extra.append(line.strip())
|
||||
if line.startswith("ftp"):
|
||||
extra.append(line.strip())
|
||||
return extra
|
||||
|
||||
for line in open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r"):
|
||||
if arch == "x86_64":
|
||||
if line.startswith("SLACKBUILD NAME: "):
|
||||
sbo_name = line[17:].strip()
|
||||
if line.startswith("SLACKBUILD DOWNLOAD_x86_64: "):
|
||||
if sbo_name == name:
|
||||
if line[28:].strip():
|
||||
return line[28:].strip()
|
||||
for line in open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r"):
|
||||
if line.startswith("SLACKBUILD NAME: "):
|
||||
sbo_name = line[17:].strip()
|
||||
if line.startswith("SLACKBUILD DOWNLOAD: "):
|
||||
if sbo_name == name:
|
||||
return line[21:].strip()
|
||||
|
||||
def sbo_requires_pkg(sbo_url, name):
|
||||
'''
|
||||
Grep package requirements
|
||||
|
@ -62,15 +53,15 @@ def sbo_requires_pkg(sbo_url, name):
|
|||
read_info = url_read(sbo_url + name + ".info")
|
||||
for line in read_info.splitlines():
|
||||
if line.startswith("REQUIRES=\""):
|
||||
return line[10:-1].strip()
|
||||
return line[10:-1].strip().split()
|
||||
|
||||
def sbo_version_pkg(name):
|
||||
sbo_name, sbo_ver = [], []
|
||||
'''
|
||||
Grep package verion
|
||||
'''
|
||||
for line in open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r"):
|
||||
if line.startswith("SLACKBUILD NAME: "):
|
||||
sbo_name.append(line[17:].strip())
|
||||
sbo_name = line[17:].strip()
|
||||
if line.startswith("SLACKBUILD VERSION: "):
|
||||
sbo_ver.append(line[20:].strip())
|
||||
for sbo, ver in zip(sbo_name, sbo_ver):
|
||||
if sbo == name:
|
||||
return ver
|
||||
if sbo_name == name:
|
||||
return line[20:].strip()
|
||||
|
|
|
@ -30,23 +30,16 @@ from slpkg.__metadata__ import lib_path
|
|||
|
||||
from slpkg.slack.slack_version import slack_ver
|
||||
|
||||
from init import initialization
|
||||
|
||||
def sbo_search_pkg(name):
|
||||
'''
|
||||
Search for package path from SLACKBUILDS.TXT file
|
||||
'''
|
||||
initialization()
|
||||
try:
|
||||
sbo_location = []
|
||||
sbo_url = ("http://slackbuilds.org/slackbuilds/{0}/".format(slack_ver()))
|
||||
for line in open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r"):
|
||||
if line.startswith("SLACKBUILD LOCATION"):
|
||||
sbo_location.append(line.replace("SLACKBUILD LOCATION: ./", ""))
|
||||
for location in sbo_location:
|
||||
location = location.replace("\n", "")
|
||||
if get_file(location, "/") == name:
|
||||
return sbo_url + location.replace(name, "") + name + "/"
|
||||
if name == get_file(line[23:].strip(), "/").replace("\n", ""):
|
||||
return sbo_url + line[23:].strip() + "/"
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
sys.exit()
|
||||
|
|
|
@ -28,18 +28,19 @@ import subprocess
|
|||
from slpkg.colors import colors
|
||||
from slpkg.functions import get_file
|
||||
from slpkg.messages import pkg_not_found, pkg_found, template
|
||||
from slpkg.__metadata__ import sbo_arch, sbo_tag, sbo_filetype, arch
|
||||
from slpkg.__metadata__ import sbo_arch, build, sbo_tag, sbo_filetype
|
||||
from slpkg.__metadata__ import tmp, pkg_path, build_path, log_path, sp
|
||||
|
||||
from slpkg.pkg.find import find_package
|
||||
from slpkg.pkg.build import build_package
|
||||
from slpkg.pkg.manager import pkg_upgrade
|
||||
|
||||
from init import initialization
|
||||
from search import sbo_search_pkg
|
||||
from file_size import server_file_size
|
||||
from download import sbo_slackbuild_dwn
|
||||
from dependency import sbo_dependencies_pkg
|
||||
from greps import sbo_source_dwn, sbo_extra_dwn, sbo_version_pkg
|
||||
from greps import sbo_source_dwn, sbo_version_pkg
|
||||
|
||||
def sbo_build(name):
|
||||
'''
|
||||
|
@ -47,6 +48,7 @@ def sbo_build(name):
|
|||
dependencies
|
||||
'''
|
||||
sys.stdout.write("Building dependency tree ...")
|
||||
initialization()
|
||||
dependencies_list = sbo_dependencies_pkg(name)
|
||||
if dependencies_list == None:
|
||||
pass
|
||||
|
@ -55,7 +57,7 @@ def sbo_build(name):
|
|||
if not os.path.exists(build_path):
|
||||
os.mkdir(build_path)
|
||||
os.chdir(build_path)
|
||||
requires, dependencies, extra = [], [], []
|
||||
requires, dependencies = [], []
|
||||
requires.append(name)
|
||||
for pkg in dependencies_list:
|
||||
requires += pkg
|
||||
|
@ -70,54 +72,73 @@ def sbo_build(name):
|
|||
pkg_sum = 1
|
||||
else:
|
||||
pkg_for_install.append(colors.RED + name + colors.ENDC)
|
||||
sbo_url = sbo_search_pkg(name)
|
||||
sbo_ver = sbo_version_pkg(name)
|
||||
sys.stdout.write("Done\n")
|
||||
src = sbo_source_dwn(name)
|
||||
arch = os.uname()[4]
|
||||
if arch == "x86_64":
|
||||
arch = "x86_64"
|
||||
elif arch.startswith("i") and arch.endswith("86"):
|
||||
arch = "i486"
|
||||
elif "arm" in arch:
|
||||
arch = "arm"
|
||||
else:
|
||||
arch = os.uname()[4]
|
||||
if "UNSUPPORTED" in src:
|
||||
arch = "UNSUPPORTED"
|
||||
elif "UNTESTED" in src:
|
||||
arch = "UNTESTED"
|
||||
print("The following packages will be automatically installed or upgraded with new version:\n")
|
||||
template(78)
|
||||
print "| Package", " "*15, "Version", " "*5, "Arch", " "*7, "Repository"
|
||||
print "| Package", " "*31, "Version", " "*7, "Arch", " "*5, "Repository"
|
||||
template(78)
|
||||
print("Installing:")
|
||||
print " ", "".join(pkg_for_install), " "*(22-len(name)), sbo_ver, " "*(
|
||||
12-len(sbo_ver)), arch, " "*(11-len(arch)), "SBo"
|
||||
print " ", "".join(pkg_for_install), " "*(38-len(name)), sbo_ver, " "*(
|
||||
14-len(sbo_ver)), arch, " "*(9-len(arch)), "SBo"
|
||||
print("Installing for dependencies:")
|
||||
for dep in dependencies[:-1]:
|
||||
sbo_url = sbo_search_pkg(dep)
|
||||
sbo_ver = sbo_version_pkg(dep)
|
||||
if find_package(dep + sp, pkg_path):
|
||||
print " ", colors.GREEN + dep + colors.ENDC, " "*(22-len(dep)), sbo_ver, " "*(
|
||||
12-len(sbo_ver)), arch, " "*(11-len(arch)), "SBo"
|
||||
print " ", colors.GREEN + dep + colors.ENDC, " "*(38-len(dep)), sbo_ver, " "*(
|
||||
14-len(sbo_ver)), arch, " "*(9-len(arch)), "SBo"
|
||||
pkg_sum += 1
|
||||
else:
|
||||
print " ", colors.RED + dep + colors.ENDC, " "*(22-len(dep)), sbo_ver, " "*(
|
||||
12-len(sbo_ver)), arch, " "*(11-len(arch)), "SBo"
|
||||
print " ", colors.RED + dep + colors.ENDC, " "*(38-len(dep)), sbo_ver, " "*(
|
||||
14-len(sbo_ver)), arch, " "*(9-len(arch)), "SBo"
|
||||
msg_pkg = "package"
|
||||
msg_2_pkg = msg_pkg
|
||||
if len(dependencies) > 1:
|
||||
msg_pkg = msg_pkg + "s"
|
||||
if len(dependencies) - pkg_sum > 1:
|
||||
msg_2_pkg = msg_2_pkg + "s"
|
||||
print("\nInstalling summary")
|
||||
print("="*79)
|
||||
print("Total {0} packages.".format(len(dependencies)))
|
||||
print("{0} packages will be installed, {1} allready installed.".format(
|
||||
(len(dependencies) - pkg_sum), pkg_sum))
|
||||
print("Total {0} {1}.".format(len(dependencies), msg_pkg))
|
||||
print("{0} {1} will be installed, {2} allready installed.".format(
|
||||
(len(dependencies) - pkg_sum), msg_2_pkg, pkg_sum))
|
||||
read = raw_input("\nDo you want to continue [Y/n]? ")
|
||||
if read == "Y" or read == "y":
|
||||
for pkg in dependencies:
|
||||
sbo_url = sbo_search_pkg(pkg)
|
||||
sbo_version = sbo_version_pkg(pkg)
|
||||
sbo_file = "".join(find_package(pkg + sp, pkg_path))
|
||||
sbo_file_version = sbo_file[len(pkg) + 1:-len(arch) - 7]
|
||||
if sbo_version > sbo_file_version:
|
||||
prgnam = ("{0}-{1}".format(pkg, sbo_version_pkg(pkg)))
|
||||
sbo_url = sbo_search_pkg(pkg)
|
||||
sbo_link = sbo_slackbuild_dwn(sbo_url, pkg)
|
||||
src_link = sbo_source_dwn(sbo_url, pkg)
|
||||
ext_link = sbo_extra_dwn(sbo_url, pkg)
|
||||
src_link = sbo_source_dwn(pkg).split()
|
||||
script = get_file(sbo_link, "/")
|
||||
source = get_file(src_link, "/")
|
||||
subprocess.call("wget -N {0} {1}".format(sbo_link, src_link), shell=True)
|
||||
if ext_link:
|
||||
for src in ext_link:
|
||||
subprocess.call("wget -N {0}".format(src), shell=True)
|
||||
extra.append(get_file(src, "/"))
|
||||
build_package(script, source, extra, build_path)
|
||||
binary = ("{0}{1}{2}{3}{4}".format(
|
||||
tmp, prgnam, sbo_arch, sbo_tag, sbo_filetype).split())
|
||||
print("\n{0}Start -->{1} {2}\n".format(colors.GREEN, colors.ENDC, pkg))
|
||||
subprocess.call("wget -N {0}".format(sbo_link), shell=True)
|
||||
sources = []
|
||||
for src in src_link:
|
||||
subprocess.call("wget -N {0}".format(src), shell=True)
|
||||
sources.append(get_file(src, "/"))
|
||||
build_package(script, sources, build_path)
|
||||
binary = ("{0}{1}{2}{3}{4}{5}".format(
|
||||
tmp, prgnam, sbo_arch, build, sbo_tag, sbo_filetype).split())
|
||||
print("{0}[ Installing ] --> {1}{2}".format(
|
||||
colors.GREEN, colors.ENDC, pkg))
|
||||
pkg_upgrade(binary)
|
||||
else:
|
||||
template(78)
|
||||
|
@ -127,16 +148,17 @@ def sbo_build(name):
|
|||
Write dependencies in a log file
|
||||
into directory `/var/log/slpkg/dep/`
|
||||
'''
|
||||
dep_path = log_path + "dep/"
|
||||
if not os.path.exists(dep_path):
|
||||
os.mkdir(dep_path)
|
||||
if os.path.isfile(dep_path + name):
|
||||
os.remove(dep_path + name)
|
||||
if len(dependencies) > 1:
|
||||
f = open(dep_path + name, "w")
|
||||
for dep in dependencies:
|
||||
f.write(dep + "\n")
|
||||
f.close()
|
||||
if find_package(name + sp, pkg_path):
|
||||
dep_path = log_path + "dep/"
|
||||
if not os.path.exists(dep_path):
|
||||
os.mkdir(dep_path)
|
||||
if os.path.isfile(dep_path + name):
|
||||
os.remove(dep_path + name)
|
||||
if len(dependencies) > 1:
|
||||
f = open(dep_path + name, "w")
|
||||
for dep in dependencies:
|
||||
f.write(dep + "\n")
|
||||
f.close()
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
sys.exit()
|
||||
|
|
|
@ -28,8 +28,8 @@ import subprocess
|
|||
from slpkg.colors import colors
|
||||
from slpkg.functions import get_file
|
||||
from slpkg.__metadata__ import tmp, pkg_path, slpkg_tmp, sp
|
||||
from slpkg.__metadata__ import sbo_arch, sbo_tag, sbo_filetype, build_path
|
||||
from slpkg.messages import s_user, pkg_not_found, pkg_found, view_sbo, template
|
||||
from slpkg.messages import pkg_not_found, pkg_found, view_sbo, template
|
||||
from slpkg.__metadata__ import sbo_arch, build, sbo_tag, sbo_filetype, build_path
|
||||
|
||||
from slpkg.pkg.build import build_package
|
||||
from slpkg.pkg.find import find_package
|
||||
|
@ -37,6 +37,7 @@ from slpkg.pkg.manager import pkg_upgrade
|
|||
|
||||
from read import *
|
||||
from greps import *
|
||||
from init import initialization
|
||||
from search import sbo_search_pkg
|
||||
from download import sbo_slackbuild_dwn
|
||||
|
||||
|
@ -47,6 +48,7 @@ def sbo_network(name):
|
|||
'''
|
||||
rdm_path = slpkg_tmp + "readme/"
|
||||
sys.stdout.write("Reading package lists ...")
|
||||
initialization()
|
||||
sbo_url = sbo_search_pkg(name)
|
||||
if sbo_url is None:
|
||||
sys.stdout.write ("Done\n")
|
||||
|
@ -59,12 +61,9 @@ def sbo_network(name):
|
|||
sys.stdout.write ("Done\n")
|
||||
sbo_req = sbo_requires_pkg(sbo_url, name)
|
||||
sbo_dwn = sbo_slackbuild_dwn(sbo_url, name)
|
||||
sbo_version = sbo_version_pkg(name)
|
||||
source_dwn = sbo_source_dwn(sbo_url, name)
|
||||
extra_dwn = " ".join(sbo_extra_dwn(sbo_url, name))
|
||||
view_sbo(name, sbo_url, get_file(sbo_dwn, "/"), get_file(source_dwn, "/"),
|
||||
", ".join([get_file(extra_dwn, "/") for extra_dwn in extra_dwn.split()]),
|
||||
sbo_req)
|
||||
source_dwn = sbo_source_dwn(name).split()
|
||||
view_sbo(name, sbo_url, get_file(sbo_dwn, "/"),
|
||||
", ".join([get_file(src, "/") for src in source_dwn]), sbo_req)
|
||||
while True:
|
||||
try:
|
||||
read = raw_input("_ ")
|
||||
|
@ -72,11 +71,11 @@ def sbo_network(name):
|
|||
print # new line at exit
|
||||
break
|
||||
if read == "D" or read == "d":
|
||||
print("\n{0}Start -->{1}\n".format(colors.GREEN, colors.ENDC))
|
||||
subprocess.call("wget -N {0} {1}".format(sbo_dwn, source_dwn), shell=True)
|
||||
if extra_dwn:
|
||||
for src in extra_dwn.split():
|
||||
subprocess.call("wget -N {0}".format(src), shell=True)
|
||||
print("\n{0}Start --> {1}{2}\n".format(colors.GREEN, colors.ENDC, name))
|
||||
subprocess.call("wget -N {0}".format(sbo_dwn), shell=True)
|
||||
for src in source_dwn:
|
||||
subprocess.call("wget -N {0}".format(src), shell=True)
|
||||
print("Complete!\n")
|
||||
break
|
||||
elif read == "R" or read == "r":
|
||||
site = "README"
|
||||
|
@ -94,41 +93,44 @@ def sbo_network(name):
|
|||
subprocess.call("less {0}{1}{2}".format(rdm_path, name, site), shell=True)
|
||||
os.remove("{0}{1}{2}".format(rdm_path, name, site))
|
||||
elif read == "B" or read == "b":
|
||||
sources = []
|
||||
os.chdir(build_path)
|
||||
script = get_file(sbo_dwn, "/")
|
||||
source = get_file(source_dwn, "/")
|
||||
print("\n{0}Start -->{1}\n".format(colors.GREEN, colors.ENDC))
|
||||
subprocess.call("wget -N {0} {1}".format(sbo_dwn, source_dwn), shell=True)
|
||||
extra = []
|
||||
if extra_dwn:
|
||||
for src in extra_dwn.split():
|
||||
subprocess.call("wget -N {0}".format(src), shell=True)
|
||||
extra.append(get_file(src, "/"))
|
||||
build_package(script, source, extra, build_path)
|
||||
print("\n{0}Start -->{1} {2}\n".format(colors.GREEN, colors.ENDC, name))
|
||||
subprocess.call("wget -N {0}".format(sbo_dwn), shell=True)
|
||||
for src in source_dwn:
|
||||
subprocess.call("wget -N {0}".format(src), shell=True)
|
||||
sources.append(get_file(src, "/"))
|
||||
build_package(script, sources, build_path)
|
||||
print("Complete!\n")
|
||||
break
|
||||
elif read == "I" or read == "i":
|
||||
os.chdir(build_path)
|
||||
pkg_for_install = ("{0}-{1}".format(name, sbo_version))
|
||||
sbo_version = sbo_version_pkg(name)
|
||||
if find_package(name + sp, pkg_path) == []:
|
||||
sources = []
|
||||
os.chdir(build_path)
|
||||
pkg_for_install = ("{0}-{1}".format(name, sbo_version))
|
||||
print("\n{0}Start -->{1} {2}\n".format(colors.GREEN, colors.ENDC, name))
|
||||
subprocess.call("wget -N {0}".format(sbo_dwn), shell=True)
|
||||
script = get_file(sbo_dwn, "/")
|
||||
source = get_file(source_dwn, "/")
|
||||
print("\n{0}Start -->{1}\n".format(colors.GREEN, colors.ENDC))
|
||||
subprocess.call("wget -N {0} {1}".format(sbo_dwn, source_dwn), shell=True)
|
||||
extra = []
|
||||
if extra_dwn:
|
||||
for src in extra_dwn.split():
|
||||
for src in source_dwn:
|
||||
subprocess.call("wget -N {0}".format(src), shell=True)
|
||||
extra.append(get_file(src, "/"))
|
||||
build_package(script, source, extra, build_path)
|
||||
binary = ("{0}{1}{2}{3}{4}".format(
|
||||
tmp, pkg_for_install, sbo_arch, sbo_tag, sbo_filetype).split())
|
||||
sources.append(get_file(src, "/"))
|
||||
build_package(script, sources, build_path)
|
||||
binary = ("{0}{1}{2}{3}{4}{5}".format(
|
||||
tmp, pkg_for_install, sbo_arch, build, sbo_tag, sbo_filetype).split())
|
||||
print("{0}[ Installing ] --> {1}{2}".format(
|
||||
colors.GREEN, colors.ENDC, name))
|
||||
pkg_upgrade(binary)
|
||||
if find_package(name + sp, pkg_path):
|
||||
print("Complete!\n")
|
||||
else:
|
||||
print("The package {0} may not install successfully".format(name))
|
||||
break
|
||||
else:
|
||||
template(78)
|
||||
pkg_found(name, sbo_version)
|
||||
template(78)
|
||||
print # new line at end
|
||||
break
|
||||
else:
|
||||
break
|
||||
|
|
|
@ -29,7 +29,7 @@ import subprocess
|
|||
from slpkg.colors import colors
|
||||
from slpkg.url_read import url_read
|
||||
from slpkg.messages import pkg_not_found, template
|
||||
from slpkg.__metadata__ import slpkg_tmp, pkg_path, arch, sp
|
||||
from slpkg.__metadata__ import slpkg_tmp, pkg_path, sp
|
||||
|
||||
from slpkg.pkg.manager import pkg_upgrade, pkg_reinstall
|
||||
|
||||
|
@ -40,9 +40,9 @@ def install(slack_pkg):
|
|||
Install packages from official Slackware distribution
|
||||
'''
|
||||
try:
|
||||
comp_sum, uncomp_sum = [], []
|
||||
dwn_list, comp_size, uncomp_size = [], [], []
|
||||
install_all, package_name, package_location = [], [], []
|
||||
comp_list, uncomp_list, comp_sum, uncomp_sum = [], [], [], []
|
||||
dwn_list, dwn_packages, comp_size, uncomp_size = [], [], [], []
|
||||
tmp_path = slpkg_tmp + "packages/"
|
||||
pkg_sum = 0
|
||||
if not os.path.exists(tmp_path):
|
||||
|
@ -54,14 +54,14 @@ def install(slack_pkg):
|
|||
sys.stdout.write ("Reading package lists ...")
|
||||
sys.stdout.flush()
|
||||
PACKAGE_TXT = url_read(mirrors(name="PACKAGES.TXT", location=""))
|
||||
index, toolbar_width = 0, 600
|
||||
index, toolbar_width = 0, 800
|
||||
for line in PACKAGE_TXT.splitlines():
|
||||
index += 1
|
||||
if index == toolbar_width:
|
||||
sys.stdout.write(".")
|
||||
sys.stdout.flush()
|
||||
toolbar_width += 600
|
||||
time.sleep(0.05)
|
||||
toolbar_width += 800
|
||||
time.sleep(0.00888)
|
||||
if line.startswith("PACKAGE NAME"):
|
||||
package_name.append(line[15:].strip())
|
||||
if line.startswith("PACKAGE LOCATION"):
|
||||
|
@ -70,61 +70,45 @@ def install(slack_pkg):
|
|||
comp_size.append(line[28:-2].strip())
|
||||
if line.startswith("PACKAGE SIZE (uncompressed): "):
|
||||
uncomp_size.append(line[30:-2].strip())
|
||||
for loc, name in zip(package_location, package_name):
|
||||
dwn_list.append("{0}{1}/{2}".format(mirrors("",""), loc, name))
|
||||
for name, size in zip(package_name, comp_size):
|
||||
comp_list.append("{0}{1}".format(name, size))
|
||||
for name, size in zip(package_name, uncomp_size):
|
||||
uncomp_list.append("{0}{1}".format(name, size))
|
||||
for loc, name, comp, uncomp in zip(package_location, package_name, comp_size, uncomp_size):
|
||||
if slack_pkg in name:
|
||||
dwn_list.append("{0}{1}/{2}".format(mirrors("",""), loc, name))
|
||||
install_all.append(name)
|
||||
comp_sum.append(comp)
|
||||
uncomp_sum.append(uncomp)
|
||||
sys.stdout.write("Done\n\n")
|
||||
for search in package_name:
|
||||
if slack_pkg in search:
|
||||
install_all.append(search)
|
||||
if install_all == []:
|
||||
bol, eol = "", "\n"
|
||||
message = "No matching"
|
||||
pkg_not_found(bol, slack_pkg, message, eol)
|
||||
else:
|
||||
if install_all:
|
||||
template(78)
|
||||
print "| Package", " "*33, "Arch", " "*3, "Build", " ", "Repos", " ", "Size"
|
||||
template(78)
|
||||
print("Installing:")
|
||||
for pkg in package_name:
|
||||
if slack_pkg in pkg:
|
||||
for size in comp_list:
|
||||
if pkg in size:
|
||||
Kb = size.replace(pkg, "")
|
||||
if "-noarch-" in pkg:
|
||||
arch = "noarch"
|
||||
elif sp+os.uname()[4]+sp in pkg:
|
||||
arch = os.uname()[4]
|
||||
elif "-i486-" in pkg:
|
||||
arch = "i486"
|
||||
elif "-i686-" in pkg:
|
||||
arch = "i686"
|
||||
elif "-x86-" in pkg:
|
||||
arch = "x86"
|
||||
elif "-fw-" in pkg:
|
||||
arch = "fw"
|
||||
else:
|
||||
arch = ""
|
||||
if os.path.isfile(pkg_path + pkg[:-4]):
|
||||
pkg_sum += 1
|
||||
SC, EC = colors.GREEN, colors.ENDC
|
||||
else:
|
||||
SC, EC = colors.RED, colors.ENDC
|
||||
print " ", SC + pkg[:-5].replace(sp+arch+sp, "") + EC, " "*(
|
||||
40-len(pkg[:-5].replace(sp+arch+sp, ""))), arch, " "*(
|
||||
7-len(arch)), pkg[-5:-4].replace(sp+arch+sp, ""), " "*(
|
||||
6-len(pkg[-5:-4].replace(sp+arch+sp, ""))), "Slack", " ", Kb, " "*(
|
||||
3-len(Kb)), "K"
|
||||
for install in install_all:
|
||||
for comp in comp_list:
|
||||
if install == comp[:-(len(comp)-len(install))]:
|
||||
comp_sum.append(comp.replace(install, ""))
|
||||
for uncomp in uncomp_list:
|
||||
if install == uncomp[:-(len(uncomp)-len(install))]:
|
||||
uncomp_sum.append(uncomp.replace(install, ""))
|
||||
for pkg, comp in zip(install_all, comp_sum):
|
||||
if "-noarch-" in pkg:
|
||||
arch = "noarch"
|
||||
elif "-x86_64-" in pkg:
|
||||
arch = "x86_64"
|
||||
elif "-i386-" in pkg:
|
||||
arch = "i386"
|
||||
elif "-i486-" in pkg:
|
||||
arch = "i486"
|
||||
elif "-i686-" in pkg:
|
||||
arch = "i686"
|
||||
elif "-x86-" in pkg:
|
||||
arch = "x86"
|
||||
elif "-fw-" in pkg:
|
||||
arch = "fw"
|
||||
else:
|
||||
arch = ""
|
||||
if os.path.isfile(pkg_path + pkg[:-4]):
|
||||
pkg_sum += 1
|
||||
SC, EC = colors.GREEN, colors.ENDC
|
||||
else:
|
||||
SC, EC = colors.RED, colors.ENDC
|
||||
print " ", SC + pkg[:-5].replace(sp+arch+sp, "") + EC, " "*(
|
||||
40-len(pkg[:-5].replace(sp+arch+sp, ""))), arch, " "*(
|
||||
7-len(arch)), pkg[-5:-4].replace(sp+arch+sp, ""), " "*(
|
||||
6-len(pkg[-5:-4].replace(sp+arch+sp, ""))), "Slack", " ", comp, " "*(
|
||||
3-len(comp)), "K"
|
||||
comp_unit, uncomp_unit = "Mb", "Mb"
|
||||
compressed = round((sum(map(float, comp_sum)) * 0.0001220703125), 2)
|
||||
uncompressed = round((sum(map(float, uncomp_sum)) * 0.0001220703125), 2)
|
||||
|
@ -150,22 +134,19 @@ def install(slack_pkg):
|
|||
uncompressed, uncomp_unit))
|
||||
read = raw_input("\nWould you like to install [Y/n]? ")
|
||||
if read == "Y" or read == "y":
|
||||
for dwn in dwn_list:
|
||||
subprocess.call("wget -N --directory-prefix={0} {1} {2}.asc".format(
|
||||
tmp_path, dwn, dwn), shell=True)
|
||||
for install in install_all:
|
||||
for dwn in dwn_list:
|
||||
if "/" + install in dwn:
|
||||
subprocess.call(
|
||||
"wget -N --directory-prefix={0} {1} {2}.asc".format(
|
||||
tmp_path, dwn, dwn), shell=True)
|
||||
for install in install_all:
|
||||
print install
|
||||
if not os.path.isfile(pkg_path + install[:-4]):
|
||||
print("{0}[ installing ] --> {1}{2}".format(
|
||||
colors.GREEN, colors.ENDC, install))
|
||||
colors.GREEN, colors.ENDC, install))
|
||||
pkg_upgrade((tmp_path + install).split())
|
||||
else:
|
||||
print("{0}[ reinstalling ] --> {1}{2}".format(
|
||||
colors.GREEN, colors.ENDC, install))
|
||||
colors.GREEN, colors.ENDC, install))
|
||||
pkg_reinstall((tmp_path + install).split())
|
||||
print("Completed!\n")
|
||||
read = raw_input("Removal downloaded packages [Y/n]? ")
|
||||
if read == "Y" or read == "y":
|
||||
for remove in install_all:
|
||||
|
@ -179,6 +160,10 @@ def install(slack_pkg):
|
|||
else:
|
||||
print("\nThere are packages in directory {0}\n".format(
|
||||
tmp_path))
|
||||
else:
|
||||
bol, eol = "", "\n"
|
||||
message = "No matching"
|
||||
pkg_not_found(bol, slack_pkg, message, eol)
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
sys.exit()
|
||||
|
|
|
@ -41,9 +41,9 @@ def patches():
|
|||
Install new patches from official Slackware mirrors
|
||||
'''
|
||||
try:
|
||||
comp_sum, uncomp_sum = [], []
|
||||
dwn_patches, comp_size, uncomp_size = [], [], []
|
||||
upgrade_all, package_name, package_location = [], [], []
|
||||
comp_list, uncomp_list, comp_sum, uncomp_sum = [], [], [], []
|
||||
dwn_list, dwn_patches, comp_size, uncomp_size = [], [], [], []
|
||||
pch_path = slpkg_tmp + "patches/"
|
||||
slack_arch = ""
|
||||
if not os.path.exists(pch_path):
|
||||
|
@ -69,15 +69,12 @@ def patches():
|
|||
comp_size.append(line[28:-2].strip())
|
||||
if line.startswith("PACKAGE SIZE (uncompressed): "):
|
||||
uncomp_size.append(line[30:-2].strip())
|
||||
for loc, name in zip(package_location, package_name):
|
||||
dwn_list.append("{0}{1}/{2}".format(mirrors("",""), loc, name))
|
||||
for name, size in zip(package_name, comp_size):
|
||||
comp_list.append("{0}{1}".format(name, size))
|
||||
for name, size in zip(package_name, uncomp_size):
|
||||
uncomp_list.append("{0}{1}".format(name, size))
|
||||
for pkg in package_name:
|
||||
if not os.path.isfile(pkg_path + pkg[:-4]):
|
||||
upgrade_all.append(pkg)
|
||||
for loc, name, comp, uncomp in zip(package_location, package_name, comp_size, uncomp_size):
|
||||
if not os.path.isfile(pkg_path + name[:-4]):
|
||||
dwn_patches.append("{0}{1}/{2}".format(mirrors("",""), loc, name))
|
||||
comp_sum.append(comp)
|
||||
uncomp_sum.append(uncomp)
|
||||
upgrade_all.append(name)
|
||||
sys.stdout.write("Done\n")
|
||||
if upgrade_all:
|
||||
print("\nThese packages need upgrading:\n")
|
||||
|
@ -85,44 +82,33 @@ def patches():
|
|||
print "| Package", " "*33, "Arch", " "*3, "Build", " ", "Repos", " ", "Size"
|
||||
template(78)
|
||||
print("Upgrading:")
|
||||
for upgrade in upgrade_all:
|
||||
for size in comp_list:
|
||||
if upgrade in size:
|
||||
Kb = size.replace(upgrade, "")
|
||||
if "-noarch-" in upgrade:
|
||||
arch = "noarch"
|
||||
elif sp+os.uname()[4]+sp in upgrade:
|
||||
arch = os.uname()[4]
|
||||
elif "-i486-" in upgrade:
|
||||
arch = "i486"
|
||||
elif "-i686-" in upgrade:
|
||||
arch = "i686"
|
||||
elif "-x86-" in upgrade:
|
||||
arch = "x86"
|
||||
elif "-fw-" in upgrade:
|
||||
arch = "fw"
|
||||
else:
|
||||
arch = ""
|
||||
if "_slack" in upgrade:
|
||||
slack = "_slack" + slack_ver()
|
||||
else:
|
||||
slack = ""
|
||||
print " ", upgrade[:-(5+len(slack))].replace(
|
||||
sp+arch+sp, ""), " "*(40-len(upgrade[:-(
|
||||
5+len(slack))].replace(sp+arch+sp, ""))), arch, " "*(
|
||||
7-len(arch)), upgrade[-15:-14].replace(sp+arch+sp, ""), " "*(
|
||||
6-len(upgrade[-15:-14].replace(sp+arch+sp, ""))), "Slack", " ", Kb, " "*(
|
||||
3-len(Kb)), "K"
|
||||
for dwn in dwn_list:
|
||||
if "/" + upgrade in dwn:
|
||||
dwn_patches.append(dwn)
|
||||
for install in upgrade_all:
|
||||
for comp in comp_list:
|
||||
if install == comp[:-(len(comp)-len(install))]:
|
||||
comp_sum.append(comp.replace(install, ""))
|
||||
for uncomp in uncomp_list:
|
||||
if install == uncomp[:-(len(uncomp)-len(install))]:
|
||||
uncomp_sum.append(uncomp.replace(install, ""))
|
||||
for upgrade, size in zip(upgrade_all, comp_sum):
|
||||
if "-noarch-" in upgrade:
|
||||
arch = "noarch"
|
||||
elif "-x86_64-" in upgrade:
|
||||
arch = "x86_64"
|
||||
elif "-i386-" in upgrade:
|
||||
arch = "i386"
|
||||
elif "-i486-" in upgrade:
|
||||
arch = "i486"
|
||||
elif "-i686-" in upgrade:
|
||||
arch = "i686"
|
||||
elif "-x86-" in upgrade:
|
||||
arch = "x86"
|
||||
elif "-fw-" in upgrade:
|
||||
arch = "fw"
|
||||
else:
|
||||
arch = ""
|
||||
if "_slack" in upgrade:
|
||||
slack = "_slack" + slack_ver()
|
||||
else:
|
||||
slack = ""
|
||||
print " ", upgrade[:-(5+len(slack))].replace(
|
||||
sp+arch+sp, ""), " "*(40-len(upgrade[:-(
|
||||
5+len(slack))].replace(sp+arch+sp, ""))), arch, " "*(
|
||||
7-len(arch)), upgrade[-15:-14].replace(sp+arch+sp, ""), " "*(
|
||||
6-len(upgrade[-15:-14].replace(sp+arch+sp, ""))), "Slack", " ", size, " "*(
|
||||
3-len(size)), "K"
|
||||
comp_unit, uncomp_unit = "Mb", "Mb"
|
||||
compressed = round((sum(map(float, comp_sum)) * 0.0001220703125), 2)
|
||||
uncompressed = round((sum(map(float, uncomp_sum)) * 0.0001220703125), 2)
|
||||
|
@ -137,7 +123,7 @@ def patches():
|
|||
msg_pkg = msg_pkg + "s"
|
||||
print("\nInstalling summary")
|
||||
print("="*79)
|
||||
print("Total {0} {1} will be upgrading.".format(len(upgrade_all), msg_pkg))
|
||||
print("Total {0} {1} will be upgraded.".format(len(upgrade_all), msg_pkg))
|
||||
print("Need to get {0} {1} of archives.".format(compressed, comp_unit))
|
||||
print("After this process, {0} {1} of additional disk space will be used.".format(
|
||||
uncompressed, uncomp_unit))
|
||||
|
@ -155,6 +141,7 @@ def patches():
|
|||
print("The kernel has been upgraded, reinstall `lilo` ...")
|
||||
subprocess.call("lilo", shell=True)
|
||||
break
|
||||
print("Completed!\n")
|
||||
read = raw_input("Removal downloaded packages [Y/n]? ")
|
||||
if read == "Y" or read == "y":
|
||||
for pkg in upgrade_all:
|
||||
|
|
|
@ -27,7 +27,7 @@ def slack_ver():
|
|||
'''
|
||||
Open file and read Slackware version
|
||||
'''
|
||||
f = open('/etc/slackware-version', 'r')
|
||||
f = open("/etc/slackware-version", "r")
|
||||
sv = f.read()
|
||||
f.close()
|
||||
return '.'.join(re.findall(r'\d+', sv))
|
||||
return ".".join(re.findall(r"\d+", sv))
|
||||
|
|
Loading…
Add table
Reference in a new issue