update support multipages

This commit is contained in:
Dimitris Zlatanidis 2015-01-16 22:55:28 +02:00
parent f797bbc9a3
commit dae0bba736
7 changed files with 50 additions and 28 deletions

View file

@ -1,3 +1,11 @@
Version 2.2.1
16-1-2015
[Feature] - Added support multipackages.
[Updated] - Fix [key error] when you enter wrong repository as default.
Version 2.2.0
08-1-2015

View file

@ -229,7 +229,7 @@ Command Line Tool Usage
.. code-block:: bash
Utility for easy management packages in Slackware
Slpkg is a user-friendly package manager for Slackware installations
Commands:
update update all package lists

View file

@ -157,8 +157,10 @@ all repositories.
.TP
\fBslpkg\fP \fB-q\fP \fB--build\fP \fB--install\fP \fB--build-install\fP
.PP
List, add, or remove sbo packages from queue. If you want to remove all the packages
from the list 'slpkg -q all --remove'. (these arguments only working for the sbo repository)
List, add, or remove sbo packages from queue. This argument is very useful if you want
to build and install multiple packages together. What to watch out for is the correct
order if there are dependencies. If you want to remove all the packages from the list
run '# slpkg -q all --remove'. (these arguments only working for the sbo repository)
Build or install or build and install packages are queued.
.SS -g , configuration file management

View file

@ -59,6 +59,17 @@ default_repositories = repositories[10] = 'slacke'
default_repositories = repositories
def remove_repositories(repositories):
'''
Remove no default repositories
'''
repos = []
for repo in repositories:
if repo in default_repositories:
repos.append(repo)
return repos
def update_repositories(repositories):
'''
Upadate with user custom repositories
@ -156,6 +167,9 @@ if os.path.isfile("/etc/slpkg/slpkg.conf"):
ktown_kde_repo = ktown_repo(repositories)
slacke_sub_repo = slacke_repo(repositories)
# remove no default repositories
repositories = remove_repositories(repositories)
# add custom repositories
update_repositories(repositories)
color = {

View file

@ -24,6 +24,7 @@
import sys
from slpkg.toolbar import status
from slpkg.blacklist import BlackList
from greps import Requires
@ -40,13 +41,14 @@ class Dependencies(object):
try:
sys.setrecursionlimit(10000)
dependencies = []
blacklist = BlackList().packages()
requires = Requires(name, repo).get_deps()
toolbar_width, index = 2, 0
if requires:
for req in requires:
index += 1
toolbar_width = status(index, toolbar_width, 1)
if req:
if req and req not in blacklist:
dependencies.append(req)
if dependencies:
self.dep_results.append(dependencies)

View file

@ -37,20 +37,20 @@ def repo_data(PACKAGES_TXT, step, repo, version):
'''
(name, location, size, unsize,
rname, rlocation, rsize, runsize) = ([] for i in range(8))
index, toolbar_width = 0, 700
index, toolbar_width = 0, 100
for line in PACKAGES_TXT.splitlines():
index += 1
toolbar_width = status(index, toolbar_width, step)
if line.startswith("PACKAGE NAME"):
if line.startswith("PACKAGE NAME:"):
if repo == "slackr":
name.append(fix_slackers_pkg(line[15:]))
else:
name.append(line[15:].strip())
if line.startswith("PACKAGE LOCATION"):
if line.startswith("PACKAGE LOCATION:"):
location.append(line[21:].strip())
if line.startswith("PACKAGE SIZE (compressed): "):
if line.startswith("PACKAGE SIZE (compressed):"):
size.append(line[28:-2].strip())
if line.startswith("PACKAGE SIZE (uncompressed): "):
if line.startswith("PACKAGE SIZE (uncompressed):"):
unsize.append(line[30:-2].strip())
if repo == "rlw":
(rname,
@ -206,11 +206,11 @@ class Requires(object):
PACKAGES_TXT = f.read()
f.close()
for line in PACKAGES_TXT.splitlines():
if line.startswith("PACKAGE NAME: "):
pkg_name = line[14:].strip().split('-')[0]
if line.startswith("PACKAGE REQUIRED: "):
if line.startswith("PACKAGE NAME:"):
pkg_name = line[13:].strip().split('-')[0]
if line.startswith("PACKAGE REQUIRED:"):
if pkg_name == self.name:
if line[17:].strip():
if line[16:].strip():
return self._req_fix(line)
def _req_fix(self, line):

View file

@ -72,7 +72,7 @@ class OthersInstall(object):
sys.stdout.write("{0}Reading package lists ...{1}".format(
color['GREY'], color['ENDC']))
sys.stdout.flush()
self.step = 700
self.step = 800 * len(packages)
if repo in default_repositories:
exec('self._init_{0}()'.format(self.repo))
@ -82,6 +82,8 @@ class OthersInstall(object):
f = open(self.lib, "r")
self.PACKAGES_TXT = f.read()
f.close()
num_lines = sum(1 for line in self.PACKAGES_TXT)
self.step = num_lines / 1000
def _init_custom(self):
self.lib = lib_path + "{0}_repo/PACKAGES.TXT".format(self.repo)
@ -94,7 +96,6 @@ class OthersInstall(object):
def _init_alien(self):
self.lib = lib_path + "alien_repo/PACKAGES.TXT"
self.mirror = Repo().alien()
self.step = self.step * 2
def _init_slacky(self):
self.lib = lib_path + "slacky_repo/PACKAGES.TXT"
@ -103,7 +104,6 @@ class OthersInstall(object):
arch = "64"
self.mirror = "{0}slackware{1}-{2}/".format(Repo().slacky(), arch,
slack_ver())
self.step = self.step * 2
def _init_studio(self):
self.lib = lib_path + "studio_repo/PACKAGES.TXT"
@ -112,12 +112,10 @@ class OthersInstall(object):
arch = "64"
self.mirror = "{0}slackware{1}-{2}/".format(Repo().studioware(),
arch, slack_ver())
self.step = self.step * 2
def _init_slackr(self):
self.lib = lib_path + "slackr_repo/PACKAGES.TXT"
self.mirror = Repo().slackers()
self.step = self.step * 2
def _init_slonly(self):
self.lib = lib_path + "slonly_repo/PACKAGES.TXT"
@ -125,17 +123,14 @@ class OthersInstall(object):
if os.uname()[4] == "x86_64":
arch = "{0}-x86_64".format(slack_ver())
self.mirror = "{0}{1}/".format(Repo().slackonly(), arch)
self.step = self.step * 3
def _init_ktown(self):
self.lib = lib_path + "ktown_repo/PACKAGES.TXT"
self.mirror = Repo().ktown()
self.step = self.step * 2
def _init_multi(self):
self.lib = lib_path + "multi_repo/PACKAGES.TXT"
self.mirror = Repo().multi()
self.step = self.step * 2
def _init_slacke(self):
arch = ""
@ -146,7 +141,6 @@ class OthersInstall(object):
self.lib = lib_path + "slacke_repo/PACKAGES.TXT"
self.mirror = "{0}slacke{1}/slackware{2}-{3}/".format(
Repo().slacke(), slacke_sub_repo[1:-1], arch, slack_ver())
self.step = self.step * 2
def _init_salix(self):
arch = "i486"
@ -154,7 +148,6 @@ class OthersInstall(object):
arch = "x86_64"
self.lib = lib_path + "salix_repo/PACKAGES.TXT"
self.mirror = "{0}{1}/{2}/".format(Repo().salix(), arch, slack_ver())
self.step = self.step * 2
def _init_slackl(self):
arch = "i486"
@ -162,17 +155,16 @@ class OthersInstall(object):
arch = "x86_64"
self.lib = lib_path + "slackl_repo/PACKAGES.TXT"
self.mirror = "{0}{1}/current/".format(Repo().slackel(), arch)
self.step = self.step * 2
def _init_rested(self):
self.lib = lib_path + "rested_repo/PACKAGES.TXT"
self.mirror = Repo().restricted()
self.step = self.step * 2
def start(self):
'''
Install packages from official Slackware distribution
'''
mas_sum = dep_sum = pkg_sum = [0, 0, 0]
(self.dwn, self.install, self.comp_sum,
self.uncomp_sum) = self.store(self.packages)
sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
@ -185,10 +177,14 @@ class OthersInstall(object):
if self.install:
self.top_view()
print("Installing:")
self.views(self.install, self.comp_sum)
mas_sum = self.views(self.install, self.comp_sum)
if dependencies:
print("Installing for dependencies:")
self.views(self.dep_install, self.dep_comp_sum)
dep_sum = self.views(self.dep_install, self.dep_comp_sum)
pkg_sum = [sum(i) for i in zip(mas_sum, dep_sum)]
unit, size = units(self.comp_sum, self.uncomp_sum)
print unit, size
def resolving_deps(self):
'''
@ -263,7 +259,7 @@ class OthersInstall(object):
for pkg in packages:
for name, loc, comp, uncomp in zip(data[0], data[1], data[2],
data[3]):
if name.startswith(pkg + "-") and pkg not in black:
if pkg in name and pkg not in black:
dwn.append("{0}{1}/{2}".format(self.mirror, loc, name))
install.append(name)
comp_sum.append(comp)