updated for version 2.1.2

This commit is contained in:
Dimitris Zlatanidis 2014-12-03 16:40:08 +02:00
parent 5ef0abc555
commit aec441580d
50 changed files with 203 additions and 182 deletions

View file

@ -1,5 +1,12 @@
Version 2.1.2-dev
xx-12-2014
[Feature] - Added checksum all repositories.
[Updated] - Fix downloads modules.
Version 2.1.1-dev
02-12-2014
01-12-2014
[Feature] - Added options in /etc/slpkg/slpkg.conf file to select
repositories.

View file

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

View file

@ -11,9 +11,9 @@
Latest Release:
- Version: 2.1.1
- Version: 2.1.2
- `Package <https://sourceforge.net/projects/slpkg/files/slpkg/binary/>`_
- `Source <https://github.com/dslackw/slpkg/archive/v2.1.1.tar.gz>`_
- `Source <https://github.com/dslackw/slpkg/archive/v2.1.2.tar.gz>`_
- `CHANGELOG <https://github.com/dslackw/slpkg/blob/master/CHANGELOG>`_
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png
@ -118,8 +118,8 @@ Untar the archive and run install.sh script:
.. code-block:: bash
$ tar xvf slpkg-2.1.1.tar.gz
$ cd slpkg-2.1.1
$ tar xvf slpkg-2.1.2.tar.gz
$ cd slpkg-2.1.2
$ ./install.sh
From SourceForge:
@ -196,7 +196,7 @@ Command Line Tool Usage
-t, [repository] [package] tracking dependencies
-p, [repository] [package] --color=[] print package description
-f, [package] find installed packages
-n, [package] view packages from SBo
-n, [package] view SBo packages through network
-i, [package...] install binary packages
-u, [package...] upgrade binary packages
-o, [package...] reinstall binary packages

View file

@ -21,7 +21,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=slpkg
VERSION=${VERSION:-2.1.1}
VERSION=${VERSION:-2.1.2}
TAG=${TAG:-_dsw}
# Installation script.

View file

@ -49,7 +49,7 @@ Optional arguments:
-t, [repository] [package] tracking dependencies
-p, [repository] [package] --color=[] print package description
-f, [package] find installed packages
-n, [package] view packages from SBo
-n, [package] view SBo packages through network
-i, [package...] install binary packages
-u, [package...] upgrade binary packages
-o, [package...] reinstall binary packages
@ -109,7 +109,8 @@ Check your packages is up to date.
.PP
Installs or upgrade packages from the repositories with automatically resolving all
dependencies of the package. Also installs the official distribution Slackware
packages.
packages. Sometimes to install a package have to pass part of the version of the
package as 'slpkg -s alien ffmpeg-2.4.3'.
.SS -t , tracking dependencies
\fBslpkg\fP \fB-t\fP <\fIrepository\fP> <\fIname of package\fP>

View file

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

View file

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

9
slpkg/arguments.py Executable file → Normal file
View file

@ -24,7 +24,6 @@
from __metadata__ import (
__version__,
repositories
)
@ -53,7 +52,8 @@ def options():
" -t, [repository] [package] tracking dependencies",
" -p, [repository] [package] --color=[] print package description",
" -f, [package] find installed packages",
" -n, [package] view packages from SBo",
" -n, [package] view SBo packages "
"through network",
" -i, [package...] install binary packages",
" -u, [package...] upgrade binary packages",
" -o, [package...] reinstall binary packages",
@ -79,10 +79,7 @@ def usage():
" [-p [repository] [package] --color=[]]",
" [-f] [-n] [-i [...]] [-u [...]]",
" [-o [...]] [-r [...]] [-d [...]]\n",
"Repositories: " + ", ".join(repositories),
"Colors: red, green, yellow, cyan, grey\n",
"For more information try 'slpkg --help'\n"
"For more information try 'slpkg --help' or view manpage\n"
]
for usg in view:
print(usg)

0
slpkg/blacklist.py Executable file → Normal file
View file

37
slpkg/checksum.py Executable file → Normal file
View file

@ -22,12 +22,41 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import hashlib
import sys
from messages import template
from __metadata__ import (
color,
default_answer
)
def md5sum(source):
def check_md5(pkg_md5, src_file):
'''
Calculate packages md5 checksum
MD5 Checksum
'''
with open(source) as file_to_check:
with open(src_file) as file_to_check:
data = file_to_check.read()
return hashlib.md5(data).hexdigest()
md5 = hashlib.md5(data).hexdigest()
if pkg_md5 != md5:
template(78)
print("| MD5SUM check for {0} [ {1}FAILED{2} ]".format(
src_file.split("/")[-1], color['RED'], color['ENDC']))
template(78)
print("| Expected: {0}".format(md5))
print("| Found: {0}".format(pkg_md5))
template(78)
if default_answer == "y":
answer = default_answer
else:
answer = raw_input("Would you like to continue [Y/n]? ")
if answer in ['y', 'Y']:
print("") # new line after answer
else:
sys.exit(0)
else:
template(78)
print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format(
src_file.split("/")[-1], color['GREEN'], color['ENDC']))
template(78)
print("") # new line after pass checksum

0
slpkg/config.py Executable file → Normal file
View file

0
slpkg/desc.py Executable file → Normal file
View file

11
slpkg/downloader.py Executable file → Normal file
View file

@ -32,20 +32,21 @@ class Download(object):
def __init__(self, path, url):
self.path = path
self.url = url
self.file_name = self.url.split("/")[-1]
def start(self):
'''
Download files usign wget.
Check if file already download the skip or continue
Check if file already download and skip or continue
download if before stoped.
'''
for dwn in self.url:
file_name = dwn.split("/")[-1]
print("\n[ {0}Download{1} ] -->{1} {2}\n".format(color['GREEN'],
color['ENDC'],
self.file_name))
file_name))
try:
subprocess.call("wget -c -N --directory-prefix={0} {1}".format(
self.path, self.url), shell=True)
self.path, dwn), shell=True)
except KeyboardInterrupt:
print # new line at cancel
sys.exit()
sys.exit(0)

4
slpkg/file_size.py Executable file → Normal file
View file

@ -41,10 +41,10 @@ class FileSize(object):
return int(meta.getheaders("Content-Length")[0])
except (urllib2.URLError, IndexError):
print("\nError: connection refused\n")
sys.exit()
sys.exit(0)
except KeyboardInterrupt:
print("") # new line at cancel
sys.exit()
sys.exit(0)
def local(self):
'''

27
slpkg/others/download.py → slpkg/grep_md5.py Executable file → Normal file
View file

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# downloads.py file is part of slpkg.
# grep_md5.py file is part of slpkg.
# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
@ -21,13 +21,26 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.downloader import Download
from __metadata__ import lib_path
def packages_dwn(path, links):
def pkg_checksum(binary, repo):
'''
Download patches
Return checksum from CHECKSUMS.md5 file by repository
'''
for dwn in links:
Download(path, dwn).start()
Download(path, dwn + ".asc").start()
repos = {
'slack': 'slack_repo/CHECKSUMS.md5',
'rlw': 'rlw_repo/CHECKSUMS.md5',
'alien': 'alien_repo/CHECKSUMS.md5',
'slacky': 'slacky_repo/CHECKSUMS.md5',
'studio': 'studio_repo/CHECKSUMS.md5'
}
lib = repos[repo]
f = open(lib_path + lib, "r")
CHECKSUMS_md5 = f.read()
f.close()
for line in CHECKSUMS_md5.splitlines():
if line.endswith(binary):
md5 = line.split()[0]
return md5

49
slpkg/init.py Executable file → Normal file
View file

@ -65,6 +65,7 @@ class Initialization(object):
log = log_path + "slack/"
lib = lib_path + "slack_repo/"
lib_file = "PACKAGES.TXT"
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
version = slack_rel
if not os.path.exists(log):
@ -72,13 +73,20 @@ class Initialization(object):
if not os.path.exists(lib):
os.mkdir(lib)
packages = mirrors(lib_file, "", version)
pkg_checksums = mirrors(md5_file, "", version)
extra = mirrors(lib_file, "extra/", version)
ext_checksums = mirrors(md5_file, "extra/", version)
pasture = mirrors(lib_file, "pasture/", version)
pas_checksums = mirrors(md5_file, "pasture/", version)
packages_txt = ("{0} {1} {2}".format(packages, extra, pasture))
checksums_md5 = ("{0} {1} {2}".format(pkg_checksums, ext_checksums,
pas_checksums))
changelog_txt = mirrors(log_file, "", version)
self.write(lib, lib_file, packages_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
md5_file, checksums_md5)
def sbo(self):
'''
@ -107,16 +115,20 @@ class Initialization(object):
log = log_path + "rlw/"
lib = lib_path + "rlw_repo/"
lib_file = "PACKAGES.TXT"
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
os.mkdir(log)
if not os.path.exists(lib):
os.mkdir(lib)
packages_txt = "{0}{1}/{2}".format(repo, slack_ver(), lib_file)
checksums_md5 = "{0}{1}/{2}".format(repo, slack_ver(), md5_file)
changelog_txt = "{0}{1}/{2}".format(repo, slack_ver(), log_file)
self.write(lib, lib_file, packages_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
md5_file, checksums_md5)
def alien(self):
'''
@ -126,16 +138,20 @@ class Initialization(object):
log = log_path + "alien/"
lib = lib_path + "alien_repo/"
lib_file = "PACKAGES.TXT"
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
os.mkdir(log)
if not os.path.exists(lib):
os.mkdir(lib)
packages_txt = "{0}{1}".format(repo, lib_file)
checksums_md5 = "{0}{1}".format(repo, md5_file)
changelog_txt = "{0}{1}".format(repo, log_file)
self.write(lib, lib_file, packages_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
md5_file, checksums_md5)
def slacky(self):
'''
@ -147,6 +163,7 @@ class Initialization(object):
log = log_path + "slacky/"
lib = lib_path + "slacky_repo/"
lib_file = "PACKAGES.TXT"
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
os.mkdir(log)
@ -156,11 +173,16 @@ class Initialization(object):
ar = "64"
packages_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
lib_file)
checksums_md5 = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
md5_file)
changelog_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
log_file)
self.write(lib, lib_file, packages_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
md5_file, checksums_md5)
def studioware(self):
'''
@ -172,6 +194,7 @@ class Initialization(object):
log = log_path + "studio/"
lib = lib_path + "studio_repo/"
lib_file = "PACKAGES.TXT"
md5_file = "CHECKSUMS.md5"
log_file = "ChangeLog.txt"
if not os.path.exists(log):
os.mkdir(log)
@ -181,27 +204,31 @@ class Initialization(object):
ar = "64"
packages_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
lib_file)
checksums_md5 = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
md5_file)
changelog_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
log_file)
self.write(lib, lib_file, packages_txt)
self.write(lib, md5_file, checksums_md5)
self.write(log, log_file, changelog_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt)
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
md5_file, checksums_md5)
@staticmethod
def write(path, files, file_url):
'''
Write files in /var/lib/slpkg/?_repo directory
'''
PACKAGES_TXT = ""
FILE_TXT = ""
if not os.path.isfile(path + files):
print("\nslpkg ...initialization")
sys.stdout.write(files + " read ...")
sys.stdout.flush()
for fu in file_url.split():
PACKAGES_TXT += URL(fu).reading()
FILE_TXT += URL(fu).reading()
sys.stdout.write("Done\n")
with open("{0}{1}".format(path, files), "w") as f:
f.write(PACKAGES_TXT)
f.write(FILE_TXT)
f.close()
print("File {0} created in {1}".format(files, path))
@ -210,7 +237,7 @@ class Initialization(object):
'''
args[0]=log, args[1]=log_file, arg[2]=changelog_txt
args[3]=lib, args[4]=lib_file, arg[5]=packages_txt
args[6]=md5_file, args[7]=checksums_md5
If the two files differ in size delete and replaced with new.
We take the size of ChangeLog.txt from the server and locally
'''
@ -226,9 +253,13 @@ class Initialization(object):
for fu in args[5].split():
PACKAGES_TXT += URL(fu).reading()
CHANGELOG_TXT = URL(args[2]).reading()
CHECKSUMS_md5 = URL(args[7]).reading()
with open("{0}{1}".format(args[3], args[4]), "w") as f:
f.write(PACKAGES_TXT)
f.close()
with open("{0}{1}".format(args[3], args[6]), "w") as f:
f.write(CHECKSUMS_md5)
f.close()
with open("{0}{1}".format(args[0], args[1]), "w") as f:
f.write(CHANGELOG_TXT)
f.close()

0
slpkg/main.py Executable file → Normal file
View file

2
slpkg/messages.py Executable file → Normal file
View file

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

19
slpkg/others/check.py Executable file → Normal file
View file

@ -25,10 +25,14 @@ import os
import sys
from slpkg.sizes import units
from slpkg.remove import delete
from slpkg.repositories import Repo
from slpkg.messages import template
from slpkg.checksum import check_md5
from slpkg.blacklist import BlackList
from slpkg.init import Initialization
from slpkg.downloader import Download
from slpkg.grep_md5 import pkg_checksum
from slpkg.splitting import split_package
from slpkg.__metadata__ import (
pkg_path,
@ -40,11 +44,9 @@ from slpkg.__metadata__ import (
from slpkg.pkg.manager import PackageManager
from slpkg.slack.remove import delete
from slpkg.slack.slack_version import slack_ver
from greps import repo_data
from download import packages_dwn
class OthersUpgrade(object):
@ -138,15 +140,15 @@ class OthersUpgrade(object):
answer = raw_input("\nWould you like to continue [Y/n]? ")
if answer in ['y', 'Y']:
upgrade_all.reverse()
packages_dwn(self.tmp_path, dwn_links)
upgrade(self.tmp_path, upgrade_all)
Download(self.tmp_path, dwn_links).start()
upgrade(self.tmp_path, upgrade_all, self.repo)
delete(self.tmp_path, upgrade_all)
else:
print("No new updates in the repository '{0}'\n".format(
self.repo))
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
sys.exit(0)
def store(self):
'''
@ -228,12 +230,17 @@ def msgs(upgrade_all):
return msg_pkg
def upgrade(tmp_path, upgrade_all):
def upgrade(tmp_path, upgrade_all, repo):
'''
Install or upgrade packages
'''
for pkg in upgrade_all:
package = (tmp_path + pkg).split()
if repo == "alien":
check_md5(pkg_checksum("/" + slack_ver() + "/" + pkg, repo),
tmp_path + pkg)
else:
check_md5(pkg_checksum(pkg, repo), tmp_path + pkg)
print("[ {0}upgrading{1} ] --> {2}".format(color['YELLOW'],
color['ENDC'], pkg[:-4]))
PackageManager(package).upgrade()

2
slpkg/others/dependency.py Executable file → Normal file
View file

@ -51,4 +51,4 @@ def dependencies_pkg(name, repo):
return dep_results
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
sys.exit(0)

0
slpkg/others/greps.py Executable file → Normal file
View file

19
slpkg/others/install.py Executable file → Normal file
View file

@ -25,9 +25,13 @@ import os
import sys
from slpkg.sizes import units
from slpkg.remove import delete
from slpkg.repositories import Repo
from slpkg.checksum import check_md5
from slpkg.init import Initialization
from slpkg.blacklist import BlackList
from slpkg.downloader import Download
from slpkg.grep_md5 import pkg_checksum
from slpkg.splitting import split_package
from slpkg.messages import (
pkg_not_found,
@ -45,11 +49,9 @@ from slpkg.__metadata__ import (
from slpkg.pkg.find import find_package
from slpkg.pkg.manager import PackageManager
from slpkg.slack.remove import delete
from slpkg.slack.slack_version import slack_ver
from greps import repo_data
from download import packages_dwn
from dependency import dependencies_pkg
@ -159,8 +161,8 @@ class OthersInstall(object):
"[Y/n]? ")
if answer in ['y', 'Y']:
install_all.reverse()
packages_dwn(self.tmp_path, dwn_links)
install(self.tmp_path, install_all)
Download(self.tmp_path, dwn_links).start()
install(self.tmp_path, install_all, self.repo)
write_deps(dependencies)
delete(self.tmp_path, install_all)
else:
@ -178,7 +180,7 @@ class OthersInstall(object):
pkg_not_found("", self.package, "No matching", "\n")
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
sys.exit(0)
def store(self, deps):
'''
@ -271,12 +273,17 @@ def msgs(install_all, uni_sum):
return [msg_pkg, msg_2_pkg]
def install(tmp_path, install_all):
def install(tmp_path, install_all, repo):
'''
Install or upgrade packages
'''
for install in install_all:
package = (tmp_path + install).split()
if repo == "alien":
check_md5(pkg_checksum("/" + slack_ver() + "/" + install, repo),
tmp_path + install)
else:
check_md5(pkg_checksum(install, repo), tmp_path + install)
if os.path.isfile(pkg_path + install[:-4]):
print("[ {0}reinstalling{1} ] --> {2}".format(color['GREEN'],
color['ENDC'],

2
slpkg/others/search.py Executable file → Normal file
View file

@ -50,4 +50,4 @@ def search_pkg(name, repo):
return pkg_name
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
sys.exit(0)

44
slpkg/pkg/build.py Executable file → Normal file
View file

@ -29,17 +29,12 @@ import shutil
import tarfile
import subprocess
from slpkg.checksum import md5sum
from slpkg.messages import (
pkg_not_found,
template
)
from slpkg.checksum import check_md5
from slpkg.messages import pkg_not_found
from slpkg.__metadata__ import (
log_path,
sbo_build_log,
sbo_check_md5,
default_answer,
color
sbo_check_md5
)
from slpkg.sbo.greps import SBoGrep
@ -106,38 +101,7 @@ class BuildPackage(object):
pkg_not_found("\n", self.prgnam, "Wrong file", "\n")
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
def check_md5(sbo_md5, src):
'''
MD5 Checksum
'''
md5 = md5sum(src)
if sbo_md5 != md5:
template(78)
print("| MD5SUM check for {0} [ {1}FAILED{2} ]".format(src,
color['RED'],
color['ENDC']))
template(78)
print("| Expected: {0}".format(md5))
print("| Found: {0}".format(sbo_md5))
template(78)
if default_answer == "y":
answer = default_answer
else:
answer = raw_input("Would you like to continue [Y/n]? ")
if answer in ['y', 'Y']:
pass
else:
sys.exit()
else:
template(78)
print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format(src,
color['GREEN'],
color['ENDC']))
template(78)
print("") # new line after pass checksum
sys.exit(0)
def log_head(path, log_file, log_time):

0
slpkg/pkg/find.py Executable file → Normal file
View file

6
slpkg/pkg/manager.py Executable file → Normal file
View file

@ -116,7 +116,7 @@ class PackageManager(object):
str(len(removed)), msg))
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
sys.exit(0)
if remove_pkg in ['y', 'Y']:
for rmv in removed:
# If package build and install with 'slpkg -s sbo <package>'
@ -133,7 +133,7 @@ class PackageManager(object):
"other packages) [Y/n]? ")
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
sys.exit(0)
if remove_dep in ['y', 'Y']:
rmv_list += self.rmv_deps(self.binary,
dependencies,
@ -316,4 +316,4 @@ class PackageManager(object):
print("") # new line at end
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
sys.exit(0)

0
slpkg/queue.py Executable file → Normal file
View file

3
slpkg/slack/remove.py → slpkg/remove.py Executable file → Normal file
View file

@ -23,7 +23,7 @@
import os
from slpkg.__metadata__ import del_all
from __metadata__ import del_all
def delete(path, packages):
@ -33,4 +33,3 @@ def delete(path, packages):
if del_all == "on":
for pkg in packages:
os.remove(path + pkg)
os.remove(path + pkg + ".asc")

0
slpkg/repositories.py Executable file → Normal file
View file

12
slpkg/sbo/check.py Executable file → Normal file
View file

@ -105,8 +105,9 @@ class SBoCheck(object):
sbo_dwn = SBoLink(sbo_url).tar_gz()
src_dwn = SBoGrep(name).source().split()
script = sbo_dwn.split("/")[-1]
Download(build_path, sbo_dwn).start()
sources = dwn_sources(src_dwn)
dwn_srcs = sbo_dwn.split() + src_dwn
Download(build_path, dwn_srcs).start()
sources = filenames(src_dwn)
BuildPackage(script, sources, build_path).build()
# Searches the package name and version in /tmp to
# install.If find two or more packages e.g. to build
@ -116,7 +117,7 @@ class SBoCheck(object):
binary = (tmp + max(binary_list)).split()
except ValueError:
build_FAILED(sbo_url, prgnam)
sys.exit()
sys.exit(0)
if find_package(name + sp, pkg_path):
print("[ {0}Upgrading{1} ] --> {2}".format(
color['YELLOW'], color['ENDC'], name))
@ -138,7 +139,7 @@ class SBoCheck(object):
print("\nNo SBo packages found\n")
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
sys.exit(0)
def sbo_list(self):
'''
@ -295,13 +296,12 @@ def view_packages(package_for_upgrade, upgrade_version, upgrade_arch):
return [count_installed, count_upgraded], [msg_ins, msg_upg]
def dwn_sources(sources):
def filenames(sources):
'''
Download sources and return filenames
'''
filename = []
for src in sources:
Download(build_path, src).start()
filename.append(src.split("/")[-1])
return filename

0
slpkg/sbo/compressed.py Executable file → Normal file
View file

2
slpkg/sbo/dependency.py Executable file → Normal file
View file

@ -55,4 +55,4 @@ def sbo_dependencies_pkg(name):
return dep_results
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
sys.exit(0)

0
slpkg/sbo/greps.py Executable file → Normal file
View file

0
slpkg/sbo/read.py Executable file → Normal file
View file

0
slpkg/sbo/remove.py Executable file → Normal file
View file

2
slpkg/sbo/search.py Executable file → Normal file
View file

@ -49,4 +49,4 @@ def sbo_search_pkg(name):
return (sbo_url + line[23:].strip() + "/")
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
sys.exit(0)

12
slpkg/sbo/slackbuild.py Executable file → Normal file
View file

@ -160,7 +160,7 @@ class SBoInstall(object):
pkg_not_found("\n", self.name, "No matching", "\n")
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
sys.exit(0)
def one_for_all(self):
'''
@ -302,7 +302,7 @@ def arch_support(source, support, package_sum, dependencies):
return answer
def dwn_sources(sources):
def filenames(sources):
'''
Download sources and return filenames
'''
@ -310,7 +310,6 @@ def dwn_sources(sources):
for src in sources:
# get file from source
filename.append(src.split("/")[-1])
Download(build_path, src).start()
return filename
@ -345,15 +344,16 @@ def build_install(dependencies, sbo_versions):
sbo_link = SBoLink(sbo_url).tar_gz()
src_link = SBoGrep(pkg).source().split()
script = sbo_link.split("/")[-1]
Download(build_path, sbo_link).start()
sources = dwn_sources(src_link)
dwn_srcs = sbo_link.split() + src_link
Download(build_path, dwn_srcs).start()
sources = filenames(src_link)
BuildPackage(script, sources, build_path).build()
binary_list = search_in_tmp(prgnam)
try:
binary = (tmp + max(binary_list)).split()
except ValueError:
build_FAILED(sbo_url, prgnam)
sys.exit()
sys.exit(0)
if find_package(pkg + sp, pkg_path):
print("{0}[ Upgrading ] --> {1}{2}".format(color['GREEN'],
color['ENDC'],

20
slpkg/sbo/views.py Executable file → Normal file
View file

@ -68,6 +68,7 @@ class SBoNetwork(object):
self.sbo_req = grep.requires()
self.sbo_dwn = SBoLink(self.sbo_url).tar_gz()
self.sbo_version = grep.version()
self.dwn_srcs = self.sbo_dwn.split() + self.source_dwn
self.space = ("\n" * 50)
sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
@ -87,7 +88,7 @@ class SBoNetwork(object):
while True:
choice = self.read_choice()
if choice in ['D', 'd']:
self.download(path="")
Download("", self.dwn_srcs).start()
break
elif choice in ['R', 'r']:
README = Read(self.sbo_url).readme("README")
@ -183,7 +184,7 @@ class SBoNetwork(object):
color['GREY'], color['ENDC']))
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
sys.exit(0)
return choice
def error_uns(self):
@ -195,14 +196,6 @@ class SBoNetwork(object):
if "".join(self.source_dwn) in UNST:
return "".join(self.source_dwn)
def download(self, path):
'''
Download sources
'''
Download(path, self.sbo_dwn).start()
for src in self.source_dwn:
Download(path, src).start()
def build(self, FAULT):
'''
Only build and create Slackware package
@ -210,13 +203,12 @@ class SBoNetwork(object):
if FAULT:
print("\n{0}The package {1} {2}\n".format(color['RED'], FAULT,
color['ENDC']))
sys.exit()
sys.exit(0)
sources = []
os.chdir(build_path)
Download(build_path, self.sbo_dwn).start()
Download(build_path, self.dwn_srcs).start()
script = self.sbo_dwn.split("/")[-1]
for src in self.source_dwn:
Download(build_path, src).start()
sources.append(src.split("/")[-1])
BuildPackage(script, sources, build_path).build()
@ -233,7 +225,7 @@ class SBoNetwork(object):
binary = (tmp + max(binary_list)).split()
except ValueError:
build_FAILED(self.sbo_url, prgnam)
sys.exit()
sys.exit(0)
print("[ {0}Installing{1} ] --> {2}".format(color['GREEN'],
color['ENDC'],
self.name))

0
slpkg/sizes.py Executable file → Normal file
View file

View file

@ -1,33 +0,0 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# downloads.py file is part of slpkg.
# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Utility for easy management packages in Slackware
# https://github.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from slpkg.downloader import Download
def slack_dwn(path, links):
'''
Download patches
'''
for dwn in links:
Download(path, dwn).start()
Download(path, dwn + ".asc").start()

0
slpkg/slack/greps.py Executable file → Normal file
View file

11
slpkg/slack/install.py Executable file → Normal file
View file

@ -25,8 +25,12 @@ import os
import sys
from slpkg.sizes import units
from slpkg.remove import delete
from slpkg.checksum import check_md5
from slpkg.blacklist import BlackList
from slpkg.init import Initialization
from slpkg.downloader import Download
from slpkg.grep_md5 import pkg_checksum
from slpkg.splitting import split_package
from slpkg.messages import (
pkg_not_found,
@ -43,10 +47,8 @@ from slpkg.__metadata__ import (
from slpkg.pkg.find import find_package
from slpkg.pkg.manager import PackageManager
from remove import delete
from mirrors import mirrors
from greps import slack_data
from download import slack_dwn
class Slack(object):
@ -106,14 +108,14 @@ class Slack(object):
else:
answer = raw_input("\nWould you like to continue [Y/n]? ")
if answer in ['y', 'Y']:
slack_dwn(self.tmp_path, dwn_links)
Download(self.tmp_path, dwn_links).start()
install(self.tmp_path, install_all)
delete(self.tmp_path, install_all)
else:
pkg_not_found("", self.slack_pkg, "No matching", "\n")
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
sys.exit(0)
def store(self):
'''
@ -177,6 +179,7 @@ def install(tmp_path, install_all):
'''
for install in install_all:
package = (tmp_path + install).split()
check_md5(pkg_checksum(install, "slack"), tmp_path + install)
if os.path.isfile(pkg_path + install[:-4]):
print("[ {0}reinstalling{1} ] --> {2}".format(color['GREEN'],
color['ENDC'],

0
slpkg/slack/mirrors.py Executable file → Normal file
View file

11
slpkg/slack/patches.py Executable file → Normal file
View file

@ -27,8 +27,12 @@ import subprocess
from slpkg.sizes import units
from slpkg.url_read import URL
from slpkg.remove import delete
from slpkg.messages import template
from slpkg.checksum import check_md5
from slpkg.blacklist import BlackList
from slpkg.downloader import Download
from slpkg.grep_md5 import pkg_checksum
from slpkg.splitting import split_package
from slpkg.__metadata__ import (
pkg_path,
@ -40,10 +44,8 @@ from slpkg.__metadata__ import (
from slpkg.pkg.find import find_package
from slpkg.pkg.manager import PackageManager
from remove import delete
from mirrors import mirrors
from greps import slack_data
from download import slack_dwn
from slack_version import slack_ver
@ -100,7 +102,7 @@ class Patches(object):
else:
answer = raw_input("\nWould you like to continue [Y/n]? ")
if answer in ['y', 'Y']:
slack_dwn(self.patch_path, dwn_links)
Download(self.patch_path, dwn_links).start()
upgrade(self.patch_path, upgrade_all)
kernel(upgrade_all)
delete(self.patch_path, upgrade_all)
@ -112,7 +114,7 @@ class Patches(object):
"date\n".format(slack_arch, self.version, slack_ver()))
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
sys.exit(0)
def store(self):
'''
@ -163,6 +165,7 @@ def upgrade(patch_path, upgrade_all):
Upgrade packages
'''
for pkg in upgrade_all:
check_md5(pkg_checksum(pkg, "slack"), patch_path + pkg)
print("[ {0}upgrading{1} ] --> {2}".format(color['YELLOW'],
color['ENDC'], pkg[:-4]))
PackageManager((patch_path + pkg).split()).upgrade()

0
slpkg/slack/slack_version.py Executable file → Normal file
View file

0
slpkg/splitting.py Executable file → Normal file
View file

0
slpkg/toolbar.py Executable file → Normal file
View file

0
slpkg/tracking.py Executable file → Normal file
View file

4
slpkg/url_read.py Executable file → Normal file
View file

@ -39,7 +39,7 @@ class URL(object):
return f.read()
except (urllib2.URLError, ValueError):
print("\nslpkg: error: connection refused\n")
sys.exit()
sys.exit(0)
except KeyboardInterrupt:
print("") # new line at exit
sys.exit()
sys.exit(0)

0
slpkg/version.py Executable file → Normal file
View file