slpkg/slpkg/arguments.py

231 lines
10 KiB
Python
Raw Normal View History

#!/usr/bin/python3
2014-10-29 12:58:44 +01:00
# -*- coding: utf-8 -*-
# arguments.py file is part of slpkg.
# Copyright 2014-2020 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://gitlab.com/dslackw/slpkg
2014-10-29 12:58:44 +01:00
# 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"""
print(f"slpkg - version {_meta_.__version__} | Slackware release: {_meta_.slack_rel} - {slack_ver()}\n")
2015-06-05 13:02:32 +02:00
2014-10-29 12:58:44 +01:00
def options():
2016-01-22 10:18:20 +01:00
"""Slpkg is a user-friendly package manager for Slackware installations
Usage: slpkg [COMMANDS|OPTIONS] {repository|package...}
2016-01-20 06:34:20 +01:00
2017-12-31 22:55:34 +01:00
_ _
___| |_ __ | | ____ _
/ __| | '_ \| |/ / _` |
\__ \ | |_) | < (_| |
|___/_| .__/|_|\_\__, |
|_| |___/
_Slackware package manager_______
2015-05-31 05:34:29 +02:00
Commands:
update, --repositories=[...] Run this command to update all
the packages lists.
2016-10-10 14:49:53 +02:00
upgrade, --repositories=[...] Delete and recreate all packages
2016-01-21 22:24:28 +01:00
lists.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
repo-add [repository name] [URL] Add custom repository.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
repo-remove [repository] Remove custom repository.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
repo-enable Enable or disable default
repositories via dialog utility.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
repo-list Print a list of all the
repositories.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
repo-info [repository] Get information about a
repository.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
update slpkg Upgrade the program directly from
repository.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
health, --silent Health check installed packages.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
deps-status, --tree, --graph=[type] Print dependencies status used by
packages or drawing dependencies
diagram.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
new-config Manage .new configuration files.
2015-05-31 05:34:29 +02:00
clean-tmp Clean the tmp/ directory from
downloaded packages and sources.
2015-05-31 05:34:29 +02:00
Optional arguments:
2016-01-21 22:24:28 +01:00
-h | --help Print this help message and exit.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
-v | --version Print program version and exit.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
-a | --autobuild, [script] [source...] Auto build SBo packages.
If you have already downloaded the
2016-01-21 22:24:28 +01:00
script and the source code you can
build a new package with this
command.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
-b | --blacklist, [package...] --add, Manage packages in the blacklist.
--remove, list Add or remove packages and print
the list. Each package is added
here will not be accessible by the
program.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01: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 the packages from the
queue.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
-g | --config, print, edit, reset Configuration file management.
Print, edit the configuration file
or reset in the default values.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
-l | --list, [repository], --index, Print a list of all available
--installed, --name packages from repository, index or
2016-01-21 22:24:28 +01:00
print only packages installed on
the system.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
-c | --check, [repository], --upgrade, Check for updated packages from
--rebuild --skip=[...], the repositories and upgrade or
--resolve-off, --checklist install with all dependencies.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
-s | --sync, [repository] [package...], Sync packages. Install packages
2016-10-10 15:35:29 +02:00
--rebuild, --reinstall, directly from remote repositories
--resolve-off, --download-only, with all dependencies.
--directory-prefix=[dir],
2017-09-24 20:06:44 +02:00
--case-ins, --patches
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
-t | --tracking, [repository] [package], Tracking package dependencies and
--check-deps, --graph=[type], print package dependencies tree
--case-ins with highlight if packages is
installed. Also check if
dependencies used or drawing
dependencies diagram.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
-p | --desc, [repository] [package], Print description of a package
--color=[] directly from the repository and
change color text.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
-n | --network, [package], --checklist, View a standard of SBo page in
--case-ins terminal and manage multiple
options like reading, downloading,
building, installation, etc.
2016-10-10 14:49:53 +02:00
2016-01-22 09:12:46 +01:00
-F | --FIND, [package...], --case-ins Find packages from each enabled
2016-01-25 09:36:44 +01:00
repository and view results.
2016-10-10 14:49:53 +02:00
-f | --find, [package...], --case-ins, Find and print installed packages
--third-party reporting the size and the sum.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
-i | --installpkg, [options] [package...] Installs single or multiple *.tgz
options=[--warn, --md5sum, --root, (or .tbz, .tlz, .txz) Slackware
--infobox, --menu, --terse, --ask, binary packages designed for use
--priority, --tagfile] with the Slackware Linux
distribution onto your system.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
-u | --upgradepkg, [options] [package...] Upgrade single or multiple
options=[--dry-run, --install-new, Slackware binary packages from
--reinstall, --verbose] an older version to a newer one.
2016-10-10 14:49:53 +02:00
2016-01-21 22:24:28 +01:00
-r | --removepkg, [options] [package...], Removes a previously installed
--deps, --check-deps, --tag, Slackware binary packages,
--checklist, --third-party while writing a progress report
2016-01-21 22:24:28 +01:00
options=[-warn, -preserve, -copy, to the standard output.
-keep] Use only package name.
2016-10-10 14:49:53 +02:00
2016-01-25 23:09:41 +01:00
-d | --display, [package...] Display the contents of installed
packages 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.
Issues: https://gitlab.com/dslackw/slpkg/issues
Homepage: https://dslackw.gitlab.io/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):
2016-01-20 06:34:20 +01:00
"""Usage: slpkg [COMMANDS|OPTIONS] {repository|package...}
Commands:
[update, --repositories=[...]]
[upgrade, --repositories=[...]]
[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]
[clean-tmp]
2015-06-05 13:02:32 +02:00
Optional arguments:
2015-06-12 22:27:20 +02:00
[-h] [-v]
[-a [script] [sources...]]
2016-01-02 23:21:39 +01:00
[-b [package...] --add, --remove,
[list]]
[-q [package...] --add, --remove,
[list, build, install, build-install]]
2015-09-10 05:57:12 +02:00
[-g [print, edit, reset]]
2016-01-29 13:06:54 +01:00
[-l [repository], --index, --installed, --name]
[-c [repository], --upgrade, --rebuild, --skip=[...],
--resolve-off, --checklist]
2016-10-10 15:35:29 +02:00
[-s [repository] [package...], --rebuild, --reinstall,
--resolve-off, --download-only,
2015-11-12 05:01:20 +01:00
--directory-prefix=[dir],
2017-09-24 20:06:44 +02:00
--case-ins, --patches]
2015-09-24 06:10:13 +02:00
[-t [repository] [package], --check-deps, --graph=[type],
--case-ins]
2015-06-05 13:02:32 +02:00
[-p [repository] [package], --color=[]]
2015-09-15 06:18:26 +02:00
[-n [SBo package], --checklist, --case-ins]
[-F [package...], --case-ins]
[-f [package...], --case-ins, --third-party]
2015-08-14 04:46:22 +02:00
[-i [options] [package...]]
[-u [options] [package...]]
2015-09-18 06:22:57 +02:00
[-r [options] [package...], --deps, --check-deps, --tag,
--checklist, --third-party]
2015-08-14 04:46:22 +02:00
[-d [package...]]
2015-06-05 13:02:32 +02:00
"""
2015-06-07 07:26:42 +02:00
if repo and repo not in _meta_.repositories:
2016-10-05 10:53:16 +02:00
error_repo = ""
2015-09-27 12:08:58 +02:00
all_repos = RepoList().all_repos.keys()
2014-12-27 11:26:59 +01:00
del RepoList().all_repos
2015-09-27 12:08:58 +02:00
if repo in all_repos:
error_repo = (f"slpkg: Error: Repository '{repo}' is not activated"
"\n")
2014-12-27 11:26:59 +01:00
else:
error_repo = (f"slpkg: Error: Repository '{repo}' does not exist"
"\n")
2016-10-05 10:53:16 +02:00
print("\n" + error_repo)
raise SystemExit(1)
2015-06-05 13:02:32 +02:00
print(usage.__doc__)
print("For more information try 'slpkg -h, --help' or view manpage\n")