pdf-devel
[Top][All Lists]
Advanced

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

Re: [pdf-devel] make syntax-check


From: gerel
Subject: Re: [pdf-devel] make syntax-check
Date: Wed, 03 Sep 2008 11:29:06 -0700 (PDT)

 > Date: Tue, 02 Sep 2008 14:13:20 -0400
 > From: Zac Brown <address@hidden>
 > 
 > address@hidden wrote:
 > >    Rather than a script to do that, I suggest we write a bzr
 > >    hook. It'd be good to just have a hook thats run after a commit
 > >    (since you have to commit before generating a merge directive) and
 > >    does syntax-check as well as running the test suite.
 > > 
 > > A pre-commit hook (if that thing exist in bazaar) makes more sense for
 > > this, isnt it?
 > > 
 > Agreed. I'll look into that.
 > 
 > >    How's that sound to everyone?
 > > 
 > > If you write a suitable python script to do that in bazaar please send
 > > it here and I will put it in prmgt/
 > > 
 > 
 > I'll see what I can do.
 > 

Hey guys, I just wrote and tested a small hook, it works ok for me.

Some notes first,

1. In order to place the script in the "prmgt" directory we also need to set
   "BZR_PLUGIN_PATH=./prmgt" (you can test it doing 'bzr hooks')

2. The commit command must be run from the projects root directory. (otherwise
   bzr will ignore our hook, it seems to be an internal issue regarding bzr)


--- post_commit.py ---
from bzrlib import branch
import os

script_cmds = ['make syntax-check', 'make check']

def post_commit_hook(local, master, old_revno, old_revid, new_revno,
                      new_revid):
    success, fails = ([],[])
    for c in script_cmds:
        if (os.system(c) != 0):
            fails.append(c)
        else:
            success.append(c)
    for s in success:
        print ">>> " + s + ": succeeded."
    for f in fails:
        print ">>> " + f + ": failed."


branch.Branch.hooks.install_named_hook('post_commit', post_commit_hook,
                                 'Patch safety scripts hook')

--- end of post_commit.py ---

I just run a commit test and here are the last 4 output lines:
##
make[1]: Leaving directory `/home/gerel/PROJECTS/libgnupdf/local/torture'
make: *** [check-recursive] Error 1
>>> make syntax-check: succeeded.
>>> make check: failed.
###

The output is correct, 'make check' is failing due to,

base/text/pdf-text-cmp.c:283:F:pdf_text_cmp:pdf_text_cmp_006:0: Failure
'pdf_text_init() != PDF_OK' occured


cheers

-gerel




reply via email to

[Prev in Thread] Current Thread [Next in Thread]