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]]
[-l all, official, non-official, --index]
[-c [repository] --upgrade]
[-s [repository] [package]
[-s [repository] [package...]
[-t [repository] [package]
[-p [repository] [package], --color=[]]
[-n] [-f [...]] [-i [...]] [-u [...]]
@ -60,7 +60,7 @@ Optional arguments:
-g, --config, --config=<editor> configuration file management
-l, all, official, non-official, --index list of installed 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
-p, [repository] [package], --color=[] print package description
-n, [package] view SBo packages through network

View file

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

View file

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

View file

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

View file

@ -30,6 +30,7 @@ from slpkg.__metadata__ import (
default_repositories
)
from slpkg.slack.mirrors import mirrors
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.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):
self.lib = lib_path + "rlw_repo/PACKAGES.TXT"
self.mirror = "{0}{1}/".format(Repo().rlw(), slack_ver())

View file

@ -111,12 +111,9 @@ class Initialization(object):
ext_checksums = mirrors(md5_file, "extra/")
pasture = mirrors(lib_file, "pasture/")
pas_checksums = mirrors(md5_file, "pasture/")
patches_txt = mirrors(lib_file, "patches/")
patches_md5 = mirrors(md5_file, "patches/")
packages_txt = ("{0} {1} {2} {3}".format(packages, extra, pasture,
patches_txt))
checksums_md5 = ("{0} {1} {2} {3}".format(pkg_checksums, ext_checksums,
pas_checksums, patches_md5))
packages_txt = ("{0} {1} {2}".format(packages, extra, pasture))
checksums_md5 = ("{0} {1} {2}".format(pkg_checksums, ext_checksums,
pas_checksums))
changelog_txt = mirrors(log_file, "")
self.write(lib, lib_file, packages_txt)
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.slackbuild import SBoInstall
from slack.install import Slack
from slack.patches import Patches
from others.check import pkg_upgrade
from others.install import OthersInstall
from binary.check import pkg_upgrade
from binary.install import BinaryInstall
class Case(object):
@ -69,11 +68,8 @@ class Case(object):
def sbo_install(self):
SBoInstall(self.package).start()
def slack_install(self):
Slack(self.package).start()
def others_install(self, repo):
OthersInstall(self.package, repo, self.release).start()
def binary_install(self, repo):
BinaryInstall(self.package, repo, self.release).start()
def sbo_upgrade(self):
SBoInstall(sbo_upgrade()).start()
@ -81,8 +77,8 @@ class Case(object):
def slack_upgrade(self):
Patches(self.release).start()
def others_upgrade(self, repo):
OthersInstall(pkg_upgrade(repo), repo, self.release).start()
def binary_upgrade(self, repo):
BinaryInstall(pkg_upgrade(repo), repo, self.release).start()
def main():
@ -148,16 +144,11 @@ def main():
if len(args) == 3 and args[0] == '-a':
BuildPackage(args[1], args[2:], path).build()
elif len(args) == 2 and args[0] == '-l':
if args[1] in ['all', 'official', 'non-official']:
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']:
elif (len(args) == 3 and args[0] == '-l' and args[2] == '--index' and
args[1] in repositories):
PackageManager(None).list(args[1], True)
else:
usage('')
elif len(args) == 2 and args[0] == '-l' and args[1] in repositories:
PackageManager(None).list(args[1], False)
elif len(args) == 3 and args[0] == '-c' and args[2] == '--upgrade':
if args[1] in repositories and args[1] not in ['slack', 'sbo']:
Case('').others_upgrade(args[1])
@ -170,14 +161,10 @@ def main():
else:
usage(args[1])
elif len(args) >= 3 and args[0] == '-s':
if args[1] in repositories and args[1] not in ['slack', 'sbo']:
Case(args[2:]).others_install(args[1])
elif args[1] in ['slack', 'sbo']:
install = {
'sbo': Case(args[2:]).sbo_install,
'slack': Case(args[2]).slack_install
}
install[args[1]]()
if args[1] in repositories and args[1] not in ['sbo']:
Case(args[2:]).binary_install(args[1])
elif args[1] == 'sbo':
Case(args[2:]).sbo_install()
else:
usage(args[1])
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"
pkg_not_found(bol, pkg, message, eol)
def list(self, pattern, INDEX):
def list(self, repo, INDEX):
'''
List with the installed packages
'''
tty_size = os.popen('stty size', 'r').read().split()
row = int(tty_size[0]) - 2
pkg_list = []
try:
index, page, official, r = 0, row, [], ''
if os.path.isfile(lib_path + 'slack_repo/PACKAGES.TXT'):
f = open(lib_path + 'slack_repo/PACKAGES.TXT', 'r')
index, page, pkg_list = 0, row, []
if repo == 'sbo':
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()
f.close()
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: "):
official.append(line[15:-4].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)
pkg_list.append(line[15:].strip())
for pkg in sorted(pkg_list):
if INDEX:
index += 1

View file

@ -44,8 +44,9 @@ from slpkg.__metadata__ import (
from slpkg.pkg.find import find_package
from slpkg.pkg.manager import PackageManager
from slpkg.binary.greps import repo_data
from mirrors import mirrors
from greps import slack_data
from slack_version import slack_ver
@ -122,7 +123,7 @@ class Patches(object):
'''
(pkg_for_upgrade, dwn, upgrade, comp_sum,
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()
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)

View file

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