From dfeded98c69b30395d637ab7cbc93946bde9d61d Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 20 Dec 2014 08:16:11 +0200 Subject: [PATCH] fix checksums after upgrade slack --- slpkg/grep_md5.py | 9 +++++++-- slpkg/init.py | 15 +++++++++++++++ slpkg/main.py | 8 +++++--- slpkg/slack/patches.py | 16 +++++++++++++--- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/slpkg/grep_md5.py b/slpkg/grep_md5.py index c1b5e41c..732548f1 100644 --- a/slpkg/grep_md5.py +++ b/slpkg/grep_md5.py @@ -24,7 +24,10 @@ from slack.mirrors import mirrors from url_read import URL -from __metadata__ import lib_path +from __metadata__ import ( + lib_path, + slack_rel +) def pkg_checksum(binary, repo): @@ -32,8 +35,10 @@ def pkg_checksum(binary, repo): Return checksum from CHECKSUMS.md5 file by repository ''' md5 = "None" - if repo == "slack_patches": + if repo == "slack_patches" and slack_rel == "stable": CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "patches/")).reading() + elif repo == "slack_patches" and slack_rel == "current": + CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "")).reading() else: repos = { 'slack': 'slack_repo/CHECKSUMS.md5', diff --git a/slpkg/init.py b/slpkg/init.py index 91c52d6f..d7fa4827 100644 --- a/slpkg/init.py +++ b/slpkg/init.py @@ -374,6 +374,21 @@ class Initialization(object): f.write(line + "\n") f.close() + def re_create(self): + ''' + Remove all package lists with changelog and checksums files + and create lists again + ''' + for repo in repositories: + changelogs = '{0}{1}{2}'.format(log_path, repo, '/ChangeLog.txt') + if os.path.isfile(changelogs): + os.remove(changelogs) + for f in os.listdir(lib_path + '{0}_repo/'.format(repo)): + packages = '{0}{1}_repo/{2}'.format(lib_path, repo, f) + if os.path.isfile(packages): + os.remove(packages) + Update().repository() + class Update(object): diff --git a/slpkg/main.py b/slpkg/main.py index 70963df1..2f48fec3 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -24,8 +24,6 @@ import sys import getpass -from slpkg_update import it_self_update - from desc import PkgDesc from config import Config from queue import QueuePkgs @@ -34,7 +32,9 @@ from tracking import track_dep from blacklist import BlackList from version import prog_version from arguments import options, usage +from slpkg_update import it_self_update from init import ( + Initialization, Update, check_exists_repositories ) @@ -112,7 +112,6 @@ class Case(object): OthersUpgrade("slonly", self.release).start() - def main(): s_user(getpass.getuser()) @@ -130,6 +129,9 @@ def main(): # checking if repositories exists check_exists_repositories() + if len(args) == 1 and args[0] == "re-create": + Initialization().re_create() + if len(args) == 0: usage() elif (len(args) == 1 and args[0] == "-h" or diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py index 52bebead..7b6792af 100644 --- a/slpkg/slack/patches.py +++ b/slpkg/slack/patches.py @@ -176,6 +176,16 @@ def kernel(upgrade_all): ''' for core in upgrade_all: if "kernel" in core: - print("The kernel has been upgraded, reinstall `lilo` ...") - subprocess.call("lilo", shell=True) - break + if default_answer == "y": + answer = default_answer + else: + print("") + template(78) + print("| {0}*** HIGHLY recommended reinstall 'LILO' " + "***{1}".format(color['RED'], color['ENDC'])) + template(78) + answer = raw_input("\nThe kernel has been upgraded, " + "reinstall `LILO` [Y/n]? ") + if answer in ['y', 'Y']: + subprocess.call("lilo", shell=True) + break