[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [GSoC] Adding information to UDD and inject the rendering to tasks,py



On Sat, Apr 04, 2015 at 04:12:19PM +0530, Akshita Jha wrote:
> It took me some time but if I understand correctly
> 'blends_prospective_gatherer' inserts new references in the bibref table
> (irrespective of whether the references are from VCS or Debian Mirror) but
> does not update the already existing references (if references are
> different in Debian Mirror and VCS. The references inserted from Debian
> Mirror remain unchanged).

Yes, that's a correct observation.
 
> If this is the issue, then this can be solved by using "REPLACE" instead of
> plain "INSERT".

+1

> In blends_prospective_gatherer, the query responsible for inserting
> references in bibref table is:
> 
> # Inserting references should be save because above we are testing for
> existant table entries
>     query = """PREPARE bibref_insert (text, text, text, text, int) AS
> INSERT INTO bibref
>                    (source, key, value, package, rank)
>                     VALUES ($1, $2, $3, $4, $5)"""
>     cur.execute(query)
>     bibquery = "EXECUTE bibref_insert (%(source)s, %(key)s, %(value)s,
> %(package)s, %(rank)s)"
> 
> This "query" can be changed to :
> 
> query = """PREPARE bibref_insert (text, text, text, text, int) AS REPLACE
> INTO bibref
>                    (source, key, value, package, rank)
>                     VALUES ($1, $2, $3, $4, $5)"""
> 
> 'bibref' table has "source", "key", "package", "rank" as its PRIMARY KEYS.
> If the record is not already present it is inserted, else the record is
> updated.

That's exactly what I mean since it has turned out that VCS became more
current than umegaya (even if this was also inspecting VCS content it
does not work reliable since some time).
 
> Another method could be to "INSERT", then check the number of rows
> affected. If number of rows affected are 0, then we could UPDATE".

I think using REPLACE is fine.
 
> Am I on the right track ? Also, how do I test the changes that I make ?

I was using my local cone for testing.  The result of the bibref
gatherer can be very easily tested since if it is not running on
udd.debian.org a debian.tex and debian.bib file is created and
processed.  A diff of these files should be a sufficient test if
everything is fine.

Kind regards

        Andreas.

-- 
http://fam-tille.de


Reply to: