mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-30 20:34:38 +01:00
updated for version 1.7.1
This commit is contained in:
parent
1f4335d5a3
commit
273a9eb695
20 changed files with 231 additions and 138 deletions
|
@ -1,3 +1,10 @@
|
|||
11-08-2014
|
||||
Version 1.7.1
|
||||
|
||||
[Updated] - Bugfix OSError: [Errno 2] No such file or directory: '/tmp/slpkg/patches/
|
||||
[Feature] - Change the way to search packages from slackbuilds.org.
|
||||
The route search package eventually becomes found after ChangeLog.txt change.
|
||||
|
||||
09-08-2014
|
||||
Version 1.7.0
|
||||
|
||||
|
|
2
PKG-INFO
2
PKG-INFO
|
@ -1,6 +1,6 @@
|
|||
Metadata-Version: 1.1
|
||||
Name: slpkg
|
||||
Version: 1.7.0
|
||||
Version: 1.7.1
|
||||
Author: dslackw
|
||||
Author-email: d zlatanidis at gmail com
|
||||
Maintainer: dslackw
|
||||
|
|
66
README.rst
66
README.rst
|
@ -105,21 +105,12 @@ build and install with all dependencies :
|
|||
.. code-block:: bash
|
||||
|
||||
$ slpkg -s sbo brasero
|
||||
|
||||
+==============================================================================
|
||||
| Build dependencies tree for package brasero:
|
||||
+==============================================================================
|
||||
[ found ] --> brasero
|
||||
[ found ] --> libunique
|
||||
[ found ] --> gst1-plugins-bad
|
||||
[ found ] --> gst1-plugins-base
|
||||
[ found ] --> gstreamer1
|
||||
[ found ] --> orc
|
||||
Building dependency tree...... Done
|
||||
The following packages will be automatically installed or upgraded with new version:
|
||||
|
||||
+==============================================================================
|
||||
| Start download, build and install packages
|
||||
+==============================================================================
|
||||
[ found ] --> orc
|
||||
orc gstreamer1 gst1-plugins-base gst1-plugins-bad libunique brasero
|
||||
|
||||
Do you want to continue [Y/n]? y
|
||||
.
|
||||
.
|
||||
.
|
||||
|
@ -149,27 +140,22 @@ download and install:
|
|||
$ slpkg -s slack mozilla
|
||||
|
||||
Packages with name matching [ mozilla ]
|
||||
|
||||
Reading package lists.............................. Done
|
||||
|
||||
[ install ] --> mozilla-firefox-24.1.0esr-x86_64-1
|
||||
[ install ] --> mozilla-nss-3.15.2-x86_64-2
|
||||
[ install ] --> mozilla-thunderbird-24.1.0-x86_64-1
|
||||
|
||||
Would you like to install [Y/y]
|
||||
Would you like to install [Y/n]?
|
||||
|
||||
Tracking all dependencies of packages:
|
||||
Tracking all dependencies of packages,
|
||||
and also displays installed packages:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ slpkg -t brasero
|
||||
|
||||
Search dependencies for package brasero from slackbuilds.org:
|
||||
|
||||
[ found ] --> brasero
|
||||
[ found ] --> libunique
|
||||
[ found ] --> gst1-plugins-bad
|
||||
[ found ] --> gst1-plugins-base
|
||||
[ found ] --> gstreamer1
|
||||
[ found ] --> orc
|
||||
Reading package lists...... Done
|
||||
|
||||
+=========================
|
||||
| brasero dependencies :
|
||||
|
@ -194,27 +180,22 @@ Check if your packages is up to date from slackbuilds.org:
|
|||
.. code-block:: bash
|
||||
|
||||
$ slpkg -c sbo flashplayer-plugin
|
||||
|
||||
Search for package flashplayer-plugin from slackbuilds.org:
|
||||
|
||||
[ found ] --> flashplayer-plugin
|
||||
Reading package lists. Done
|
||||
|
||||
New version is available:
|
||||
+==============================================================================
|
||||
| Package: flashplayer-plugin 11.2.202.356 --> flashplayer-plugin 11.2.202.394
|
||||
+==============================================================================
|
||||
|
||||
Would you like to install ? [Y/y]
|
||||
Would you like to install [Y/n]?
|
||||
|
||||
$ slpkg -c sbo ranger
|
||||
|
||||
Search for package ranger from slackbuilds.org:
|
||||
Reading package lists. Done
|
||||
|
||||
[ found ] --> ranger
|
||||
|
||||
Package ranger-1.6.1-x86_64-1_SBo is up to date
|
||||
Package 'ranger-1.6.1' is up to date
|
||||
|
||||
$ slpkg -c sbo termcolor
|
||||
Reading package lists. Done
|
||||
|
||||
No such package termcolor: Not installed
|
||||
|
||||
|
@ -224,6 +205,7 @@ Check if your distribution is up to date from `Slackware official mirrors
|
|||
.. code-block:: bash
|
||||
|
||||
$ slpkg -c slack upgrade
|
||||
Reading package lists....... Done
|
||||
|
||||
These packages need upgrading:
|
||||
|
||||
|
@ -231,18 +213,15 @@ Check if your distribution is up to date from `Slackware official mirrors
|
|||
[ upgrade ] --> samba-4.1.11-x86_64-1_slack14.1.txz
|
||||
[ upgrade ] --> xscreensaver-5.29-x86_64-1_slack14.1.txz
|
||||
|
||||
Would you like to upgrade ? [Y/y]
|
||||
Would you like to upgrade [Y/y]?
|
||||
|
||||
Find packages from slackbuilds.org:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ slpkg -n bitfighter
|
||||
Reading package lists. Done
|
||||
|
||||
Search for package bitfighter from slackbuilds.org:
|
||||
|
||||
[ found ] --> bitfighter
|
||||
|
||||
+===============================================================================
|
||||
| Package bitfighter --> http://slackbuilds.org/repository/14.1/games/bitfighter/
|
||||
+===============================================================================
|
||||
|
@ -266,6 +245,7 @@ Auto tool to build package:
|
|||
|
||||
Two files termcolor.tar.gz and termcolor-1.1.0.tar.gz
|
||||
must be in the same directory.
|
||||
(slackbuild script & source code or extra sources if needed)
|
||||
|
||||
$ slpkg -a termcolor.tar.gz termcolor-1.1.0.tar.gz
|
||||
|
||||
|
@ -441,7 +421,7 @@ Remove packages:
|
|||
|
||||
[ delete ] --> termcolor-1.1.0-x86_64-1_SBo
|
||||
|
||||
Are you sure to remove 1 package(s) [Y/y] y
|
||||
Are you sure to remove 1 package(s) [Y/n]? y
|
||||
|
||||
Package: termcolor-1.1.0-x86_64-1_SBo
|
||||
Removing...
|
||||
|
@ -487,7 +467,7 @@ Remove packages with all dependencies:
|
|||
|
||||
[ delete ] --> Flask-0.10.1-x86_64-1_SBo
|
||||
|
||||
Are you sure to remove 1 package [Y/y] y
|
||||
Are you sure to remove 1 package [Y/n]? y
|
||||
|
||||
+==============================================================================
|
||||
| Found dependencies for package Flask:
|
||||
|
@ -499,7 +479,7 @@ Remove packages with all dependencies:
|
|||
| werkzeug
|
||||
+==============================================================================
|
||||
|
||||
Remove dependencies [Y/y] y
|
||||
Remove dependencies [Y/n]? y
|
||||
|
||||
.
|
||||
.
|
||||
|
|
32
man/slpkg.8
32
man/slpkg.8
|
@ -130,7 +130,8 @@ For example:
|
|||
|
||||
|
||||
$ \fBslpkg -t brasero\fP
|
||||
|
||||
Reading package lists...... Done
|
||||
|
||||
+=========================
|
||||
| brasero dependencies :
|
||||
+=========================
|
||||
|
@ -150,16 +151,12 @@ $ \fBslpkg -t brasero\fP
|
|||
NOTE: green installed, red not installed
|
||||
|
||||
$ \fBslpkg -s sbo brasero\fP
|
||||
|
||||
+==============================================================================
|
||||
| Build dependencies tree for package brasero
|
||||
+==============================================================================
|
||||
[ found ] --> brasero
|
||||
[ found ] --> libunique
|
||||
[ found ] --> gst1-plugins-bad
|
||||
[ found ] --> gst1-plugins-base
|
||||
[ found ] --> gstreamer1
|
||||
[ found ] --> orc
|
||||
Building dependency tree...... Done
|
||||
The following packages will be automatically installed or upgraded with new version:
|
||||
|
||||
orc gstreamer1 gst1-plugins-base gst1-plugins-bad libunique brasero
|
||||
|
||||
Do you want to continue [Y/n]? y
|
||||
.
|
||||
.
|
||||
.
|
||||
|
@ -183,25 +180,22 @@ $ \fBslpkg -s sbo brasero\fP
|
|||
|
||||
|
||||
$ \fBslpkg -c sbo flashplayer-plugin\fP
|
||||
|
||||
Search for package flashplayer-plugin from slackbuilds.org:
|
||||
|
||||
[ found ] --> flashplayer-plugin ]
|
||||
Reading package lists. Done
|
||||
|
||||
New version is available:
|
||||
+==============================================================================
|
||||
| Package: flashplayer-plugin 11.2.202.356 --> flashplayer-plugin 11.2.202.394
|
||||
+==============================================================================
|
||||
|
||||
Would you like to install ? [Y/y]
|
||||
Would you like to install [Y/n]?
|
||||
|
||||
$ \fBslpkg -c slack upgrade\fp
|
||||
Reading package lists....... Done
|
||||
|
||||
Your system is up to date
|
||||
Slackware64 v14.1 distribution is up to date
|
||||
|
||||
$ \fBslpkg -n termcolor\fP
|
||||
|
||||
[ found ] --> termcolor
|
||||
Reading package lists. Done
|
||||
|
||||
+==============================================================================
|
||||
| Package termcolor --> http://slackbuilds.org/repository/14.1/python/termcolor/
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
Slpkg is a terminal multitool in order to easy use Slackware
|
||||
packages.
|
||||
|
||||
Features
|
||||
========
|
||||
Features:
|
||||
|
||||
- Build third party packages from source with all dependencies
|
||||
- Install packages through from official Slackware mirrros
|
||||
- Install packages through from official Slackware mirrors
|
||||
- Find and Download packages from slackbuilds.org
|
||||
- Grabs packages from slackbuilds.org in real time
|
||||
- Automatic tool build and install packages
|
||||
- Check if your distribution is up to date
|
||||
- Remove packages with all dependencies
|
||||
- Display the contents of the packages
|
||||
- Install-upgrade Slackware packages
|
||||
- Build and install all in a command
|
||||
|
@ -18,8 +18,7 @@ Features
|
|||
- Find installed package
|
||||
- Read SlackBuilds files
|
||||
- Τracking dependencies
|
||||
- Remove packages
|
||||
- No dependencies
|
||||
|
||||
It's a quick and easy way to manage your packages in `Slackware <http://www.slackware$
|
||||
It's a quick and easy way to manage your packages in Slackware
|
||||
to a command.
|
||||
|
|
|
@ -2,7 +2,7 @@ PRGNAM="slpkg"
|
|||
VERSION="1.x.x"
|
||||
HOMEPAGE="https://github.com/dslackw/slpkg"
|
||||
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.x.x.tar.gz"
|
||||
MD5SUM="9676ce788fc030ac83362aa3e183ec42"
|
||||
MD5SUM=""
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
REQUIRES=""
|
||||
|
|
|
@ -6,7 +6,7 @@ import subprocess
|
|||
|
||||
__all__ = "slpkg"
|
||||
__author__ = "dslackw"
|
||||
__version_info__ = (1, 7, 0)
|
||||
__version_info__ = (1, 7, 1)
|
||||
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
||||
__license__ = "GNU General Public License v3 (GPLv3)"
|
||||
__email__ = "d.zlatanidis@gmail.com"
|
||||
|
|
|
@ -11,11 +11,11 @@ def pkg_not_found(bol, pkg, message, eol):
|
|||
'''
|
||||
print ("{0}No such package {1}: {2}{3}".format(bol, pkg, message, eol))
|
||||
|
||||
def pkg_found(pkg):
|
||||
def pkg_found(pkg, version):
|
||||
'''
|
||||
Print message when package found
|
||||
'''
|
||||
print ("| Package {0} is already installed".format(pkg))
|
||||
print ("| Package {0}-{1} is already installed".format(pkg, version))
|
||||
|
||||
def pkg_installed(pkg):
|
||||
'''
|
||||
|
|
|
@ -89,7 +89,7 @@ def pkg_remove(binary):
|
|||
if len(removed) > 1:
|
||||
msg = msg + "s"
|
||||
try:
|
||||
remove_pkg = raw_input("\nAre you sure to remove {0} {1} [Y/y] ".format(
|
||||
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
|
||||
|
@ -116,7 +116,7 @@ def pkg_remove(binary):
|
|||
print ("| " + dep)
|
||||
template(78)
|
||||
try:
|
||||
remove_dep = raw_input("\nRemove dependencies [Y/y] ")
|
||||
remove_dep = raw_input("\nRemove dependencies (maybe used by other packages) [Y/n]? ")
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
sys.exit()
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import os
|
||||
import getpass
|
||||
|
||||
from slpkg.pkg.build import *
|
||||
from slpkg.pkg.find import find_package
|
||||
from slpkg.pkg.manager import pkg_upgrade
|
||||
|
@ -21,19 +22,23 @@ def sbo_check(name):
|
|||
'''
|
||||
Check for new package updates
|
||||
'''
|
||||
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:
|
||||
print ("\nSearch for package {0} from slackbuilds.org:\n".format(name))
|
||||
sys.stdout.flush()
|
||||
sbo_url = sbo_search_pkg(name)
|
||||
if sbo_url is None:
|
||||
sys.stdout.write (' Done\n')
|
||||
message = "From slackbuilds.org"
|
||||
bol, eol = "", "\n"
|
||||
bol, eol = "\n", "\n"
|
||||
pkg_not_found(bol, name, message, eol)
|
||||
else:
|
||||
sys.stdout.write (' Done\n')
|
||||
sbo_version = sbo_version_pkg(sbo_url, name)
|
||||
sbo_dwn = sbo_slackbuild_dwn(sbo_url, name)
|
||||
source_dwn = sbo_source_dwn(sbo_url, name)
|
||||
|
@ -47,7 +52,11 @@ def sbo_check(name):
|
|||
name, sbo_file_version, name, sbo_version))
|
||||
template(78)
|
||||
print # new line at start
|
||||
read = raw_input("Would you like to install ? [Y/y] ")
|
||||
try:
|
||||
read = raw_input("Would you like to install [Y/n]? ")
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
sys.exit()
|
||||
if read == "Y" or read == "y":
|
||||
s_user(getpass.getuser())
|
||||
os.system("mkdir -p {0}".format(build_path))
|
||||
|
@ -68,5 +77,4 @@ def sbo_check(name):
|
|||
tmp, pkg_for_install, sbo_arch, sbo_tag, sbo_filetype).split())
|
||||
pkg_upgrade(binary)
|
||||
else:
|
||||
print ("\nPackage {0} is up to date\n".format(
|
||||
"".join(find_package(name + sp, pkg_path))))
|
||||
print ("\nPackage '{0}-{1}' is up to date\n".format(name, sbo_file_version))
|
||||
|
|
|
@ -32,6 +32,8 @@ def sbo_dependencies_pkg(name):
|
|||
if dependencies:
|
||||
dep_results.append(dependencies)
|
||||
for line in dependencies:
|
||||
sys.stdout.write(".")
|
||||
sys.stdout.flush()
|
||||
sbo_dependencies_pkg(line)
|
||||
return dep_results
|
||||
except KeyboardInterrupt:
|
||||
|
@ -42,8 +44,9 @@ def pkg_tracking(name):
|
|||
'''
|
||||
Print tree of dependencies
|
||||
'''
|
||||
print ('\nSearch dependencies for package {0} from slackbuilds.org:\n'.format(name))
|
||||
sys.stdout.write ('Reading package lists.')
|
||||
dependencies_list = sbo_dependencies_pkg(name)
|
||||
sys.stdout.write(' Done\n')
|
||||
if dependencies_list is None:
|
||||
pass
|
||||
elif dependencies_list == []:
|
||||
|
|
|
@ -6,5 +6,4 @@ def sbo_slackbuild_dwn(sbo_url, name):
|
|||
Convert http repository link to
|
||||
slackbuild download link
|
||||
'''
|
||||
sbo_url = sbo_url.replace(name + "/", name + ".tar.gz")
|
||||
return sbo_url
|
||||
return sbo_url.replace(name + "/", name + ".tar.gz")
|
||||
|
|
27
slpkg/sbo/file_size.py
Executable file
27
slpkg/sbo/file_size.py
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*
|
||||
|
||||
import os
|
||||
import sys
|
||||
import urllib2
|
||||
|
||||
def server_file_size(url):
|
||||
'''
|
||||
Returns the size of remote files
|
||||
'''
|
||||
try:
|
||||
tar = urllib2.urlopen(url)
|
||||
meta = tar.info()
|
||||
return meta.getheaders("Content-Length")
|
||||
except urllib2.URLError:
|
||||
print ("\nError: connection refused\n")
|
||||
sys.exit()
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
sys.exit()
|
||||
|
||||
def local_file_size(registry):
|
||||
'''
|
||||
Returns the size of local files
|
||||
'''
|
||||
return os.path.getsize(registry)
|
|
@ -2,6 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
|
||||
from slpkg.url_read import url_read
|
||||
from slpkg.__metadata__ import uname, arch
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
import os
|
||||
import getpass
|
||||
|
||||
from slpkg.messages import s_user
|
||||
from slpkg.url_read import url_read
|
||||
from slpkg.__metadata__ import slpkg_path
|
||||
|
|
|
@ -1,30 +1,77 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
from slpkg.colors import colors
|
||||
from slpkg.url_read import url_read
|
||||
from slpkg.functions import get_file
|
||||
from slpkg.__metadata__ import slpkg_path
|
||||
|
||||
from slpkg.pkg.find import find_package
|
||||
|
||||
from slpkg.slack.slack_version import slack_ver
|
||||
|
||||
from file_size import server_file_size, local_file_size
|
||||
|
||||
def sbo_search_pkg(name):
|
||||
'''
|
||||
Find SlackBuilds packages from slackbuilds.org
|
||||
'''
|
||||
try:
|
||||
sbo_location = []
|
||||
os.system("mkdir -p {0}{1}".format(slpkg_path, "sbo_repo/"))
|
||||
sbo_url = ("http://slackbuilds.org/slackbuilds/{0}/".format(slack_ver()))
|
||||
SLACKBUILDS_TXT = url_read((
|
||||
"http://slackbuilds.org/slackbuilds/{0}/SLACKBUILDS.TXT".format(slack_ver())))
|
||||
for line in SLACKBUILDS_TXT.splitlines():
|
||||
'''
|
||||
Read SLACKBUILDS.TXT from slackbuilds.org and write in /tmp/slpkg/sbo_repo/
|
||||
directory if not exist
|
||||
'''
|
||||
if find_package("SLACKBUILDS.TXT", slpkg_path + "sbo_repo/") == []:
|
||||
print ("\nslpkg initialization ...")
|
||||
SLACKBUILDS_TXT = url_read((
|
||||
"http://slackbuilds.org/slackbuilds/{0}/SLACKBUILDS.TXT".format(slack_ver())))
|
||||
ChangeLog_txt = url_read((
|
||||
"http://slackbuilds.org/slackbuilds/{0}/ChangeLog.txt".format(slack_ver())))
|
||||
sbo = open("{0}sbo_repo/SLACKBUILDS.TXT".format(slpkg_path), "w")
|
||||
sbo.write(SLACKBUILDS_TXT)
|
||||
sbo.close()
|
||||
log = open("{0}sbo_repo/ChangeLog.txt".format(slpkg_path), "w")
|
||||
log.write(ChangeLog_txt)
|
||||
log.close()
|
||||
'''
|
||||
We take the size of ChangeLog.txt from the server and locally
|
||||
'''
|
||||
server = int(''.join(server_file_size(sbo_url + "ChangeLog.txt")))
|
||||
local = int(local_file_size(slpkg_path + "sbo_repo/ChangeLog.txt"))
|
||||
'''
|
||||
If the two files differ in size delete and replaced with new
|
||||
'''
|
||||
if server != local:
|
||||
os.remove("{0}sbo_repo/{1}".format(slpkg_path, "SLACKBUILDS.TXT"))
|
||||
os.remove("{0}sbo_repo/{1}".format(slpkg_path, "ChangeLog.txt"))
|
||||
print ("\nNEWS in ChangeLog.txt, slpkg initialization ...")
|
||||
SLACKBUILDS_TXT = url_read((
|
||||
"http://slackbuilds.org/slackbuilds/{0}/SLACKBUILDS.TXT".format(slack_ver())))
|
||||
ChangeLog_txt = url_read((
|
||||
"http://slackbuilds.org/slackbuilds/{0}/ChangeLog.txt".format(slack_ver())))
|
||||
sbo = open("{0}sbo_repo/SLACKBUILDS.TXT".format(slpkg_path), "w")
|
||||
sbo.write(SLACKBUILDS_TXT)
|
||||
sbo.close()
|
||||
log = open("{0}sbo_repo/ChangeLog.txt".format(slpkg_path), "w")
|
||||
log.write(ChangeLog_txt)
|
||||
log.close()
|
||||
'''
|
||||
Search for package path from SLACKBUILDS.TXT file
|
||||
'''
|
||||
for line in open(slpkg_path + "sbo_repo/SLACKBUILDS.TXT", "r"):
|
||||
if line.startswith('SLACKBUILD LOCATION'):
|
||||
sbo_location.append(line.replace('SLACKBUILD LOCATION: ./', ''))
|
||||
for loc in sbo_location:
|
||||
if get_file(loc, '/') == name:
|
||||
print ('{0}[ found ] --> {1}{2}'.format(colors.CYAN, colors.ENDC, name))
|
||||
return sbo_url + loc.replace(name, '') + name + "/"
|
||||
for location in sbo_location:
|
||||
location = location.replace('\n', '')
|
||||
if get_file(location, '/') == name:
|
||||
return sbo_url + location.replace(name, '') + name + "/"
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
sys.exit()
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
import os
|
||||
import sys
|
||||
import getpass
|
||||
|
||||
from slpkg.colors import colors
|
||||
from slpkg.functions import get_file
|
||||
from slpkg.__metadata__ import tmp, pkg_path, build_path, sp
|
||||
|
@ -15,6 +16,7 @@ from slpkg.pkg.build import build_package
|
|||
from slpkg.pkg.manager import pkg_upgrade
|
||||
|
||||
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
|
||||
|
@ -26,11 +28,9 @@ def sbo_build(name):
|
|||
dependencies
|
||||
'''
|
||||
s_user(getpass.getuser())
|
||||
print # new line at start
|
||||
template(78)
|
||||
print ("| Build dependencies tree for package {0}:".format(name))
|
||||
template(78)
|
||||
sys.stdout.write ('Building dependency tree.')
|
||||
dependencies_list = sbo_dependencies_pkg(name)
|
||||
sys.stdout.write(' Done')
|
||||
if dependencies_list == None:
|
||||
pass
|
||||
else:
|
||||
|
@ -46,35 +46,36 @@ def sbo_build(name):
|
|||
if duplicate not in dependencies:
|
||||
dependencies.append(duplicate)
|
||||
print # new lines at start
|
||||
template(78)
|
||||
print ("| Start download, build and install packages:")
|
||||
template(78)
|
||||
for pkg in dependencies:
|
||||
sbo_url = sbo_search_pkg(pkg)
|
||||
sbo_version = sbo_version_pkg(sbo_url, 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(sbo_prgnam_pkg(sbo_url, pkg),
|
||||
sbo_version_pkg(sbo_url, 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)
|
||||
script = get_file(sbo_link, '/')
|
||||
source = get_file(src_link, '/')
|
||||
os.system("wget -N {0} {1}".format(sbo_link, src_link))
|
||||
if ext_link:
|
||||
for src in ext_link:
|
||||
os.system("wget -N {0}".format(src))
|
||||
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())
|
||||
pkg_upgrade(binary)
|
||||
else:
|
||||
template(78)
|
||||
pkg_found(pkg)
|
||||
template(78)
|
||||
print ('The following packages will be automatically installed or upgraded with new version:\n')
|
||||
print (' ' + ' '.join(dependencies))
|
||||
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(sbo_url, 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(sbo_prgnam_pkg(sbo_url, pkg),
|
||||
sbo_version_pkg(sbo_url, 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)
|
||||
script = get_file(sbo_link, '/')
|
||||
source = get_file(src_link, '/')
|
||||
os.system("wget -N {0} {1}".format(sbo_link, src_link))
|
||||
if ext_link:
|
||||
for src in ext_link:
|
||||
os.system("wget -N {0}".format(src))
|
||||
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())
|
||||
pkg_upgrade(binary)
|
||||
else:
|
||||
template(78)
|
||||
pkg_found(pkg, sbo_file_version)
|
||||
template(78)
|
||||
'''
|
||||
Write dependencies in a log file into directory '/var/log/slpkg/dep/'
|
||||
'''
|
||||
|
@ -86,7 +87,6 @@ def sbo_build(name):
|
|||
for dep in dependencies:
|
||||
f.write(dep + "\n")
|
||||
f.close()
|
||||
print # new line at end
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
sys.exit()
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from slpkg.colors import colors
|
||||
from slpkg.functions import get_file
|
||||
from slpkg.__metadata__ import tmp, pkg_path, slpkg_path, sp
|
||||
|
@ -22,13 +24,15 @@ def sbo_network(name):
|
|||
View SlackBuild package, read or install them
|
||||
from slackbuilds.org
|
||||
'''
|
||||
print ('\nSearch for package {0} from slackbuilds.org:\n'.format(name))
|
||||
sys.stdout.write ("Reading package lists.")
|
||||
sbo_url = sbo_search_pkg(name)
|
||||
if sbo_url is None:
|
||||
sys.stdout.write (' Done\n')
|
||||
message = "From slackbuilds.org"
|
||||
bol, eol = "\n", "\n"
|
||||
pkg_not_found(bol, name, message, eol)
|
||||
else:
|
||||
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(sbo_url, name)
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import getpass
|
||||
|
||||
from slpkg.colors import colors
|
||||
from slpkg.url_read import url_read
|
||||
from slpkg.messages import pkg_not_found, s_user
|
||||
|
@ -25,14 +27,24 @@ def install(slack_pkg):
|
|||
os.system("mkdir -p {0}{1}".format(slpkg_path, 'packages/'))
|
||||
print ("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
||||
colors.CYAN, slack_pkg, colors.ENDC))
|
||||
sys.stdout.write ("Reading package lists.")
|
||||
sys.stdout.flush()
|
||||
PACKAGE_TXT = url_read(mirrors(name='PACKAGES.TXT', location=''))
|
||||
index, toolbar_width = 0, 600
|
||||
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)
|
||||
if line.startswith('PACKAGE NAME'):
|
||||
package_name.append(line.replace('PACKAGE NAME: ', ''))
|
||||
if line.startswith('PACKAGE LOCATION'):
|
||||
package_location.append(line.replace('PACKAGE LOCATION: ./', ''))
|
||||
for loc, name in zip(package_location, package_name):
|
||||
dwn_list.append('{0}{1}/{2}'.format(mirrors('',''), loc, name))
|
||||
sys.stdout.write(" Done\n\n")
|
||||
for pkg in package_name:
|
||||
if slack_pkg in pkg:
|
||||
if pkg.endswith('.txz'):
|
||||
|
@ -48,7 +60,7 @@ def install(slack_pkg):
|
|||
message = "No matching"
|
||||
pkg_not_found(bol, slack_pkg, message, eol)
|
||||
else:
|
||||
read = raw_input("\nWould you like to install [Y/y] ")
|
||||
read = raw_input ("\nWould you like to install [Y/n]? ")
|
||||
if read == "Y" or read == "y":
|
||||
for install in install_all:
|
||||
for dwn in dwn_list:
|
||||
|
@ -59,7 +71,7 @@ def install(slack_pkg):
|
|||
print ("{0}[ installing ] --> {1}{2}".format(
|
||||
colors.GREEN, colors.ENDC, install))
|
||||
pkg_upgrade((slpkg_path + 'packages/' + install).split())
|
||||
read = raw_input("Remove the packages downloaded ? [Y/y] ")
|
||||
read = raw_input ("Removal downloaded packages [Y/n]? ")
|
||||
if read == "Y" or read == "y":
|
||||
for remove in install_all:
|
||||
os.remove("{0}{1}{2}".format(slpkg_path, 'packages/', remove))
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import getpass
|
||||
|
||||
from slpkg.colors import colors
|
||||
from slpkg.messages import s_user
|
||||
from slpkg.url_read import url_read
|
||||
|
@ -24,8 +26,17 @@ def patches():
|
|||
dwn_list, dwn_patches = [], []
|
||||
upgrade_all, package_name, package_location = [], [], []
|
||||
os.system("mkdir -p {0}{1}".format(slpkg_path, 'patches/'))
|
||||
sys.stdout.write ("Reading package lists.")
|
||||
sys.stdout.flush()
|
||||
PACKAGE_TXT = url_read(mirrors(name='PACKAGES.TXT', location='patches/'))
|
||||
index, toolbar_width = 0, 100
|
||||
for line in PACKAGE_TXT.splitlines():
|
||||
index += 1
|
||||
if index == toolbar_width:
|
||||
sys.stdout.write('.')
|
||||
sys.stdout.flush()
|
||||
toolbar_width += 100
|
||||
time.sleep(0.05)
|
||||
if line.startswith('PACKAGE NAME'):
|
||||
package_name.append(line.replace('PACKAGE NAME: ', ''))
|
||||
if line.startswith('PACKAGE LOCATION'):
|
||||
|
@ -36,6 +47,7 @@ def patches():
|
|||
installed_pkg = ''.join(find_package(pkg.replace('.txz', ''), pkg_path))
|
||||
if installed_pkg == '':
|
||||
upgrade_all.append(pkg)
|
||||
sys.stdout.write(' Done\n')
|
||||
if upgrade_all:
|
||||
print ("\nThese packages need upgrading:\n")
|
||||
for upgrade in upgrade_all:
|
||||
|
@ -44,7 +56,7 @@ def patches():
|
|||
for dwn in dwn_list:
|
||||
if upgrade in dwn:
|
||||
dwn_patches.append(dwn)
|
||||
read = raw_input("\nWould you like to upgrade ? [Y/y] ")
|
||||
read = raw_input("\nWould you like to upgrade [Y/n]? ")
|
||||
if read == "Y" or read == "y":
|
||||
for dwn in dwn_patches:
|
||||
os.system("wget -N --directory-prefix={0}{1} {2}".format(
|
||||
|
@ -53,18 +65,17 @@ def patches():
|
|||
print ("{0}[ upgrading ] --> {1}{2}".format(
|
||||
colors.GREEN, colors.ENDC, pkg))
|
||||
pkg_upgrade((slpkg_path + 'patches/' + pkg).split())
|
||||
read = raw_input("Remove the packages downloaded ? [Y/y] ")
|
||||
if read == "Y" or read == "y":
|
||||
for pkg in upgrade_all:
|
||||
os.remove("{0}{1}{2}".format(slpkg_path, 'patches/', pkg))
|
||||
if os.listdir(slpkg_path + 'patches/') == []:
|
||||
print ("Packages removed")
|
||||
read = raw_input("Removal downloaded packages [Y/n]? ")
|
||||
if read == "Y" or read == "y":
|
||||
for pkg in upgrade_all:
|
||||
os.remove("{0}{1}{2}".format(slpkg_path, 'patches/', pkg))
|
||||
if os.listdir(slpkg_path + 'patches/') == []:
|
||||
print ("Packages removed")
|
||||
else:
|
||||
print ("\nThere are packages in direcrory {0}{1}\n".format(
|
||||
slpkg_path, 'patches/'))
|
||||
else:
|
||||
print ("\nThere are packages in direcrory {0}{1}\n".format(
|
||||
slpkg_path, 'patches/'))
|
||||
else:
|
||||
print ("\nThere are packages in directory {0}{1}\n".format(
|
||||
slpkg_path, 'patches/'))
|
||||
print ("\nThere are packages in directory {0}{1}\n".format( slpkg_path, 'packages/'))
|
||||
else:
|
||||
if arch == "x86_64":
|
||||
slack_arch = 64
|
||||
|
|
Loading…
Add table
Reference in a new issue