fix: restore command, remove premature creation of pkgbase

We're currently creating a "PackageBases" when the "restore" command is executed.

This is problematic for pkgbases that never existed before.
In those cases it will create the record but fail in the update.py script.
Thus it leaves an orphan "PackageBases" record in the DB
(which does not have any related "Packages" record(s))

Navigating to such a packages /pkgbase/... URL will result in a crash
since it is not foreseen to have "orphan" pkgbase records.

We can safely remove the early creation of that record because
it'll be taken care of in the update.py script that is being called

We'll also fix some tests. Before it was executing a dummy script
instead of "update.py" which might be a bit misleading
since it did not check the real outcome of our "restore" action.

Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
moson-mo 2023-06-11 20:31:51 +02:00
parent c6c81f0789
commit 143575c9de
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
3 changed files with 21 additions and 35 deletions

View file

@ -56,7 +56,7 @@ ssh-options = restrict
repo-path = ./aur.git/
repo-regex = [a-z0-9][a-z0-9.+_-]*$
git-shell-cmd = ./git-shell.sh
git-update-cmd = ./update.sh
git-update-cmd = $GIT_UPDATE
ssh-cmdline = ssh aur@aur.archlinux.org
[update]
@ -90,13 +90,6 @@ echo $GIT_NAMESPACE
EOF
chmod +x git-shell.sh
cat >update.sh <<-\EOF
#!/bin/sh
echo $AUR_USER
echo $AUR_PKGBASE
EOF
chmod +x update.sh
AUR_CONFIG=config
export AUR_CONFIG