[reagent] add "reagent status" tool, print repositories status
This commit is contained in:
@@ -129,7 +129,7 @@
|
||||
.\" ========================================================================
|
||||
.\"
|
||||
.IX Title "REAGENT 1"
|
||||
.TH REAGENT 1 "2010-01-27" "perl v5.8.8" "Entropy"
|
||||
.TH REAGENT 1 "2010-02-11" "perl v5.8.8" "Entropy"
|
||||
.SH "NAME"
|
||||
\&\fBreagent\fR \- Official Sabayon Linux Server\-Side Package Management tool
|
||||
.SH "SYNOPSIS"
|
||||
@@ -159,6 +159,9 @@ print version
|
||||
disable colorized output
|
||||
.SH "OPTIONS"
|
||||
.IX Header "OPTIONS"
|
||||
.IP "\fBstatus\fR" 4
|
||||
.IX Item "status"
|
||||
show current repositories status
|
||||
.IP "\fBupdate\fR" 4
|
||||
.IX Item "update"
|
||||
scan the System looking for newly compiled packages
|
||||
@@ -311,9 +314,6 @@ enable the specified repository
|
||||
.IP "\fBdisable <repo\fR>" 4
|
||||
.IX Item "disable <repo>"
|
||||
disable the specified repository
|
||||
.IP "\fBstatus <repo\fR>" 4
|
||||
.IX Item "status <repo>"
|
||||
show the current Server Interface status
|
||||
.IP "\fBpackage-dep <repo\fR [atoms]>" 4
|
||||
.IX Item "package-dep <repo [atoms]>"
|
||||
handle packages dependencies
|
||||
|
||||
@@ -40,6 +40,10 @@ disable colorized output
|
||||
|
||||
=over
|
||||
|
||||
=item B<status>
|
||||
|
||||
show current repositories status
|
||||
|
||||
=item B<update>
|
||||
|
||||
scan the System looking for newly compiled packages
|
||||
@@ -245,10 +249,6 @@ enable the specified repository
|
||||
|
||||
disable the specified repository
|
||||
|
||||
=item B<status <repo>>
|
||||
|
||||
show the current Server Interface status
|
||||
|
||||
=item B<package-dep <repo> [atoms]>
|
||||
|
||||
handle packages dependencies
|
||||
|
||||
+8
-2
@@ -43,6 +43,8 @@ help_opts = [
|
||||
None,
|
||||
(0, _('Application Options'), 0, None),
|
||||
None,
|
||||
(1, 'status', 3, _('show current repositories status')),
|
||||
None,
|
||||
(1, 'update', 3, _('scan the System looking for newly compiled packages')),
|
||||
(2, '--seekstore', 2, _('analyze the Entropy Store directory directly')),
|
||||
(2, '--repackage <atoms>', 1, _('repackage the specified atoms')),
|
||||
@@ -88,7 +90,6 @@ help_opts = [
|
||||
(1, 'repo', 3, _('manage a repository')),
|
||||
(2, 'enable <repo>', 3, _('enable the specified repository')),
|
||||
(2, 'disable <repo>', 3, _('disable the specified repository')),
|
||||
(2, 'status <repo>', 3, _('show the current Server Interface status')),
|
||||
(2, 'package-dep <repo> [atoms]', 1, _('handle packages dependencies')),
|
||||
(2, 'package-tag <repo> <tag-string> [atoms]', 1, _('clone a package assigning it an arbitrary tag')),
|
||||
(2, 'move <from> <to> [atoms]', 1, _('move packages from a repository to another')),
|
||||
@@ -183,7 +184,6 @@ elif main_cmd == "inject":
|
||||
rc = server_reagent.inject(options)
|
||||
server_reagent.Entropy.close_repositories()
|
||||
|
||||
# database tool
|
||||
elif main_cmd == "database":
|
||||
if "switchbranch" in options:
|
||||
etpUi['warn'] = False
|
||||
@@ -200,6 +200,12 @@ elif main_cmd == "repo":
|
||||
import server_reagent
|
||||
rc = server_reagent.repositories(options)
|
||||
|
||||
elif main_cmd == "status":
|
||||
import server_reagent
|
||||
server_reagent.status()
|
||||
server_reagent.Entropy.close_repositories()
|
||||
rc = 0
|
||||
|
||||
elif main_cmd == "key":
|
||||
import server_key
|
||||
rc = server_key.key(options)
|
||||
|
||||
@@ -16,9 +16,12 @@ from entropy.output import red, bold, brown, purple, darkgreen, darkred, blue, \
|
||||
green, print_info, print_warning, print_error, print_generic, teal
|
||||
from entropy.exceptions import InvalidAtom
|
||||
from entropy.server.interfaces import Server
|
||||
from entropy.core.settings.base import SystemSettings
|
||||
from entropy.i18n import _
|
||||
|
||||
import entropy.tools
|
||||
Entropy = Server(community_repo = etpConst['community']['mode'])
|
||||
SYS_SET = SystemSettings()
|
||||
|
||||
def inject(options):
|
||||
|
||||
@@ -123,9 +126,6 @@ def repositories(options):
|
||||
Entropy.switch_default_repository(repoid, save = True)
|
||||
return 0
|
||||
|
||||
elif cmd == "status":
|
||||
return 0
|
||||
|
||||
elif cmd == "package-tag":
|
||||
|
||||
if len(myopts) < 3:
|
||||
@@ -134,7 +134,7 @@ def repositories(options):
|
||||
|
||||
sys_settings_plugin_id = \
|
||||
etpConst['system_settings_plugins_ids']['server_plugin']
|
||||
srv_set = Entropy.SystemSettings[sys_settings_plugin_id]['server']
|
||||
srv_set = SYS_SET[sys_settings_plugin_id]['server']
|
||||
if repo not in srv_set['repositories']:
|
||||
return 3
|
||||
|
||||
@@ -165,7 +165,7 @@ def repositories(options):
|
||||
|
||||
sys_settings_plugin_id = \
|
||||
etpConst['system_settings_plugins_ids']['server_plugin']
|
||||
srv_set = Entropy.SystemSettings[sys_settings_plugin_id]['server']
|
||||
srv_set = SYS_SET[sys_settings_plugin_id]['server']
|
||||
if repo not in srv_set['repositories']:
|
||||
return 3
|
||||
|
||||
@@ -646,7 +646,7 @@ def database(options):
|
||||
|
||||
sys_settings_plugin_id = \
|
||||
etpConst['system_settings_plugins_ids']['server_plugin']
|
||||
for repoid in Entropy.SystemSettings[sys_settings_plugin_id]['server']['repositories']:
|
||||
for repoid in SYS_SET[sys_settings_plugin_id]['server']['repositories']:
|
||||
|
||||
print_info(darkgreen(" * ")+"%s %s %s: %s" % (
|
||||
blue(_("Collecting packages that would be marked")),
|
||||
@@ -832,7 +832,8 @@ def database(options):
|
||||
dbpath = db_data.pop(myid)
|
||||
except IndexError:
|
||||
continue
|
||||
if not os.path.isfile(dbpath): continue
|
||||
if not os.path.isfile(dbpath):
|
||||
continue
|
||||
break
|
||||
|
||||
status, err_msg = Entropy.Client.restore_database(dbpath, db_file)
|
||||
@@ -840,6 +841,43 @@ def database(options):
|
||||
return 0
|
||||
return 1
|
||||
|
||||
def status():
|
||||
|
||||
sys_settings_plugin_id = \
|
||||
etpConst['system_settings_plugins_ids']['server_plugin']
|
||||
repos_data = SYS_SET[sys_settings_plugin_id]['server']['repositories']
|
||||
|
||||
for repo_id in sorted(repos_data):
|
||||
repo_data = repos_data[repo_id]
|
||||
repo_rev = Entropy.get_local_repository_revision(repo = repo_id)
|
||||
store_dir = Entropy._get_local_store_directory(repo = repo_id)
|
||||
upload_basedir = Entropy._get_local_upload_directory(repo = repo_id)
|
||||
upload_files, upload_packages = \
|
||||
Entropy.Mirrors._calculate_local_upload_files(repo = repo_id)
|
||||
local_files, local_packages = \
|
||||
Entropy.Mirrors._calculate_local_package_files(repo = repo_id)
|
||||
|
||||
print_info("[%s] %s" % (purple(repo_id),
|
||||
brown(repo_data['description']),))
|
||||
|
||||
print_info(" %s:\t\t\t%s" % (
|
||||
blue(_("local revision")), repo_rev,))
|
||||
print_info(" %s:\t\t\t%s" % (
|
||||
darkgreen(_("local packages")), local_files,))
|
||||
|
||||
store_pkgs = []
|
||||
if os.path.isdir(store_dir):
|
||||
store_pkgs = os.listdir(store_dir)
|
||||
print_info(" %s:\t\t\t%s" % (
|
||||
darkgreen(_("stored packages")), len(store_pkgs),))
|
||||
for pkg_rel in sorted(store_pkgs):
|
||||
print_info("\t%s" % (brown(pkg_rel),))
|
||||
|
||||
print_info(" %s:\t\t\t%s" % (
|
||||
teal(_("upload packages")), upload_files,))
|
||||
for pkg_rel in sorted(upload_packages):
|
||||
print_info("\t%s" % (brown(pkg_rel),))
|
||||
|
||||
|
||||
def spm(options):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user