Commit e88273ee authored by Sébastien Luttringer's avatar Sébastien Luttringer

Upgrade is about repository not database

Database should not be exposed to external. We should use repository most of
time.
parent 688765ad
......@@ -456,12 +456,12 @@ def c_unprepare_chroot(args):
'''
istools.unprepare_chroot(args.path, mount=not args.no_umount)
def c_upgrade_db(args):
def c_upgrade(args):
'''
Upgrade repository's database to the current database version
Upgrade repository's to the last version
'''
repoman = load_repositories(args)
repoman[args.repository].upgrade_db()
repoman[args.repository].upgrade()
def c_version(args):
'''
......@@ -747,10 +747,10 @@ def arg_parser_init():
p.add_argument("path")
p.set_defaults(func=c_unprepare_chroot)
# upgrade_db command parser
p = subparser.add_parser("upgrade_db",
help=c_upgrade_db.__doc__.lower())
p = subparser.add_parser("upgrade",
help=c_upgrade.__doc__.lower())
p.add_argument("repository", help="repository to upgrade")
p.set_defaults(func=c_upgrade_db)
p.set_defaults(func=c_upgrade)
# version command parser
p = subparser.add_parser("version", help=c_version.__doc__.lower())
p.set_defaults(func=c_version)
......
......@@ -188,7 +188,7 @@ _is() {
[[ "$cur" == -* ]] && _opt '-h --help -m --no-mount' && return 0
_filedir -d
;;
upgrade_db)
upgrade)
[[ "$cur" == -* ]] && _opt '-h --help' && return 0
_count_args
(( args == 2 )) && _local_repo
......
......@@ -320,7 +320,7 @@ _is() {
'1:path:_files -/'
)
;;
(upgrade_db)
(upgrade)
args+=(
'1:repo:_installsystems_local_repo'
)
......
......@@ -350,8 +350,8 @@ unprepare_chroot [-h] [-m] *path*
disable unmouting of /{proc,dev,sys}
upgrade_db [-h] *repository*
Upgrade repository's database to the current database version
upgrade [-h] *repository*
Upgrade repository's to the last version
version [-h]
......
......@@ -155,8 +155,8 @@ class Repository(object):
because repository is not initialized
'''
config = object.__getattribute__(self, "config")
# config, init, local and upgrade_db are always accessible
if name in ("init", "config", "local", "upgrade_db"):
# config, init, local and upgrade are always accessible
if name in ("init", "config", "local", "upgrade"):
return object.__getattribute__(self, name)
# if no db (not init or not accessible) raise error
if config.offline:
......@@ -537,9 +537,9 @@ class Repository(object):
(a[0],)).fetchall()
return [ a[0] ] + [ x[0] for x in b ]
def upgrade_db(self):
def upgrade(self):
if self.version == Database.version:
info("Database already up-to-date (%s)" % self.version)
info("Repository already up-to-date (%s)" % self.version)
return
else:
arrow("Start repository upgrade")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment