From 0c38039afbfb2007efe5fdf97c7bcfde2718b42a Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 28 Nov 2014 12:30:36 +0200 Subject: [PATCH] added studioware repository --- CHANGELOG | 2 ++ README.rst | 15 +++++++++------ man/slpkg.8 | 2 +- slpkg/__metadata__.py | 3 ++- slpkg/arguments.py | 2 +- slpkg/desc.py | 6 ++++-- slpkg/init.py | 25 +++++++++++++++++++++++++ slpkg/main.py | 31 ++++++++++++++++++++----------- slpkg/others/check.py | 22 +++++++++++++++++----- slpkg/others/greps.py | 2 +- slpkg/others/install.py | 23 +++++++++++++++++------ slpkg/others/search.py | 3 ++- slpkg/pkg/manager.py | 1 + slpkg/repositories.py | 6 ++++++ slpkg/splitting.py | 3 +++ slpkg/tracking.py | 3 ++- 16 files changed, 113 insertions(+), 36 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index dbf2a4c6..d6366016 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,9 @@ Version 2.1.0-dev +28-11-2014 [Updated] - Fix change build path. - Fix creating directories if not exists. + - Added Studioware repository. Version 2.0.9 26-11-2014 diff --git a/README.rst b/README.rst index 247600f1..c1377e0a 100644 --- a/README.rst +++ b/README.rst @@ -31,21 +31,24 @@ Slpkg is `Open Source `_ software writ Python language. It's use is for managing packages in Slackware linux distribution. Supported Repositories: -- SBo - `slackbuilds.org `_ +- SBo - `Reposiory `_ Arch: {x86, x86_64} Versions: {11.0, 12.0, 12.1, 12.2, 13.0, 13.1, 13.37, 14.0, 14.1} -- Slack - `slackware.com `_ +- Slack - `Repository `_ Arch: {x86, x86_64} Versions: {3.3, 8.1, 9.0, 9.1, 10.0, 10.1, 10.2, 11.0, 12.0, 12.2, 13.0, 13.37, 14.0, 14.1, current} -- Alien - `alien bob `_ +- Alien - `Repository `_ Arch: {x86, x86_64} Versions: {11.0, 12.0, 12.1, 12.2, 13.0, 13.1, 13.37, 14.0, 14.1, current} -- Slacky - `slacky.eu `_ +- Slacky - `Repository `_ Arch: {x86, x86_64} Versions: {11.0, 12.0, 12.1, 12.2, 13.0, 13.1, 13.37, 14.0, 14.1} -- Robby's - `rworkman's `_ +- Robby's - `Repository `_ Arch: {x86, x86_64} Versions: {11.0, 12.0, 12.1, 12.2, 13.0, 13.1, 13.37, 14.0, 14.1} +- Studioware - `Repository `_ + Arch: {x86, x86_64} + Versions: {13.37, 14.0, 14.1} Slpkg works in accordance with the standards of the organization slackbuilds.org to builds packages. Also uses the Slackware linux instructions for installation, @@ -194,7 +197,7 @@ Command Line Tool Usage -r, [package...] remove binary packages -d, [package...] display the contents - Repositories: + Repositories: Colors = [red, green, yellow, cyan, grey] Slpkg Examples diff --git a/man/slpkg.8 b/man/slpkg.8 index ab097ac4..2eb4f28c 100644 --- a/man/slpkg.8 +++ b/man/slpkg.8 @@ -57,7 +57,7 @@ It's a quick and easy way to manage your packages in slackware to a command. -r, [package...] remove binary packages -d, [package...] display the contents - Repositories: + Repositories: Colors = [red, green, yellow, cyan, grey]\fP .SH GLOBAL OPTIONS diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index ecc13204..e8208b04 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -88,7 +88,8 @@ repositories = [ "slack", "rlw", "alien", - "slacky" + "slacky", + "studio" ] if use_colors == "on": diff --git a/slpkg/arguments.py b/slpkg/arguments.py index 9b9b881a..339ce7cd 100755 --- a/slpkg/arguments.py +++ b/slpkg/arguments.py @@ -56,7 +56,7 @@ def options(): " -o, [package...] reinstall binary packages", " -r, [package...] remove binary packages", " -d, [package...] display the contents\n", - "Repositories: ", + "Repositories: ", "Colors = [red, green, yellow, cyan, grey]\n", ] for opt in arguments: diff --git a/slpkg/desc.py b/slpkg/desc.py index ebad10d5..56c29a34 100755 --- a/slpkg/desc.py +++ b/slpkg/desc.py @@ -44,7 +44,8 @@ class PkgDesc(object): 'slack': Initialization().slack, 'rlw': Initialization().rlw, 'alien': Initialization().alien, - 'slacky': Initialization().slacky + 'slacky': Initialization().slacky, + 'studio': Initialization().studioware } init_repos[self.repo]() color_text = { @@ -62,7 +63,8 @@ class PkgDesc(object): 'slack': 'slack_repo/PACKAGES.TXT', 'rlw': 'rlw_repo/PACKAGES.TXT', 'alien': 'alien_repo/PACKAGES.TXT', - 'slacky': 'slacky_repo/PACKAGES.TXT' + 'slacky': 'slacky_repo/PACKAGES.TXT', + 'studio': 'studio_repo/PACKAGES.TXT' } self.lib = lib_path + repos[self.repo] diff --git a/slpkg/init.py b/slpkg/init.py index df0e1658..4cd5e92b 100755 --- a/slpkg/init.py +++ b/slpkg/init.py @@ -162,6 +162,31 @@ class Initialization(object): self.write(log, log_file, changelog_txt) self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt) + def studioware(self): + ''' + Creating alien local library + ''' + ar = "" + arch = os.uname()[4] + repo = Repo().studioware() + log = log_path + "studio/" + lib = lib_path + "studio_repo/" + lib_file = "PACKAGES.TXT" + log_file = "ChangeLog.txt" + if not os.path.exists(log): + os.mkdir(log) + if not os.path.exists(lib): + os.mkdir(lib) + if arch == "x86_64": + ar = "64" + packages_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(), + lib_file) + changelog_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, 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) + @staticmethod def write(path, files, file_url): ''' diff --git a/slpkg/main.py b/slpkg/main.py index 3dfc4766..0afced72 100755 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -72,6 +72,9 @@ class Case(object): def slacky_install(self): OthersInstall(self.package, "slacky", self.release).start() + def studioware_install(self): + OthersInstall(self.package, "studio", self.release).start() + def sbo_upgrade(self): SBoCheck().start() @@ -87,6 +90,9 @@ class Case(object): def slacky_upgrade(self): OthersUpgrade("slacky", self.release).start() + def studioware_upgrade(self): + OthersUpgrade("studio", self.release).start() + def main(): @@ -115,11 +121,12 @@ def main(): elif len(args) == 3 and args[0] == "-c" and args[2] == "--upgrade": pkg = Case("") upgrade = { - "sbo": pkg.sbo_upgrade, - "slack": pkg.slack_upgrade, - "rlw": pkg.rlw_upgrade, - "alien": pkg.alien_upgrade, - "slacky": pkg.slacky_upgrade + 'sbo': pkg.sbo_upgrade, + 'slack': pkg.slack_upgrade, + 'rlw': pkg.rlw_upgrade, + 'alien': pkg.alien_upgrade, + 'slacky': pkg.slacky_upgrade, + 'studio': pkg.studioware_upgrade } if args[1] in repositories: upgrade[args[1]]() @@ -129,17 +136,19 @@ def main(): pkg = Case(args[2]) if args[1] in repositories: install = { - "sbo": pkg.sbo_install, - "slack": pkg.slack_install, - "rlw": pkg.rlw_install, - "alien": pkg.alien_install, - "slacky": pkg.slacky_install + 'sbo': pkg.sbo_install, + 'slack': pkg.slack_install, + 'rlw': pkg.rlw_install, + 'alien': pkg.alien_install, + 'slacky': pkg.slacky_install, + 'studio': pkg.studioware_install } install[args[1]]() else: usage() elif len(args) == 3 and args[0] == "-t" and args[1] in ["sbo", "alien", - "rlw", "slacky"]: + "rlw", "slacky", + "studio"]: track_dep(args[2], args[1]) elif len(args) == 2 and args[0] == "-n": SBoNetwork(args[1]).view() diff --git a/slpkg/others/check.py b/slpkg/others/check.py index e43226eb..575c27b1 100644 --- a/slpkg/others/check.py +++ b/slpkg/others/check.py @@ -75,6 +75,15 @@ class OthersUpgrade(object): self.mirror = "{0}slackware{1}-{2}/".format(repos.slacky(), arch, slack_ver()) self.step = self.step * 2 + elif self.repo == "studio": + lib = lib_path + "studio_repo/PACKAGES.TXT" + arch = "" + if os.uname()[4] == "x86_64": + arch = "64" + self.mirror = "{0}slackware{1}-{2}/".format(repos.studioware(), + arch, slack_ver()) + self.step = self.step * 2 + f = open(lib, "r") self.PACKAGES_TXT = f.read() f.close() @@ -86,7 +95,8 @@ class OthersUpgrade(object): repository = { 'rlw': Initialization().rlw, 'alien': Initialization().alien, - 'slacky': Initialization().slacky + 'slacky': Initialization().slacky, + 'studio': Initialization().studioware } repository[self.repo]() @@ -155,8 +165,8 @@ class OthersUpgrade(object): data[3]): inst_pkg = split_package(pkg) repo_pkg = split_package(name[:-4]) - if repo_pkg[0] == inst_pkg[0] and name[:-4] > pkg \ - and inst_pkg[0] not in black: + if (repo_pkg[0] == inst_pkg[0] and + name[:-4] > pkg 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) @@ -172,7 +182,8 @@ class OthersUpgrade(object): repository = { 'rlw': '_rlw', 'alien': 'alien', - 'slacky': 'sl' + 'slacky': 'sl', + 'studio': 'se' } repo = repository[self.repo] for pkg in os.listdir(pkg_path): @@ -190,7 +201,8 @@ def views(upgrade_all, comp_sum, repository): align = { 'rlw': ' ' * 3, 'alien': ' ', - 'slacky': '' + 'slacky': '', + 'studio': '' } 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 299ffbeb..775944db 100644 --- a/slpkg/others/greps.py +++ b/slpkg/others/greps.py @@ -61,7 +61,7 @@ def repo_data(PACKAGES_TXT, step, repo, version): rsize, runsize ) = alien_filter(name, location, size, unsize, version) - elif repo == "slacky": + elif repo in ["slacky", "studio"]: rname, rlocation, rsize, runsize = name, location, size, unsize return [rname, rlocation, rsize, runsize] diff --git a/slpkg/others/install.py b/slpkg/others/install.py index 9a809b40..4774734b 100644 --- a/slpkg/others/install.py +++ b/slpkg/others/install.py @@ -84,6 +84,15 @@ class OthersInstall(object): self.mirror = "{0}slackware{1}-{2}/".format(repos.slacky(), arch, slack_ver()) self.step = self.step * 2 + elif self.repo == "studio": + lib = lib_path + "studio_repo/PACKAGES.TXT" + arch = "" + if os.uname()[4] == "x86_64": + arch = "64" + self.mirror = "{0}slackware{1}-{2}/".format(repos.studioware(), + arch, slack_ver()) + self.step = self.step * 2 + f = open(lib, "r") self.PACKAGES_TXT = f.read() f.close() @@ -98,9 +107,10 @@ class OthersInstall(object): if not os.path.isfile(lib_path + "slack_repo/PACKAGES.TXT"): Initialization().slack() repository = { - "rlw": Initialization().rlw, - "alien": Initialization().alien, - "slacky": Initialization().slacky + 'rlw': Initialization().rlw, + 'alien': Initialization().alien, + 'slacky': Initialization().slacky, + 'studio': Initialization().studioware } repository[self.repo]() @@ -218,9 +228,10 @@ def views(install_all, comp_sum, repository, dependencies): count = pkg_sum = uni_sum = upg_sum = 0 # fix repositories align align = { - "rlw": ' ' * 3, - "alien": ' ', - "slacky": '' + 'rlw': ' ' * 3, + 'alien': ' ', + 'slacky': '', + 'studio': '' } 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 758ddd8f..4849451c 100644 --- a/slpkg/others/search.py +++ b/slpkg/others/search.py @@ -38,7 +38,8 @@ def search_pkg(name, repo): repo_dir = { "rlw": "rlw_repo/PACKAGES.TXT", "alien": "alien_repo/PACKAGES.TXT", - "slacky": "slacky_repo/PACKAGES.TXT" + "slacky": "slacky_repo/PACKAGES.TXT", + "studio": "studio_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 8b4e96be..0d82011d 100644 --- a/slpkg/pkg/manager.py +++ b/slpkg/pkg/manager.py @@ -292,6 +292,7 @@ class PackageManager(object): 'rlw': '_rlw', 'alien': 'alien', 'slacky': 'sl', + 'studio': 'se', 'all': '' } search = pkg_list[pattern] diff --git a/slpkg/repositories.py b/slpkg/repositories.py index e50a7ebd..1af91211 100755 --- a/slpkg/repositories.py +++ b/slpkg/repositories.py @@ -68,3 +68,9 @@ class Repo(object): Slacky.eu repository ''' return "http://repository.slacky.eu/" + + def studioware(self): + ''' + Studioware repository + ''' + return "http://studioware.org/files/packages/" diff --git a/slpkg/splitting.py b/slpkg/splitting.py index c386302c..5f7a5619 100755 --- a/slpkg/splitting.py +++ b/slpkg/splitting.py @@ -35,6 +35,7 @@ def split_package(package): rlw = "_rlw" alien = "alien" slacky = "sl" + studio = "se" build = split[-1] if build.endswith(sbo): build = split[-1][:-4] # and remove .t?z extension @@ -46,6 +47,8 @@ def split_package(package): build = split[-1][:-len(alien)] elif build.endswith(slacky): build = split[-1][:-len(slacky)] + elif build.endswith(studio): + build = split[-1][:-len(studio)] arch = split[-2] ver = split[-3] name = "-".join(split[:-3]) diff --git a/slpkg/tracking.py b/slpkg/tracking.py index f34c7b5e..49a77a7c 100755 --- a/slpkg/tracking.py +++ b/slpkg/tracking.py @@ -52,7 +52,8 @@ def track_dep(name, repo): 'slack': Initialization().slack, 'rlw': Initialization().rlw, 'alien': Initialization().alien, - 'slacky': Initialization().slacky + 'slacky': Initialization().slacky, + 'studio': Initialization().studioware } init_repos[repo]() sys.stdout.write("{0}Reading package lists ...{1}".format(color['GREY'],