[PATCH] aurblup: make provider updates more robust

Eli Schwartz eschwartz at archlinux.org
Mon Jan 21 20:16:28 UTC 2019


On 1/21/19 2:33 PM, Lukas Fleischer wrote:
> Prevent from corner cases, such as failing unique key constraints when a
> provided package changes from lower case to upper case.

What about:

"Reverse the order of deletion and addition so that deletion comes
first. This prevents corner cases such as failing unique key constraints
when a provided package changes from lower case to upper case and the
old name is not yet gone."

I'm a big lover of manuscript-style commit messages :D and this makes it
clearer *how* the patch intends to solve the problem.

> Signed-off-by: Lukas Fleischer <lfleischer at archlinux.org>
> ---
>  aurweb/scripts/aurblup.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/aurweb/scripts/aurblup.py b/aurweb/scripts/aurblup.py
> index 1433173..a7d43f1 100755
> --- a/aurweb/scripts/aurblup.py
> +++ b/aurweb/scripts/aurblup.py
> @@ -39,13 +39,13 @@ def main():
>      cur = conn.execute("SELECT Name, Provides FROM OfficialProviders")
>      oldproviders = set(cur.fetchall())
>  
> +    for pkg, provides in oldproviders.difference(providers):
> +        conn.execute("DELETE FROM OfficialProviders "
> +                     "WHERE Name = ? AND Provides = ?", [pkg, provides])
>      for pkg, provides in providers.difference(oldproviders):
>          repo = repomap[(pkg, provides)]
>          conn.execute("INSERT INTO OfficialProviders (Name, Repo, Provides) "
>                       "VALUES (?, ?, ?)", [pkg, repo, provides])
> -    for pkg, provides in oldproviders.difference(providers):
> -        conn.execute("DELETE FROM OfficialProviders "
> -                     "WHERE Name = ? AND Provides = ?", [pkg, provides])
>  
>      conn.commit()
>      conn.close()
> 


-- 
Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1601 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/aur-dev/attachments/20190121/bd492e90/attachment.asc>


More information about the aur-dev mailing list