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 Version 2.1.6
02-1-2015 03-1-2015
[Updated] - Fix queue downloads. [Updated] - Fix queue downloads.
- Update find argument. - Update find argument.
- Rename commands repolist and repoinfo to repo-list, repo-info.
[Feature] - Added custom binary repository. [Feature] - Added custom binary repository.

View file

@ -72,8 +72,9 @@ Supported Repositories:
Versions: {current} 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. '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 Slpkg works in accordance with the standards of the organization slackbuilds.org
to builds packages. Also uses the Slackware linux instructions for installation, to builds packages. Also uses the Slackware linux instructions for installation,
@ -277,7 +278,21 @@ and update the package lists:
Update repository multi ...Done 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 .. code-block:: bash

View file

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

View file

@ -112,10 +112,12 @@ 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/")
packages_txt = ("{0} {1} {2}".format(packages, extra, pasture)) patches = mirrors(lib_file, "patches/")
pat_checksums = 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))
checksums_md5 = ("{0} {1} {2} {3}".format(pkg_checksums, ext_checksums,
pas_checksums, pat_checksums))
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

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

View file

@ -30,6 +30,7 @@ from slpkg.messages import (
template template
) )
from slpkg.__metadata__ import ( from slpkg.__metadata__ import (
lib_path,
pkg_path, pkg_path,
sp, sp,
log_path, log_path,
@ -40,7 +41,6 @@ from slpkg.__metadata__ import (
) )
from slpkg.pkg.find import find_package from slpkg.pkg.find import find_package
from slpkg.slack.slack_version import slack_ver
class PackageManager(object): class PackageManager(object):
@ -279,46 +279,44 @@ 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): def list(self, pattern, 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:
pkg_list = { index, page, official = 0, row, []
'sbo': ['_SBo'], if os.path.isfile(lib_path + 'slack_repo/PACKAGES.TXT'):
'slack': ['_slack{0}'.format(slack_ver())], f = open(lib_path + 'slack_repo/PACKAGES.TXT', 'r')
'rlw': ['_rlw'], r = f.read()
'alien': ['alien'], f.close()
'slacky': ['sl'], for line in r.splitlines():
'studio': ['se'], if line.startswith("PACKAGE NAME:"):
'slackr': ['cf'], official.append(line[15:-4].strip())
'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
for pkg in find_package("", pkg_path): for pkg in find_package("", pkg_path):
for tag in search: if pattern == 'all':
if pkg.endswith(tag): pkg_list.append(pkg)
index += 1 elif pattern == 'official' and pkg in official:
print("{0}{1}:{2} {3}".format(color['GREY'], index, pkg_list.append(pkg)
color['ENDC'], pkg)) elif pattern == 'non-official' and pkg not in official:
if index == page: pkg_list.append(pkg)
read = raw_input("\nPress {0}Enter{1} to " for pkg in pkg_list:
"continue... ".format( if INDEX:
color['CYAN'], color['ENDC'])) index += 1
if read in ['Q', 'q']: print("{0}{1}:{2} {3}".format(color['GREY'], index,
break color['ENDC'], pkg))
print("") # new line after page if index == page:
page += row 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 print("") # new line at end
except KeyboardInterrupt: except KeyboardInterrupt:
print("") # new line at exit print("") # new line at exit

View file

@ -71,6 +71,6 @@ class RepoList(object):
repo_id, ' ' * (17 - len(repo_id)), repo_id, ' ' * (17 - len(repo_id)),
repo_name, ' ' * (45 - len(repo_name)), repo_name, ' ' * (45 - len(repo_name)),
COLOR, status, color['ENDC'])) 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") "'/etc/slpkg/slpkg.conf' file\n")
sys.exit(0) sys.exit(0)