Added support msb repository

This commit is contained in:
Dimitris Zlatanidis 2015-06-12 23:27:20 +03:00
parent 848b2e057e
commit 66d7263c37
9 changed files with 66 additions and 30 deletions

View file

@ -132,7 +132,7 @@ class MetaData(object):
default_repositories = ["slack", "sbo", "rlw", "alien", "slacky", "studio", default_repositories = ["slack", "sbo", "rlw", "alien", "slacky", "studio",
"slackr", "slonly", "ktown", "multi", "slacke", "slackr", "slonly", "ktown", "multi", "slacke",
"salix", "slackl", "rested"] "salix", "slackl", "rested", "msb"]
# read value from configuration file # read value from configuration file
if os.path.isfile("%s%s" % (conf_path, "slpkg.conf")): if os.path.isfile("%s%s" % (conf_path, "slpkg.conf")):
@ -176,6 +176,7 @@ class MetaData(object):
# Grap sub repositories # Grap sub repositories
ktown_kde_repo = grab_sub_repo(repositories, "ktown") ktown_kde_repo = grab_sub_repo(repositories, "ktown")
slacke_sub_repo = grab_sub_repo(repositories, "slacke") slacke_sub_repo = grab_sub_repo(repositories, "slacke")
msb_sub_repo = grab_sub_repo(repositories, "msb")
# remove no default repositories # remove no default repositories
repositories = remove_repositories(repositories, default_repositories) repositories = remove_repositories(repositories, default_repositories)

View file

@ -128,18 +128,20 @@ def usage(repo):
[repo-info [repository]] [update [slpkg]] [repo-info [repository]] [update [slpkg]]
Optional arguments: Optional arguments:
[-h] [-v] [-a [script.tar.gz] [sources...]] [-h] [-v]
[-a [script] [sources...]]
[-b [package...] --add, --remove, list] [-b [package...] --add, --remove, list]
[-q [package...] --add, --remove, list] [-q [package...] --add, --remove, list]
[-q build, install, build-install] [-q [build, install, build-install]]
[-g print, edit=[editor]] [-g [print, edit=[editor]]]
[-l [repository], --index, --installed] [-l [repository], --index, --installed]
[-c [repository] --upgrade, --skip=[] --resolve-off] [-c [repository] --upgrade, --skip=[] --resolve-off]
[-s [repository] [package...], --resolve-off] [-s [repository] [package...], --resolve-off]
[-t [repository] [package]] [-t [repository] [package]]
[-p [repository] [package], --color=[]] [-p [repository] [package], --color=[]]
[-n [SBo package]] [-F [...]] [-f [...]] [-i [...]] [-n [SBo package]] [-F [...]] [-f [...]]
[-u [...]] [-r [...]] [-d [...]] [-i [options] [...]] [-u [options] [...]]
[-r [options] [...], --check-deps] [-d [...]]
""" """
error_repo = "" error_repo = ""
if repo and repo not in _meta_.repositories: if repo and repo not in _meta_.repositories:

View file

@ -36,6 +36,7 @@ from slpkg.log_deps import write_deps
from slpkg.grep_md5 import pkg_checksum from slpkg.grep_md5 import pkg_checksum
from slpkg.splitting import split_package from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
from slpkg.get_version import get_installed_version
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
@ -233,7 +234,7 @@ class BinaryInstall(object):
else: else:
COLOR = self.meta.color["RED"] COLOR = self.meta.color["RED"]
uni_sum += 1 uni_sum += 1
ver = self.get_installed_version(pkg_split[0]) ver = get_installed_version(pkg_split[0])
print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>11}{12}".format( print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>11}{12}".format(
COLOR, pkg_split[0] + ver, self.meta.color["ENDC"], COLOR, pkg_split[0] + ver, self.meta.color["ENDC"],
" " * (24-len(pkg_split[0] + ver)), pkg_split[1], " " * (24-len(pkg_split[0] + ver)), pkg_split[1],
@ -243,19 +244,11 @@ class BinaryInstall(object):
comp, " K")).rstrip() comp, " K")).rstrip()
return [pkg_sum, upg_sum, uni_sum] return [pkg_sum, upg_sum, uni_sum]
def get_installed_version(self, package):
"""Get installed package version
"""
find = find_package(package + self.meta.sp, self.meta.pkg_path)
if find:
return self.meta.sp + split_package(find[0])[1]
return ""
def top_view(self): def top_view(self):
Msg().template(78) Msg().template(78)
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format( print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
"| Package", " " * 17, "| Package", " " * 17,
"Version", " " * 12, "New Version", " " * 8,
"Arch", " " * 4, "Arch", " " * 4,
"Build", " " * 2, "Build", " " * 2,
"Repos", " " * 10, "Repos", " " * 10,

View file

@ -116,3 +116,10 @@ class RepoInit(object):
def _init_rested(self): def _init_rested(self):
self.mirror = Repo().restricted() self.mirror = Repo().restricted()
def _init_msb(self):
arch = "x86"
if os.uname()[4] == "x86_64":
arch = "x86_64"
self.mirror = "{0}{1}/{2}/{3}/".format(
Repo().msb(), slack_ver(), self.meta.msb_sub_repo[1:-1], arch)

View file

@ -478,6 +478,37 @@ class Initialization(object):
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt, self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
md5_file, checksums_md5, lst_file, filelist_txt) md5_file, checksums_md5, lst_file, filelist_txt)
def msb(self):
"""
Creating mate restricted local library
"""
ar = "x86"
arch = os.uname()[4]
repo = Repo().msb()
log = self.log_path + "msb/"
lib = self.lib_path + "msb_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)
if arch == "x86_64":
ar = "x86_64"
packages_txt = "{0}{1}/{2}/{3}/{4}".format(
repo, slack_ver(), self.meta.msb_sub_repo[1:-1], ar, lib_file)
filelist_txt = ""
checksums_md5 = "{0}{1}/{2}/{3}/{4}".format(
repo, slack_ver(), self.meta.msb_sub_repo[1:-1], ar, 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)
def write_file(self, path, archive, contents_txt): def write_file(self, path, archive, contents_txt):
""" """
Create local file Create local file

View file

@ -50,7 +50,8 @@ class RepoList(object):
"slacke": Repo().slacke(), "slacke": Repo().slacke(),
"salix": Repo().salix(), "salix": Repo().salix(),
"slackl": Repo().slackel(), "slackl": Repo().slackel(),
"rested": Repo().restricted() "rested": Repo().restricted(),
"msb": Repo().msb()
} }
self.all_repos.update(Repo().custom_repository()) self.all_repos.update(Repo().custom_repository())

View file

@ -189,3 +189,9 @@ class Repo(object):
""" """
return ("http://taper.alienbase.nl/mirrors/people/alien/" return ("http://taper.alienbase.nl/mirrors/people/alien/"
"restricted_slackbuilds/") "restricted_slackbuilds/")
def msb(self):
"""
MSB mate repository
"""
return ("http://slackware.org.uk/msb/")

View file

@ -33,6 +33,7 @@ from slpkg.log_deps import write_deps
from slpkg.downloader import Download from slpkg.downloader import Download
from slpkg.splitting import split_package from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
from slpkg.get_version import get_installed_version
from slpkg.pkg.find import find_package from slpkg.pkg.find import find_package
from slpkg.pkg.build import BuildPackage from slpkg.pkg.build import BuildPackage
@ -213,7 +214,7 @@ class SBoInstall(object):
Msg().template(78) Msg().template(78)
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format( print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
"| Package", " " * 17, "| Package", " " * 17,
"Version", " " * 12, "New version", " " * 8,
"Arch", " " * 4, "Arch", " " * 4,
"Build", " " * 2, "Build", " " * 2,
"Repos", " " * 10, "Repos", " " * 10,
@ -228,7 +229,7 @@ class SBoInstall(object):
args[2] version args[2] version
args[3] arch args[3] arch
""" """
ver = self.get_installed_version(args[1]) ver = get_installed_version(args[1])
print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>11}{12}".format( print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>11}{12}".format(
args[0], args[1] + ver, self.meta.color["ENDC"], args[0], args[1] + ver, self.meta.color["ENDC"],
" " * (24-len(args[1] + ver)), args[2], " " * (24-len(args[1] + ver)), args[2],
@ -236,14 +237,6 @@ class SBoInstall(object):
" " * (15-len(args[3])), "", " " * (15-len(args[3])), "",
"", "SBo", "", "")).rstrip() "", "SBo", "", "")).rstrip()
def get_installed_version(self, package):
"""Get installed package version
"""
find = find_package(package + self.meta.sp, self.meta.pkg_path)
if find:
return self.meta.sp + split_package(find[0])[1]
return ""
def tag(self, sbo, count_ins, count_upg, count_uni): def tag(self, sbo, count_ins, count_upg, count_uni):
""" """
Tag with color green if package already installed, Tag with color green if package already installed,

View file

@ -38,6 +38,7 @@ from slpkg.downloader import Download
from slpkg.grep_md5 import pkg_checksum from slpkg.grep_md5 import pkg_checksum
from slpkg.splitting import split_package from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
from slpkg.get_version import get_installed_version
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
@ -86,7 +87,7 @@ class Patches(object):
Msg().template(78) Msg().template(78)
print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format( print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
"| Package", " " * 17, "| Package", " " * 17,
"Version", " " * 12, "New Version", " " * 8,
"Arch", " " * 4, "Arch", " " * 4,
"Build", " " * 2, "Build", " " * 2,
"Repos", " " * 10, "Repos", " " * 10,
@ -158,9 +159,10 @@ class Patches(object):
color = self.meta.color["YELLOW"] color = self.meta.color["YELLOW"]
if not find_package(pkg_split[0], self.meta.pkg_path): if not find_package(pkg_split[0], self.meta.pkg_path):
color = self.meta.color["RED"] color = self.meta.color["RED"]
ver = get_installed_version(pkg_split[0])
print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>12}{12}".format( print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>12}{12}".format(
color, pkg_split[0], self.meta.color["ENDC"], color, pkg_split[0] + ver, self.meta.color["ENDC"],
" " * (24-len(pkg_split[0])), pkg_split[1], " " * (24-len(pkg_split[0] + ver)), pkg_split[1],
" " * (18-len(pkg_split[1])), pkg_split[2], " " * (18-len(pkg_split[1])), pkg_split[2],
" " * (8-len(pkg_split[2])), pkg_split[3], " " * (8-len(pkg_split[2])), pkg_split[3],
" " * (7-len(pkg_split[3])), "Slack", " " * (7-len(pkg_split[3])), "Slack",