diff --git a/CHANGELOG b/CHANGELOG
index 53d387ed..5f1b5b0c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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.
diff --git a/PKG-INFO b/PKG-INFO
index 2cb9ac52..803baba6 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -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
diff --git a/README.rst b/README.rst
index e2a8bd0c..b4977486 100644
--- a/README.rst
+++ b/README.rst
@@ -11,9 +11,9 @@
Latest Release:
-- Version: 2.1.1
+- Version: 2.1.2
- `Package `_
-- `Source `_
+- `Source `_
- `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
diff --git a/install.sh b/install.sh
index 24c6ce00..f0a2b0ce 100755
--- a/install.sh
+++ b/install.sh
@@ -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.
diff --git a/man/slpkg.8 b/man/slpkg.8
index 65eb3b86..1bc2524f 100644
--- a/man/slpkg.8
+++ b/man/slpkg.8
@@ -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>
diff --git a/slackbuild/slpkg.SlackBuild b/slackbuild/slpkg.SlackBuild
index 92da6606..be3458f1 100755
--- a/slackbuild/slpkg.SlackBuild
+++ b/slackbuild/slpkg.SlackBuild
@@ -23,7 +23,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=slpkg
-VERSION=${VERSION:-2.1.1}
+VERSION=${VERSION:-2.1.2}
BUILD=${BUILD:-1}
TAG=${TAG:-_dsw}
diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py
index 44107652..2e9524fa 100644
--- a/slpkg/__metadata__.py
+++ b/slpkg/__metadata__.py
@@ -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"
diff --git a/slpkg/arguments.py b/slpkg/arguments.py
old mode 100755
new mode 100644
index 5f08412a..ea669549
--- a/slpkg/arguments.py
+++ b/slpkg/arguments.py
@@ -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)
diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py
old mode 100755
new mode 100644
diff --git a/slpkg/checksum.py b/slpkg/checksum.py
old mode 100755
new mode 100644
index 29e575a5..44a18951
--- a/slpkg/checksum.py
+++ b/slpkg/checksum.py
@@ -22,12 +22,41 @@
# along with this program. If not, see .
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
diff --git a/slpkg/config.py b/slpkg/config.py
old mode 100755
new mode 100644
diff --git a/slpkg/desc.py b/slpkg/desc.py
old mode 100755
new mode 100644
diff --git a/slpkg/downloader.py b/slpkg/downloader.py
old mode 100755
new mode 100644
index fb6de051..c7fe5d83
--- a/slpkg/downloader.py
+++ b/slpkg/downloader.py
@@ -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.
'''
- print("\n[ {0}Download{1} ] -->{1} {2}\n".format(color['GREEN'],
- color['ENDC'],
- self.file_name))
- try:
- subprocess.call("wget -c -N --directory-prefix={0} {1}".format(
- self.path, self.url), shell=True)
- except KeyboardInterrupt:
- print # new line at cancel
- sys.exit()
+ for dwn in self.url:
+ file_name = dwn.split("/")[-1]
+ print("\n[ {0}Download{1} ] -->{1} {2}\n".format(color['GREEN'],
+ color['ENDC'],
+ file_name))
+ try:
+ subprocess.call("wget -c -N --directory-prefix={0} {1}".format(
+ self.path, dwn), shell=True)
+ except KeyboardInterrupt:
+ print # new line at cancel
+ sys.exit(0)
diff --git a/slpkg/file_size.py b/slpkg/file_size.py
old mode 100755
new mode 100644
index 09f49abb..db686a55
--- a/slpkg/file_size.py
+++ b/slpkg/file_size.py
@@ -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):
'''
diff --git a/slpkg/others/download.py b/slpkg/grep_md5.py
old mode 100755
new mode 100644
similarity index 57%
rename from slpkg/others/download.py
rename to slpkg/grep_md5.py
index 9680bf9f..5b2d5e44
--- a/slpkg/others/download.py
+++ b/slpkg/grep_md5.py
@@ -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
# 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 .
-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
diff --git a/slpkg/init.py b/slpkg/init.py
old mode 100755
new mode 100644
index 4cd5e92b..46d7c407
--- a/slpkg/init.py
+++ b/slpkg/init.py
@@ -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()
diff --git a/slpkg/main.py b/slpkg/main.py
old mode 100755
new mode 100644
diff --git a/slpkg/messages.py b/slpkg/messages.py
old mode 100755
new mode 100644
index 3505d33f..08fb8d6a
--- a/slpkg/messages.py
+++ b/slpkg/messages.py
@@ -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):
diff --git a/slpkg/others/check.py b/slpkg/others/check.py
old mode 100755
new mode 100644
index 575c27b1..4f689d6b
--- a/slpkg/others/check.py
+++ b/slpkg/others/check.py
@@ -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()
diff --git a/slpkg/others/dependency.py b/slpkg/others/dependency.py
old mode 100755
new mode 100644
index 4df4783b..d260f33d
--- a/slpkg/others/dependency.py
+++ b/slpkg/others/dependency.py
@@ -51,4 +51,4 @@ def dependencies_pkg(name, repo):
return dep_results
except KeyboardInterrupt:
print("") # new line at exit
- sys.exit()
+ sys.exit(0)
diff --git a/slpkg/others/greps.py b/slpkg/others/greps.py
old mode 100755
new mode 100644
diff --git a/slpkg/others/install.py b/slpkg/others/install.py
old mode 100755
new mode 100644
index 4774734b..85406c9b
--- a/slpkg/others/install.py
+++ b/slpkg/others/install.py
@@ -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'],
diff --git a/slpkg/others/search.py b/slpkg/others/search.py
old mode 100755
new mode 100644
index 4849451c..4341fed2
--- a/slpkg/others/search.py
+++ b/slpkg/others/search.py
@@ -50,4 +50,4 @@ def search_pkg(name, repo):
return pkg_name
except KeyboardInterrupt:
print("") # new line at exit
- sys.exit()
+ sys.exit(0)
diff --git a/slpkg/pkg/build.py b/slpkg/pkg/build.py
old mode 100755
new mode 100644
index 16fc57a8..7ad2bb97
--- a/slpkg/pkg/build.py
+++ b/slpkg/pkg/build.py
@@ -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):
diff --git a/slpkg/pkg/find.py b/slpkg/pkg/find.py
old mode 100755
new mode 100644
diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py
old mode 100755
new mode 100644
index 0d82011d..0478c7e7
--- a/slpkg/pkg/manager.py
+++ b/slpkg/pkg/manager.py
@@ -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 '
@@ -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)
diff --git a/slpkg/queue.py b/slpkg/queue.py
old mode 100755
new mode 100644
diff --git a/slpkg/slack/remove.py b/slpkg/remove.py
old mode 100755
new mode 100644
similarity index 92%
rename from slpkg/slack/remove.py
rename to slpkg/remove.py
index cf172660..454be3df
--- a/slpkg/slack/remove.py
+++ b/slpkg/remove.py
@@ -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")
diff --git a/slpkg/repositories.py b/slpkg/repositories.py
old mode 100755
new mode 100644
diff --git a/slpkg/sbo/check.py b/slpkg/sbo/check.py
old mode 100755
new mode 100644
index df4b0604..d814b93f
--- a/slpkg/sbo/check.py
+++ b/slpkg/sbo/check.py
@@ -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
diff --git a/slpkg/sbo/compressed.py b/slpkg/sbo/compressed.py
old mode 100755
new mode 100644
diff --git a/slpkg/sbo/dependency.py b/slpkg/sbo/dependency.py
old mode 100755
new mode 100644
index 78d79286..27e7aab9
--- a/slpkg/sbo/dependency.py
+++ b/slpkg/sbo/dependency.py
@@ -55,4 +55,4 @@ def sbo_dependencies_pkg(name):
return dep_results
except KeyboardInterrupt:
print("") # new line at exit
- sys.exit()
+ sys.exit(0)
diff --git a/slpkg/sbo/greps.py b/slpkg/sbo/greps.py
old mode 100755
new mode 100644
diff --git a/slpkg/sbo/read.py b/slpkg/sbo/read.py
old mode 100755
new mode 100644
diff --git a/slpkg/sbo/remove.py b/slpkg/sbo/remove.py
old mode 100755
new mode 100644
diff --git a/slpkg/sbo/search.py b/slpkg/sbo/search.py
old mode 100755
new mode 100644
index 4e5b196c..e7b4e2a5
--- a/slpkg/sbo/search.py
+++ b/slpkg/sbo/search.py
@@ -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)
diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py
old mode 100755
new mode 100644
index 0d2d6925..2a68f570
--- a/slpkg/sbo/slackbuild.py
+++ b/slpkg/sbo/slackbuild.py
@@ -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'],
diff --git a/slpkg/sbo/views.py b/slpkg/sbo/views.py
old mode 100755
new mode 100644
index 211777c1..eedefd1c
--- a/slpkg/sbo/views.py
+++ b/slpkg/sbo/views.py
@@ -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))
diff --git a/slpkg/sizes.py b/slpkg/sizes.py
old mode 100755
new mode 100644
diff --git a/slpkg/slack/download.py b/slpkg/slack/download.py
deleted file mode 100755
index 4d1b42fe..00000000
--- a/slpkg/slack/download.py
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-# downloads.py file is part of slpkg.
-
-# Copyright 2014 Dimitris Zlatanidis
-# All rights reserved.
-
-# Utility for easy management packages in Slackware
-
-# https://github.com/dslackw/slpkg
-
-# Slpkg is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-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()
diff --git a/slpkg/slack/greps.py b/slpkg/slack/greps.py
old mode 100755
new mode 100644
diff --git a/slpkg/slack/install.py b/slpkg/slack/install.py
old mode 100755
new mode 100644
index f7e5c436..de5f9ed6
--- a/slpkg/slack/install.py
+++ b/slpkg/slack/install.py
@@ -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'],
diff --git a/slpkg/slack/mirrors.py b/slpkg/slack/mirrors.py
old mode 100755
new mode 100644
diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py
old mode 100755
new mode 100644
index 15f01915..60328283
--- a/slpkg/slack/patches.py
+++ b/slpkg/slack/patches.py
@@ -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()
diff --git a/slpkg/slack/slack_version.py b/slpkg/slack/slack_version.py
old mode 100755
new mode 100644
diff --git a/slpkg/splitting.py b/slpkg/splitting.py
old mode 100755
new mode 100644
diff --git a/slpkg/toolbar.py b/slpkg/toolbar.py
old mode 100755
new mode 100644
diff --git a/slpkg/tracking.py b/slpkg/tracking.py
old mode 100755
new mode 100644
diff --git a/slpkg/url_read.py b/slpkg/url_read.py
old mode 100755
new mode 100644
index 1d08bf7a..9ff3bac2
--- a/slpkg/url_read.py
+++ b/slpkg/url_read.py
@@ -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)
diff --git a/slpkg/version.py b/slpkg/version.py
old mode 100755
new mode 100644