2014-10-29 12:58:44 +01:00
|
|
|
#!/usr/bin/python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
# arguments.py file is part of slpkg.
|
|
|
|
|
2015-05-21 01:00:07 +02:00
|
|
|
# Copyright 2014-2015 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
2014-10-29 12:58:44 +01:00
|
|
|
# All rights reserved.
|
|
|
|
|
2014-12-19 05:57:56 +01:00
|
|
|
# Slpkg is a user-friendly package manager for Slackware installations
|
2014-10-29 12:58:44 +01:00
|
|
|
|
|
|
|
# https://github.com/dslackw/slpkg
|
|
|
|
|
|
|
|
# Slpkg is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
2015-08-21 01:15:43 +02:00
|
|
|
from slpkg.repolist import RepoList
|
|
|
|
from slpkg.__metadata__ import MetaData as _meta_
|
2014-10-29 12:58:44 +01:00
|
|
|
|
2015-08-21 01:15:43 +02:00
|
|
|
from slpkg.slack.slack_version import slack_ver
|
2015-08-14 05:23:57 +02:00
|
|
|
|
2014-10-29 12:58:44 +01:00
|
|
|
|
2015-06-05 13:02:32 +02:00
|
|
|
def header():
|
|
|
|
"""help header message"""
|
2015-08-14 05:23:57 +02:00
|
|
|
print("\nslpkg - version {0} | Slackware release: {1} - {2}\n".format(
|
|
|
|
_meta_.__version__, _meta_.slack_rel, slack_ver()))
|
2015-06-05 13:02:32 +02:00
|
|
|
|
|
|
|
|
2014-10-29 12:58:44 +01:00
|
|
|
def options():
|
2015-05-31 05:37:31 +02:00
|
|
|
"""Slpkg is a user-friendly package manager for Slackware installations
|
2015-05-31 05:46:44 +02:00
|
|
|
_ _
|
|
|
|
___| |_ __ | | ____ _
|
2015-08-28 06:58:19 +02:00
|
|
|
/ __| | '_ \| |/ / _` |
|
2015-05-31 05:46:44 +02:00
|
|
|
\__ \ | |_) | < (_| |
|
|
|
|
|___/_| .__/|_|\_\__, |
|
2015-06-01 05:23:27 +02:00
|
|
|
|_| |___/
|
2015-05-31 05:34:29 +02:00
|
|
|
|
|
|
|
Commands:
|
2015-06-13 05:36:57 +02:00
|
|
|
update, --only=[...] Run this command to update all
|
2015-05-31 05:34:29 +02:00
|
|
|
the packages list.
|
2015-06-13 05:36:57 +02:00
|
|
|
upgrade, --only=[...] Delete and recreate all packages
|
2015-05-31 05:34:29 +02:00
|
|
|
lists.
|
|
|
|
repo-add [repository name] [URL] Add custom repository.
|
|
|
|
repo-remove [repository] Remove custom repository.
|
2015-08-31 22:27:06 +02:00
|
|
|
repo-enable Enable or disable default
|
|
|
|
repositories via dialog utility.
|
2015-05-31 05:34:29 +02:00
|
|
|
repo-list Print a list of all the
|
|
|
|
repositories.
|
|
|
|
repo-info [repository] Get information about a
|
|
|
|
repository.
|
|
|
|
update slpkg Upgrade the program directly from
|
|
|
|
repository.
|
2015-07-16 01:03:52 +02:00
|
|
|
health, --silent Health check installed packages.
|
2015-08-14 04:46:22 +02:00
|
|
|
deps-status, --tree, --graph=[type] Print dependencies status used by
|
2015-07-28 06:06:17 +02:00
|
|
|
packages or drawing dependencies
|
|
|
|
diagram.
|
2015-08-04 00:31:51 +02:00
|
|
|
new-config Manage .new configuration files.
|
2015-05-31 05:34:29 +02:00
|
|
|
|
|
|
|
Optional arguments:
|
2015-06-09 02:54:13 +02:00
|
|
|
-h, --help Print this help message and exit.
|
2015-05-31 05:46:44 +02:00
|
|
|
-v, --version Print program version and exit.
|
2015-06-06 16:37:53 +02:00
|
|
|
-a, --autobuild, [script] [source...] Auto build SBo packages.
|
2015-05-31 05:34:29 +02:00
|
|
|
If you already have downloaded the
|
|
|
|
script and the source code you can
|
|
|
|
build a new package with this
|
|
|
|
command.
|
2015-06-06 16:37:53 +02:00
|
|
|
-b, --blacklist, [package...] --add, Manage packages in the blacklist.
|
|
|
|
--remove, list Add or remove packages and print
|
2015-05-31 05:34:29 +02:00
|
|
|
the list. Each package is added
|
|
|
|
here will not be accessible by the
|
|
|
|
program.
|
2015-06-06 16:37:53 +02:00
|
|
|
-q, --queue, [package...] --add, Manage SBo packages in the queue.
|
|
|
|
--remove, list, build, install, Add or remove and print the list
|
|
|
|
build-install of packages. Build and then install
|
2015-05-31 05:34:29 +02:00
|
|
|
the packages from the queue.
|
2015-09-07 04:25:17 +02:00
|
|
|
-g, --config, print, edit=[editor], Configuration file management.
|
|
|
|
reset Print, edit the configuration file
|
|
|
|
or reset in the default values.
|
2015-06-06 16:37:53 +02:00
|
|
|
-l, --list, [repository], --index, Print a list of all available
|
|
|
|
--installed packages repository, index or print
|
2015-05-31 05:34:29 +02:00
|
|
|
only packages installed on the
|
|
|
|
system.
|
2015-09-08 01:29:07 +02:00
|
|
|
-c, --check, [repository], --upgrade, Check for updated packages from the
|
|
|
|
--skip=[...], --resolve--off repositories and install with all
|
|
|
|
--checklist dependencies.
|
2015-06-06 16:37:53 +02:00
|
|
|
-s, --sync, [repository] [package...], Sync packages. Install packages
|
2015-06-04 03:08:51 +02:00
|
|
|
--resolve-off directly from remote repositories
|
2015-05-31 05:34:29 +02:00
|
|
|
with all dependencies.
|
2015-07-22 05:37:41 +02:00
|
|
|
-t, --tracking, [repository] [package], Tracking package dependencies and
|
2015-07-28 06:21:26 +02:00
|
|
|
--check-deps, --graph=[type] print package dependenies tree with
|
2015-05-31 05:34:29 +02:00
|
|
|
highlight if packages is installed.
|
2015-07-25 18:52:31 +02:00
|
|
|
Also check if dependencies used or
|
2015-07-28 06:06:17 +02:00
|
|
|
drawing dependencies digram.
|
2015-06-20 01:56:36 +02:00
|
|
|
-p, --desc, [repository] [package], Print description of a package
|
2015-06-06 16:37:53 +02:00
|
|
|
--color=[] directly from the repository and
|
2015-05-31 05:34:29 +02:00
|
|
|
change color text.
|
2015-06-06 16:37:53 +02:00
|
|
|
-n, --network, [package] View a standard of SBo page in
|
2015-05-31 05:34:29 +02:00
|
|
|
terminal and manage multiple options
|
|
|
|
like reading, downloading, building
|
|
|
|
installation, etc.
|
2015-06-06 16:37:53 +02:00
|
|
|
-F, --FIND, [package...] Find packages from repositories and
|
2015-05-31 05:34:29 +02:00
|
|
|
search at each enabled repository
|
|
|
|
and prints results.
|
2015-06-06 16:37:53 +02:00
|
|
|
-f, --find, [package...] Find and print installed packages
|
2015-05-31 05:34:29 +02:00
|
|
|
reporting the size and the sum.
|
2015-06-12 05:55:10 +02:00
|
|
|
-i, --installpkg, [options] [package...] Installs single or multiple *.tgz
|
|
|
|
options=[--warn, --md5sum, --root, (or .tbz, .tlz, .txz) Slackware
|
2015-06-13 07:01:08 +02:00
|
|
|
--infobox, --menu, --terse, --ask, binary packages designed for use
|
|
|
|
--priority, --tagfile] with the Slackware Linux
|
|
|
|
distribution onto your system.
|
2015-06-10 21:14:40 +02:00
|
|
|
-u, --upgradepkg, [options] [package...] Upgrade single or multiple Slackware
|
|
|
|
options=[--dry-run, --install-new, binary packages from an older
|
2015-06-13 07:01:08 +02:00
|
|
|
--reinstall, --verbose] version to a newer one.
|
2015-06-12 05:55:10 +02:00
|
|
|
-r, --removepkg, [options] [package...], Removes a previously installed
|
2015-08-24 15:32:37 +02:00
|
|
|
--check-deps, --tag, --checklist Slackware binary packages,
|
2015-06-13 17:31:54 +02:00
|
|
|
options=[-warn, -preserve, -copy, while writing a progress report
|
2015-06-13 07:01:08 +02:00
|
|
|
-keep] to the standard output.
|
2015-06-07 06:38:05 +02:00
|
|
|
-d, --display, [package...] Display the installed packages
|
|
|
|
contents and file list.
|
2015-05-31 05:34:29 +02:00
|
|
|
|
|
|
|
You can read more about slpkg from manpage or see examples from readme file.
|
2015-07-23 04:56:09 +02:00
|
|
|
Issues: https://github.com/dslackw/slpkg/issues
|
2015-05-31 05:46:44 +02:00
|
|
|
Homepage: https://github.com/dslackw/slpkg
|
2015-05-31 05:34:29 +02:00
|
|
|
"""
|
2015-06-05 13:02:32 +02:00
|
|
|
header()
|
|
|
|
print(options.__doc__)
|
2014-10-29 12:58:44 +01:00
|
|
|
|
|
|
|
|
2014-12-26 23:58:03 +01:00
|
|
|
def usage(repo):
|
2015-06-05 13:02:32 +02:00
|
|
|
"""Usage: slpkg Commands:
|
2015-08-14 04:46:22 +02:00
|
|
|
[update, --only=[...]]
|
|
|
|
[upgrade, --only=[...]]
|
2015-06-13 05:36:57 +02:00
|
|
|
[repo-add [repository name] [URL]]
|
2015-08-14 04:46:22 +02:00
|
|
|
[repo-remove [repository]]
|
2015-08-31 22:27:06 +02:00
|
|
|
[repo-enable]
|
2015-08-14 04:46:22 +02:00
|
|
|
[repo-list]
|
|
|
|
[repo-info [repository]]
|
|
|
|
[update [slpkg]]
|
|
|
|
[health, --silent]
|
|
|
|
[deps-status, --tree, --graph=[type]]
|
2015-08-04 00:31:51 +02:00
|
|
|
[new-config]
|
2015-06-05 13:02:32 +02:00
|
|
|
|
|
|
|
Optional arguments:
|
2015-06-12 22:27:20 +02:00
|
|
|
[-h] [-v]
|
|
|
|
[-a [script] [sources...]]
|
2015-06-09 03:24:47 +02:00
|
|
|
[-b [package...] --add, --remove, list]
|
|
|
|
[-q [package...] --add, --remove, list]
|
2015-06-12 22:27:20 +02:00
|
|
|
[-q [build, install, build-install]]
|
2015-09-07 04:25:17 +02:00
|
|
|
[-g [print, edit=[editor], reset]]
|
2015-06-05 13:02:32 +02:00
|
|
|
[-l [repository], --index, --installed]
|
2015-09-08 01:29:07 +02:00
|
|
|
[-c [repository], --upgrade, --skip=[...], --resolve-off,
|
|
|
|
--checklist]
|
2015-06-05 13:02:32 +02:00
|
|
|
[-s [repository] [package...], --resolve-off]
|
2015-07-28 06:21:26 +02:00
|
|
|
[-t [repository] [package], --check-deps, --graph=[type]]
|
2015-06-05 13:02:32 +02:00
|
|
|
[-p [repository] [package], --color=[]]
|
2015-08-14 04:46:22 +02:00
|
|
|
[-n [SBo package]]
|
|
|
|
[-F [package...]]
|
|
|
|
[-f [package...]]
|
|
|
|
[-i [options] [package...]]
|
|
|
|
[-u [options] [package...]]
|
2015-08-24 15:32:37 +02:00
|
|
|
[-r [options] [package...], --check-deps, --tag, --checklist]
|
2015-08-14 04:46:22 +02:00
|
|
|
[-d [package...]]
|
2015-06-05 13:02:32 +02:00
|
|
|
"""
|
2014-12-26 23:58:03 +01:00
|
|
|
error_repo = ""
|
2015-06-07 07:26:42 +02:00
|
|
|
if repo and repo not in _meta_.repositories:
|
2014-12-27 11:26:59 +01:00
|
|
|
all_repos = RepoList().all_repos
|
|
|
|
del RepoList().all_repos
|
|
|
|
if repo in all_repos:
|
|
|
|
error_repo = ("slpkg: error: repository '{0}' is not activated"
|
|
|
|
"\n".format(repo))
|
|
|
|
else:
|
|
|
|
error_repo = ("slpkg: error: repository '{0}' does not exist"
|
|
|
|
"\n".format(repo))
|
2015-06-05 13:02:32 +02:00
|
|
|
header()
|
|
|
|
print(usage.__doc__)
|
|
|
|
print(error_repo)
|
|
|
|
print("For more information try 'slpkg -h, --help' or view manpage\n")
|