From b912758f4a4d0b46f59b86231189905a3a930341 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 18 Dec 2014 08:15:07 +0200 Subject: [PATCH] added slackers.it repository --- README.rst | 9 +++++ conf/slpkg.conf | 3 +- man/slpkg.8 | 9 ++++- slackbuild/doinst.sh | 2 +- slpkg/__metadata__.py | 3 +- slpkg/desc.py | 3 +- slpkg/grep_md5.py | 3 +- slpkg/init.py | 78 +++++++++++++++++++++++++++++++++++------ slpkg/main.py | 12 +++++-- slpkg/others/check.py | 13 ++++--- slpkg/others/greps.py | 46 +++++++++++++++++++----- slpkg/others/install.py | 8 ++++- slpkg/others/search.py | 14 +++++--- slpkg/pkg/manager.py | 1 + slpkg/repositories.py | 6 ++++ slpkg/splitting.py | 3 ++ 16 files changed, 176 insertions(+), 37 deletions(-) diff --git a/README.rst b/README.rst index c12dcffc..fe8635bf 100644 --- a/README.rst +++ b/README.rst @@ -49,6 +49,9 @@ Supported Repositories: - Studioware - `Repository `_ Arch: {x86, x86_64} Versions: {13.37, 14.0, 14.1} +- Slackers - `Repository `_ + Arch: {x86_64} + Versions: {current} * Choose repositories you need to work from file '/etc/slpkg/slpkg.conf' default is all repositories. @@ -746,3 +749,9 @@ Man page it is available for full support: .. code-block:: bash $ man slpkg + + +Donate +-------- +If you feel satisfied with this project and want to thank me go +to `Slackware `_ and make a donation or visit the `store `_. diff --git a/conf/slpkg.conf b/conf/slpkg.conf index 55de32d8..c9f8899b 100644 --- a/conf/slpkg.conf +++ b/conf/slpkg.conf @@ -24,7 +24,8 @@ VERSION=stable # Choose repositories want to work. -# Available repositories : slack, sbo, alien, rlw, slacky, studio +# Available repositories : slack, sbo, alien, rlw, slacky, studio, slackr +# slackr (slackers.it) repository only for Slackware64 current. REPOSITORIES=slack,sbo,alien,rlw,slacky,studio # Build directory for repository slackbuilds.org. In this directory diff --git a/man/slpkg.8 b/man/slpkg.8 index 8da9fa97..b77fcb00 100644 --- a/man/slpkg.8 +++ b/man/slpkg.8 @@ -61,7 +61,14 @@ Optional arguments: -d, [package...] display the contents .SH REPOSITORIES - slack, sbo, alien, slacky, rlw, studio + slackware.com = 'slack' + SlackBuilds.org = 'sbo' + AlienBob = 'alien' + slacky.eu = 'slacky' + rworkman's = 'rlw' + studioware.org = 'studio' + slacker.it = 'slackr' + .SH COLORS red, green, yellow, cyan, grey .PP diff --git a/slackbuild/doinst.sh b/slackbuild/doinst.sh index c06beaa6..f64c9d0d 100644 --- a/slackbuild/doinst.sh +++ b/slackbuild/doinst.sh @@ -10,7 +10,7 @@ config() { CONFIGS="slpkg.conf blacklist slackware-mirrors" for file in $CONFIGS; do - config /etc/slpkg/${file}.new + config etc/slpkg/${file}.new done if [ -x /usr/bin/update-desktop-database ]; then diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index 36a1635c..0f57e89a 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -42,7 +42,8 @@ repositories = [ 'rlw', 'alien', 'slacky', - 'studio' + 'studio', + 'slackr' ] build_path = "/tmp/slpkg/build/" slpkg_tmp_packages = tmp + "slpkg/packages/" diff --git a/slpkg/desc.py b/slpkg/desc.py index 9d12075d..6585a7ce 100644 --- a/slpkg/desc.py +++ b/slpkg/desc.py @@ -54,7 +54,8 @@ class PkgDesc(object): 'rlw': 'rlw_repo/PACKAGES.TXT', 'alien': 'alien_repo/PACKAGES.TXT', 'slacky': 'slacky_repo/PACKAGES.TXT', - 'studio': 'studio_repo/PACKAGES.TXT' + 'studio': 'studio_repo/PACKAGES.TXT', + 'slackr': 'slackr_repo/PACKAGES.TXT' } self.lib = lib_path + repos[self.repo] diff --git a/slpkg/grep_md5.py b/slpkg/grep_md5.py index cdfe8a47..3ff8e652 100644 --- a/slpkg/grep_md5.py +++ b/slpkg/grep_md5.py @@ -40,7 +40,8 @@ def pkg_checksum(binary, repo): 'rlw': 'rlw_repo/CHECKSUMS.md5', 'alien': 'alien_repo/CHECKSUMS.md5', 'slacky': 'slacky_repo/CHECKSUMS.md5', - 'studio': 'studio_repo/CHECKSUMS.md5' + 'studio': 'studio_repo/CHECKSUMS.md5', + 'slackr': 'slackr_repo/CHECKSUMS.md5' } lib = repos[repo] f = open(lib_path + lib, "r") diff --git a/slpkg/init.py b/slpkg/init.py index a60a5144..f8f3a72b 100644 --- a/slpkg/init.py +++ b/slpkg/init.py @@ -67,6 +67,7 @@ class Initialization(object): log = log_path + "slack/" lib = lib_path + "slack_repo/" lib_file = "PACKAGES.TXT" + lst_file = "" md5_file = "CHECKSUMS.md5" log_file = "ChangeLog.txt" if not os.path.exists(log): @@ -74,6 +75,7 @@ class Initialization(object): if not os.path.exists(lib): os.mkdir(lib) packages = mirrors(lib_file, "") + filelist_txt = "" pkg_checksums = mirrors(md5_file, "") extra = mirrors(lib_file, "extra/") ext_checksums = mirrors(md5_file, "extra/") @@ -88,7 +90,7 @@ class Initialization(object): 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) + md5_file, checksums_md5, lst_file, filelist_txt) def sbo(self): ''' @@ -98,6 +100,7 @@ class Initialization(object): log = log_path + "sbo/" lib = lib_path + "sbo_repo/" lib_file = "SLACKBUILDS.TXT" + lst_file = "" md5_file = "" log_file = "ChangeLog.txt" if not os.path.exists(log): @@ -105,12 +108,13 @@ class Initialization(object): if not os.path.exists(lib): os.mkdir(lib) packages_txt = "{0}{1}/{2}".format(repo, slack_ver(), lib_file) + filelist_txt = "" checksums_md5 = "" changelog_txt = "{0}/{1}/{2}".format(repo, slack_ver(), log_file) self.write(lib, lib_file, packages_txt) self.write(log, log_file, changelog_txt) self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt, - md5_file, checksums_md5) + md5_file, checksums_md5, lst_file, filelist_txt) def rlw(self): ''' @@ -120,6 +124,7 @@ class Initialization(object): log = log_path + "rlw/" lib = lib_path + "rlw_repo/" lib_file = "PACKAGES.TXT" + lst_file = "" md5_file = "CHECKSUMS.md5" log_file = "ChangeLog.txt" if not os.path.exists(log): @@ -127,13 +132,14 @@ class Initialization(object): if not os.path.exists(lib): os.mkdir(lib) packages_txt = "{0}{1}/{2}".format(repo, slack_ver(), lib_file) + filelist_txt = "" 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, - md5_file, checksums_md5) + md5_file, checksums_md5, lst_file, filelist_txt) def alien(self): ''' @@ -143,6 +149,7 @@ class Initialization(object): log = log_path + "alien/" lib = lib_path + "alien_repo/" lib_file = "PACKAGES.TXT" + lst_file = "" md5_file = "CHECKSUMS.md5" log_file = "ChangeLog.txt" if not os.path.exists(log): @@ -150,13 +157,14 @@ class Initialization(object): 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) + md5_file, checksums_md5, lst_file, filelist_txt) def slacky(self): ''' @@ -168,6 +176,7 @@ class Initialization(object): log = log_path + "slacky/" lib = lib_path + "slacky_repo/" lib_file = "PACKAGES.TXT" + lst_file = "" md5_file = "CHECKSUMS.md5" log_file = "ChangeLog.txt" if not os.path.exists(log): @@ -178,6 +187,7 @@ class Initialization(object): ar = "64" packages_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(), lib_file) + filelist_txt = "" checksums_md5 = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(), md5_file) @@ -187,7 +197,7 @@ class Initialization(object): 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) + md5_file, checksums_md5, lst_file, filelist_txt) def studioware(self): ''' @@ -199,6 +209,7 @@ class Initialization(object): log = log_path + "studio/" lib = lib_path + "studio_repo/" lib_file = "PACKAGES.TXT" + lst_file = "" md5_file = "CHECKSUMS.md5" log_file = "ChangeLog.txt" if not os.path.exists(log): @@ -209,6 +220,7 @@ class Initialization(object): ar = "64" packages_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(), lib_file) + filelist_txt = "" 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(), @@ -217,7 +229,33 @@ class Initialization(object): 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) + md5_file, checksums_md5, lst_file, filelist_txt) + + def slackers(self): + ''' + Creating slackers local library + ''' + repo = Repo().slackers() + log = log_path + "slackr/" + lib = lib_path + "slackr_repo/" + lib_file = "PACKAGES.TXT" + lst_file = "FILELIST.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) + filelist_txt = "{0}{1}".format(repo, lst_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, lst_file, filelist_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): @@ -240,9 +278,16 @@ class Initialization(object): @staticmethod def remote(*args): ''' - 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 + 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 + args[8] = lst_file + args[9] = filelist_txt We take the size of ChangeLog.txt from the server and locally. If the two files differ in size delete and replace all files with new. @@ -259,6 +304,9 @@ class Initialization(object): # remove CHECKSUMS.md5 if args[6]: os.remove("{0}{1}".format(args[3], args[6])) + # remove FILELIST.TXT + if args[8]: + os.remove("{0}{1}".format(args[3], args[8])) for fu in args[5].split(): PACKAGES_TXT += URL(fu).reading() CHANGELOG_TXT = URL(args[2]).reading() @@ -285,6 +333,15 @@ class Initialization(object): toolbar_width = status(index, toolbar_width, 700) f.write(line + "\n") f.close() + # create FILELIST.TXT file + if args[8]: + FILELIST_TXT = URL(args[9]).reading() + with open("{0}{1}".format(args[3], args[8]), "w") as f: + for line in FILELIST_TXT.splitlines(): + index += 1 + toolbar_width = status(index, toolbar_width, 700) + f.write(line + "\n") + f.close() class Update(object): @@ -296,7 +353,8 @@ class Update(object): 'rlw': Initialization().rlw, 'alien': Initialization().alien, 'slacky': Initialization().slacky, - 'studio': Initialization().studioware + 'studio': Initialization().studioware, + 'slackr': Initialization().slackers } def repository(self): diff --git a/slpkg/main.py b/slpkg/main.py index c49a2d3e..c73d3efe 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -81,6 +81,9 @@ class Case(object): def studioware_install(self): OthersInstall(self.package, "studio", self.release).start() + def slackers_install(self): + OthersInstall(self.package, "slackr", self.release).start() + def sbo_upgrade(self): SBoCheck().start() @@ -99,6 +102,9 @@ class Case(object): def studioware_upgrade(self): OthersUpgrade("studio", self.release).start() + def slackers_upgrade(self): + OthersUpgrade("slackr", self.release).start() + def main(): @@ -141,7 +147,8 @@ def main(): 'rlw': pkg.rlw_upgrade, 'alien': pkg.alien_upgrade, 'slacky': pkg.slacky_upgrade, - 'studio': pkg.studioware_upgrade + 'studio': pkg.studioware_upgrade, + 'slackr': pkg.slackers_upgrade } if args[1] in repositories: upgrade[args[1]]() @@ -155,7 +162,8 @@ def main(): 'rlw': pkg.rlw_install, 'alien': pkg.alien_install, 'slacky': pkg.slacky_install, - 'studio': pkg.studioware_install + 'studio': pkg.studioware_install, + 'slackr': pkg.slackers_install } if args[1] in repositories: install[args[1]]() diff --git a/slpkg/others/check.py b/slpkg/others/check.py index e0116e8b..9ae15550 100644 --- a/slpkg/others/check.py +++ b/slpkg/others/check.py @@ -83,6 +83,10 @@ class OthersUpgrade(object): self.mirror = "{0}slackware{1}-{2}/".format(repos.studioware(), arch, slack_ver()) self.step = self.step * 2 + elif self.repo == "slackr": + lib = lib_path + "slackr_repo/PACKAGES.TXT" + self.mirror = repos.slackers() + self.step = self.step * 2 f = open(lib, "r") self.PACKAGES_TXT = f.read() @@ -146,9 +150,8 @@ class OthersUpgrade(object): # location = data[1] # size = data[2] # unsize = data[3] - installed = self.installed() data = repo_data(self.PACKAGES_TXT, self.step, self.repo, self.version) - for pkg in installed: + for pkg in self.installed(): for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]): inst_pkg = split_package(pkg) @@ -171,7 +174,8 @@ class OthersUpgrade(object): 'rlw': '_rlw', 'alien': 'alien', 'slacky': 'sl', - 'studio': 'se' + 'studio': 'se', + 'slackr': 'cf' } repo = repository[self.repo] for pkg in os.listdir(pkg_path): @@ -190,7 +194,8 @@ def views(upgrade_all, comp_sum, repository): 'rlw': ' ' * 3, 'alien': ' ', 'slacky': '', - 'studio': '' + 'studio': '', + 'slackr': '' } 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 775944db..dd2776d8 100644 --- a/slpkg/others/greps.py +++ b/slpkg/others/greps.py @@ -42,7 +42,10 @@ def repo_data(PACKAGES_TXT, step, repo, version): index += 1 toolbar_width = status(index, toolbar_width, step) if line.startswith("PACKAGE NAME"): - name.append(line[15:].strip()) + if repo == "slackr": + name.append(fix_slackers_pkg(line[15:])) + else: + name.append(line[15:].strip()) if line.startswith("PACKAGE LOCATION"): location.append(line[21:].strip()) if line.startswith("PACKAGE SIZE (compressed): "): @@ -61,7 +64,7 @@ def repo_data(PACKAGES_TXT, step, repo, version): rsize, runsize ) = alien_filter(name, location, size, unsize, version) - elif repo in ["slacky", "studio"]: + elif repo in ["slacky", "studio", "slackr"]: rname, rlocation, rsize, runsize = name, location, size, unsize return [rname, rlocation, rsize, runsize] @@ -104,6 +107,25 @@ def alien_filter(name, location, size, unsize, version): return [fname, flocation, fsize, funsize] +def fix_slackers_pkg(name): + ''' + Fix 'PACKAGE NAME:' from PACKAGES.TXT file + Beacause repository slackers.it not report the full + name in PACKAGES.TXT file then use FILELIST.TXT to + get it. + ''' + f = open(lib_path + "slackr_repo/FILELIST.TXT", "r") + FILELIST_TXT = f.read() + f.close() + for line in FILELIST_TXT.splitlines(): + if name in line and line.endswith(".txz"): + return line.split("/")[-1].strip() + # This trick fix spliting 'NoneType' packages + # reference wrong name between PACKAGE.TXT and + # FILELIST.TXT + return "xxx-xxx-xxx-xxx.txz" + + class Requires(object): def __init__(self, name, repo): @@ -118,26 +140,32 @@ class Requires(object): ''' Grap package requirements from repositories ''' - if self.repo in ["alien", "slacky"]: + if self.repo in ["alien", "slacky", "slackr"]: lib = { - 'alien': lib_path + "alien_repo/PACKAGES.TXT", - 'slacky': lib_path + "slacky_repo/PACKAGES.TXT" + 'alien': lib_path + 'alien_repo/PACKAGES.TXT', + 'slacky': lib_path + 'slacky_repo/PACKAGES.TXT', + 'slackr': lib_path + 'slackr_repo/PACKAGES.TXT' } f = open(lib[self.repo], "r") PACKAGES_TXT = f.read() f.close() for line in PACKAGES_TXT.splitlines(): if line.startswith("PACKAGE NAME: "): - pkg = line[14:].strip() - pkg_name = split_package(pkg)[0] + if self.repo == "slackr": + pkg_name = line[14:].strip() + else: + pkg = line[14:].strip() + pkg_name = split_package(pkg)[0] if line.startswith("PACKAGE REQUIRED: "): if pkg_name == self.name: if line[17:].strip(): if self.repo == "slacky": return self.slacky_req_fix(line) - - else: + elif self.repo == "alien": return line[18:].strip().split(",") + else: + return line[18:].strip().split() + elif self.repo == "rlw": # Robby's repository dependencies as shown in the central page # http://rlworkman.net/pkgs/ diff --git a/slpkg/others/install.py b/slpkg/others/install.py index 86f9879a..e4db6d94 100644 --- a/slpkg/others/install.py +++ b/slpkg/others/install.py @@ -97,6 +97,10 @@ class OthersInstall(object): self.mirror = "{0}slackware{1}-{2}/".format(repos.studioware(), arch, slack_ver()) self.step = self.step * 2 + elif self.repo == "slackr": + lib = lib_path + "slackr_repo/PACKAGES.TXT" + self.mirror = repos.slackers() + self.step = self.step * 2 f = open(lib, "r") self.PACKAGES_TXT = f.read() @@ -195,6 +199,7 @@ 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 @@ -221,7 +226,8 @@ def views(install_all, comp_sum, repository, dependencies): 'rlw': ' ' * 3, 'alien': ' ', 'slacky': '', - 'studio': '' + 'studio': '', + 'slackr': '' } 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 4341fed2..cb7a2ae2 100644 --- a/slpkg/others/search.py +++ b/slpkg/others/search.py @@ -36,15 +36,19 @@ def search_pkg(name, repo): try: blacklist = BlackList().packages() repo_dir = { - "rlw": "rlw_repo/PACKAGES.TXT", - "alien": "alien_repo/PACKAGES.TXT", - "slacky": "slacky_repo/PACKAGES.TXT", - "studio": "studio_repo/PACKAGES.TXT" + 'rlw': 'rlw_repo/PACKAGES.TXT', + 'alien': 'alien_repo/PACKAGES.TXT', + 'slacky': 'slacky_repo/PACKAGES.TXT', + 'studio': 'studio_repo/PACKAGES.TXT', + 'slackr': 'slackr_repo/PACKAGES.TXT' } with open(lib_path + repo_dir[repo], "r") as PACKAGES_TXT: for line in PACKAGES_TXT: if line.startswith("PACKAGE NAME: "): - pkg_name = split_package(line[15:])[0].strip() + if repo == 'slackr': + pkg_name = line[15:].strip() + else: + pkg_name = split_package(line[15:])[0].strip() if name == pkg_name and name not in blacklist: PACKAGES_TXT.close() return pkg_name diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py index 0478c7e7..0ec13789 100644 --- a/slpkg/pkg/manager.py +++ b/slpkg/pkg/manager.py @@ -293,6 +293,7 @@ class PackageManager(object): 'alien': 'alien', 'slacky': 'sl', 'studio': 'se', + 'slackr': 'cf', 'all': '' } search = pkg_list[pattern] diff --git a/slpkg/repositories.py b/slpkg/repositories.py index 1af91211..ed5859f1 100644 --- a/slpkg/repositories.py +++ b/slpkg/repositories.py @@ -74,3 +74,9 @@ class Repo(object): Studioware repository ''' return "http://studioware.org/files/packages/" + + def slackers(self): + ''' + Slackers.it repository + ''' + return "http://www.slackers.it/repository/" diff --git a/slpkg/splitting.py b/slpkg/splitting.py index 5f7a5619..034c8ab0 100644 --- a/slpkg/splitting.py +++ b/slpkg/splitting.py @@ -36,6 +36,7 @@ def split_package(package): alien = "alien" slacky = "sl" studio = "se" + slacks = "cf" build = split[-1] if build.endswith(sbo): build = split[-1][:-4] # and remove .t?z extension @@ -49,6 +50,8 @@ def split_package(package): build = split[-1][:-len(slacky)] elif build.endswith(studio): build = split[-1][:-len(studio)] + elif build.endswith(slacks): + build = split[-1][:-len(slacks)] arch = split[-2] ver = split[-3] name = "-".join(split[:-3])