[aur-dev] [PATCH] Adding PackagerUID to the generated dummy data

Lukas Fleischer lfleischer at archlinux.org
Sun Jun 14 15:45:24 UTC 2015


Minor nit: We usually write commit message in imperative mood. Also,
there is no need to add a cover letter when you only submit a single
patch.

On Sun, 14 Jun 2015 at 17:36:52, Leonidas Spyropoulos wrote:
> ---
>  schema/gendummydata.py | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/schema/gendummydata.py b/schema/gendummydata.py
> index 9ad5373..7b18a50 100755
> --- a/schema/gendummydata.py
> +++ b/schema/gendummydata.py
> @@ -193,16 +193,18 @@ for p in list(seen_pkgs.keys()):
>         NOW = int(time.time())
>         if count % 2 == 0:
>                 muid = developers[random.randrange(0,len(developers))]
> +               puid = developers[random.randrange(0,len(developers))]
>         else:
>                 muid = trustedusers[random.randrange(0,len(trustedusers))]
> +               puid = trustedusers[random.randrange(0,len(trustedusers))]
>         if count % 20 == 0: # every so often, there are orphans...
>                 muid = "NULL"
>  
>         uuid = genUID() # the submitter/user
>  
>         s = ("INSERT INTO PackageBases (ID, Name, CategoryID, SubmittedTS, "
> -         "SubmitterUID, MaintainerUID) VALUES (%d, '%s', %d, %d, %d, %s);\n")
> -       s = s % (seen_pkgs[p], p, genCategory(), NOW, uuid, muid)
> +         "SubmitterUID, MaintainerUID, PackagerUID) VALUES (%d, '%s', %d, %d, %d, %s, %s);\n")
> +       s = s % (seen_pkgs[p], p, genCategory(), NOW, uuid, muid, puid)

Wow. This part of the code is really ugly. Using "%s" for integer values
and not escaping strings in queries. I wonder if somebody cares enough
to rewrite it, though...

Anyway, your patch looks good. Will be applied, thanks!

>         out.write(s)
>  
>         s = ("INSERT INTO Packages (ID, PackageBaseID, Name, Version) VALUES "
> -- 
> 2.4.3


More information about the aur-dev mailing list