[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 07:39:30PM +0530, Akshita Jha wrote:
> Hi,
> 
> I have created a patch for using a separate script file generation of
> debian.bib and debian.tex files. However, I have a couple of questions
> before I submit it. Please find my questions inline.
> 
> 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.

> > ...
> > +    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.

> > +
> > +    g = generate_bib_tex()
> > +    g.run(cur)
> >
> >
> I think calling generate_bib_tex() in blends_prospective gatherer after the
> references from VCS have been inserted in bibref table, is the expected
> solution to the issue at hand. Am I right ?

Yes, but as I said above: If this generation is decoupled from any of
the gatherers we gain the most flexibility.
 
> >
> 
> This creates a class generate_bib_tex(). Is it a good idea to create a
> class or should I define methods only ?

I do not really mind.  Feel free to choose the most simple solution also
in terms of work you need to spent into this.  If you tested this
solution its fine to keep it.
 

> > ...
> 
> 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?

> 
> > +  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.
 
> >
> 
> 
> > +                INNER JOIN sources s ON s.source = p.source
> >
> 
> This is the  INNER JOIN performed to ensure that references of packages
> that are both in VCS and in Debian are the only ones that are included in
> the bibtex file that is created.

Fine. That's what I meant in myprevious mail.
 
> I have checked the differences in the debian.bib and debian.tex files. They
> are as expected.
> 
>  -> Without these changes, the references are outdated.

Good!

>  -> When self.all_ref = 1, then there are many more references.
>  -> When self.all_ref = 0, then the number of references are greater than
> the older references but less than when self.all_ref = 1.

Seems the changes are exactly matching the requirements.
 
> 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.
 
BTW, since it is also related to our GSoC work:  Could you perhaps make
up your mind about

   https://lists.debian.org/debian-blends/2015/04/msg00038.html

(and my answer to this)?

I did not found the time to check this and I think it would be a great
exercise for you to warm up with the tasks pages.

Kind regards

       Andreas.

-- 
http://fam-tille.de


Reply to: