diff --git a/CHANGELOG b/CHANGELOG index 6895f043..d2225217 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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. diff --git a/README.rst b/README.rst index 165460d7..92f86a9c 100644 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/slpkg/arguments.py b/slpkg/arguments.py index a9e1893c..83df42e1 100644 --- a/slpkg/arguments.py +++ b/slpkg/arguments.py @@ -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", diff --git a/slpkg/init.py b/slpkg/init.py index 84dbf217..e36b3aff 100644 --- a/slpkg/init.py +++ b/slpkg/init.py @@ -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) diff --git a/slpkg/main.py b/slpkg/main.py index bfe8b86b..15bdd446 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -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": diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py index 5cb59481..d6d7e6b4 100644 --- a/slpkg/pkg/manager.py +++ b/slpkg/pkg/manager.py @@ -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 diff --git a/slpkg/repolist.py b/slpkg/repolist.py index a5921f09..ca26a2c2 100644 --- a/slpkg/repolist.py +++ b/slpkg/repolist.py @@ -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)