update slack repo and list

This commit is contained in:
Dimitris Zlatanidis 2015-01-23 05:49:39 +02:00
parent 590f15e8bb
commit 2a8d9dd0db
14 changed files with 61 additions and 65 deletions

View file

@ -28,7 +28,7 @@ Usage: slpkg Commands:
[-g --config, --config=[editor]] [-g --config, --config=[editor]]
[-l all, official, non-official, --index] [-l all, official, non-official, --index]
[-c [repository] --upgrade] [-c [repository] --upgrade]
[-s [repository] [package] [-s [repository] [package...]
[-t [repository] [package] [-t [repository] [package]
[-p [repository] [package], --color=[]] [-p [repository] [package], --color=[]]
[-n] [-f [...]] [-i [...]] [-u [...]] [-n] [-f [...]] [-i [...]] [-u [...]]
@ -60,7 +60,7 @@ Optional arguments:
-g, --config, --config=<editor> configuration file management -g, --config, --config=<editor> configuration file management
-l, all, official, non-official, --index list of installed packages -l, all, official, non-official, --index list of installed packages
-c, [repository] --upgrade check for updated packages -c, [repository] --upgrade check for updated packages
-s, [repository] [package] download, build & install -s, [repository] [package...] download, build & install
-t, [repository] [package] tracking dependencies -t, [repository] [package] tracking dependencies
-p, [repository] [package], --color=[] print package description -p, [repository] [package], --color=[] print package description
-n, [package] view SBo packages through network -n, [package] view SBo packages through network

View file

@ -57,11 +57,11 @@ def options():
"from queue", "from queue",
" -g, --config, --config=[editor] configuration file " " -g, --config, --config=[editor] configuration file "
"management", "management",
" -l, all, official, non-official, --index list of installed " " -l, [repository], --index list of repositories "
"packages", "packages",
" -c, [repository] --upgrade check for updated " " -c, [repository] --upgrade check for updated "
"packages", "packages",
" -s, [repository] [package] download, build & install", " -s, [repository] [package...] download, build & install",
" -t, [repository] [package] tracking dependencies", " -t, [repository] [package] tracking dependencies",
" -p, [repository] [package], --color=[] print package description", " -p, [repository] [package], --color=[] print package description",
" -n, [package] view SBo packages " " -n, [package] view SBo packages "
@ -101,9 +101,9 @@ def usage(repo):
" [-q --list, [...] --add, --remove]", " [-q --list, [...] --add, --remove]",
" [-q --build, --install, --build-install]", " [-q --build, --install, --build-install]",
" [-g --config, --config=[editor]]", " [-g --config, --config=[editor]]",
" [-l all, official, non-official, --index]", " [-l [repository], --index]",
" [-c [repository] --upgrade]", " [-c [repository] --upgrade]",
" [-s [repository] [package]", " [-s [repository] [package...]",
" [-t [repository] [package]", " [-t [repository] [package]",
" [-p [repository] [package], --color=[]]", " [-p [repository] [package], --color=[]]",
" [-n] [-f [...]] [-i [...]] [-u [...]]", " [-n] [-f [...]] [-i [...]] [-u [...]]",

View file

@ -41,9 +41,9 @@ class Dependencies(object):
# toolbar_width = status(index, toolbar_width, step) # toolbar_width = status(index, toolbar_width, step)
if line.startswith("PACKAGE NAME:"): if line.startswith("PACKAGE NAME:"):
if repo == "slackr": if repo == "slackr":
self.packages.append(line[15:].strip()) self.packages.append(line[14:].strip())
else: else:
self.packages.append(split_package(line[15:].strip())[0]) self.packages.append(split_package(line[14:].strip())[0])
def others(self, name): def others(self, name):
''' '''
@ -59,7 +59,7 @@ class Dependencies(object):
for req in requires: for req in requires:
index += 1 index += 1
toolbar_width = status(index, toolbar_width, 7) toolbar_width = status(index, toolbar_width, 7)
if req and req in self.packages and req not in blacklist: if (req and req in self.packages and req not in blacklist):
dependencies.append(req) dependencies.append(req)
if dependencies: if dependencies:
self.dep_results.append(dependencies) self.dep_results.append(dependencies)

View file

@ -55,7 +55,7 @@ from repo_init import RepoInit
from dependency import Dependencies from dependency import Dependencies
class OthersInstall(object): class BinaryInstall(object):
def __init__(self, packages, repo, version): def __init__(self, packages, repo, version):
self.packages = packages self.packages = packages

View file

@ -30,6 +30,7 @@ from slpkg.__metadata__ import (
default_repositories default_repositories
) )
from slpkg.slack.mirrors import mirrors
from slpkg.slack.slack_version import slack_ver from slpkg.slack.slack_version import slack_ver
@ -57,6 +58,10 @@ class RepoInit(object):
self.lib = lib_path + "{0}_repo/PACKAGES.TXT".format(self.repo) self.lib = lib_path + "{0}_repo/PACKAGES.TXT".format(self.repo)
self.mirror = "{0}".format(Repo().custom_repository()[self.repo]) self.mirror = "{0}".format(Repo().custom_repository()[self.repo])
def _init_slack(self):
self.lib = lib_path + "slack_repo/PACKAGES.TXT"
self.mirror = mirrors('', '')
def _init_rlw(self): def _init_rlw(self):
self.lib = lib_path + "rlw_repo/PACKAGES.TXT" self.lib = lib_path + "rlw_repo/PACKAGES.TXT"
self.mirror = "{0}{1}/".format(Repo().rlw(), slack_ver()) self.mirror = "{0}{1}/".format(Repo().rlw(), slack_ver())

View file

@ -111,12 +111,9 @@ class Initialization(object):
ext_checksums = mirrors(md5_file, "extra/") ext_checksums = mirrors(md5_file, "extra/")
pasture = mirrors(lib_file, "pasture/") pasture = mirrors(lib_file, "pasture/")
pas_checksums = mirrors(md5_file, "pasture/") pas_checksums = mirrors(md5_file, "pasture/")
patches_txt = mirrors(lib_file, "patches/") packages_txt = ("{0} {1} {2}".format(packages, extra, pasture))
patches_md5 = mirrors(md5_file, "patches/") checksums_md5 = ("{0} {1} {2}".format(pkg_checksums, ext_checksums,
packages_txt = ("{0} {1} {2} {3}".format(packages, extra, pasture, pas_checksums))
patches_txt))
checksums_md5 = ("{0} {1} {2} {3}".format(pkg_checksums, ext_checksums,
pas_checksums, patches_md5))
changelog_txt = mirrors(log_file, "") changelog_txt = mirrors(log_file, "")
self.write(lib, lib_file, packages_txt) self.write(lib, lib_file, packages_txt)
self.write(lib, md5_file, checksums_md5) self.write(lib, md5_file, checksums_md5)

View file

@ -54,10 +54,9 @@ from sbo.check import sbo_upgrade
from sbo.views import SBoNetwork from sbo.views import SBoNetwork
from sbo.slackbuild import SBoInstall from sbo.slackbuild import SBoInstall
from slack.install import Slack
from slack.patches import Patches from slack.patches import Patches
from others.check import pkg_upgrade from binary.check import pkg_upgrade
from others.install import OthersInstall from binary.install import BinaryInstall
class Case(object): class Case(object):
@ -69,11 +68,8 @@ class Case(object):
def sbo_install(self): def sbo_install(self):
SBoInstall(self.package).start() SBoInstall(self.package).start()
def slack_install(self): def binary_install(self, repo):
Slack(self.package).start() BinaryInstall(self.package, repo, self.release).start()
def others_install(self, repo):
OthersInstall(self.package, repo, self.release).start()
def sbo_upgrade(self): def sbo_upgrade(self):
SBoInstall(sbo_upgrade()).start() SBoInstall(sbo_upgrade()).start()
@ -81,8 +77,8 @@ class Case(object):
def slack_upgrade(self): def slack_upgrade(self):
Patches(self.release).start() Patches(self.release).start()
def others_upgrade(self, repo): def binary_upgrade(self, repo):
OthersInstall(pkg_upgrade(repo), repo, self.release).start() BinaryInstall(pkg_upgrade(repo), repo, self.release).start()
def main(): def main():
@ -148,16 +144,11 @@ def main():
if len(args) == 3 and args[0] == '-a': if len(args) == 3 and args[0] == '-a':
BuildPackage(args[1], args[2:], path).build() BuildPackage(args[1], args[2:], path).build()
elif len(args) == 2 and args[0] == '-l': elif (len(args) == 3 and args[0] == '-l' and args[2] == '--index' and
if args[1] in ['all', 'official', 'non-official']: args[1] in repositories):
PackageManager(None).list(args[1], False)
else:
usage('')
elif len(args) == 3 and args[0] == '-l' and args[2] == '--index':
if args[1] in ['all', 'official', 'non-official']:
PackageManager(None).list(args[1], True) PackageManager(None).list(args[1], True)
else: elif len(args) == 2 and args[0] == '-l' and args[1] in repositories:
usage('') PackageManager(None).list(args[1], False)
elif len(args) == 3 and args[0] == '-c' and args[2] == '--upgrade': elif len(args) == 3 and args[0] == '-c' and args[2] == '--upgrade':
if args[1] in repositories and args[1] not in ['slack', 'sbo']: if args[1] in repositories and args[1] not in ['slack', 'sbo']:
Case('').others_upgrade(args[1]) Case('').others_upgrade(args[1])
@ -170,14 +161,10 @@ def main():
else: else:
usage(args[1]) usage(args[1])
elif len(args) >= 3 and args[0] == '-s': elif len(args) >= 3 and args[0] == '-s':
if args[1] in repositories and args[1] not in ['slack', 'sbo']: if args[1] in repositories and args[1] not in ['sbo']:
Case(args[2:]).others_install(args[1]) Case(args[2:]).binary_install(args[1])
elif args[1] in ['slack', 'sbo']: elif args[1] == 'sbo':
install = { Case(args[2:]).sbo_install()
'sbo': Case(args[2:]).sbo_install,
'slack': Case(args[2]).slack_install
}
install[args[1]]()
else: else:
usage(args[1]) usage(args[1])
elif (len(args) == 3 and args[0] == '-t' and args[1] in repositories): elif (len(args) == 3 and args[0] == '-t' and args[1] in repositories):

View file

@ -279,29 +279,35 @@ class PackageManager(object):
bol = eol = "\n" bol = eol = "\n"
pkg_not_found(bol, pkg, message, eol) pkg_not_found(bol, pkg, message, eol)
def list(self, pattern, INDEX): def list(self, repo, INDEX):
''' '''
List with the installed packages List with the installed packages
''' '''
tty_size = os.popen('stty size', 'r').read().split() tty_size = os.popen('stty size', 'r').read().split()
row = int(tty_size[0]) - 2 row = int(tty_size[0]) - 2
pkg_list = []
try: try:
index, page, official, r = 0, row, [], '' index, page, pkg_list = 0, row, []
if os.path.isfile(lib_path + 'slack_repo/PACKAGES.TXT'): if repo == 'sbo':
f = open(lib_path + 'slack_repo/PACKAGES.TXT', 'r') if os.path.isfile(lib_path + '{0}_repo/SLACKBUILDS.TXT'.format(
repo)):
f = open(lib_path + '{0}_repo/SLACKBUILDS.TXT'.format(repo),
'r')
r = f.read()
f.close()
else:
if os.path.isfile(lib_path + '{0}_repo/PACKAGES.TXT'.format(
repo)):
f = open(lib_path + '{0}_repo/PACKAGES.TXT'.format(repo),
'r')
r = f.read() r = f.read()
f.close() f.close()
for line in r.splitlines(): for line in r.splitlines():
if repo == 'sbo':
if line.startswith("SLACKBUILD NAME: "):
pkg_list.append(line[17:].strip())
else:
if line.startswith("PACKAGE NAME: "): if line.startswith("PACKAGE NAME: "):
official.append(line[15:-4].strip()) pkg_list.append(line[15:].strip())
for pkg in find_package("", pkg_path):
if pattern == 'all':
pkg_list.append(pkg)
elif pattern == 'official' and pkg in official:
pkg_list.append(pkg)
elif pattern == 'non-official' and pkg not in official:
pkg_list.append(pkg)
for pkg in sorted(pkg_list): for pkg in sorted(pkg_list):
if INDEX: if INDEX:
index += 1 index += 1

View file

@ -44,8 +44,9 @@ from slpkg.__metadata__ import (
from slpkg.pkg.find import find_package from slpkg.pkg.find import find_package
from slpkg.pkg.manager import PackageManager from slpkg.pkg.manager import PackageManager
from slpkg.binary.greps import repo_data
from mirrors import mirrors from mirrors import mirrors
from greps import slack_data
from slack_version import slack_ver from slack_version import slack_ver
@ -122,7 +123,7 @@ class Patches(object):
''' '''
(pkg_for_upgrade, dwn, upgrade, comp_sum, (pkg_for_upgrade, dwn, upgrade, comp_sum,
uncomp_sum) = ([] for i in range(5)) uncomp_sum) = ([] for i in range(5))
data = slack_data(self.PACKAGES_TXT, self.step) data = repo_data(self.PACKAGES_TXT, self.step, 'slack', slack_ver)
black = BlackList().packages() black = BlackList().packages()
for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]): for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]):
inst_pkg = find_package(split_package(name)[0] + "-", pkg_path) inst_pkg = find_package(split_package(name)[0] + "-", pkg_path)

View file

@ -37,8 +37,8 @@ from pkg.find import find_package
from sbo.search import sbo_search_pkg from sbo.search import sbo_search_pkg
from sbo.dependency import Requires from sbo.dependency import Requires
from others.search import search_pkg from binary.search import search_pkg
from others.dependency import Dependencies from binary.dependency import Dependencies
def track_dep(name, repo): def track_dep(name, repo):
@ -55,7 +55,7 @@ def track_dep(name, repo):
dependencies_list = Requires().sbo(name) dependencies_list = Requires().sbo(name)
find_pkg = sbo_search_pkg(name) find_pkg = sbo_search_pkg(name)
else: else:
dependencies_list = Dependencies().others(name, repo) dependencies_list = Dependencies().binary(name, repo)
find_pkg = search_pkg(name, repo) find_pkg = search_pkg(name, repo)
sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC'])) sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
if find_pkg: if find_pkg: