mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Add a restore command to the SSH interface
Implement a new command that can be used to restore deleted package bases without having to push a new commit. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
da875276d4
commit
4112e572aa
4 changed files with 33 additions and 9 deletions
|
@ -19,6 +19,7 @@ aur_db_socket = config.get('database', 'socket')
|
|||
repo_path = config.get('serve', 'repo-path')
|
||||
repo_regex = config.get('serve', 'repo-regex')
|
||||
git_shell_cmd = config.get('serve', 'git-shell-cmd')
|
||||
git_update_cmd = config.get('serve', 'git-update-cmd')
|
||||
ssh_cmdline = config.get('serve', 'ssh-cmdline')
|
||||
|
||||
enable_maintenance = config.getboolean('options', 'enable-maintenance')
|
||||
|
@ -152,10 +153,28 @@ elif action == 'setup-repo':
|
|||
if len(cmdargv) > 2:
|
||||
die_with_help("{:s}: too many arguments".format(action))
|
||||
create_pkgbase(cmdargv[1], user)
|
||||
elif action == 'restore':
|
||||
if len(cmdargv) < 2:
|
||||
die_with_help("{:s}: missing repository name".format(action))
|
||||
if len(cmdargv) > 2:
|
||||
die_with_help("{:s}: too many arguments".format(action))
|
||||
|
||||
pkgbase = cmdargv[1]
|
||||
if not re.match(repo_regex, pkgbase):
|
||||
die('{:s}: invalid repository name: {:s}'.format(action, pkgbase))
|
||||
|
||||
if pkgbase_exists(pkgbase):
|
||||
die('{:s}: package base exists: {:s}'.format(action, pkgbase))
|
||||
create_pkgbase(pkgbase, user)
|
||||
|
||||
os.environ["AUR_USER"] = user
|
||||
os.environ["AUR_PKGBASE"] = pkgbase
|
||||
os.execl(git_update_cmd, git_update_cmd, 'restore')
|
||||
elif action == 'help':
|
||||
die("Commands:\n" +
|
||||
" help Show this help message and exit.\n" +
|
||||
" list-repos List all your repositories.\n" +
|
||||
" restore <name> Restore a deleted package base.\n" +
|
||||
" setup-repo <name> Create an empty repository.\n" +
|
||||
" git-receive-pack Internal command used with Git.\n" +
|
||||
" git-upload-pack Internal command used with Git.")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue