update packages list args

This commit is contained in:
Dimitris Zlatanidis 2015-01-03 11:05:41 +02:00
parent 9ae83e56bb
commit 7db7d7ad45
7 changed files with 71 additions and 51 deletions

View file

@ -1,8 +1,9 @@
Version 2.1.6
02-1-2015
03-1-2015
[Updated] - Fix queue downloads.
- Update find argument.
- Rename commands repolist and repoinfo to repo-list, repo-info.
[Feature] - Added custom binary repository.

View file

@ -72,8 +72,9 @@ Supported Repositories:
Versions: {current}
* Choose repositories you need to work from file '/etc/slpkg/slpkg.conf' default is
* Choose default repositories you need to work from file '/etc/slpkg/slpkg.conf' default is
'slack' and 'sbo' repositories and read REPOSITORIES file for each of the particularities.
Manage custom repositories with commands 'repo-add' and 'repo-remove'.
Slpkg works in accordance with the standards of the organization slackbuilds.org
to builds packages. Also uses the Slackware linux instructions for installation,
@ -277,7 +278,21 @@ and update the package lists:
Update repository multi ...Done
Take information repositories with commands:
Add and remove custom repositories:
.. code-block:: bash
$ slpkg repo-add ponce http://ponce.cc/slackware/slackware64-14.1/packages/
Repository 'ponce' successfully added
$ slpkg repo-remove ponce
Repository 'ponce' successfully removed
Take information repositories:
.. code-block:: bash

View file

@ -41,8 +41,8 @@ def options():
" re-create recreate package lists",
" repo-add [name] [URL] add custom repository",
" repo-remove [name] remove custom repository",
" repolist list all repositories",
" repoinfo [repository] repository information",
" repo-list list all repositories",
" repo-info [repository] repository information",
" update slpkg check and update slpkg\n",
"Optional arguments:",
" -h, --help show this help message "
@ -57,7 +57,7 @@ def options():
"from queue",
" -g, --config, --config=[editor] configuration file "
"management",
" -l, [repository], all list of installed "
" -l, all, official, non-official, --index list of installed "
"packages",
" -c, [repository] --upgrade check for updated "
"packages",

View file

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

View file

@ -113,7 +113,7 @@ def main():
if len(args) == 2 and args[0] == "update" and args[1] == "slpkg":
it_self_update()
if len(args) == 1 and args[0] == "repolist":
if len(args) == 1 and args[0] == "repo-list":
RepoList().repos()
if len(args) == 0:
@ -138,20 +138,24 @@ def main():
if len(args) == 1 and args[0] == "re-create":
Initialization().re_create()
if (len(args) == 2 and args[0] == "repoinfo" and
if (len(args) == 2 and args[0] == "repo-info" and
args[1] in RepoList().all_repos):
del RepoList().all_repos
RepoInfo().view(args[1])
elif (len(args) == 2 and args[0] == "repoinfo" and
elif (len(args) == 2 and args[0] == "repo-info" and
args[1] not in RepoList().all_repos):
usage(args[1])
if len(args) == 3 and args[0] == "-a":
BuildPackage(args[1], args[2:], path).build()
elif len(args) == 2 and args[0] == "-l":
pkg_list = ["all"] + repositories
if args[1] in pkg_list:
PackageManager(None).list(args[1])
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']:
PackageManager(None).list(args[1], True)
else:
usage('')
elif len(args) == 3 and args[0] == "-c" and args[2] == "--upgrade":

View file

@ -30,6 +30,7 @@ from slpkg.messages import (
template
)
from slpkg.__metadata__ import (
lib_path,
pkg_path,
sp,
log_path,
@ -40,7 +41,6 @@ from slpkg.__metadata__ import (
)
from slpkg.pkg.find import find_package
from slpkg.slack.slack_version import slack_ver
class PackageManager(object):
@ -279,46 +279,44 @@ class PackageManager(object):
bol = eol = "\n"
pkg_not_found(bol, pkg, message, eol)
def list(self, pattern):
def list(self, pattern, INDEX):
'''
List with the installed packages
'''
tty_size = os.popen('stty size', 'r').read().split()
row = int(tty_size[0]) - 2
pkg_list = []
try:
pkg_list = {
'sbo': ['_SBo'],
'slack': ['_slack{0}'.format(slack_ver())],
'rlw': ['_rlw'],
'alien': ['alien'],
'slacky': ['sl'],
'studio': ['se'],
'slackr': ['cf'],
'slonly': ['_slack'],
'ktown': ['alien'],
'multi': ['alien', 'alien_slack{0}'.format(slack_ver()),
'compat32'],
'slacke': ['jp'],
'salix': ['gv', 'rl', 'msb', 'dj', 'tg', 'cp', 'tjb', 'alien'],
'slackl': [''],
'all': ['']
}
search = pkg_list[pattern]
index, page = 0, row
index, page, official = 0, row, []
if os.path.isfile(lib_path + 'slack_repo/PACKAGES.TXT'):
f = open(lib_path + 'slack_repo/PACKAGES.TXT', 'r')
r = f.read()
f.close()
for line in r.splitlines():
if line.startswith("PACKAGE NAME:"):
official.append(line[15:-4].strip())
for pkg in find_package("", pkg_path):
for tag in search:
if pkg.endswith(tag):
index += 1
print("{0}{1}:{2} {3}".format(color['GREY'], index,
color['ENDC'], pkg))
if index == page:
read = raw_input("\nPress {0}Enter{1} to "
"continue... ".format(
color['CYAN'], color['ENDC']))
if read in ['Q', 'q']:
break
print("") # new line after page
page += row
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 pkg_list:
if INDEX:
index += 1
print("{0}{1}:{2} {3}".format(color['GREY'], index,
color['ENDC'], pkg))
if index == page:
read = raw_input("\nPress {0}Enter{1} to "
"continue... ".format(color['CYAN'],
color['ENDC']))
if read in ['Q', 'q']:
break
print("") # new line after page
page += row
else:
print pkg
print("") # new line at end
except KeyboardInterrupt:
print("") # new line at exit

View file

@ -71,6 +71,6 @@ class RepoList(object):
repo_id, ' ' * (17 - len(repo_id)),
repo_name, ' ' * (45 - len(repo_name)),
COLOR, status, color['ENDC']))
print("\nFor enable or disable repositories edit "
print("\nFor enable or disable default repositories edit "
"'/etc/slpkg/slpkg.conf' file\n")
sys.exit(0)