From 91787da9e8853191d1dc3d2d9e4706d2a2d82012 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 24 Dec 2014 11:22:07 +0200 Subject: [PATCH] added Aliens multi repository --- CHANGELOG | 5 +++-- README.rst | 4 ++++ REPOSITORIES | 6 ++++-- man/slpkg.8 | 3 ++- slpkg/__metadata__.py | 3 ++- slpkg/desc.py | 3 ++- slpkg/grep_md5.py | 3 ++- slpkg/init.py | 28 +++++++++++++++++++++++++++- slpkg/main.py | 12 ++++++++++-- slpkg/others/check.py | 33 +++++++++++++++++---------------- slpkg/others/greps.py | 27 +++++++++++++++++++++++++-- slpkg/others/install.py | 12 +++++++++--- slpkg/others/search.py | 3 ++- slpkg/pkg/manager.py | 4 +++- slpkg/repolist.py | 3 ++- slpkg/repositories.py | 10 ++++++++-- slpkg/splitting.py | 10 +++++++--- 17 files changed, 129 insertions(+), 40 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 57b9035e..36a3d1ca 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,8 @@ Version 2.1.5-dev -22-12-2014 +24-12-2014 -[Feature] - Added slacker.it, slackonly.com, Alien's ktown repositories. +[Feature] - Added slacker.it, slackonly.com, Alien's ktown, Alien's multilib + repositories. - Added command 're-create'. - Added command 'repolist'. - Added command 'repoinfo'. diff --git a/README.rst b/README.rst index 82428664..434af8df 100644 --- a/README.rst +++ b/README.rst @@ -58,6 +58,9 @@ Supported Repositories: - Alien's ktown - `Repository `_ Arch: {x86, x86_64} Versions: {13.37, 14.0, 14.1, current} +- Alien's multi - `Repository `_ + Arch: {x86_64} + Versions: {13.0, 13.1, 13.37, 14.0, 14.1, current} * Choose repositories you need to work from file '/etc/slpkg/slpkg.conf' default is 'slack' and 'sbo' repositories and read REPOSITORIES file for each of the particularities. @@ -269,6 +272,7 @@ Take information repositories with commands: +============================================================================== alien http://www.slackware.com/~alien/slackbuilds/ enabled ktown http://alien.slackbook.org/ktown/ enabled + multi http://www.slackware.com/~alien/multilib/ enabled rlw http://rlworkman.net/pkgs/ enabled sbo http://slackbuilds.org/slackbuilds/ enabled slack http://ftp.cc.uoc.gr/mirrors/linux/slackware/ enabled diff --git a/REPOSITORIES b/REPOSITORIES index c73050dc..35af3c19 100644 --- a/REPOSITORIES +++ b/REPOSITORIES @@ -10,8 +10,6 @@ Rworkman's (rlw) repository use dependencies where displayed in central site 'http://rlworkman.net/pkgs/' and only those. Unfortunately there is no fixed reference dependencies file PACKAGES.TXT. -Studioware (studio) and Alien's ktown (ktown)repository has no reference dependencies. - Slackers.it (slackr) repository be used only from Slackware64 current users. Also find in some packages will not show package description when you run the command 'slpkg -p slackr ' and this is because there is not constant reference to the @@ -26,3 +24,7 @@ lines with 'PACKAGE NAME:' there is no package so 'slpkg' can not find package. Users with Slackware x86_64 will use this repository should establish from the beginning the list of packages with the command 'slpkg re-create' to be updated with new packages and it's because the repository has not 'ChangeLog.txt' file. + +Studioware (studio), Alien's ktown (ktown), Alien's multilib (multi) repository has no +reference dependencies. + diff --git a/man/slpkg.8 b/man/slpkg.8 index 68ee15f3..ae5f1de1 100644 --- a/man/slpkg.8 +++ b/man/slpkg.8 @@ -73,7 +73,8 @@ Optional arguments: slacker.it = 'slackr' slackonly.com = 'slonly' Alien's ktown = 'ktown' - + Alien's multilib = 'multi' + Default enable repository is 'slack' and 'sbo'. Add or remove repository in configuration file '/etc/slpkg/slpkg.conf' diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index 0f756484..8208600b 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -44,7 +44,8 @@ repositories = [ 'studio', 'slackr', 'slonly', - 'ktown{latest}' + 'ktown{latest}', + 'multi' ] diff --git a/slpkg/desc.py b/slpkg/desc.py index c3327b37..c716cfb2 100644 --- a/slpkg/desc.py +++ b/slpkg/desc.py @@ -57,7 +57,8 @@ class PkgDesc(object): 'studio': 'studio_repo/PACKAGES.TXT', 'slackr': 'slackr_repo/PACKAGES.TXT', 'slonly': 'slonly_repo/PACKAGES.TXT', - 'ktown': 'ktown_repo/PACKAGES.TXT' + 'ktown': 'ktown_repo/PACKAGES.TXT', + 'multi': 'multi_repo/PACKAGES.TXT' } self.lib = lib_path + repos[self.repo] diff --git a/slpkg/grep_md5.py b/slpkg/grep_md5.py index 78bb431e..688c2397 100644 --- a/slpkg/grep_md5.py +++ b/slpkg/grep_md5.py @@ -48,7 +48,8 @@ def pkg_checksum(binary, repo): 'studio': 'studio_repo/CHECKSUMS.md5', 'slackr': 'slackr_repo/CHECKSUMS.md5', 'slonly': 'slonly_repo/CHECKSUMS.md5', - 'ktown': 'ktown_repo/CHECKSUMS.md5' + 'ktown': 'ktown_repo/CHECKSUMS.md5', + 'multi': 'multi_repo/CHECKSUMS.md5' } lib = repos[repo] f = open(lib_path + lib, "r") diff --git a/slpkg/init.py b/slpkg/init.py index f024aca8..8b8b94b4 100644 --- a/slpkg/init.py +++ b/slpkg/init.py @@ -313,6 +313,31 @@ class Initialization(object): self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt, md5_file, checksums_md5, lst_file, filelist_txt) + def multi(self): + ''' + Creating alien multilib local library + ''' + repo = Repo().multi() + log = log_path + "multi/" + lib = lib_path + "multi_repo/" + lib_file = "PACKAGES.TXT" + lst_file = "" + 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) + filelist_txt = "" + 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, + md5_file, checksums_md5, lst_file, filelist_txt) + @staticmethod def write(path, data_file, file_url): ''' @@ -427,7 +452,8 @@ class Update(object): 'studio': Initialization().studioware, 'slackr': Initialization().slackers, 'slonly': Initialization().slackonly, - 'ktown': Initialization().ktown + 'ktown': Initialization().ktown, + 'multi': Initialization().multi } def repository(self): diff --git a/slpkg/main.py b/slpkg/main.py index f0e3d544..b5be18f8 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -93,6 +93,9 @@ class Case(object): def ktown_install(self): OthersInstall(self.package, "ktown", self.release).start() + def multi_install(self): + OthersInstall(self.package, "multi", self.release).start() + def sbo_upgrade(self): SBoCheck().start() @@ -120,6 +123,9 @@ class Case(object): def ktown_upgrade(self): OthersUpgrade("ktown", self.release).start() + def multi_upgrade(self): + OthersUpgrade("multi", self.release).start() + def main(): @@ -178,7 +184,8 @@ def main(): 'studio': pkg.studioware_upgrade, 'slackr': pkg.slackers_upgrade, 'slonly': pkg.slackonly_upgrade, - 'ktown': pkg.ktown_upgrade + 'ktown': pkg.ktown_upgrade, + 'multi': pkg.multi_upgrade } if args[1] in repositories: upgrade[args[1]]() @@ -195,7 +202,8 @@ def main(): 'studio': pkg.studioware_install, 'slackr': pkg.slackers_install, 'slonly': pkg.slackonly_install, - 'ktown': pkg.ktown_install + 'ktown': pkg.ktown_install, + 'multi': pkg.multi_install } if args[1] in repositories: install[args[1]]() diff --git a/slpkg/others/check.py b/slpkg/others/check.py index 3ca36e05..2559be24 100644 --- a/slpkg/others/check.py +++ b/slpkg/others/check.py @@ -26,6 +26,7 @@ import sys from slpkg.sizes import units from slpkg.remove import delete +from slpkg.toolbar import status from slpkg.repositories import Repo from slpkg.messages import template from slpkg.checksum import check_md5 @@ -65,7 +66,8 @@ class OthersUpgrade(object): 'studio': self._init_studio, 'slackr': self._init_slackr, 'slonly': self._init_slonly, - 'ktown': self._init_ktown + 'ktown': self._init_ktown, + 'multi': self._init_multi } init_repos[self.repo]() @@ -118,6 +120,11 @@ class OthersUpgrade(object): self.mirror = Repo().ktown() self.step = self.step * 2 + def _init_multi(self): + self.lib = lib_path + "multi_repo/PACKAGES.TXT" + self.mirror = Repo().multi() + self.step = self.step * 2 + def start(self): ''' Install packages from official Slackware distribution @@ -160,7 +167,7 @@ class OthersUpgrade(object): upgrade(self.tmp_path, upgrade_all, self.repo, self.version) delete(self.tmp_path, upgrade_all) else: - print("No new updates in the repository '{0}'\n".format( + print("No new updates from repository '{0}'\n".format( self.repo)) except KeyboardInterrupt: print("") # new line at exit @@ -177,14 +184,18 @@ class OthersUpgrade(object): # size = data[2] # unsize = data[3] data = repo_data(self.PACKAGES_TXT, self.step, self.repo, self.version) + index, toolbar_width, step = 0, 700, 10 for pkg in self.installed(): + index += 1 + toolbar_width = status(index, toolbar_width, step) for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]): inst_pkg = split_package(pkg) - if name: + if name: # this tips because some pkg_name is empty repo_pkg = split_package(name[:-4]) if (repo_pkg[0] == inst_pkg[0] and - name[:-4] > pkg and inst_pkg[0] not in black): + repo_pkg[-3] > inst_pkg[-3] and + inst_pkg[0] not in black): # store downloads packages by repo dwn.append("{0}{1}/{2}".format(self.mirror, loc, name)) install.append(name) @@ -197,18 +208,7 @@ class OthersUpgrade(object): Return all installed packages by repository ''' packages = [] - repository = { - 'rlw': '_rlw', - 'alien': 'alien', - 'slacky': 'sl', - 'studio': 'se', - 'slackr': 'cf', - 'slonly': '_slack', - 'ktown': 'alien' - } - repo = repository[self.repo] for pkg in os.listdir(pkg_path): - if pkg.endswith(repo): packages.append(pkg) return packages @@ -226,7 +226,8 @@ def views(upgrade_all, comp_sum, repository): 'studio': '', 'slackr': '', 'slonly': '', - 'ktown': ' ' + 'ktown': ' ', + 'multi': ' ' } repository += align[repository] for pkg, comp in zip(upgrade_all, comp_sum): diff --git a/slpkg/others/greps.py b/slpkg/others/greps.py index 7c32ee38..a395c9a3 100644 --- a/slpkg/others/greps.py +++ b/slpkg/others/greps.py @@ -71,6 +71,12 @@ def repo_data(PACKAGES_TXT, step, repo, version): rsize, runsize ) = ktown_filter(name, location, size, unsize, version) + elif repo == "multi": + (rname, + rlocation, + rsize, + runsize + ) = multi_filter(name, location, size, unsize, version) elif repo in ["slacky", "studio", "slackr", "slonly"]: rname, rlocation, rsize, runsize = name, location, size, unsize return [rname, rlocation, rsize, runsize] @@ -96,7 +102,7 @@ def rlw_filter(name, location, size, unsize): def alien_filter(name, location, size, unsize, version): ''' - Filter alien repository data + Filter Alien's repository data ''' ver = slack_ver() if version == "current": @@ -116,7 +122,7 @@ def alien_filter(name, location, size, unsize, version): def ktown_filter(name, location, size, unsize, version): ''' - Filter alien repository data + Filter Alien's ktown repository data ''' ver = slack_ver() if version == "current": @@ -134,6 +140,23 @@ def ktown_filter(name, location, size, unsize, version): return [fname, flocation, fsize, funsize] +def multi_filter(name, location, size, unsize, version): + ''' + Filter Alien's multilib repository data + ''' + ver = slack_ver() + if version == "current": + ver = "current" + (fname, flocation, fsize, funsize) = ([] for i in range(4)) + for n, l, s, u in zip(name, location, size, unsize): + if l.startswith(ver): + fname.append(n) + flocation.append(l) + fsize.append(s) + funsize.append(u) + return [fname, flocation, fsize, funsize] + + def fix_slackers_pkg(name): ''' Fix 'PACKAGE NAME:' from PACKAGES.TXT file diff --git a/slpkg/others/install.py b/slpkg/others/install.py index ae461e7f..d99276df 100644 --- a/slpkg/others/install.py +++ b/slpkg/others/install.py @@ -74,7 +74,8 @@ class OthersInstall(object): 'studio': self._init_studio, 'slackr': self._init_slackr, 'slonly': self._init_slonly, - 'ktown': self._init_ktown + 'ktown': self._init_ktown, + 'multi': self._init_multi } init_repos[self.repo]() @@ -128,6 +129,11 @@ class OthersInstall(object): self.mirror = Repo().ktown() self.step = self.step * 2 + def _init_multi(self): + self.lib = lib_path + "multi_repo/PACKAGES.TXT" + self.mirror = Repo().multi() + self.step = self.step * 2 + def start(self): ''' Install packages from official Slackware distribution @@ -207,7 +213,6 @@ class OthersInstall(object): else: for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]): - package = "".join(deps) if package in name and package not in black: # store downloads packages by repo @@ -235,7 +240,8 @@ def views(install_all, comp_sum, repository, dependencies): 'studio': '', 'slackr': '', 'slonly': '', - 'ktown': ' ' + 'ktown': ' ', + 'multi': ' ' } repository += align[repository] for pkg, comp in zip(install_all, comp_sum): diff --git a/slpkg/others/search.py b/slpkg/others/search.py index 95d6e48d..5eba3fcb 100644 --- a/slpkg/others/search.py +++ b/slpkg/others/search.py @@ -42,7 +42,8 @@ def search_pkg(name, repo): 'studio': 'studio_repo/PACKAGES.TXT', 'slackr': 'slackr_repo/PACKAGES.TXT', 'slonly': 'slonly_repo/PACKAGES.TXT', - 'ktown': 'ktown_repo/PACKAGES.TXT' + 'ktown': 'ktown_repo/PACKAGES.TXT', + 'multi': 'multi_repo/PACKAGES.TXT' } with open(lib_path + repo_dir[repo], "r") as PACKAGES_TXT: for line in PACKAGES_TXT: diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py index c2c883ea..38fdb8b5 100644 --- a/slpkg/pkg/manager.py +++ b/slpkg/pkg/manager.py @@ -295,7 +295,9 @@ class PackageManager(object): 'slacky': 'sl', 'studio': 'se', 'slackr': 'cf', - 'slonly': '_slack', # this conflict with slack repository + 'slonly': '_slack', + 'ktown': 'alien', + 'multi': 'compat32', 'all': '' } search = pkg_list[pattern] diff --git a/slpkg/repolist.py b/slpkg/repolist.py index 4e215719..ddc4b7b2 100644 --- a/slpkg/repolist.py +++ b/slpkg/repolist.py @@ -44,7 +44,8 @@ class RepoList(object): 'studio': Repo().studioware(), 'slackr': Repo().slackers(), 'slonly': Repo().slackonly(), - 'ktown': Repo().ktown() + 'ktown': Repo().ktown(), + 'multi': Repo().multi() } def repos(self): diff --git a/slpkg/repositories.py b/slpkg/repositories.py index 53ccb13c..a8265734 100644 --- a/slpkg/repositories.py +++ b/slpkg/repositories.py @@ -59,7 +59,7 @@ class Repo(object): def alien(self): ''' - Alien repository + Alien's slackbuilds repository ''' return "http://www.slackware.com/~alien/slackbuilds/" @@ -89,6 +89,12 @@ class Repo(object): def ktown(self): ''' - Alien ktown repository + Alien's ktown repository ''' return "http://alien.slackbook.org/ktown/" + + def multi(self): + ''' + Alien's multilib repository + ''' + return "http://www.slackware.com/~alien/multilib/" diff --git a/slpkg/splitting.py b/slpkg/splitting.py index 037452d8..c3cfb99b 100644 --- a/slpkg/splitting.py +++ b/slpkg/splitting.py @@ -38,7 +38,9 @@ def split_package(package): studio = "se" slackr = "cf" slonly = "_slack" - ktown = "alien" + # ktown = alien + # multi = alien + compat = "compat32" build = split[-1] if build.endswith(sbo): @@ -57,8 +59,10 @@ def split_package(package): build = split[-1][:-len(slackr)] elif build.endswith(slonly): build = split[-1][:-len(slonly)] - elif build.endswith(ktown): - build = split[-1][:-len(ktown)] + elif (slack + compat) in build: + build = split[-1][:-len(slack + compat)] + elif build.endswith(compat): + build = split[-1][:-len(compat)] arch = split[-2] ver = split[-3]