mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
added command 'repolist'
This commit is contained in:
parent
ab4c3f42ad
commit
1c1a1f8f95
5 changed files with 89 additions and 9 deletions
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
__all__ = "slpkg"
|
__all__ = "slpkg"
|
||||||
__author__ = "dslackw"
|
__author__ = "dslackw"
|
||||||
__version_info__ = (2, 1, 'x-dev')
|
__version_info__ = (2, 1, 'x-dev')
|
||||||
|
@ -44,7 +43,7 @@ repositories = [
|
||||||
'slacky',
|
'slacky',
|
||||||
'studio',
|
'studio',
|
||||||
'slackr',
|
'slackr',
|
||||||
'only'
|
'slonly'
|
||||||
]
|
]
|
||||||
build_path = "/tmp/slpkg/build/"
|
build_path = "/tmp/slpkg/build/"
|
||||||
slpkg_tmp_packages = tmp + "slpkg/packages/"
|
slpkg_tmp_packages = tmp + "slpkg/packages/"
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# 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 sys
|
||||||
|
|
||||||
from __metadata__ import (
|
from __metadata__ import (
|
||||||
__version__,
|
__version__,
|
||||||
|
@ -36,6 +37,7 @@ def options():
|
||||||
" update update all package " +
|
" update update all package " +
|
||||||
"lists",
|
"lists",
|
||||||
" re-create recreate package lists",
|
" re-create recreate package lists",
|
||||||
|
" repolist list all repositories",
|
||||||
" update slpkg check and update slpkg\n",
|
" update slpkg check and update slpkg\n",
|
||||||
"Optional arguments:",
|
"Optional arguments:",
|
||||||
" -h, --help show this help message " +
|
" -h, --help show this help message " +
|
||||||
|
@ -68,6 +70,7 @@ def options():
|
||||||
]
|
]
|
||||||
for opt in arguments:
|
for opt in arguments:
|
||||||
print(opt)
|
print(opt)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
|
@ -89,3 +92,4 @@ def usage():
|
||||||
]
|
]
|
||||||
for usg in view:
|
for usg in view:
|
||||||
print(usg)
|
print(usg)
|
||||||
|
sys.exit(0)
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
import sys
|
import sys
|
||||||
import getpass
|
import getpass
|
||||||
|
|
||||||
|
from repolist import RepoList
|
||||||
|
|
||||||
from desc import PkgDesc
|
from desc import PkgDesc
|
||||||
from config import Config
|
from config import Config
|
||||||
from queue import QueuePkgs
|
from queue import QueuePkgs
|
||||||
|
@ -126,21 +128,26 @@ def main():
|
||||||
if len(args) == 2 and args[0] == "update" and args[1] == "slpkg":
|
if len(args) == 2 and args[0] == "update" and args[1] == "slpkg":
|
||||||
it_self_update()
|
it_self_update()
|
||||||
|
|
||||||
# checking if repositories exists
|
if len(args) == 1 and args[0] == "repolist":
|
||||||
check_exists_repositories()
|
RepoList().repos()
|
||||||
|
|
||||||
if len(args) == 1 and args[0] == "re-create":
|
|
||||||
Initialization().re_create()
|
|
||||||
|
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
usage()
|
usage()
|
||||||
elif (len(args) == 1 and args[0] == "-h" or
|
elif (len(args) == 1 and args[0] == "-h" or
|
||||||
args[0] == "--help" and args[1:] == []):
|
args[0] == "--help" and args[1:] == []):
|
||||||
options()
|
options()
|
||||||
elif (len(args) == 1 and args[0] == "-v" or
|
|
||||||
|
if (len(args) == 1 and args[0] == "-v" or
|
||||||
args[0] == "--version" and args[1:] == []):
|
args[0] == "--version" and args[1:] == []):
|
||||||
prog_version()
|
prog_version()
|
||||||
elif len(args) == 3 and args[0] == "-a":
|
|
||||||
|
# checking if repositories exists
|
||||||
|
check_exists_repositories()
|
||||||
|
|
||||||
|
if len(args) == 1 and args[0] == "re-create":
|
||||||
|
Initialization().re_create()
|
||||||
|
|
||||||
|
if len(args) == 3 and args[0] == "-a":
|
||||||
BuildPackage(args[1], args[2:], path).build()
|
BuildPackage(args[1], args[2:], path).build()
|
||||||
elif len(args) == 2 and args[0] == "-l":
|
elif len(args) == 2 and args[0] == "-l":
|
||||||
pkg_list = ["all", "noarch"] + repositories
|
pkg_list = ["all", "noarch"] + repositories
|
||||||
|
|
67
slpkg/repolist.py
Normal file
67
slpkg/repolist.py
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# repolist.py file is part of slpkg.
|
||||||
|
|
||||||
|
# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
||||||
|
# All rights reserved.
|
||||||
|
|
||||||
|
# Slpkg is a user-friendly package manager for Slackware installations
|
||||||
|
|
||||||
|
# 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/>.
|
||||||
|
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from repositories import Repo
|
||||||
|
from messages import template
|
||||||
|
from __metadata__ import repositories, color
|
||||||
|
|
||||||
|
|
||||||
|
class RepoList(object):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.all_repos = {
|
||||||
|
'slack': Repo().slack(),
|
||||||
|
'sbo': Repo().sbo(),
|
||||||
|
'rlw': Repo().rlw(),
|
||||||
|
'alien': Repo().alien(),
|
||||||
|
'slacky': Repo().slacky(),
|
||||||
|
'studio': Repo().studioware(),
|
||||||
|
'slackr': Repo().slackers(),
|
||||||
|
'slonly': Repo().slackonly()
|
||||||
|
}
|
||||||
|
|
||||||
|
def repos(self):
|
||||||
|
'''
|
||||||
|
View or enabled or disabled repositories
|
||||||
|
'''
|
||||||
|
print('')
|
||||||
|
template(78)
|
||||||
|
print('{0}{1}{2}{3}{4}'.format(
|
||||||
|
'| Repo id', ' ' * 10,
|
||||||
|
'Repo name', ' ' * 45,
|
||||||
|
'Status'))
|
||||||
|
template(78)
|
||||||
|
for repo_id, repo_name in sorted(self.all_repos.iteritems()):
|
||||||
|
status = '{0}disabled{1}'.format(color['RED'], color['ENDC'])
|
||||||
|
if repo_id in repositories:
|
||||||
|
status = '{0}enabled{1}'.format(color['GREEN'], color['ENDC'])
|
||||||
|
print(' {0}{1}{2}{3}{4:>17}'.format(
|
||||||
|
repo_id, ' ' * (17 - len(repo_id)),
|
||||||
|
repo_name, ' ' * (52 - len(repo_name)),
|
||||||
|
status))
|
||||||
|
print("\nFor enable or disable repositories edit "
|
||||||
|
"'/etc/slpkg/slpkg.conf' file\n")
|
||||||
|
sys.exit(0)
|
|
@ -21,6 +21,8 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# 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 sys
|
||||||
|
|
||||||
from __metadata__ import (
|
from __metadata__ import (
|
||||||
__version__,
|
__version__,
|
||||||
__license__,
|
__license__,
|
||||||
|
@ -35,3 +37,4 @@ def prog_version():
|
||||||
print("Version : {0}".format(__version__))
|
print("Version : {0}".format(__version__))
|
||||||
print("Licence : {0}".format(__license__))
|
print("Licence : {0}".format(__license__))
|
||||||
print("Email : {0}".format(__email__))
|
print("Email : {0}".format(__email__))
|
||||||
|
sys.exit(0)
|
||||||
|
|
Loading…
Reference in a new issue