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

Re: [PATCH] Make use of a separate script for generation of debian.{bib,tex} files.



Hi,

On Wed, Apr 22, 2015 at 8:28 PM, Andreas Tille <andreas@an3as.eu> wrote:
Hi,

> On Wed, Apr 22, 2015 at 7:07 PM, Akshita Jha <zenith158@gmail.com> wrote:
>
> > ...
> > +from generate_bib_tex import generate_bib_tex
> > +
> >
>
> 'generate_bib_tex' is the new file that is created. Is the name of the file
> alright? Is it according to the naming convention followed by Debian ?

I'm not aware of any naming convention.  I *personally* would have
choosen generate_bibtex since bibtex is a single word.

 
Renamed to generate_bibtex.

> > ...
> > +    g = generate_bib_tex()
> > +    g.run(cur)
> >
> >
> Do I need to generate the debian.{bib.tex} files in bibref_gatherer ? For
> now I have called generate_bib_tex(), but the files generated will always
> consist of outdated references.

I rather consider a totally separate script which is called at the end of

   scripts/cron_ftpnew_blends.sh

as the most flexible solution.

 
Yes. It indeed is the most flexible solution. Will do this.
 
> > ...
>
> If self.all_ref = 1
>    references for all the sources from bibref table will be included
> (irrespective of the fact whether or not they are included Debian).
> else :
>    only references for sources which are both in VCS and Debian packages
> will be included. By default self.all_ref = 0

At the moment I have no time to test.  I'd prefer I wait until you might
have regarded my hints and checkout afterwards.  Is this OK for you?

It is perfectly fine. I will inform you when I am done with all the changes you suggested.
 
>
> > +  def run(self, cur):
> > +
> > +    # if there is a working LaTeX installation try to build a BibTeX
> > database and test it by creating a debian.pdf file
> > +    if isfile('/usr/bin/pdflatex') and access('/usr/bin/pdflatex', X_OK)
> > and \
> > +       isfile('/usr/bin/bibtex')   and access('/usr/bin/bibtex', X_OK)
> > and \
> > +       (
> > isfile('/usr/share/texlive/texmf-dist/fonts/source/jknappen/ec/ecrm.mf') or
> > \
> > +
> >  isfile('/usr/share/texmf-texlive/fonts/source/jknappen/ec/ecrm.mf') ) :
> > +
> > +      # create BibTeX file
> > +      bf = open(self.bibtexfile, 'w')
> > +
> > +      if self.all_ref == 1:
> > +        query = "SELECT * FROM bibtex()"
> >
>
> This includes refrences from all the sources in bibref table, by making use
> of bibtex() <https://udd.debian.org/schema/udd.html#public.function.bibtex>
> from UDD. However, '#' is not escaped here. How do I change that ? Do I
> make the changes in bibtex() of UDD itself ?

Replace # by \#.  I think UDD should remain as imported from the
original sources and the bibtex export code should export valid BibTeX
syntax.  Does this sound sensible for you?

> Below is the default part which is similar to bibtex()
> <https://udd.debian.org/schema/udd.html#public.function.bibtex> of UDD but
> performs an inner join and escapes '#'. Is it better to include this in UDD
> itself ?

Ahhh, hmmm, I think I need some more detailed explanation what you meain
by the last sentence.  Do you mean "include it into the data table" or
"include it into the postgresql procedure that extracts the data".  We
should do all needed syntax changes in the same manner.


I meant "include the replacement of '#' with '\#', into the postgresql procedure that extracts the data" as this is what is done by bibtex() (https://udd.debian.org/schema/udd.html#public.function.bibtex) in UDD. The bibtex() :

               .........  
               replace(replace(replace(replace(biburl.value,
                        '_', E'\\_'),           --
                        '%', E'\\%'),           --
                        '&', E'\\&'),           --
                        '~', E'\\~{}') 
               .........

If I am to make changes to the bibtex() already in UDD, how do I do it so that it can directly be imported ? Or else I could rewrite the function in generate_bibtex, and include replace '#' with '\#' and an INNER JOIN (if required).
 
> Also, is there a possibility that the references which have been injected
> by bibref_gatherer are updated in blends_prospective_gatherer. I had not
> found any Updates when I had written the "Upsert" functionality, but if
> there is a possibility, then I think we should include Upsert also in
> blends_prospective_gatherer and then generate the debian.bib and debian.tex
> files.

If (and only if) Umegaya works correctly than the references in
bibref_gatherer and in blends_prospective_gatherer should be the same.
May be the problem with Umegaya vanished for whatever reason
(temporarily??).  Since Upsert does not seem any harm we should probably
use it and be safe for future failures.


There were inserts but no updates in blends_prospective_gatherer. Will include Upsert in blends_prospective_gatherer, to be safe.

-- 
Regards,
Akshita Jha

Reply to: