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/>.
|
|
|
|
|
|
|
|
|
2014-12-27 11:26:59 +01:00
|
|
|
from repolist import RepoList
|
2015-06-07 07:26:42 +02:00
|
|
|
from __metadata__ import MetaData as _meta_
|
2014-10-29 12:58:44 +01:00
|
|
|
|
|
|
|
|
2015-06-05 13:02:32 +02:00
|
|
|
def header():
|
|
|
|
"""help header message"""
|
|
|
|
print("\nslpkg - version {0} | Slackware release: {1}\n".format(
|
2015-06-07 07:26:42 +02:00
|
|
|
_meta_.__version__, _meta_.slack_rel))
|
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-06-05 13:42:52 +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:
|
|
|
|
update Run this command to update all
|
|
|
|
the packages list.
|
|
|
|
upgrade Delete and recreate all packages
|
|
|
|
lists.
|
|
|
|
repo-add [repository name] [URL] Add custom repository.
|
|
|
|
repo-remove [repository] Remove custom repository.
|
|
|
|
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.
|
|
|
|
|
|
|
|
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-06-06 16:37:53 +02:00
|
|
|
-g, --config, print, edit=[editor] Configuration file management.
|
2015-05-31 05:34:29 +02:00
|
|
|
Print the configuration file or
|
|
|
|
edit.
|
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-06-09 03:24:47 +02:00
|
|
|
-c, --check, [repository] --upgrade, Check, view and install updated
|
2015-06-13 02:52:26 +02:00
|
|
|
--skip=[] --resolve--off packages from repositories.
|
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-06-06 16:37:53 +02:00
|
|
|
-t, --tracking, [repository] [package] Tracking package dependencies and
|
2015-05-31 05:34:29 +02:00
|
|
|
print package dependenies tree with
|
|
|
|
highlight if packages is installed.
|
2015-06-06 16:37:53 +02:00
|
|
|
-p, --print, [repository] [package], Print description of a package
|
|
|
|
--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
|
|
|
|
--infobox, --menu, --terse, binary packages designed for use
|
|
|
|
--ask, --priority, with the Slackware Linux
|
|
|
|
--tagfile] 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
|
|
|
|
--reinstall, --verbose] version to a newer one.
|
2015-06-12 05:55:10 +02:00
|
|
|
-r, --removepkg, [options] [package...], Removes a previously installed
|
|
|
|
--check-deps Slackware binary packages,
|
|
|
|
options=[-warn, -preserve, copy, while writing a progress report
|
|
|
|
-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-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:
|
|
|
|
[update] [upgrade] [repo-add [repository name] [URL]]
|
|
|
|
[repo-remove [repository]] [repo-list]
|
|
|
|
[repo-info [repository]] [update [slpkg]]
|
|
|
|
|
|
|
|
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]]
|
|
|
|
[-g [print, edit=[editor]]]
|
2015-06-05 13:02:32 +02:00
|
|
|
[-l [repository], --index, --installed]
|
2015-06-09 03:24:47 +02:00
|
|
|
[-c [repository] --upgrade, --skip=[] --resolve-off]
|
2015-06-05 13:02:32 +02:00
|
|
|
[-s [repository] [package...], --resolve-off]
|
|
|
|
[-t [repository] [package]]
|
|
|
|
[-p [repository] [package], --color=[]]
|
2015-06-12 22:27:20 +02:00
|
|
|
[-n [SBo package]] [-F [...]] [-f [...]]
|
|
|
|
[-i [options] [...]] [-u [options] [...]]
|
|
|
|
[-r [options] [...], --check-deps] [-d [...]]
|
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")
|