mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-27 09:58:10 +01:00
Updated for repo-enable coomand
This commit is contained in:
parent
c46175f7cd
commit
443068b9f6
7 changed files with 98 additions and 16 deletions
|
@ -1,9 +1,13 @@
|
||||||
2.7.7 - 30/08/2015
|
2.7.7 - 31/08/2015
|
||||||
Added:
|
Added:
|
||||||
- NEW configuration file for repositories in /etc/slpkg/repositories.conf
|
- NEW configuration file for repositories in /etc/slpkg/repositories.conf
|
||||||
|
- Enable and disable repositories with command via dialog utility
|
||||||
Update:
|
Update:
|
||||||
- Command line help logo
|
- Command line help logo
|
||||||
- Flags for packages upgrade
|
- Flags for packages upgrade
|
||||||
|
- Clear screen after exit dialog utility
|
||||||
|
Fixed:
|
||||||
|
- Remove None type packages
|
||||||
|
|
||||||
2.7.6 - 28/08/2015
|
2.7.6 - 28/08/2015
|
||||||
Fixed:
|
Fixed:
|
||||||
|
|
9
KNOWN_ISSUES
Normal file
9
KNOWN_ISSUES
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
Known issues:
|
||||||
|
|
||||||
|
- Dialog utility crash in option --buildlist when move with arrows
|
||||||
|
sometimes without yet that create big issues.
|
||||||
|
Issues reference here:
|
||||||
|
https://sourceforge.net/p/pythondialog/bugs/6/
|
||||||
|
|
||||||
|
Upgrade dialog utility from here if only necessary:
|
||||||
|
https://github.com/dslackw/slacks/tree/master/dialog
|
16
README.rst
16
README.rst
|
@ -196,7 +196,7 @@ choices such read, download, build, install etc.
|
||||||
|
|
||||||
If you want to find packages from all repositories, this command will solve your hands '$ slpkg -F
|
If you want to find packages from all repositories, this command will solve your hands '$ slpkg -F
|
||||||
<packages>'. It will search in all enabled repositories will find the configuration file
|
<packages>'. It will search in all enabled repositories will find the configuration file
|
||||||
'/etc/slpkg/slpkg.conf' will print all the packages that match the description that you enter.
|
'/etc/slpkg/repositories.conf' will print all the packages that match the description that you enter.
|
||||||
|
|
||||||
If you want to see if any packages are installed on your system enter the command '$ slpkg -f <packages>'.
|
If you want to see if any packages are installed on your system enter the command '$ slpkg -f <packages>'.
|
||||||
The surprise in the end is the reporting of packages sum and size found.
|
The surprise in the end is the reporting of packages sum and size found.
|
||||||
|
@ -369,6 +369,8 @@ Command Line Tool Usage
|
||||||
lists.
|
lists.
|
||||||
repo-add [repository name] [URL] Add custom repository.
|
repo-add [repository name] [URL] Add custom repository.
|
||||||
repo-remove [repository] Remove custom repository.
|
repo-remove [repository] Remove custom repository.
|
||||||
|
repo-enable Enable or disable default
|
||||||
|
repositories via dialog utility.
|
||||||
repo-list Print a list of all the
|
repo-list Print a list of all the
|
||||||
repositories.
|
repositories.
|
||||||
repo-info [repository] Get information about a
|
repo-info [repository] Get information about a
|
||||||
|
@ -445,6 +447,18 @@ Command Line Tool Usage
|
||||||
Slpkg Examples
|
Slpkg Examples
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
Enable default repositories edit /etc/slpkg/repositories.conf file or with
|
||||||
|
command.
|
||||||
|
(require pythondialog, install with '# slpkg -s sbo python2-pythondialog'):
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
$ slpkg repo-enable
|
||||||
|
|
||||||
|
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/repo_enable.png
|
||||||
|
:target: https://raw.githubusercontent.com/dslackw/images/master/slpkg/deps2.png
|
||||||
|
|
||||||
|
|
||||||
If you use slpkg for the first time will have to create and update the package
|
If you use slpkg for the first time will have to create and update the package
|
||||||
list. This command must be executed to update the package lists:
|
list. This command must be executed to update the package lists:
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ Usage: slpkg Commands:
|
||||||
[upgrade, --only=[...]]
|
[upgrade, --only=[...]]
|
||||||
[repo-add [repository name] [URL]]
|
[repo-add [repository name] [URL]]
|
||||||
[repo-remove [repository]]
|
[repo-remove [repository]]
|
||||||
|
[repo-enable]
|
||||||
[repo-list]
|
[repo-list]
|
||||||
[repo-info [repository]]
|
[repo-info [repository]]
|
||||||
[update [slpkg]]
|
[update [slpkg]]
|
||||||
|
@ -95,6 +96,11 @@ contain at least the files "PACKAGES.TXT" and "CHECKSUMS.md5" and optional file
|
||||||
.PP
|
.PP
|
||||||
Remove custom repository by name.
|
Remove custom repository by name.
|
||||||
|
|
||||||
|
.SS repo-enable, enable or disable repositories
|
||||||
|
\fBslpkg\fP \fBrepo-enable\fP
|
||||||
|
.PP
|
||||||
|
Enable or disable repositories via dialog utility (require pythondialog)
|
||||||
|
|
||||||
.SS repo-list, repositories list
|
.SS repo-list, repositories list
|
||||||
\fBslpkg\fP \fBrepo-list\fP
|
\fBslpkg\fP \fBrepo-list\fP
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -50,6 +50,8 @@ Commands:
|
||||||
lists.
|
lists.
|
||||||
repo-add [repository name] [URL] Add custom repository.
|
repo-add [repository name] [URL] Add custom repository.
|
||||||
repo-remove [repository] Remove custom repository.
|
repo-remove [repository] Remove custom repository.
|
||||||
|
repo-enable Enable or disable default
|
||||||
|
repositories via dialog utility.
|
||||||
repo-list Print a list of all the
|
repo-list Print a list of all the
|
||||||
repositories.
|
repositories.
|
||||||
repo-info [repository] Get information about a
|
repo-info [repository] Get information about a
|
||||||
|
@ -137,6 +139,7 @@ def usage(repo):
|
||||||
[upgrade, --only=[...]]
|
[upgrade, --only=[...]]
|
||||||
[repo-add [repository name] [URL]]
|
[repo-add [repository name] [URL]]
|
||||||
[repo-remove [repository]]
|
[repo-remove [repository]]
|
||||||
|
[repo-enable]
|
||||||
[repo-list]
|
[repo-list]
|
||||||
[repo-info [repository]]
|
[repo-info [repository]]
|
||||||
[update [slpkg]]
|
[update [slpkg]]
|
||||||
|
|
|
@ -41,6 +41,7 @@ from slpkg.version import prog_version
|
||||||
from slpkg.health import PackageHealth
|
from slpkg.health import PackageHealth
|
||||||
from slpkg.new_config import NewConfig
|
from slpkg.new_config import NewConfig
|
||||||
from slpkg.tracking import TrackingDeps
|
from slpkg.tracking import TrackingDeps
|
||||||
|
from slpkg.repoenable import RepoEnable
|
||||||
from slpkg.pkg_find import find_from_repos
|
from slpkg.pkg_find import find_from_repos
|
||||||
from slpkg.arguments import options, usage
|
from slpkg.arguments import options, usage
|
||||||
from slpkg.slpkg_update import it_self_update
|
from slpkg.slpkg_update import it_self_update
|
||||||
|
@ -76,6 +77,7 @@ class ArgParse(object):
|
||||||
"upgrade",
|
"upgrade",
|
||||||
"repo-add",
|
"repo-add",
|
||||||
"repo-remove",
|
"repo-remove",
|
||||||
|
"repo-enable",
|
||||||
"repo-list",
|
"repo-list",
|
||||||
"repo-info",
|
"repo-info",
|
||||||
"update-slpkg",
|
"update-slpkg",
|
||||||
|
@ -86,8 +88,8 @@ class ArgParse(object):
|
||||||
|
|
||||||
# checking if repositories exists
|
# checking if repositories exists
|
||||||
if len(self.args) > 1 and self.args[0] not in [
|
if len(self.args) > 1 and self.args[0] not in [
|
||||||
"-h", "--help", "-v", "--version", "upgrade", "repo-list",
|
"-h", "--help", "-v", "--version", "upgrade", "repo-enable",
|
||||||
"repo-add", "repo-remove", "update", "update-slpkg",
|
"repo-list", "repo-add", "repo-remove", "update", "update-slpkg",
|
||||||
"health", "-g", "--config"
|
"health", "-g", "--config"
|
||||||
]:
|
]:
|
||||||
check_exists_repositories()
|
check_exists_repositories()
|
||||||
|
@ -127,6 +129,14 @@ class ArgParse(object):
|
||||||
else:
|
else:
|
||||||
usage("")
|
usage("")
|
||||||
|
|
||||||
|
def command_repo_enable(self):
|
||||||
|
"""Repositories enable/disable
|
||||||
|
"""
|
||||||
|
if len(self.args) == 1 and self.args[0] == "repo-enable":
|
||||||
|
RepoEnable().choose()
|
||||||
|
else:
|
||||||
|
usage("")
|
||||||
|
|
||||||
def command_repo_list(self):
|
def command_repo_list(self):
|
||||||
"""Repositories list
|
"""Repositories list
|
||||||
"""
|
"""
|
||||||
|
@ -581,6 +591,7 @@ def main():
|
||||||
"update": argparse.command_update,
|
"update": argparse.command_update,
|
||||||
"upgrade": argparse.command_upgrade,
|
"upgrade": argparse.command_upgrade,
|
||||||
"update-slpkg": argparse.command_update_slpkg,
|
"update-slpkg": argparse.command_update_slpkg,
|
||||||
|
"repo-enable": argparse.command_repo_enable,
|
||||||
"repo-list": argparse.command_repo_list,
|
"repo-list": argparse.command_repo_list,
|
||||||
"repo-add": argparse.command_repo_add,
|
"repo-add": argparse.command_repo_add,
|
||||||
"repo-remove": argparse.command_repo_remove,
|
"repo-remove": argparse.command_repo_remove,
|
||||||
|
|
|
@ -22,16 +22,21 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
from slpkg.utils import Utils
|
from slpkg.utils import Utils
|
||||||
from slpkg.dialog_box import DialogUtil
|
from slpkg.dialog_box import DialogUtil
|
||||||
from slpkg.__metadata__ import MetaData as _meta_
|
from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
|
||||||
class RepoEnable(object):
|
class RepoEnable(object):
|
||||||
|
"""Read repositories.conf file and update with new enabled or
|
||||||
|
disabled repositories
|
||||||
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
self.tag = "[REPOSITORIES]"
|
self.tag = "[REPOSITORIES]"
|
||||||
|
self.tag_line = False
|
||||||
self.repositories_conf = "repositories.conf"
|
self.repositories_conf = "repositories.conf"
|
||||||
self.conf = Utils().read_file(
|
self.conf = Utils().read_file(
|
||||||
self.meta.conf_path + self.repositories_conf)
|
self.meta.conf_path + self.repositories_conf)
|
||||||
|
@ -50,40 +55,70 @@ Keys: SPACE select or deselect the highlighted repositories,
|
||||||
TAB move focus
|
TAB move focus
|
||||||
ENTER press the focused button
|
ENTER press the focused button
|
||||||
|
|
||||||
Disabled <----------------------> Enabled"""
|
Disabled <-------- REPOSITORIES -------> Enabled"""
|
||||||
self.read_enabled()
|
self.read_enabled()
|
||||||
self.read_disabled()
|
self.read_disabled()
|
||||||
self.selected = DialogUtil(self.disabled, text=keys,
|
self.selected = DialogUtil(self.disabled, text=keys,
|
||||||
title="Enable | Disable Repositories",
|
title="Enable | Disable Repositories",
|
||||||
backtitle="",
|
backtitle="",
|
||||||
status=False).buildlist(self.enabled)
|
status=False).buildlist(self.enabled)
|
||||||
self.update()
|
self.update_repos()
|
||||||
|
self.clear_screen()
|
||||||
|
self.reference()
|
||||||
|
|
||||||
def read_enabled(self):
|
def read_enabled(self):
|
||||||
"""Read enable repositories
|
"""Read enable repositories
|
||||||
"""
|
"""
|
||||||
read_line = False
|
|
||||||
for line in self.conf.splitlines():
|
for line in self.conf.splitlines():
|
||||||
line = line.lstrip()
|
line = line.lstrip()
|
||||||
if self.tag in line:
|
if self.tag in line:
|
||||||
read_line = True
|
self.tag_line = True
|
||||||
if (line and read_line and not line.startswith("#") and
|
if (line and self.tag_line and not line.startswith("#") and
|
||||||
self.tag not in line):
|
self.tag not in line):
|
||||||
self.enabled.append(line)
|
self.enabled.append(line)
|
||||||
|
self.tag_line = False
|
||||||
|
|
||||||
def read_disabled(self):
|
def read_disabled(self):
|
||||||
"""Read disable repositories
|
"""Read disable repositories
|
||||||
"""
|
"""
|
||||||
read_line = False
|
|
||||||
for line in self.conf.splitlines():
|
for line in self.conf.splitlines():
|
||||||
line = line.lstrip()
|
line = line.lstrip()
|
||||||
if self.tag in line:
|
if self.tag in line:
|
||||||
read_line = True
|
self.tag_line = True
|
||||||
if read_line and line.startswith("#"):
|
if self.tag_line and line.startswith("#"):
|
||||||
line = "".join(line.split("#")).strip()
|
line = "".join(line.split("#")).strip()
|
||||||
self.disabled.append(line)
|
self.disabled.append(line)
|
||||||
|
self.tag_line = False
|
||||||
|
|
||||||
def update(self):
|
def update_repos(self):
|
||||||
print self.selected
|
"""Update repositories.conf file with enabled or disabled
|
||||||
|
repositories
|
||||||
|
"""
|
||||||
|
with open("{0}{1}".format(self.meta.conf_path,
|
||||||
|
self.repositories_conf), "w") as new_conf:
|
||||||
|
for line in self.conf.splitlines():
|
||||||
|
line = line.lstrip()
|
||||||
|
if self.tag in line:
|
||||||
|
self.tag_line = True
|
||||||
|
if self.tag_line and line.startswith("#"):
|
||||||
|
repo = "".join(line.split("#")).strip()
|
||||||
|
if repo in self.selected:
|
||||||
|
new_conf.write(line.replace(line, repo + "\n"))
|
||||||
|
continue
|
||||||
|
if (self.tag_line and not line.startswith("#") and
|
||||||
|
line != self.tag):
|
||||||
|
repo = line.strip()
|
||||||
|
if repo not in self.selected:
|
||||||
|
new_conf.write(line.replace(line, "# " + line + "\n"))
|
||||||
|
continue
|
||||||
|
new_conf.write(line + "\n")
|
||||||
|
|
||||||
RepoEnable().choose()
|
def clear_screen(self):
|
||||||
|
"""Clear screen
|
||||||
|
"""
|
||||||
|
os.system("clear")
|
||||||
|
|
||||||
|
def reference(self):
|
||||||
|
"""Reference enable repositories
|
||||||
|
"""
|
||||||
|
print("Enabled repositories: {0}".format(", ".join(self.selected)))
|
||||||
|
|
Loading…
Reference in a new issue